Last active
November 26, 2017 09:27
-
-
Save rafaltrojanowski/c88cbcbe97ce877a84072bae0f734a73 to your computer and use it in GitHub Desktop.
This file contains 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 solution(a) | |
hash = {} | |
a.each do |element| | |
if hash[element].nil? | |
hash[element] = 1 | |
else | |
hash[element] += 1 | |
end | |
end | |
hash.select { |k, v| v % 2 == 1 }.keys.first | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment