java - Printing a 2D Array Combinations Without Duplicates -
i'm struggling print unique combinations 2d array hold same value.
example 2d array
[4, 4, 4, 4]
[4, 4, 4, 4]
possible unique combinations
0,1
0,2
0,3
1,2
1,3
could give pointers on how tackle this?
you can avoid looping through array correctly:
for (int = 0; < array.length; i++) { (int j = i+1; j < array.length[i]; j++) { // start j = i+1 avoid comparing same cells } }
Comments
Post a Comment