The Next Lexicographic Arrangement
A lock displays a sequence of digits. Its current display is an array `nums` containing a permutation, possibly with repeated values. Rearrange the same elements **in place** so the display becomes the smallest sequence strictly larger in lexicographic order than the current sequence.