K05

Cash Register Change

Junior Level Candidate
Target Time: 15 - 20 Minutes
Type: NUMERIC

Problem Statement & Objective

Calculate optimal coin return using greedy denomination selection.

Function Signature (Python)

cash_register_change(amount: int) -> int

Input & 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: 5

Example Test Scenarios (3)

Example 1
Input:[63]
Expected Output:5
Example 2: 99 Birim (50+25+10+10+1*4)
Input:[99]
Expected Output:8
Example 3: 15 Birim (10+5)
Input:[15]
Expected Output:2
Loading Python Editor...
Input Parameters
[
  63
]
Expected Output
5