K05
Cash Register Change
Problem Statement & Objective
Calculate optimal coin return using greedy denomination selection.
Function Signature (Python)
cash_register_change(amount: int) -> intInput & Output Contract
Output Rule:Minimum para adedi. tutar = 0 ise 0. tutar < 0 ise -1.
System Constraints
-10^9 <= tutar <= 10^9
Kullanılabilir madeni paralar: {1, 5, 10, 25, 50}Example Execution Walkthrough
tutar = 63
63 = 50 + 10 + 1 + 1 + 1 (5 adet)
cevap: 5Example Test Scenarios (3)
Example 1
Input:
[63]Expected Output:
5Example 2: 99 Birim (50+25+10+10+1*4)
Input:
[99]Expected Output:
8Example 3: 15 Birim (10+5)
Input:
[15]Expected Output:
2