As reported: Goldman Sachs Analyst Superday, DSA round 2 (2025): Coin Change — the minimum number of coins.
Given coin denominations coins (unlimited supply of each) and an amount, return the fewest coins that sum to amount, or -1 if it cannot be made.
This is LeetCode 322 — Coin Change.
Example 1
coins = [1,2,5], amount = 11
-> 3
Example 2
coins = [2], amount = 3
-> -1
Example 3
coins = [1], amount = 0
-> 0
Constraints: 1 ≤ coins.length ≤ 12; 1 ≤ coins[i] ≤ 2^31 − 1; 0 ≤ amount ≤ 10^4.
Code runner format: one JSON value per line: coins, then amount (LeetCode's test-case format). Implement coinChange(coins, amount); the harness prints the result as JSON.