Inplace Remove Certain Value from an Array

Solution

class Solution(object): def removeElement(self, nums, val): """ :type nums: List[int] :type val: int :rtype: int """ searchIdx = 0 fillIdx = 0 rInt = 0 for searchIdx in range(len(nums)): if nums[searchIdx]==val: pass else: nums[fillIdx] = nums[searchIdx] fillIdx += 1 rInt += 1 return rInt