Palindrome with One Deletion
Problem statement
Given a string s, return true if it can become a palindrome after deleting at most one character. Otherwise, return false.
A palindrome reads the same from left to right and right to left. Keeping the string unchanged is allowed.
Function
validPalindrome(s: String) → booleanExamples
Example 1
s = "abca"return = trueDeleting b gives aca; deleting c gives aba.
Example 2
s = "abc"return = falseEach possible single deletion leaves two different characters.
Example 3
s = "aba"return = trueThe string is already a palindrome; no deletion is required.
Constraints
1 <= s.length <= 10000.scontains only lowercase English letters.