In [[1,2],[2,1],[8,9],[12,12]], the first two elements are same. I want to get an output like this: [[8,9],[12,12]].
In:
[1,2,3].product([1,2,3])
# => [[1, 1], [1, 2], [1, 3], [2, 1], [2, 2], [2, 3], [3, 1], [3, 2], [3, 3]]
I want to get an output like this:
[[1, 1], [2, 2], [3, 3]]