title: Minimum number of Appends needed to make a string palindrome
body: <p>I tried doing this question using recursion in an interview.they said this solution is not efficient.How to make this code more efficient?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include&lt;cstring&gt;
  using namespace std;
  int palin(char str[], int len)
  {
      static int cnt;
      int s = 0;
      int e = len - 1;
      while(s &lt; e){
          if(str[s] != str[e]) {
              cnt++;
              return palin(str + 1, len - 1);
          }
          else{
              s++;
              e--;
          }
      }
      return cnt;
  }
  
  int main() {
      char str[100];
      cin.getline(str, 100);
      int len = strlen(str);
      cout &lt;&lt; palin(str, len);
  }
  </code></pre>