```
class Solution:
# @param num, a list of integer
# @return nothing (void), do not return anything, modify num in-place instead.
# 1:23
def nextPermutation(self, num):
for i in range(len(num) - 2, -1, -1):
for j in range(len(num) - 1, i, -1):
if num[i] < num[j]:
num[i], num[j] = num[j], num[i]
num[i+1:] = num[i+1:][::-1]
return
num.reverse()
```