Count ways to make change (DP)
Company: Walmart Labs
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: This question evaluates understanding of dynamic programming and combinatorial counting, focusing on unbounded coin usage and counting order‑independent combinations.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: (5, [1,2,5])
Expected Output: 4
Explanation: There are four order-insensitive combinations.
Input: (3, [2])
Expected Output: 0
Explanation: No combination reaches 3.
Input: (0, [1,2])
Expected Output: 1
Explanation: Choosing no coins is one way.
Input: (10, [10])
Expected Output: 1
Explanation: One coin can make the amount exactly.
Hints
- Clarify edge cases before coding.
- Keep outputs deterministic when several valid answers exist.