← ALL NOTES
Array

46. Permutations

You can hand-roll the classic swap/DFS backtracker here, but this solution leans on the library instead: sort to the lexicographically smallest arrangement, then call std::next_permutation in a loop…

Loading…