• Please we urge all unregistered users to swiftly register to enable you enjoy loads of benefits rollingout in our community. Be open to opportunities to do good for someone else today. Anything that do not please God in your life has come to distroy you.

AdServersite

Follow Us
Nov 24, 2023
272
0
16
34
Abuja Nigeria
JavaScript:
class Solution {
    public void moveZeroes(int[] nums) {
        int left=0;
        int right=0;

        for(int i=0;i<nums.length;i++){
            if(nums[i]==0){
                left=i;
                right=i+1;
                break;
            }
        }

        while(right<nums.length){
            if(nums[right]!=0 && nums[left]==0){
                int temp=nums[right];
                nums[right]=nums[left];
                nums[left]=temp;
                left++;
                right++;
            }
            else{
                right++;   
            }
        }
    }
}
 

BSF For Soul Wining Support Donation

Total amount
$0.00
Goal
$1,000.00
Donation ends: