LeetCode 46 Permutations - Problem Statement

The problem

Given an array of distinct integers, return all possible permutations.

With [1, 2, 3], return all 6 permutations: [[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]].

A permutation uses every element exactly once. The order matters.

This is a foundational backtracking problem. How do you systematically generate all orderings?

Constraints: 11 \le length 6\le 6. All elements distinct.