use the STL algorithm ,we can solve the problem only one sentense.

```
void nextPermutation(vector<int> &nums)
{
next_permutation(nums.begin(), nums.end());
}
```

next_permutation(first,last) in the <algorithm> head file,its defination is that:

Rearranges the elements in the range [first,last) into the next lexicographically greater permutation.