private void delete(int[] nums, int i, int size) {
while (i < size - 1) {
//nums[i ++] = nums[i + 1];
nums[i] = nums[i + 1];
i++;
System.out.println("i: "+i);
}
return;
}
I found that if replace the statement
nums[i] = nums[i + 1];
i++;
with the comment part
nums[i ++] = nums[i + 1];
It throws OutOfIndex in java but performs well in C.