给定金额 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: use dynamic programming. Split solutions into (1) those excluding the mth coin and (2) those including it. Recurrence: solve(C, m, n) = solve(C, m-1, n) + solve(C, m, n - Cm). Use a dp table t...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。