I\'m writing a code segment that iterates through every permutation of n digits. So for example, if n = 3, I would want to iterate through each of the following elements:
If you want the permutation for all the digits for a specific length;as you have shown example of 3 digits. Instead of running 3 nested loops, run a single loop of 10^3 which will give you all the permutations.
Split the number obtained into digits in each iteration if you want to use it for indexing.
Thus you will be needing just one loop rather than nested loops.