https://leetcode.com/problems/remove-duplicates-from-sorted-array/submissions/901455147/
- 문제를 제대로 이해하지 못함.
- O(n) 개념 부족.
Do not allocate extra space for another array. You must do this by modifying the input array in-place with O(1) extra memory.
var removeDuplicates = function(nums) {
// return [...new Set(nums)];
for (let i = 0; i < nums.length; i++) {
if (nums[i] === nums[i + 1]) {
nums.splice(i, 1);
i--;
}
}
};