Advertisement
Guest User

Untitled

a guest
May 29th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. def countChange(money: Int, coins: List[Int]): Int = {
  2.  
  3. money match {
  4. case 0 => 1
  5. case x if x < 0 => 0
  6. case x if x>=1 && coins.isEmpty => 0
  7. case _ => countChange(money, coins.tail) + countChange(money - coins.head, coins)
  8.  
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement