Created
May 6, 2016 22:36
-
-
Save chuck0523/ec04eb13b98e01fe6b2f34d9b0a645dd 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
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 nums.map { |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