Skip to content

Instantly share code, notes, and snippets.

@JavadocMD
Created October 18, 2014 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JavadocMD/2b41cf33914dba484e82 to your computer and use it in GitHub Desktop.
Save JavadocMD/2b41cf33914dba484e82 to your computer and use it in GitHub Desktop.
def parse(s: String): List[List[Long]] =
s.lines.map(_.split(" ").map(_.toLong).toList).toList
def pairwiseChoose(row: List[Long]): List[Long] =
(row.sliding(2).map { case a :: b :: Nil => max(a, b) }).toList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment