Bloomberg Online Java Interview Question

Anonymous User
1070
Feb 08, 2021

Write a function that prints out the minimum number of coins recquired to add up to the number of cents passed in. You may dispense any number of 1c, 5c,10c,25c coins to make up the minimum.

for eg:
12 -> "1x 10c, 2x 1c"
132 -> "5x 25c, 1x 5c, 2x 1c"
68 -> "2x 25c, 1x 10c, 1x 5c, 3x 1c"

Provide optimal java solution.

Comments (2)