Created
August 27, 2014 03:08
-
-
Save martin2110/24a45a3278258e8e8a4c to your computer and use it in GitHub Desktop.
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
arr = [1,2,3,4,5,5,6,7,7,7] | |
track = Hash.new | |
arr.each_with_index do | num, index | | |
unless track[num] | |
track[num] = Array.new | |
end | |
track[num].push(index) | |
end | |
track.each { |key, value| | |
if value.count == 1 | |
puts "number: #{key} at index #{value}" | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment