Valid Palindrome II
A easy-tier problem at 43% community acceptance, tagged with Two Pointers, String, Greedy. Reported in interviews at Whatnot and 7 others.
Valid Palindrome II is the problem where the obvious two-pointer approach almost works, but the twist kills you: you get to skip exactly one character. It's marked easy, but the acceptance rate tells you candidates blank on the greedy move when they hit it live. Meta, Walmart Labs, eBay, and Roku all ask this. You know the pattern theoretically. When you're 8 minutes into the assessment and the naive solution fails test case 3, that's when StealthCoder solves it invisibly and you move on.
Companies that ask "Valid Palindrome II"
Valid Palindrome II is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made for the engineer who has done the work but might still blank with a webcam pointed at him.
Get StealthCoderThe trap is thinking you can handle mismatches by expanding your pointers. You can't. When left and right characters don't match, you have one shot: skip either the left or right character and check if the remaining substring is a palindrome. The greedy insight is that you don't need to try both and pick the winner during the OA. You validate one, and if it fails, validate the other. Most candidates hardcode the obvious loop first, test locally, and then realize they need the helper function for substring validation. The topics are Two Pointers, String, and Greedy because you're moving inward and making a one-time choice on which mismatch to forgive. If you freeze on the logic during screen share, StealthCoder surfaces the working two-pass pattern in seconds.
Pattern tags
You know the problem.
Make sure you actually pass it.
Valid Palindrome II recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Valid Palindrome II interview FAQ
Is this actually easy if the acceptance rate is 43%?+
Yes. The acceptance rate is low because candidates see 'palindrome' and code the two-pointer loop, then hit a test case where a valid answer requires skipping one character. They know the pattern but execute the wrong one under pressure. The problem itself is straightforward once you see the skip-and-validate move.
Do I need to try both skip options or just one?+
You need to handle both. When characters don't match, check if skipping the left character leaves a valid palindrome, or if skipping the right does. You can't know ahead of time which one will work, so the greedy aspect is making the call and validating. If one path fails, you try the other before returning false.
Why do Meta and Walmart ask this if it's easy?+
It's a screening-level problem that filters for people who can code clean two-pointer logic without off-by-one errors, and who recognize the skip-once constraint. It's easy in isolation but easy to mess up under OA time pressure, which is exactly what interviewers want to see.
What's the time complexity and does it matter for the OA?+
O(n) to traverse the string, where n is the length. You might make two passes if you hit the mismatch case, but it's still linear overall. For this problem, big-O doesn't differentiate you. Clean code and fast first submission do.
How does this relate to the original Valid Palindrome problem?+
The original ignores non-alphanumeric characters and is a pure two-pointer match. This one lets you skip one character. If you've done the original, you have the loop structure already. The new piece is the conditional logic when characters don't match and the helper to validate substrings.
Want the actual problem statement? View "Valid Palindrome II" on LeetCode →