C++ two lines solution


  • 0
    T

    class Solution {
    public:
    int removeElement(vector<int>& nums, int val) {
    nums.erase(remove(nums.begin(),nums.end(),val), nums.end());
    return nums.size();
    }
    };


Log in to reply
 

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