Skip to content

Instantly share code, notes, and snippets.

@rabitarochan
Created September 26, 2014 03:48
Show Gist options
  • Save rabitarochan/73d9b21c3b0fe6d71811 to your computer and use it in GitHub Desktop.
Save rabitarochan/73d9b21c3b0fe6d71811 to your computer and use it in GitHub Desktop.
『0、6、0、7』をつかって10にしてください in Scala
// らびたろちゃんは『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