1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <set>
 
using namespace std;
 
string solution(vector<string> participant, vector<string> completion) {
    string answer = "";
    set<string> name;
    
    for(int i = 0; i < participant.size(); i++)
    {
        auto it = find(completion.begin(), completion.end(), participant[i]);
        if (it == completion.end())
        {
            answer = participant[i];
            return answer;
        }
        
        if(name.find(participant[i]) != name.end())
        {
            answer = participant[i];
            return answer;
        }
        
        name.insert(participant[i]);
    }
    return answer;
}
 
cs

푸는중..

블로그 이미지

토유

개발일지

,