Given an array of numbers, a function should return an array of arrays, where each subarray contains all the duplicates of a particular number.
Subarrays should be in the same order as the first occurence of the number they contain. Given this:
[3, 2, 6, 2, 1, 3]
how can i get this
[[3, 3], [2, 2], [6], [1]]