❤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)

 

上一篇:Ubuntu18.04系统py2与py3切换方法


下一篇:Ubuntu 18.04下安装FSL的一些说明