Amazon Interview Question

Implement C++'s next_permutation