class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ if not nums: return 0 flag=0 for i in range(len(nums)): if nums[i]!=val: nums[flag]=nums[i] flag+=1 return flag
标签:gpo elf lag highlight pytho object pos rem pre
class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ if not nums: return 0 flag=0 for i in range(len(nums)): if nums[i]!=val: nums[flag]=nums[i] flag+=1 return flag
标签:gpo elf lag highlight pytho object pos rem pre
原文地址:http://www.cnblogs.com/xlqtlhx/p/8052208.html