Dynamically change the number of nested for loops
Think about how many times you run through this loop. It looks like (size!) / (size - n)!
:
int numLoops = 1;
for (int i = 0; i < n; i++) {
numLoops*= (size - i);
}
for (int i = 0; i < numLoops; i++) {
//do something
}