public int removeElement(int[] nums, int val) {
int k = 0;
for (int i = 0; i < nums.length; ++i) {
if (nums[i] != val) {
nums[k] = nums[i];
k++;
}
}
return k;
}
func removeElement(nums []int, val int) {
k := 0;
for i:=0; i < nums.length; i++{
if nums[i] != val{
nums[k] = nums[i]
k++
}
}
return k
}
[Go] Array and string - Rotate Array (0) | 2022.04.14 |
---|---|
[Go] Array and String - Minimum Size Subarray Sum (0) | 2022.04.13 |
[Go] Array and string - Two Sum II - Input Array Is Sorted (0) | 2022.04.12 |
[Go] Array and String - Array Partition I (0) | 2022.04.10 |
[Go] Array and string - Reverse String (0) | 2022.04.09 |
댓글 영역