You are viewing a single comment's thread. Return to all comments →
This doesn't seem to work with duplicate values... this fails the third test.
t.times do cash = gets.to_i number_of_flavours = gets.to_i flavours = gets.chomp.strip.split(' ').map(&:to_i) hash = Hash[flavours.map.with_index { |e, i| [e, i] }] flavours.each.with_index do |e, i| if i2 = hash[cash - e] puts "#{i + 1} #{i2 + 1}" break end end end
Seems like cookies are disabled on this browser, please enable them to open this website
Ice Cream Parlor
You are viewing a single comment's thread. Return to all comments →
This doesn't seem to work with duplicate values... this fails the third test.