Valid Palindrome II
Valid Palindrome II
Given a string s, determine if it can become a palindrome by deleting at most one character.
Examples:
-
Input:
s = "aba"Output:true -
Input:
s = "abca"Output:trueExplanation: Delete 'c'. -
Input:
s = "abc"Output:false
Constraints:
1 <= s.length <= 105sconsists of lowercase English letters.
Similar LeetCode problem: Valid Palindrome II
AI interview prep
Core dilemma
Efficiently checking palindrome properties while accommodating a single character deletion.
2 tradeoffs and 2 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Valid Palindrome II
Valid Palindrome II
Given a string s, determine if it can become a palindrome by deleting at most one character.
Examples:
-
Input:
s = "aba"Output:true -
Input:
s = "abca"Output:trueExplanation: Delete 'c'. -
Input:
s = "abc"Output:false
Constraints:
1 <= s.length <= 105sconsists of lowercase English letters.
Similar LeetCode problem: Valid Palindrome II