Description
Given a string s, return true if the s can be palindrome after deleting at most one character from it.
Examples
Input:
s = "aba"Output:
trueExplanation:
The string 'aba' already reads the same forwards and backwards, so no deletion is needed. It is possible to delete 0 characters (which is at most 1).
Input:
s = "abca"Output:
trueExplanation:
Comparing 'a' and 'a' at ends matches. Comparing 'b' and 'c' fails. trying skipping 'c' at index 2, leaving 'aba' which is a valid palindrome.
Input:
s = "abc"Output:
falseExplanation:
No single deletion makes the string a palindrome, so the answer is false.
Constraints
- •
1 ≤ s.length ≤ 10⁵ - •
s consists of lowercase English letters.