Created
September 26, 2014 03:48
-
-
Save rabitarochan/73d9b21c3b0fe6d71811 to your computer and use it in GitHub Desktop.
『0、6、0、7』をつかって10にしてください in Scala
This file contains 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
// らびたろちゃんは『0、6、0、7』をつかって10にしてください。 http://shindanmaker.com/217387 | |
List(0, 6, 0, 7) | |
.reverse | |
.map(x => List(x).zipWithIndex.map{case (y, i) => y.toString + i.toString}) | |
.map(_.mkString.toInt) | |
.reduce((z, n) => z - n) | |
// => 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment