MEDIUMasked at 2 companies

Maximum Number of Removable Characters

A medium-tier problem at 46% community acceptance, tagged with Array, Two Pointers, String. Reported in interviews at Moveworks and 1 others.

Founder's read

You're given a string, a list of removable character indices, and a substring to match. The catch: you need to find the maximum number of characters you can remove while keeping that substring as a subsequence. It's a classic two-pointer problem hiding under a binary-search wrapper, and both Moveworks and Snowflake have asked it. The acceptance rate hovers just under 46%, which means most candidates either miss the binary-search angle or bungle the two-pointer validation logic. If this problem lands in your assessment and you freeze on the approach, StealthCoder surfaces a working solution in seconds, invisible to the proctor.

Companies asking
2
Difficulty
MEDIUM
Acceptance
46%

Companies that ask "Maximum Number of Removable Characters"

If this hits your live OA

Maximum Number of Removable Characters 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. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code.

Get StealthCoder
What this means

The problem feels like a greedy question at first: just remove characters left-to-right and check if the substring survives. That fails. The real trick is binary search over the number of removals. For each candidate count k, use two pointers to check if the substring is still a valid subsequence after removing the first k characters from the removable list. The inner validation is where most people derail: they forget that you're not removing from the original string arbitrarily, only from the specific indices provided. Once you nail the two-pointer subsequence check, the binary search layer becomes straightforward. Arrays and strings collide here in a way that looks simple but punishes sloppy implementation. StealthCoder hedges the live OA if you blank on why greedy doesn't work.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Maximum Number of Removable Characters recycles across companies for a reason. It's medium-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. Built by an Amazon engineer who realized the OA tests how well you memorized 200 problems, not how well you code. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Number of Removable Characters interview FAQ

Is this really a binary-search problem?+

Yes. You binary-search the answer (number of removals), not the input. For each mid-point, use two pointers to validate whether the substring survives after removing k characters. The validation step is O(n), making the overall solution O(n log n). Many candidates try greedy instead and time out on larger test cases.

What's the most common pitfall?+

Confusing the removable indices with direct string indices. You're only removing from a specific list of positions, not arbitrary characters. Another trap: forgetting to reset pointers or state between binary-search iterations, which corrupts your validation logic and burns both companies' OAs.

How do I validate the subsequence after removals?+

Mark the first k indices in the removable list as deleted. Then iterate the original string with two pointers: one for the string, one for the substring. Skip marked positions and advance both pointers when characters match. If you reach the end of the substring, it's a valid subsequence.

Does this problem combine array and string topics equally?+

It does. The array is the removable list and the indices within it. The string is both the original and the target subsequence. Most failures happen on the string two-pointer check, not the array indexing, so debug your subsequence validation first.

Is 46% acceptance typical for medium-level binary-search problems?+

It's slightly lower than average for medium. The binary-search wrapper and two-pointer combo confuse people who've drilled binary search in isolation. Snowflake and Moveworks both ask it, so if you're targeting either, this is worth a focused drill before your OA.

Want the actual problem statement? View "Maximum Number of Removable Characters" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.