loading...

re: Daily Challenge #220 - What Dominates Your Array? VIEW POST

FULL DISCUSSION
 

Ruby.

def dominator(arr)
  arr.tally.find { |_k, v| v > arr.size / 2 }&.first || -1
end
 
 
 

yeah, I googled and begin to read official documents 👌

code of conduct - report abuse