02.06 · Problem
Permutations
Return every ordering of the given distinct numbers. Any order is fine.
Examples
Example 1
Input: nums = [1, 2, 3]
Output: [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
Example 2
Input: nums = [0, 1]
Output: [[0, 1], [1, 0]]solulu Pro
Continue this problem with Pro
Inside: step-by-step hints · 8 hidden tests · reference solutions · code editor.
Lifetime ₹1,999 ₹999 · Launch offer
Item 17 of 44 · updated 2026-10-13