Java solution


  • 0
    T

    public class Solution {
    public void moveZeroes(int[] nums) {
    int start = 0;
    int end = nums.length;
    for(int i = 0;i<end;i++){
    if(nums[i] != 0){
    nums[start] = nums[i];
    start++;
    }
    }
    for(int j = end - 1;j>=start;j--){
    nums[j] = 0;
    }
    }
    }


Log in to reply
 

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