27-Remove-Element

Sat 17 May 2025

https://leetcode.com/problems/remove-element

import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
  def removeElement(self, nums: List[int], val: int) -> int:
    i = 0

    for num in nums:
      if num != val:
        nums[i] = num
        i += 1

    return i
new Solution().removeElement()

Score: 5

Category: leetcode