669. 换硬币
中文English
给出不同面额的硬币以及一个总金额. 写一个方法来计算给出的总金额可以换取的最少的硬币数量.
如果已有硬币的任意组合均无法与总金额面额相等, 那么返回 -1.
样例
样例1
输入:
[1, 2, 5]
11
输出: 3
解释: 11 = 5 + 5 + 1
样例2
输入:
[2]
3
输出: -1
注意事项
你可以假设每种硬币均有无数个
class Solution {
public:
/**
* @param A: a list of integer
* @param M: a total amount of money amount
* @return: the fewest number of coins that you need to make up
*/
int coinChange(vector<int> &A, int M