One line solution using stl c++


#1

vector Solution::nextPermutation(vector &A) {

next_permutation(A.begin(),A.end());
return A;
}


#2

They asked you specifically not to do this.


#3

Very smart. 100 IQ answer.