Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def checkEqualFrequency(inputArray)
- counts = Hash.new 0
- inputArray.each do |number|
- counts[number] += 1
- end
- counts = counts.to_a
- x = 0
- value = counts[0][1]
- while (x < counts.length)
- if counts[x][1] != value then
- return false
- end
- x = x + 1
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement