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.
2 parents c4a6b4f + f5da40e commit df9a580Copy full SHA for df9a580
animation-simulation/数组篇/leetcode27移除元素.md
@@ -85,6 +85,8 @@ class Solution {
85
86
**题目代码:**
87
88
+Java Code:
89
+
90
```java
91
class Solution {
92
public int removeElement(int[] nums, int val) {
@@ -106,3 +108,16 @@ class Solution {
106
108
}
107
109
```
110
111
+Python3 Code:
112
113
+```py
114
+class Solution:
115
+ def removeElement(self, nums: List[int], val: int) -> int:
116
+ i = 0
117
+ for j in range(len(nums)):
118
+ if nums[j] != val:
119
+ nums[i] = nums[j]
120
+ i += 1
121
+ return i
122
+```
123
0 commit comments