[Programmers] 완주하지 못한 선수

Time Lapse :NONE

solution.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <string>
#include <vector>
#include<algorithm>
using namespace std;


string solution(vector<string> participant, vector<string> completion) {
int i;
sort(participant.begin(), participant.end());
sort(completion.begin(), completion.end());

for (i = 0; i < completion.size(); i++)
{
if (participant[i] != completion[i]) return participant[i];
}

return participant[i];
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/30/PS/Programmers/failedPlayer/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.