How can i split it into sequences/runs/subsequent-numbers, if the run is no longer than 3?
Having an array as follows
[1, 2, 3, 5, 9, 10, 16, 17, 18, 19]
My expected output would be the following arrays:
[1, 2, 3][5][9, 10][16, 17, 18][19]
e.g. [[1, 2, 3], [5], [9, 10], [16, 17, 18], [19]]
If it is a run of length 8 e.g. [1, 2, 3, 4, 5, 6, 7, 8] i would like to get 8 / 3 + 1 = 2 lists:
[1, 2, 3][4, 5, 6][7, 8]