Created
October 30, 2018 17:49
-
-
Save twsiyuan/6bb1ab33485913d029d5a8f5e444d9cc to your computer and use it in GitHub Desktop.
LeetCode #27
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://leetcode.com/problems/remove-element/ | |
class Solution: | |
def removeElement(self, nums, val): | |
""" | |
:type nums: List[int] | |
:type val: int | |
:rtype: int | |
""" | |
run = 0 | |
for num in nums: | |
if num != val: | |
nums[run] = num | |
run = run + 1 | |
return run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment