DIY: Next Permutation

Solve the interview question "Next Permutation" in this lesson.

Problem statement

Given a list of numbers, you have to rearrange these numbers into the next lexicographically greater permutation of numbers. If such an arrangement is not possible, you must ...