Skip to content

Instantly share code, notes, and snippets.

@venelrene
Created December 10, 2019 22:24
Show Gist options
  • Select an option

  • Save venelrene/4a812b87b94ee393b9f544b9cbf730d3 to your computer and use it in GitHub Desktop.

Select an option

Save venelrene/4a812b87b94ee393b9f544b9cbf730d3 to your computer and use it in GitHub Desktop.
Given an array, find the integer that appears an odd number of times. There will always be only one integer that appears an odd number of times.
def find_it(seq)
seq.select {|n| seq.count(n).odd? }.first
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment