Valid Palindrome II

Given a string `s`, return `true` if the string can be a palindrome after deleting at most one character, otherwise return `false`.

Input Format

s = input string

Output Format

true if s can become a palindrome after at most one deletion, false otherwise

Constraints

Examples

Example 1:

Input:

s = "aba"

Output:

true

Explanation:

Already a palindrome.

Example 2:

Input:

s = "abca"

Output:

true

Explanation:

Delete 'c' to get 'aba'.

Example 3:

Input:

s = "abc"

Output:

false

Explanation:

Needs to delete more than one character to be palindrome.

Loading...
Valid Palindrome II - Two Pointers DSA Problem