Skip to content

Commit 02c2b65

Browse files
authored
Update 0027-remove-element.py
1 parent 6af839b commit 02c2b65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/0027-remove-element.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ def removeElement(self, nums: List[int], val: int) -> int:
77
k += 1
88
return k
99

10-
11-
class Solution2:
10+
# Optimized solution with the same time and space complexity
11+
class Solution:
1212
def removeElement(self, nums: List[int], val: int) -> int:
1313
# Avoid unessary copy operations in a previous solution, when k == i and nums[i] != val
1414
# by swapping nums[i] and the last element of the array (nums[n])

0 commit comments

Comments
 (0)