Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
nums = [1, 2, 1, 4, 5, 5, 2, 3]
puts nums.max_by {|x| nums.count(x)}
max_size = nums.count(nums.max_by {|x| nums.count(x)})
puts { |x| x if nums.count(x) == max_size}.uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment