编程语言
首页 > 编程语言> > ❤leetcode,python2❤从排序数组中删除重复项

❤leetcode,python2❤从排序数组中删除重复项

作者:互联网

class Solution(object):
    def removeDuplicates(self, nums):
        """
        :type nums: List[int]
        :rtype: int
        """

        for i in range(len(nums)):
            for j in range(i+1,len(nums)):
                if nums[i] == nums[i+1]:
                    del nums[i+1]
                else:
                    break


        return len(nums)

 

标签:nums,int,self,len,range,removeDuplicates,排序,leetcode,python2
来源: https://blog.51cto.com/u_15282986/2952361