1 line solution using STL library function


#1

//One line solution
//use the STL library function

vector Solution::nextPermutation(vector &A) {
next_permutation(A.begin(),A.end());
return A;
}


#2

Note clearly mentions that STL permutate can’t be used.