We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a1bef9 commit 4b39a4aCopy full SHA for 4b39a4a
java/0080-remove-duplicates-from-sorted-array-ii.java
@@ -0,0 +1,11 @@
1
+class Solution {
2
+ public int removeDuplicates(int[] nums) {
3
+ int k = 0;
4
+ for (int num: nums) {
5
+ if (k < 2 || nums[k-2] != num) {
6
+ nums[k++] = num;
7
+ }
8
9
+ return k;
10
11
+}
0 commit comments