Search topics...

Valid Palindrome II

easy
stringTime: O(n)Space: O(1)Frequency: 4

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
two-pointers