Skip to content

Commit 5d137d5

Browse files
committed
update tags
1 parent 02e9b01 commit 5d137d5

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

zh-hans/integer_array/remove_element.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Remove Element
22

3-
**TAGS:** TAG_Array TAG_Two_Pointers
3+
Tags: Array, Two Pointers, Easy
44

55
## Question
66

@@ -75,13 +75,12 @@ func removeElement(nums []int, val int) int {
7575
public class Solution {
7676
public int removeElement(int[] nums, int val) {
7777
int left = 0;
78-
for (int i = 0; i < nums.length; i++) {
79-
if (nums[i] != val) {
80-
nums[left] = nums[i];
81-
left++;
78+
for (int num : nums) {
79+
if (num != val) {
80+
nums[left++] = num;
8281
}
8382
}
84-
83+
8584
return left;
8685
}
8786
}

0 commit comments

Comments
 (0)