class Solution(object):
def removeDuplicates(self, nums):
l = len(nums)
k = 0
for i in range(len(nums)): #O(n)
if nums[i] != 200:
for j in range(i+1, len(nums)): #O(n)
if i != j and nums[i] == nums[j]:
nums[j] = 200
k += 1
for i in range(k): #O(k)
nums.remove(200)
k = len(nums)
return k
sorted 함수 사용
class Solution(object):
def removeDuplicates(self, nums):
s = set(nums) #O(n)
k = len(s) #O(n)
a = list(s) #O(n)
h = sorted(a) #O(nlogN)
nums[:] = h #O(n)
return k