Skip to content

Commit 1b87c13

Browse files
committed
remove duplicates
1 parent 7c1afdf commit 1b87c13

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

problem52/main.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
void main(List<String> args) {
3+
print(removeDuplicates([1,1,1,2,2,3]));
4+
}
5+
int removeDuplicates(List<int> nums) {
6+
7+
for(int i=1;i<nums.length-1;i++){
8+
if(nums[i-1]==nums[i+1]){
9+
nums.removeAt(i);
10+
i--;
11+
}
12+
}
13+
14+
return nums.length;
15+
}
16+

0 commit comments

Comments
 (0)