class Solution:
def removeDuplicates(self, nums):
¦ """
¦ :type nums: List[int]
¦ :rtype: int
¦ """
¦ if nums is None or len(nums) == 0:
¦ ¦ return 0
¦ idx = 0
¦ for item in nums:
¦ ¦ if item != nums[idx]:
¦ ¦ ¦ idx += 1
¦ ¦ ¦ nums[idx] = item
¦ ¦ ¦ print(nums)
¦ return idx + 1
def removeDuplicates2(self, nums):
¦ if nums is None or len(nums) == 0:
¦ ¦ return 0
¦ s = set()
¦ for item in nums:
¦ ¦ s.add(item)
¦ return len(s)