Easy Explaination 🔥🔥 || Minimum Insertion Steps to make string palimdrome
\tclass Solution {\n\tpublic:\n\t\tint vec[501][501];\n\n\t\tint fun(string &s1, string &s2, int n1, int n2)\n\t\t{\n\t\t\tif(n1 == 0 || n2 == 0)\n\t\t\t\tretur
\tclass Solution {\n\tpublic:\n\t\tint vec[501][501];\n\n\t\tint fun(string &s1, string &s2, int n1, int n2)\n\t\t{\n\t\t\tif(n1 == 0 || n2 == 0)\n\t\t\t\treturn 0;\n\n\t\t\tif(vec[n1 - 1][n2 - 1] != -1)\n\t\t\t\treturn vec[n1 - 1][n2 - 1];\n\n\t\t\tif(s1[n1 - 1] == s2[n2 - 1])\n\t\t\t\treturn vec[n1 - 1][n2 - 1] = (1 + fun(s1, s2, n1 - 1, n2 -1));\n\t\t\telse\n\t\t\t\treturn vec[n1 - 1][n2 - 1] = max(fun(s1, s2, n1 - 1, n2), fun(s1, s2, n1, n2 - 1));\n\n\t\t}\n\n\t\tint minInsertions(string s) {\n\t\t\tstring srev = s;\n\t\t\treverse(s.begin(), s.end());\n\n\t\t\tfor(int i = 0; i < 501; i++)\n\t\t\t\tfor(int j = 0; j < 501; j++)\n\t\t\t\t\tvec[i][j] = -1;\n\n\t\t\tfun(srev, s, s.length(), s.length());\n\n\t\t\treturn s.length()- vec[s.length() - 1][s.length() - 1];\n\n\t\t}\n\t};
['String', 'Dynamic Programming', 'Memoization']