My 4ms C++ Solution


  • 0
    T
    int removeElement(vector<int>& nums, int val) {
        for(auto it = std::find(nums.begin(), nums.end(), val); 
                 it != nums.end(); 
                 it = std::find(it, nums.end(), val)) 
        {
            it = nums.erase(it); 
        }
        return nums.size(); 
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.