Two test cases are failed
(JAVA TA) 2 test cases failed
Run Error , this one sir
test case 0 and test case 1 has failed sir
@87adarsh.gupta
ur code is correct , on big test cases due to too many copy of array it is showing that error.
do it iteratively to avoid any copy.
how?
public void moveZeroes(int[] nums) {
int pos = 0;
for(int i = 0; i < nums.length; i++){
if(nums[i] != 0){
nums[pos]= nums[i];
pos++;
}
}
for(;pos<nums.length; pos++){
nums[pos] = 0;
}
}
Thanks sir , it passed all the test cases now