Skip to content

Commit 9be0363

Browse files
authored
Fix Spacing 0026-remove-duplicates-from-sorted-array.js
1 parent 6727ad4 commit 9be0363

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
/**
2-
* Linear
2+
* Linear
33
* Time O(N) | Space O(1)
44
* https://leetcode.com/problems/remove-duplicates-from-sorted-array/
55
* @param {number[]} nums
66
* @return {number}
77
*/
8-
var removeDuplicates = function(nums) {
8+
var removeDuplicates = function (nums) {
9+
let swap = 1;
910

10-
let swap = 1;
11-
12-
for(let i=1; i<nums.length; i++) {
13-
if(nums[i] != nums[i-1]) {
14-
nums[swap] = nums[i];
15-
swap++;
16-
}
17-
}
18-
return swap;
19-
}
11+
for (let i = 1; i < nums.length; i++) {
12+
if (nums[i] != nums[i - 1]) {
13+
nums[swap] = nums[i];
14+
swap++;
15+
}
16+
}
17+
return swap;
18+
};

0 commit comments

Comments
 (0)