First Unmakeable Coin Sum
Preview mode. Log in to edit, run, submit, and save progress.
Medium
First Unmakeable Coin Sum
A shopkeeper has coins with different positive values. Using each coin at most once, some totals can be formed and some cannot. Return the smallest positive total that cannot be formed from the available coins.
Examples
Example 1
Input:
1 2 3
Output:
7
Approach hint
If all sums from 1 to x - 1 are possible, a coin of value at most x extends the reachable range.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
solution.cpp