Skip to content

Instantly share code, notes, and snippets.

@EricDykstra
Created May 15, 2013 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EricDykstra/5587737 to your computer and use it in GitHub Desktop.
Save EricDykstra/5587737 to your computer and use it in GitHub Desktop.
def onehundred(arr)
result = []
arr.each_with_index do |x,i|
i_of_2nd = arr[i..arr.length].find_index(100-x)
if i_of_2nd
result << [x, 100-x]
arr.delete_at(i_of_2nd)
end
end
return result
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment