I’ve a strange question: Which is the smart/best way to order an array of number like this
[1,1,2,2,3,3,4,4]
to this
[1,2,3,4,1,2,3,4]
The idea is to balance the list in order to give a sort of priority to each element of the list.
Language could be php, it does not matter that much
lets say we have [1,1,2,2,2,2,3,3]
Take first set of equal numbers and put it in seperate arrays ( vertically )
similarly for second set of equal numbers and so on
Concat the arrays to get the result