Minimum Number of Coins to be Added
A medium-tier problem at 57% community acceptance, tagged with Array, Greedy, Sorting. Reported in interviews at Flipkart and 0 others.
You have a set of coin denominations and need to find the minimum number of coins to add so you can make any value up to a target. Flipkart has asked this one. It's a greedy problem that looks straightforward until you realize the obvious approach leaves gaps. You'll hit this in an OA and either spot the pattern or get stuck on edge cases. About 57% acceptance rate means half the candidates miss something. If the greedy trick doesn't click during the assessment, StealthCoder reads the problem and surfaces a working solution in seconds, invisible to the proctor.
Companies that ask "Minimum Number of Coins to be Added"
Minimum Number of Coins to be Added 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 by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.
Get StealthCoderThe trap is thinking you can just add missing denominations greedily. The real trick is that you need to construct reachable ranges. Start with what you have, figure out the maximum value you can currently make, then add a coin that extends that range optimally. Each new coin should roughly double your coverage. Sort your input first, then iterate through, checking gaps in what you can reach. When you find a hole, add the right coin to plug it. The greedy choice is counterintuitive: you're not adding the smallest coin, you're adding the coin that maximizes range expansion. Most candidates either brute-force or misunderstand the range-building logic. If you blank on the construction during the live assessment, StealthCoder solves the range-expansion pattern for you.
Pattern tags
You know the problem.
Make sure you actually pass it.
Minimum Number of Coins to be Added 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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Number of Coins to be Added interview FAQ
What's the actual trick here?+
You're not filling gaps randomly. You track the maximum amount you can make with current coins (say, 0 to 5). When you find a hole (can't make 6), you add a coin that extends your range as far as possible. A coin of value k extends your range from [0,n] to [0,n+k] if k <= n+1. Greedy coin choice, not denomination order, wins.
How does sorting help?+
Sorting lets you process denominations in order and detect unreachable ranges efficiently. You iterate once through the sorted array, tracking the highest value you can make. When a coin is larger than your current max, you've found a gap. Sorting makes the greedy choice obvious and avoids backtracking.
Is this asked at FAANG or just Flipkart?+
Flipkart is the reported company. It's a greedy-with-ranges pattern that fits medium difficulty at various tech companies, but only Flipkart shows up in the data. Mid-acceptance rate suggests it's not trivial but solvable if you know the range-extension principle.
What's the time complexity if I do this right?+
O(n log n) for sorting, then O(n + k) where k is the number of coins you add. In the worst case you add O(log target) coins because each one roughly doubles your range. Total is dominated by sorting unless the array is huge.
What do most people get wrong?+
They either try to fill gaps with the smallest missing denomination (greedy on value, not range) or they brute-force all possible coin combinations. The insight is that you need to track reachability as a contiguous range and expand it optimally with each new coin. Miss that and you'll iterate forever or miscount additions.
Want the actual problem statement? View "Minimum Number of Coins to be Added" on LeetCode →