var isPalindrome = function (x, moves) { x = x.toString(); let initial = 0; let last = x.length - 1; let isPalindrome = true; for (let i = 0; i < x.length; i++) { if (x[initial] == x[last] && initial < last) { initial++; last--; } else if (initial > last) { } else if (moves === 1 && Math.abs(x.length % 2) == 1) { isPalindrome = false; break; } } return isPalindrome; }; console.log(isPalindrome("abba"))
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)