-
-
Save yukinagae/23e72b70024ce4dd84b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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