Ctrl K
Problem

Fewest Bills

Medium · Fewest Bills

A cash register holds bills of several denominations, listed in the array `denominations`, with an unlimited supply of each. You need to pay out exactly `total`. Return the smallest number of bills that does it. If the exact sum cannot be made, return −1. When `total` is 0, the answer is 0.…

Solve the problem →