https://leetcode.com/problems/remove-element/description/?envType=study-plan-v2&envId=top-interview-150

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)

應該沒有什麼特別的