Given `coins` (an array of distinct denominations) and a target `amount`, implement `coinChange(coins, amount)` returning the fewest coins that sum to `amount`, or `-1` if it cannot be made. You may use each denomination any number of times. (Asked at Amazon, Microsoft, and Google.)
+ 2 hidden tests run on Submit.
Bottom-up DP builds the answer for every amount from 0 up to the target. Each amount takes one more coin than the best reachable smaller amount. Unreachable amounts stay Infinity and map to -1. O(amount × coins) time.
Run your code to see results.