========坚持30天刷leetcode=====
题目链接:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
# 第二次提交
class Solution:
def removeDuplicates(self, nums: List[int]) -> int:
llen=len(nums)
if len==0 or len==1: # 第一次提交没有判断数组长度为特殊值
return llen
i=0
for j in range(1,llen):
if nums[i]!=nums[j]:
nums[i+1]=nums[j]
i+=1
return i+1