<p>Given a string <code>s</code>. In one step you can insert any character at any index of the string.</p>

<p>Return <em>the minimum number of steps</em> to make <code>s</code>&nbsp;palindrome.</p>

<p>A&nbsp;<b>Palindrome String</b>&nbsp;is one that reads the same backward as well as forward.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;zzazz&quot;
<strong>Output:</strong> 0
<strong>Explanation:</strong> The string &quot;zzazz&quot; is already palindrome we do not need any insertions.
</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;mbadm&quot;
<strong>Output:</strong> 2
<strong>Explanation:</strong> String can be &quot;mbdadbm&quot; or &quot;mdbabdm&quot;.
</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>
<strong>Input:</strong> s = &quot;leetcode&quot;
<strong>Output:</strong> 5
<strong>Explanation:</strong> Inserting 5 characters the string becomes &quot;leetcodocteel&quot;.
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s.length &lt;= 500</code></li>
	<li><code>s</code> consists of lowercase English letters.</li>
</ul>

int t[1001][1001];
class Solution {
public:
 int lcs(string s,string s1,int n,int m){
   for(int i=0;i<=n;i++){
    for(int j=0;j<=m;j++){
        if(i==0||j==0)
        t[i][j]=0;
    }
   }
   for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
        if(s1[i-1]==s[j-1]){
            t[i][j]=1+t[i-1][j-1];
        }
        else t[i][j]=max(t[i-1][j],t[i][j-1]);
    }
   }
   return t[n][m];
    }
   
 
    int minInsertions(string s) {
        int n=s.length();
        memset(t,-1,sizeof(t));
        string s1=s;
      reverse(s.begin(),s.begin()+n);

     //cout<<lcs(s1,s,n,n);
       return (n-lcs(s1,s,n,n));

    }
};
12000