mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 11:34:46 +08:00
Update 0031.下一个排列.md
fixed bug in python solution and display issues
This commit is contained in:
@ -153,7 +153,7 @@ class Solution:
|
|||||||
break
|
break
|
||||||
self.reverse(nums, i, length-1)
|
self.reverse(nums, i, length-1)
|
||||||
break
|
break
|
||||||
else:
|
if n == 1:
|
||||||
# 若正常结束循环,则对原数组直接翻转
|
# 若正常结束循环,则对原数组直接翻转
|
||||||
self.reverse(nums, 0, length-1)
|
self.reverse(nums, 0, length-1)
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ class Solution:
|
|||||||
high -= 1
|
high -= 1
|
||||||
```
|
```
|
||||||
>上一版本简化版
|
>上一版本简化版
|
||||||
'''python
|
```python
|
||||||
class Solution(object):
|
class Solution(object):
|
||||||
def nextPermutation(self, nums: List[int]) -> None:
|
def nextPermutation(self, nums: List[int]) -> None:
|
||||||
n = len(nums)
|
n = len(nums)
|
||||||
@ -185,7 +185,7 @@ class Solution(object):
|
|||||||
end -= 1
|
end -= 1
|
||||||
|
|
||||||
return nums
|
return nums
|
||||||
'''
|
```
|
||||||
|
|
||||||
## Go
|
## Go
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user