while with manual incrementing should be avoided at all costs in Ruby, the following reads much more easily:
interrupt.times do
for x in 1..arr.length-1
if arr[x-1] > arr[x]
arr[x-1], arr[x] = arr[x], arr[x-1]
end
end
end
You can simplify this line:
line.map!(&:to_i)
As ! Makes methods work in place. &: converts a method to a block.
(minor) remove that semicolon, it is really weird:
line = line.chomp.split(" ");