Last active
August 29, 2015 14:04
-
-
Save jackliusr/7c8918e2bd80c1d7e779 to your computer and use it in GitHub Desktop.
Hackerrank Service Lane 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
object Solution { | |
def main(args: Array[String]) { | |
val lines = io.Source.stdin.getLines().toList | |
val segs = lines(1).split("\\s+").map(_.toInt) | |
val testcases = lines.drop(2) | |
for( tc <- testcases){ | |
val p = tc.split("\\s+").map(_.toInt).toList | |
println(segs.slice(p(0), p(1) + 1).min) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment