Skip to content

Commit 07853ac

Browse files
authored
Merge pull request doocs#103 from zhanary/master
Create Solution with python2 to 0027-20ms
2 parents cef4653 + d8dddb7 commit 07853ac

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#仿照0026思路-20ms
2+
class Solution(object):
3+
def removeElement(self, nums, val):
4+
if not nums:
5+
return 0
6+
7+
newtail = 0
8+
9+
for i in range(0, len(nums)):
10+
if nums[i] != val:
11+
nums[newtail] = nums[i]
12+
newtail += 1
13+
14+
return newtail
15+

0 commit comments

Comments
 (0)