## Next Permutation

Posted on Fri 24 March 2017 in Puzzles

**Aim**: Find a larger permutation

We must move a larger number forward. So we should go from the tail to find any new number is smaller than a number behind it. If no next permutation, reverse list.

```
def next_permutation(l):
'''Give out the next permutation of list l
>>> next_permutation …
```

Continue reading