Perhaps not a fast but a concise one


  • 0
    L

    '''
    int remove_element(vector<int>& nums, int val)
    {
    return std::distance(nums.begin(), std::remove(nums.begin(), nums.end(), val))
    }
    '''


Log in to reply
 

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