class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int idx = 0;
for (auto &x: nums) {
if (x == val) continue;
nums[idx++] = x;
}
return idx;
}
};
Time Complexity: O(n)
Space: O(1)
應該沒有什麼特別的