1 class Solution { 2 public: 3 void nextPermutation(vector &num) { 4 // Note: The Solution object is instantiated only once and is reused by each test case. 5 int n = num.size(); 6 if (n <= 1) 7 return; 8 int i; 9 for (i = n - 2; i >= 0; i--){10 if (num[i]num[i] && num[j]