Skip to content

Commit 5d60367

Browse files
longsizhuogithub-actions[bot]
authored andcommitted
chore(docs): sync doc metadata [skip ci]
1 parent eb6c9e1 commit 5d60367

2 files changed

Lines changed: 31 additions & 9 deletions

File tree

app/docs/CommunityShare/Leetcode/46.全排列.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ title: 46.permutations
33
date: 24/3/2025
44
tags:
55
- Python
6-
- '9021'
6+
- "9021"
77
- tree
88
abbrlink: d567a4cd
9+
docId: mxt0ux1zpbzph4nuxz51eyg7
910
---
1011

1112
# Description:
13+
1214
Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order.
1315

1416
Example 1:
@@ -24,10 +26,11 @@ Example 3:
2426
Input: nums = [1]
2527
Output: [[1]]
2628

27-
2829
# Thinking:
30+
2931
This question is more like a tree problem.
3032
like the tree below:
33+
3134
```shell
3235
dfs(0): nums = [1,2,3]
3336
|
@@ -56,12 +59,14 @@ dfs(0): nums = [1,2,3]
5659
|-- dfs(2): append [3,1,2]
5760

5861
```
62+
5963
We swap the current position index with each possible candidate `i` from `index` to the end. They can be seen as left and right pointers: `index` determines which position we're filling, and `i` tries different numbers to place there.
6064

61-
Before the recursive call, we swap `nums[i]` and `nums[index]` to try placing a new number at position index. If we reach the last position (`index == len(nums) - 1`), we add the current permutation to the answer list.
65+
Before the recursive call, we swap `nums[i]` and `nums[index]` to try placing a new number at position index. If we reach the last position (`index == len(nums) - 1`), we add the current permutation to the answer list.
6266
After recursion, we swap back to restore the original state (backtracking).
6367

6468
# Code:
69+
6570
```python
6671
class Solution:
6772
def permute(self, nums: List[int]) -> List[List[int]]:
@@ -79,4 +84,4 @@ class Solution:
7984
res = []
8085
dfs(0)
8186
return res
82-
```
87+
```

generated/doc-contributors.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"repo": "InvolutionHell/involutionhell",
3-
"generatedAt": "2025-11-24T03:05:25.591Z",
3+
"generatedAt": "2025-11-25T03:06:12.634Z",
44
"docsDir": "app/docs",
5-
"totalDocs": 122,
5+
"totalDocs": 123,
66
"results": [
77
{
88
"docId": "ue27z7z95yzw3lhhfj7nit1c",
@@ -2221,6 +2221,23 @@
22212221
}
22222222
]
22232223
},
2224+
{
2225+
"docId": "mxt0ux1zpbzph4nuxz51eyg7",
2226+
"path": "app/docs/CommunityShare/Leetcode/46.全排列.md",
2227+
"contributorStats": {
2228+
"114939201": 1
2229+
},
2230+
"contributors": [
2231+
{
2232+
"githubId": "114939201",
2233+
"contributions": 1,
2234+
"lastContributedAt": "2025-11-25T03:00:08.000Z",
2235+
"login": "longsizhuo",
2236+
"avatarUrl": "https://avatars.githubusercontent.com/u/114939201?v=4",
2237+
"htmlUrl": "https://github.com/longsizhuo"
2238+
}
2239+
]
2240+
},
22242241
{
22252242
"docId": "ryp6s59uwc10w2dywgs6f66h",
22262243
"path": "app/docs/CommunityShare/Leetcode/80_translated.md",
@@ -2242,13 +2259,13 @@
22422259
"docId": "d5evrnoglwjvmyginjq84bl0",
22432260
"path": "app/docs/CommunityShare/Leetcode/93复原Ip地址.md",
22442261
"contributorStats": {
2245-
"114939201": 1
2262+
"114939201": 2
22462263
},
22472264
"contributors": [
22482265
{
22492266
"githubId": "114939201",
2250-
"contributions": 1,
2251-
"lastContributedAt": "2025-11-24T03:00:36.000Z",
2267+
"contributions": 2,
2268+
"lastContributedAt": "2025-11-24T03:05:26.000Z",
22522269
"login": "longsizhuo",
22532270
"avatarUrl": "https://avatars.githubusercontent.com/u/114939201?v=4",
22542271
"htmlUrl": "https://github.com/longsizhuo"

0 commit comments

Comments
 (0)