We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9dff793 commit 4277415Copy full SHA for 4277415
docs/data-structure/array/README.md
@@ -371,6 +371,20 @@ class Solution:
371
return res
372
```
373
374
+优化:
375
+
376
+```python
377
+class Solution:
378
+ def removeElement(self, nums: List[int], val: int) -> int:
379
+ i = 0
380
+ for j in range(len(nums)):
381
+ if nums[j] == val:
382
+ continue
383
+ nums[i], nums[j] = nums[j], nums[i]
384
+ i += 1
385
+ return i
386
+```
387
388
#### **Go**
389
390
```go
0 commit comments