One line C++

  • 0

    This would probably wouldn't fly in an interview, but if I'd rather just use the proper algorithm available in the standard library.

    class Solution {
        void moveZeroes(vector<int>& nums) {
            stable_partition(nums.begin(), nums.end(), [](int n) { return n != 0; });

Log in to reply

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