Created
December 10, 2019 22:24
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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