I have a 1D array:
[3, 4, 5, 6, 7, 20, 31, 32, 33, 34]
which I want to turn into a 2D interval array by merging every consecutive values into intervals:
[
[ 3, 7],
[20, 20],
[32, 34]
]
What would be a decent, possibly GPU-friendly, way to do it?