LTIMindtree interview question

Next permutation Question Example 1: Input: nums = [1,2,3] Output: [1,3,2]