Moves Zeroes Java Solution Easy

class Solution {
public void moveZeroes(int[] nums) {

    int a=0, b=0;
    
    while(b<nums.length){
        if(nums[b]!=0) nums[p1++]=nums[b];
        b++;
    }
    
    while(a<nums.length){
        nums[a++]=0;
    }
    
}

}

Comments (0)
No comments yet.