//27
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int it = 0;
for (int i = 0; i < nums.size(); i++)
if (nums[i] != val) nums[it++] = nums[i];
return it;
}
};
LeetCode27. 移除元素
最新推荐文章于 2024-08-21 22:23:47 发布