Algorithm · Apple · Medium
You are given an integer array nums in which no value repeats. Generate every possible ordering of the elements in nums, and return them as a list of arrays. Each permutation must contain all elements from nums exactly once. The permutations themselves may be listed in any order. Example 1: Explanation: These are the six distinct ways to arrange the three values. Example 2: Example 3: Constraints: The length of nums satisfies $$1 \le \text{nums} \le 6$$. Each value satisfies…
Checking your access…