225. Valid Palindrome II

MediumStringString

Given a string s, return true if it can become a palindrome after deleting at most one character.

Input: A quoted string s.

Output: Boolean — true or false.

Examples

Example 1
Input: "aba"
Output: true
Explanation: Already a palindrome.
Example 2
Input: "abca"
Output: true
Explanation: Delete 'c' (or 'b') to get a palindrome.
Example 3
Input: "abc"
Output: false
Explanation: Cannot fix with one deletion.

Constraints

Asked by

MetaIBMAmazonMicrosoftGoogleBloomberg
Solve this problem in the editor →