Question DSA-GRDY-0043
MediumWhat is the output of this code?
def coins(n, cs=(2000, 500, 200, 100, 50, 20, 10, 5, 2, 1)):
cnt = 0
for c in cs:
cnt += n // c
n %= c
return cnt
print(coins(2738))
- A.
7
- B.
8
- C.
Sign up free to see the answer and a step-by-step explanation.