#680

Valid Palindrome II

pupil · 470 · lc easy +26 · verified · 44% accepted · 8,965 likes · top 26%

Description

Given a string s, determine whether it can become a palindrome by removing at most one character. Return true if so, false otherwise.

Example 1:

Input: s = "aba"
Output: true

Example 2:

Input: s = "abca"
Output: true
Explanation: You could delete the character 'c'.

Example 3:

Input: s = "abc"
Output: false

Code

1
2
3