leetcode 删除数组中的重复项
2021-01-24 22:15
标签:sort and sorted array ref element move def for leetcode 删除数组中的重复项 标签:sort and sorted array ref element move def for 原文地址:https://www.cnblogs.com/yutingting/p/12744060.htmlleetcode 26.删除排序数组中的重复项
class Solution(object):
# 重复项保留一个
def removeDuplicates(self, nums):
n = len(nums)
if n
leetcode 27.移除元素
class Solution(object):
def removeElement(self, nums, val):
ind = 0
for i in range(len(nums)):
if nums[i] != val:
nums[ind] = nums[i]
ind += 1
return ind
文章标题:leetcode 删除数组中的重复项
文章链接:http://soscw.com/index.php/essay/46517.html