Skip to content

@Canx /kata4_1.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
kata 4: data munging (part 1)
data = Array.new
File.foreach("weather.dat") { |line|
if line =~ /^\s+([0-9]+)\s+([0-9]+)[*]?\s+([0-9]+)[*]?/ then
data << {:day => Integer($1), :spread => Integer($2) - Integer($3)}
end
}
puts data.min { |a,b| a[:spread] <=> b[:spread] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.