标签:problems else 重复 元素 move rgba bsp problem duplicate
LeetCode26 删除排序数组中的重复项
1 class Solution: 2 def removeDuplicates(self, nums: List[int]) -> int: 3 n = len(nums) 4 i, j = 0, 1 5 while(j<n): 6 if nums[i] == nums[j]: 7 j += 1 8 else: 9 nums[i+1] = nums[j] 10 i += 1 11 j += 1 12 return len(nums[0:i+1])#返回数组的0到i个元素,索引为0到i+1.
标签:problems else 重复 元素 move rgba bsp problem duplicate
原文地址:https://www.cnblogs.com/vvzhang/p/14350919.html