4
1. Use two pointers, one initialised to 0 and the other initialised to end of string. Check if characters at each index5
are the same. If they are the same, shrink both pointers. Else, we have two possibilities: one that neglects character6
at left pointer and the other that neglects character at right pointer. Hence, we check if s[low+1...right] is a palindrome7
or s[low...right-1] is a palindrome. If one of them is a palindrome, we know that we can form a palindrome with one deletion and return true. Else, we require more than one deletion, and hence we return false.9
var validPalindrome = function (s) {13
if (s[low] !== s[high]) {14
return isPalindrome(s, low + 1, high) || isPalindrome(s, low, high - 1);23
function isPalindrome(str, low, high) {25
if (str[low] !== str[high]) return false;