Problem · String
Valid Palindrome II
Learn this problemProblem statement
Given a string s, return true if it can become a palindrome after deleting at most one character. Otherwise, return false.
Function
validPalindrome(s: String) → booleanExamples
Example 1
s = "aba"return = trueThe string is already a palindrome, so no deletion is needed.
Example 2
s = "abca"return = trueDeleting b or c leaves a palindrome.
Constraints
1 <= s.length <= 10^5scontains only lowercase English letters.