Next Checkpoint Payment
Preview mode. Log in to edit, run, submit, and save progress.
Easy
Next Checkpoint Payment
A ticket counter accepts payments only in exact bundles of size m. You already have n coins. Return the minimum number of extra coins you must add so your total becomes divisible by m.
Examples
Example 1
Input:
10 4
Output:
2
Explanation: Adding 2 makes the total 12, which is divisible by 4.
Approach hint
Only the remainder of n modulo m matters.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
solution.cpp