I am looking for the best way to get all possible int arrays of length n from int array of length k, including an option for n-1 items to be null. for example I have the array with 5 elements (k=5) and I want all combinations of 3 (n=3)
int[] numbers = new int[5] {1, 2, 3, 4, 5};
and the possible sub arrays of length 3:
{1,null,null},{1,null,2},{1,2,null}..... and so on.
What would be the best way to do it? Matan