Minimum Suffix Flips
A medium-tier problem at 73% community acceptance, tagged with String, Greedy. Reported in interviews at J.P. Morgan and 1 others.
Minimum Suffix Flips is a medium-difficulty string problem that appears in J.P. Morgan and IBM assessments. The setup is straightforward: you're given a binary string and need to find the minimum number of bit flips to make the entire suffix uniform. The catch is that the greedy observation isn't obvious at first. Most candidates either overthink it or miss the linear-time pattern that makes this problem solvable in a single pass. It's the kind of problem where a blank moment during your live OA could cost you, and StealthCoder surfaces the solution instantly if you hit that wall.
Companies that ask "Minimum Suffix Flips"
Minimum Suffix Flips 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 engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share.
Get StealthCoderThe core trick is greedy: process the string from left to right and track runs of consecutive identical bits. Each time the bit changes, you're forced to flip something. You don't need dynamic programming or complex state machines. The insight is that to make a suffix uniform, you only care about where changes happen, and you always choose to flip toward the most frequent bit in the remaining suffix. The false starts come from trying to optimize within each run or overthinking prefix vs. suffix logic. Most candidates solve it correctly but slowly. String and Greedy are both foundational topics, but the combination here is where the pattern hides. If this problem hits your live assessment and the greedy logic doesn't click, StealthCoder runs invisibly and gives you working code in seconds.
Pattern tags
You know the problem.
Make sure you actually pass it.
Minimum Suffix Flips 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 engineer at a top-10 tech company who can solve these problems cold but didn't want to trust himself in a 90-minute screen share. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Suffix Flips interview FAQ
How hard is Minimum Suffix Flips really?+
Medium in name only. The acceptance rate is 73%, and that's because the greedy pattern is teachable once you see it. It's not a hard algorithmic jump, but it does require spotting the structure. One pass, one decision per change. If you blank on the observation live, it stings.
Is this still asked at J.P. Morgan and IBM?+
Yes. Both companies have it in their reported problems. Given the low company count and medium difficulty, it's not a warm-up, but it's not a late-round gauntlet problem either. Solid mid-interview material where they expect you to reason under time pressure.
What's the greedy trick everyone misses?+
You don't need to decide which bit to target upfront. Process left to right and count the minimum flips needed at each transition. Each run of consecutive identical bits costs you flips only at its boundaries. The moment you see a bit change, you've found a forced flip point.
How does Greedy connect to String problems on coding interviews?+
Greedy on strings usually means making local optimal choices that build a global solution without backtracking. Here, the local choice is 'flip at every transition,' and that gives you the global minimum. Many string problems hide their greedy structure until you spot the invariant.
Can I brute force this or do I need the greedy insight?+
Brute force will TLE on large inputs. You need the O(n) linear scan with the greedy observation. No memoization or DP will save a naive approach. The insight is the solution.
Want the actual problem statement? View "Minimum Suffix Flips" on LeetCode →