public int[] withoutTen(int[] nums) {
int i = 0;
while(i < nums.length && nums[i] != 10)
i++;
for(int j = i + 1; j < nums.length; j++) {
if(nums[j] != 10) {
nums[i] = nums[j];
nums[j] = 10;
i++;
}
}
for( ; i < nums.length; i++)
nums[i] = 0;
return nums;
}
What does the above Java code represent?
a) A method to remove all occurrences of 10 from an array.
b) A method to replace all elements in an array with 10.
c) A method to shift all elements in an array to the left, replacing 10.
d) A method to calculate the sum of elements in an array, excluding 10.