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