Created
May 26, 2021 03:50
-
-
Save particle4dev/2bd829cbc5bd81b4d2861da1413ca3a1 to your computer and use it in GitHub Desktop.
Revisions
-
particle4dev revised this gist
May 26, 2021 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ function removeDuplicates(nums: number[]): number { const list = {}; let total = 0; -
particle4dev revised this gist
May 26, 2021 . No changes.There are no files selected for viewing
-
particle4dev revised this gist
May 26, 2021 . No changes.There are no files selected for viewing
-
particle4dev created this gist
May 26, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // https://leetcode.com/problems/remove-duplicates-from-sorted-array/ function removeDuplicates(nums: number[]): number { const list = {}; let total = 0; for(let i = 0; i < nums.length; i += 1) { if(!list[nums[i]]) { list[nums[i]] = true; total += 1; } else { nums.splice(i, 1); i -= 1; } } return total; };