Solution Review: All Permutations of an Integer List

This review provides a detailed analysis of generating all permutations of an integer list.

Solution

At each recursive call, we swap the number at index i with all the array elements on its right. We recursively repeat the process for sub-arrays until the sub-array of one element is left.

Letā€™s look at the illustration to better understand the solution before reviewing its code.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.