This is the object:
const b = {1: [[0, 'a'], [0, 'b'], [0, 'c']], 2: [[1, 'a'], [1, 'b']], 3: [[2, 'a'], [2, 'b']]}
It has been sorted with bucket sort.
I need to create a sub array with two arrays, i.e.: { 1: [[[0, 'a'], [0, 'b']], [[0, 'c']]]
In order to do that I must iterate over the value.
Is there anyway to do it in linear time complexity?
My initial thoughts were to remove the value from the key, work on it on a separate loop and re-insert.