未验证 提交 eb416964 编写于 作者: K KEQI HUANG 提交者: GitHub

Update 031._next_permutation.md

上级 85f43a69
......@@ -92,7 +92,7 @@ class Solution(object):
idx = i
break
if idx != 0: # if the number exist,which means that the nums not like{5,4,3,2,1}
for i in range(len(nums)-1, 0, -1):
for i in range(len(nums)-1, idx-1, -1):
if nums[i] > nums[idx-1]:
nums[i], nums[idx-1] = nums[idx-1], nums[i]
break
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册