feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent e28da5def2
commit 0f264ef603
94 changed files with 1840 additions and 0 deletions

View File

@@ -9,6 +9,26 @@ categories:
patterns:
- backtracking
function_signature: "def permute(nums: list[int]) -> list[list[int]]:"
test_cases:
visible:
- input: { nums: [1, 2, 3] }
expected: [[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]
- input: { nums: [0, 1] }
expected: [[0, 1], [1, 0]]
- input: { nums: [1] }
expected: [[1]]
hidden:
- input: { nums: [5, 4] }
expected: [[5, 4], [4, 5]]
- input: { nums: [-1, 0, 1] }
expected: [[-1, 0, 1], [-1, 1, 0], [0, -1, 1], [0, 1, -1], [1, -1, 0], [1, 0, -1]]
- input: { nums: [1, 2, 3, 4] }
expected: [[1, 2, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 4, 2], [1, 4, 2, 3], [1, 4, 3, 2], [2, 1, 3, 4], [2, 1, 4, 3], [2, 3, 1, 4], [2, 3, 4, 1], [2, 4, 1, 3], [2, 4, 3, 1], [3, 1, 2, 4], [3, 1, 4, 2], [3, 2, 1, 4], [3, 2, 4, 1], [3, 4, 1, 2], [3, 4, 2, 1], [4, 1, 2, 3], [4, 1, 3, 2], [4, 2, 1, 3], [4, 2, 3, 1], [4, 3, 1, 2], [4, 3, 2, 1]]
- input: { nums: [0] }
expected: [[0]]
description: |
Given an array `nums` of distinct integers, return *all the possible permutations*. You can return the answer in **any order**.