from typing import List


class Solution:
    def removeDuplicates(self, nums: List[int]) -> int:
        j = 1
        for i in range(1, len(nums)):
            if j == 1 or nums[i] != nums[j - 2]:
                nums[j] = nums[i]
                j += 1
        return j


print(Solution().removeDuplicates(nums=[1, 1, 1, 2, 2, 3]))
print(Solution().removeDuplicates(nums=[0, 0, 1, 1, 1, 1, 2, 3, 3]))
