function will now swamp pivot with lowest number right of pivot
This commit is contained in:
parent
c16bdad9b9
commit
fbe9f4bf02
@ -9,7 +9,13 @@ def next_bigger(n):
|
|||||||
if pivot == -1:
|
if pivot == -1:
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
print(pivot)
|
right = digits[pivot + 1 :]
|
||||||
|
swamp = right.index(min(right))
|
||||||
|
print(digits)
|
||||||
|
digits[pivot], digits[len(digits) - len(right) + swamp] = (
|
||||||
|
right[swamp],
|
||||||
|
digits[pivot],
|
||||||
|
)
|
||||||
return digits
|
return digits
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user