Two lines c++ code.


  • 3
    H

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


Log in to reply
 

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