Created
February 7, 2020 16:05
-
-
Save honux77/af692a4d6d5fc043343cdb809e7294ff to your computer and use it in GitHub Desktop.
프로그래머스 완주하지 못한 선수 정렬로 풀기
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 정렬 사용해서 다시 풀었음 | |
import java.util.Arrays; | |
public class Solution { | |
public String solution(String[] participant, String[] completion) { | |
Arrays.sort(participant); | |
Arrays.sort(completion); | |
int i; | |
for (i = 0; i < completion.length; i++) { | |
if (!participant[i].equals(completion[i])) { | |
return participant[i]; | |
} | |
} | |
return participant[i]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment