Valid Palindrome II Visualizer & Solution | Rulcode
Loading problem details...
215. Valid Palindrome II
Easy
Topics
Companies
Hint
Understand Before Coding
Visualize This Problem
Open Visualizer
Draw Your Approach
Draw
Example 1:
Input:s = "aba"
Output:true
Explanation:The string "aba" is already a palindrome. No deletion is needed.
Example 2:
Input:s = "abca"
Output:true
Explanation:Deleting 'c' at index 2 results in "aba", which is a palindrome.
Example 3:
Input:s = "abc"
Output:false
Explanation:Deleting 'a' results in "bc" (not a palindrome). Deleting 'b' results in "ac" (not a palindrome). Deleting 'c' results in "ab" (not a palindrome). Thus, it cannot be a palindrome with one deletion.
Example 4:
Input:s = "eeccccbebaeeabebccceea"
Output:false
Explanation:This is a longer example where no single deletion can make it a palindrome.