Concept Flow - Next Permutation of Array
Start from right end
Find first pair where nums[i
If no such pair, reverse whole array and STOP
Find element nums[j
Swap nums[i
Reverse subarray nums[i+1
Done: Next permutation formed
Find the next bigger arrangement by swapping and reversing parts of the array.
