MMeta·DSAE4Online Assessment
Valid Palindrome II
Problem
Given a string s, return true if it can become a palindrome after deleting at most one character.
Example
s = "abca"
Output: true // delete 'c'
Constraints
- 1 ≤ s.length ≤ 10^5
- Lowercase English letters
Approach
Two pointers; on first mismatch, try skipping the left or the right character. O(n).
added 6 days ago