Test cases
| 
 | 
 | 
Solution 1: TLE
DP.
- Base case: dp[0] = 0
- Induction rule: dp[i] = min(dp[j] + 1) where j < i;
Time: O(n^3)
Space: O(n)  
| 
 | 
 | 
Solution 2: accepted 27ms
Dp.
Instead of check every value in (1, i), we only check the possible coin value, which is a much smaller range.  
Time: O(n^2)
Space: O(n)  
| 
 | 
 |