Skip to content

Commit b5ef747

Browse files
committed
feat: add solution of Remove Duplicates from Sorted Array(026) with javascript
1 parent cfffaa3 commit b5ef747

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/_026/Solution.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var removeDuplicates = function(nums) {
2+
for (var i = 1;i < nums.length; i++) {
3+
for (var j = 0; j < i; j++){
4+
if (nums[i] === nums[j]) {
5+
nums.splice(i, 1)
6+
i = i - 1
7+
}
8+
}
9+
}
10+
return nums.length
11+
};

0 commit comments

Comments
 (0)