Position: SDE2
Given an infinite supply of certain coins, return the minimum number of coins required to make a change. You need to return the exact coins used to make that change. For example, if you have [Quarter, Dime, Nickel, Penny] or in other words the given coins are [0.25, 0.10, 0.05, 0.01] and the given amount is $1, return "4 quarters" or [0.25, 0.25, 0.25, 0.25].
The problem was intentionally left a bit vague (such as the input, denomination of coins, output format) and I had to ask follow up questions to clarify them. For example, if there are multiple combinations of coins that give a certain amount, return the one with the lowest value of coins when the coins are sorted in ascending order by value (see the 2nd example).
Variation of - https://leetcode.com/problems/coin-change/
Example:
Input: coins = [1,2,5], amount = 11
Output: [1, 5, 5]
Explanation: 11 = 5 + 5 + 1
Input: coins = [7, 1, 2, 4, 5, 6], amount = 11
Output: [4, 7]
Explanation: There are 2 ways to make 11 using 2 coins. [4, 7] and [5, 6]. Return [4, 7] as 4 comes before 5.