c++ solution -- one liner


  • 0
    Z
    void moveZeroes(vector<int>& nums) {
            stable_sort(nums.begin(), nums.end(), [](int a, int b){return b==0;});
        }
    

    apologies if this solution was already mentioned earlier. stable_sort and lambdas ftw.


Log in to reply
 

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