The problem don't mean this ,but the solution can be AC.


  • 0
    L
    void nextPermutation(vector<int> &num) {
        next_permutation(num.begin(),num.end());
    }

  • 0
    D

    Yes, this is AC.
    Why? Becouse std::next_permutation do exactly the same as descripted in the task.
    Obviously, the task was implement this function by yourself.

    This is not a competition site. Nobody will check whether you cheat. We are here to perpare for the interview. And if task ask to implement function that already exist in std - be sure - it is NOT the check whether you know names of all function in std.

    It doesn't mean that you can't use algorithm library at all. Usually (on interview) you can use all other function except this one. Also you can let interviewer know that if he wants you can implement other function by youself too.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.