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