January 2022 enrollments are closed and the course commences on 8th of January, 2022. For future cohorts Join the waitlist


class Solution {
    void nextPermutation(vector<int> &num) {
        bool ans = next_permutation(num.begin(), num.end());
        if( ans == false ) {
            sort(num.begin(), num.end());

470+ Competitive Programming Solutions

If you like what you read subscribe to my newsletter.

I write essays on various engineering topics and share it through my weekly newsletter 👇