Skip to content

Commit

Permalink
Merge pull request sashaaero#16 from zerogs/master
Browse files Browse the repository at this point in the history
leet_27 py
  • Loading branch information
sashaaero committed Oct 10, 2019
2 parents 98be689 + badc433 commit 56738c8
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions leet_27.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://leetcode.com/problems/remove-element/submissions/
# Runtime: 40 ms, faster than 69.97% of Python3 online submissions for Remove Element.

class Solution:
def removeElement(self, nums: List[int], val: int) -> int:
i = len(nums) - 1
while i >= 0:
if nums[i] == val:
del nums[i]
i -= 1

return len(nums)

0 comments on commit 56738c8

Please sign in to comment.