My C++ Solution


  • 0
    R
    class Solution {
    public:
        void moveZeroes(vector<int>& nums) {
            int i, j;
            for(i=0; i<nums.size(); i++) {
                for(j=i; j<nums.size(); j++) {
                    if(nums[i] != 0) continue;
                    else swap(nums[i], nums[j]);
                } 
            }
        }
    };
    

Log in to reply
 

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