문제 링크

요약

  • 문제를 잘 읽자

최종

  • 중복된 애들을 없애는게 아니고, “연속된” 애들을 없애는거다. 문제를 잘 읽자.
#include <vector>
#include <iostream>
 
using namespace std;
 
vector<int> solution(vector<int> arr) 
{
	int top = -1;
	vector<int> ret;
	
	for (auto &a : arr) {
		if (top != a) {
			ret.push_back(a);
			top = a;
		}
	}
	
	return ret;
}