Given this array:
[38, 38, 40, 40, 40, 41, 41, 41, 41, 60]
How do I sort it into this?
[38, 40, 41, 60, 38, 40, 41, 40, 41, 41]
-------------------------------------------------------
max = arr.map { |e| arr.count(e) }.max
arr.sort. group_by { |e| e }.values. map { |a| a.fill(nil, a.size..max-1) }.transpose.flatten.compact