[C++] 완주하지 못한 선수


[C++] 완주하지 못한 선수

문제 소스 코드 #include <string> #include <vector> #include <unordered_map> #include <iostream> using namespace std; string solution(vector<string> participant, vector<string> completion) { unordered_map<string,int> m; for(auto part:participant) { if(m.end() == m.find(part)) m.insert(make_pair(part, 1)); else m[part]++; } for(auto com:completion) m[com] -= 1 ; for(auto elem : participant) { if(m[elem] > 0) return elem; } } /* 1. key, value setting 2. update key 3. find key using second value */ 링크 htt...



원문링크 : [C++] 완주하지 못한 선수