Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
object OutRunScala {
def solve(source: Source): Int = {
private def fold(acc: IndexedSeq[Int], row: Array[Int]): IndexedSeq[Int] = {
for {
i <- 0 until row.size
n <- Some(row(i))
l <- if (i == acc.size) Some(0) else Some(acc(i))
r <- if (i == 0) Some(0) else Some(acc(i - 1))
} yield n + math.max(l, r)
def main(args: Array[String]) {
val start = System.currentTimeMillis
val result = solve(Source fromFile args(0))
val duration = System.currentTimeMillis - start
println(s"# result: $result")
println(s"# execution duration: $duration ms")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.