26. Remove Duplicates from Sorted Array for python


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

留言

這個網誌中的熱門文章

使用DLIB函式庫達成即時人臉辨識功能

Without Function數位影像處理(細線化)程式碼python數位影像處理(二值化,低通,高通,中值濾波器)程式碼python

以dlib實現人臉辨識打卡系統