给定金额 N 与硬币面值集合 C(每种无限),计算组成 N 的方案数(硬币顺序不影响结果)。
Count the number of ways to make change for N with infinite supply of given coins (order doesn't matter).
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: hard
分类: problem-solving
标签: DP, Coin Change
目标公司: IBM
参考答案摘要
Method Split solutions into two sets: (1) solutions that do not include the mth coin (Cm) and (2) solutions that include at least one Cm. Use: solve(C[], m, n) = solve(C[], m-1, n) + solve(C[], m, n-C...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。