Move all zeroes to the end of an array with the order of the elements preserved
Advertisements Can anyone tell me what have I done wrong in this code ? In this approach, I traverse the array and, as soon as I find a 0 element, I traverse to the right of the 0, and swap it with the 1st non-0 element found. class Solution { public void moveZeroes(int[] nums) {… Read More Move all zeroes to the end of an array with the order of the elements preserved