Guest User

Untitled

a guest
Jan 21st, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. // T(n, k) = T(n - k0, k) + T(n, {k1..k})
  2.  
  3. def countChange(money: Int, coins: List[Int]): Int = {
  4. if (money < 0 || coins.isEmpty) 0
  5. else if (money == 0) 1
  6. else countChange(money - coins.head, coins) + countChange(money, coins.tail)
  7. }
Add Comment
Please, Sign In to add comment