Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // T(n, k) = T(n - k0, k) + T(n, {k1..k})
- def countChange(money: Int, coins: List[Int]): Int = {
- if (money < 0 || coins.isEmpty) 0
- else if (money == 0) 1
- else countChange(money - coins.head, coins) + countChange(money, coins.tail)
- }
Add Comment
Please, Sign In to add comment