Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def odd_frequency(array)
- hash_counter = Hash.new(0)
- final = []
- array.each do |v|
- hash_counter[v] += 1
- end
- hash_counter.each { |k,v| final << k if v % 2 != 0 }
- print final
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement