Skip to content

Instantly share code, notes, and snippets.

@yukinagae
Forked from Yachida/legalTender.scala
Last active August 29, 2015 14:13
Show Gist options
  • Select an option

  • Save yukinagae/23e72b70024ce4dd84b8 to your computer and use it in GitHub Desktop.

Select an option

Save yukinagae/23e72b70024ce4dd84b8 to your computer and use it in GitHub Desktop.
object legalTender extends App {
val yenCoins = List(1
,5
,10
,50
,100
,500)
val yenMax = 20
def sumCoins(max: Int)(coins: List[Int]): Int = coins.map(_ * max).sum
println(sumCoins(yenMax)(yenCoins))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment