Rearrange nums in place into the next lexicographically greater permutation. Find the pivot, swap with its next-larger successor, then reverse the suffix — watch it run step by step.