Search topics...
All Problems

Valid Palindrome II

Solution Approach
Was this helpful?
EasystringExpected: 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...