ruby
def count(array)
count = Hash.new(0)
array.each do |elem|
count[elem] += 1
end
p count
end
Go to list of users who liked
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
def count(array)
count = Hash.new(0)
array.each do |elem|
count[elem] += 1
end
p count
end
Register as a new user and use Qiita more conveniently
Go to list of users who liked