Valid Palindrome II
Solution ApproachWas this helpful?
Easy•string•Expected: O(n) time, O(1) space
two-pointers
Problem
Given a string, determine if it can be a palindrome after deleting at most one character.
Example 1:
Input: s = "aba"
Output: true
Example 2:
Input: s = "abca"
Output: true
Explanation: Removing 'b' or 'c' yields a palindrome.
Example 3:
Input: s = "abc"
Output: false
Reference solution unlocks after your first submission
Loading...
