Skip to content

Instantly share code, notes, and snippets.

@schmmd
Created May 12, 2015 15:48
Show Gist options
  • Save schmmd/660ee37930424dfce782 to your computer and use it in GitHub Desktop.
Save schmmd/660ee37930424dfce782 to your computer and use it in GitHub Desktop.
list.sum
(a zip b).map(_.productIterator).flatten
def fib100 = {
def fib(x: BigInt, y: BigInt): Stream[BigInt] = {
val z = x + y
z #:: fib(y, z)
}
(0 #:: 1 #:: fib(0, 1)).take(100).toList
}
def concatMax(list: List[Int]) = {
list.permutations.map {
_.map(_.toString).reduce(_ + _)
}.map(_.toInt).max
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment