Hacker Rank Solutions: Service Lane
1
2
3
4
5
6
7
8
9
| freeway_length, test_cases = $stdin.gets.chomp.split(' ').collect{ |x| x.to_i }
freeway_segments = $stdin.gets.chomp.split(' ').collect{ |x| x.to_i }
test_cases.times do
startpos, endpos = $stdin.gets.chomp.split(' ').collect{ |x| x.to_i }
puts freeway_segments[startpos..endpos].min
end
|