Skip to content

Commit 967b741

Browse files
authored
Create sourcema.md
1 parent c31faf3 commit 967b741

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

2019.11.24/sourcema.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# leetcode 80
2+
public int removeDuplicates(int[] nums) {
3+
if (nums == null || nums.length == 0 || nums.length < 3) {
4+
return nums.length;
5+
}
6+
int i=0;
7+
for (int j = 0; j < nums.length; j++) {
8+
if (i < 2 || nums[j] != nums[i - 2]) {
9+
nums[i] = nums[j];
10+
i++;
11+
}
12+
}
13+
return i;
14+
}

0 commit comments

Comments
 (0)