https://programmers.co.kr/learn/courses/30/lessons/42576
#include <string>
#include <vector>
#include<map>
#include<iostream>
using namespace std;
string solution(vector<string> participant, vector<string> completion) {
map<string, int> hash;
for (auto i : participant) hash[i]++;
for (auto i : completion) hash[i]--;
for (auto i : hash) {
if (i.second == 1)
return i.first;
}
}
해시테이블을 사용해서 풀었습니다 문제에서 완주하지 못한 선수가 1명으로 고정되있다고 써져있기 때문에 출전한 선수를 카운팅하고 완주한 선수를 카운팅해서 한 명의 선수를 리턴하게끔 코드를 짰습니다.