class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        if len(nums) <= 0:
            return 0
        k=0
        for i in nums:
            if i != val:
                nums[k]=i
                k+=1
        return k

 

相关文章:

  • 2022-03-01
  • 2021-12-20
  • 2022-12-23
  • 2022-01-05
  • 2021-06-16
  • 2021-07-23
猜你喜欢
  • 2021-06-12
  • 2021-12-29
  • 2021-06-27
  • 2021-07-26
  • 2021-09-28
  • 2021-12-06
相关资源
相似解决方案