Skip to content

Instantly share code, notes, and snippets.

@honux77
Created February 7, 2020 16:05
Show Gist options
  • Save honux77/af692a4d6d5fc043343cdb809e7294ff to your computer and use it in GitHub Desktop.
Save honux77/af692a4d6d5fc043343cdb809e7294ff to your computer and use it in GitHub Desktop.
프로그래머스 완주하지 못한 선수 정렬로 풀기
// 정렬 사용해서 다시 풀었음
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