Problem
Problem URL : 같은 숫자는 싫어
[1] Answer Code (18. 07. 22)
vector<int> solution(vector<int> arr)
{
vector<int> answer;
int size = arr.size();
answer.push_back(arr[0]);
for(int i=0; i<size-1; i++){
if( arr[i] != arr[i+1]){
answer.push_back(arr[i+1]);
}
}
return answer;
}
[1] Answer Code (18. 07. 22)
- Programmers Problem