LeetCode,移除排序数组中重复元素,用python
LeetCode,移除排序数组中重复元素,用python
class Solution(object):
    def removeDuplicates(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """
        result = 1
        length = len(nums)
        if length == 0:
            return 0
        if length == 1:
            return 1
        for i in range(1,length):
            if nums[i] == nums[i - 1]:
                continue
            else:
                nums[result] = nums[i]
                result  = 1
        return result