| 64 | } |
| 65 | |
| 66 | void next_permutation(vector<int> & nums) { |
| 67 | int i = nums.size() - 1; |
| 68 | while (i >= 0) { |
| 69 | if (i != 0 and nums[i - 1] < nums[i] ) { |
| 70 | int j = 3; |
| 71 | while (nums[j] <= nums[i - 1]) j -- ; |
| 72 | swap(nums[i - 1], nums[j]); |
| 73 | reverse(nums.begin() + i, nums.end()); |
| 74 | return; |
| 75 | } else if (i == 0) { |
| 76 | reverse(nums.begin(), nums.end()); |
| 77 | return; |
| 78 | } |
| 79 | i -- ; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | string to_str(Ops op) { |
| 84 | switch (op) { |
nothing calls this directly
no outgoing calls
no test coverage detected