首页 > 代码库 > leetcode_remove_distance

leetcode_remove_distance

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int a[5] = { 1,2,-1,3,5 };
    vector<int>num(a, a + 5);
    int tar;
    cin >> tar;
    cout << distance(num.begin(), remove(num.begin(), num.end(), tar));
    system("pause");
    return 0;
}

 

leetcode_remove_distance