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.
Arrays.asList(outer).containsAll(Arrays.asList(inner))stackoverflow.com/questions/16524709/…sets[0][0] = {0, 0, 0}. ForArrays.asList(numbers).containsAll(Arrays.asList(inner))to be evaluated to true,numbersonly needs to contain one 0, whereas my algorithm would need it to contain three different 0s.