Minimum bills to pay amount due


Suppose you're given an array of currency bills at varying values along with an integer representing an amount of money owed.

Given these inputs, write a function to return the fewest # of bills that are needed to pay the amount due. If the amount can not be paid with the bills shown, return 'Not possible'.

You can assume you have an infinite number of each kind of bill.

For example:

Input: bills = [1,2,5], amount = 15
Output: 3
(15 = 5 + 5 + 5)
Input: bills = [2], amount = 5
Output: Not possible


Access restricted

Subscribe to premium account to see the solution.

Get premium now