2-line c++ solution


  • 0
    H

    '''

    class Solution {
    public:
    int removeElement(vector<int>& nums, int val) {
    vector<int>::iterator ie = remove(nums.begin(),nums.end(),val);
    return ie-nums.begin();
    }
    };
    '''

    easy to understand.


Log in to reply
 

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