Algorithm · Amazon · Medium
Requirements For a given currency amount, determine the fewest bills and coins whose total matches that amount exactly. Available bills are 20, 10, 5, and 1; available coins are 0.25, 0.10, 0.05, and 0.01. Example: 7.40 → one 5, two 1s, one 0.25, one 0.10, one 0.05. Preparation Implement the integer-cent greedy approach, then manually check 7.40 along with several other amounts. Create the limited-stock version and test a case in which greedy must declare failure; also…
Checking your access…