Skip to content

Commit 9b4614e

Browse files
refactor 80
1 parent 444696c commit 9b4614e

File tree

1 file changed

+2
-9
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+2
-9
lines changed

src/main/java/com/fishercoder/solutions/_80.java

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@ public static class Solution1 {
99
public int removeDuplicates(int[] nums) {
1010
int counter = 0;
1111
int len = nums.length;
12-
if (len == 0) {
13-
return 0;
12+
if (len < 3) {
13+
return len;
1414
}
15-
if (len == 1) {
16-
return 1;
17-
}
18-
if (len == 2) {
19-
return 2;
20-
}
21-
2215
List<Integer> a = new ArrayList();
2316
a.add(nums[0]);
2417
a.add(nums[1]);

0 commit comments

Comments
 (0)