Say I have the following sorted array:
int[] numbers = {0, 0, 1, 2, 2, 2}
.
How can I check if any sub-array of length 3 of numbers
exists in the following 2-dimensional array:
int[][] sets = { {0, 0, 0}, {1, 1, 1}, {2, 2, 2} }
In this simple example, the last 3 elements of numbers
are clearly contained as an array in sets
, but in my actual program, sets
will have far more 3 digit permutations of more numbers, but they will all remain length 3, and numbers
will always be sorted.