每日一道算法题之LeetCode26
2021-03-04 16:26
标签:problems else 重复 元素 move rgba bsp problem duplicate LeetCode26 删除排序数组中的重复项 每日一道算法题之LeetCode26 标签:problems else 重复 元素 move rgba bsp problem duplicate 原文地址:https://www.cnblogs.com/vvzhang/p/14350919.html 1 class Solution:
2 def removeDuplicates(self, nums: List[int]) -> int:
3 n = len(nums)
4 i, j = 0, 1
5 while(jn):
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.
文章标题:每日一道算法题之LeetCode26
文章链接:http://soscw.com/index.php/essay/60060.html