[Javascript] Dynamic Programming Easy and explained
Explanation : This is the direct implementation of Longest Palindromic Subsequence. \n\nPS: Feel free to ask your questions in comments and do upvote if you lik
**Explanation** : This is the direct implementation of Longest Palindromic Subsequence. \n\nPS: Feel free to ask your questions in comments and do upvote if you liked my solution.\n\n```\n/**\n * @param {string} s\n * @return {number}\n */\nvar minInsertions = function(s) {\n    \n    let dp = []\n    \n    for(let row = 0 ; row <= s.length ; row ++){\n        let arr = []\n        \n        for(let col = 0 ; col <= s.length ; col ++) arr.push(0)\n        \n        dp.push(arr)\n    }\n    \n    let rev = s.split("")\n    \n    rev = rev.reverse();\n    \n    rev = rev.join("");\n    \n    for(let row = 1 ; row <= s.length ; row ++ )\n        for(let col = 1 ; col <= s.length ; col ++) {\n            \n            if(s[row-1] === rev[col-1])\n                dp[row][col] = 1 + dp[row-1][col-1]\n            else\n                dp[row][col] = Math.max(dp[row-1][col],dp[row][col-1])\n        }\n    \n    return s.length - dp[s.length][s.length];\n    \n};\n```
['Dynamic Programming', 'JavaScript']