Leetcode 518. Coin Change II

In this post, solution to leetcode problem – 518, coin change II – is explained. Please refer to this link for detail problem description. This is very similar to combination sum IV problem. The only difference is that the order doesn’t matter and this is essentially a subset problem with duplicates. Let’s see how we can approach the problem. Brute Force Exhaustively enumerate all subsets and check if it makes the amount. This will have exponential cost. Optimized version We can follow the similar approach as combination sum IV problem. The only difference is that order doesn’t matter and if READ MORE