from typing import List


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


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

"""
The code starts iterating from i = 1 because we need to compare each element with its
previous element to check for duplicates.

The main logic is inside the for loop:

1. If the current element nums[i] is not equal to the previous element nums[i - 1],
    it means we have encountered a new unique element.
2. In that case, we update nums[j] with the value of the unique element at nums[i],
    and then increment j by 1 to mark the next position for a new unique element.
3. By doing this, we effectively overwrite any duplicates in the array and only keep
    the unique elements.

Once the loop finishes, the value of j represents the length of the resulting array
with duplicates removed.

Finally, we return j as the desired result.
"""
