function will now swamp pivot with lowest number right of pivot

This commit is contained in:
Sandro Zimmermann 2026-03-11 22:22:40 +01:00
parent c16bdad9b9
commit fbe9f4bf02

View File

@ -9,7 +9,13 @@ def next_bigger(n):
if pivot == -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