• 0

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

        return start+1

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.