Rearrange an array into the next permutation in dictionary order, in place — or the smallest one if it is already the largest.
Rearrange an array into the next permutation in dictionary order, in place — or the smallest one if it is already the largest.
Opens with the full question.