mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 16:54:50 +08:00
Merge branch 'youngyangyang04:master' into master
This commit is contained in:
@ -296,7 +296,7 @@ class Solution {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
Python:
|
Python:
|
||||||
```py
|
```python
|
||||||
class Solution:
|
class Solution:
|
||||||
def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:
|
def combinationSum2(self, candidates: List[int], target: int) -> List[List[int]]:
|
||||||
res = []
|
res = []
|
||||||
|
@ -93,10 +93,10 @@ class Solution:
|
|||||||
if not root:
|
if not root:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
quene = [root]
|
queue = [root]
|
||||||
out_list = []
|
out_list = []
|
||||||
|
|
||||||
while quene:
|
while queue:
|
||||||
length = len(queue)
|
length = len(queue)
|
||||||
in_list = []
|
in_list = []
|
||||||
for _ in range(length):
|
for _ in range(length):
|
||||||
|
@ -210,7 +210,20 @@ var reverseString = function(s) {
|
|||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Swift:
|
||||||
|
|
||||||
|
```swift
|
||||||
|
func reverseString(_ s: inout [Character]) {
|
||||||
|
var l = 0
|
||||||
|
var r = s.count - 1
|
||||||
|
while l < r {
|
||||||
|
// 使用元祖
|
||||||
|
(s[l], s[r]) = (s[r], s[l])
|
||||||
|
l += 1
|
||||||
|
r -= 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user