From 20a084dcbd45863acc72babb3ceee253b73c0a42 Mon Sep 17 00:00:00 2001 From: Ivan Zhitnikov Date: Thu, 10 Oct 2019 22:38:20 +0300 Subject: [PATCH 1/2] Task 27 solution --- leet_27 | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 leet_27 diff --git a/leet_27 b/leet_27 new file mode 100644 index 0000000..5da3800 --- /dev/null +++ b/leet_27 @@ -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) From badc433bd92da02d109e831b9f64915b6b07730a Mon Sep 17 00:00:00 2001 From: Ivan Zhitnikov Date: Thu, 10 Oct 2019 22:46:02 +0300 Subject: [PATCH 2/2] task 27 --- leet_27 => leet_27.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename leet_27 => leet_27.py (100%) diff --git a/leet_27 b/leet_27.py similarity index 100% rename from leet_27 rename to leet_27.py