IT/알고리즘
46★] 프로그래머스 같은 숫자는 싫어
깻잎쌈
2020. 9. 15. 21:14
반응형
#include <vector>
#include<algorithm>
using namespace std;
vector<int> solution(vector<int> arr)
{
arr.erase(unique(arr.begin(), arr.end()), arr.end());
return arr;
}
What's the most efficient way to erase duplicates and sort a vector?
I need to take a C++ vector with potentially a lot of elements, erase duplicates, and sort it. I currently have the below code, but it doesn't work. vec.erase( std::unique(vec.begin(), vec....
stackoverflow.com
반응형