This file contains 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
function solution(participant, completion){ | |
participant.sort(); | |
completion.sort(); | |
for(var i = 0; i < participant.length; i++){ | |
if(participant[i] != completion[i]){ | |
return participant[i]; | |
} | |
} | |
} |
This file contains 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
function solution(answers){ | |
var answer = []; | |
var check = [0,0,0]; | |
var soopoPerson1 = [1,2,3,4,5]; | |
var soopoPerson2 = [2,1,2,3,2,4,2,5]; | |
var soopoPerson3 = [3,3,1,1,2,2,4,4,5,5]; | |
for(var i = 0; i < answers.length; i++){ | |
if(soopoPerson1[i % 5] == answers[i]) check[0]++; | |
if(soopoPerson2[i % 8] == answers[i]) check[1]++; |
This file contains 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
function solution(n, lost, reserve){ | |
var answer = n - lost.length; | |
//reservePerson이 체육복을 도난 당했을 때 | |
for(var x = 0 ; x < reserve.length; x++){ | |
for(var y = 0; y < lost.length; y++){ | |
if(reserve[x] == -1 && lost[y] == -1){ | |
continue; | |
} | |
if(reserve[x] == lost[y]){ | |
reserve[x] = -1; |
This file contains 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
function solution(array, commands){ | |
var answer = []; | |
var list; | |
for(var i = 0; i < commands.length; i++){ | |
var start = (commands[i][0] - 1); | |
var end = commands[i][1]; | |
list = array.slice(start, end).sort(function(a,b){ | |
return a-b; | |
}); | |
answer.push(list[commands[i][2] - 1]); |
This file contains 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
function solution(arr){ | |
var answer = []; | |
var correct = 0; | |
for(var i = 0; i < arr.length; i++){ | |
if(arr[i] == arr[i+1]){ | |
continue; | |
} | |
else{ | |
answer.push(arr[i]); | |
} |
This file contains 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
function solution(array, divisor){ | |
var answer = []; | |
for(var i = 0; i < array.length; i++){ | |
if(array[i] % divisor == 0){ | |
answer.push(array[i]); | |
} | |
} | |
if(answer == ""){answer.push(-1)} | |
return answer.sort(function(a,b){ return a - b}); | |
} |
This file contains 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
function solution(string, n){ | |
var answer = []; | |
var empt = [] | |
for(var i = 0; i < string.length; i++){ | |
empt[i] = string[i].charAt(n); | |
} | |
empt.sort(); | |
console.log(empt); | |
for(var i = 0 ; i < string.length; i++){ | |
for(var j = 0; j < empt.length; j++){ |
This file contains 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
function solution(strings, n){ | |
return strings.sort(function(a, b){ | |
let front = a[n] | |
let back = b[n] | |
if( front === back){ | |
return (a > b) - (a < b) | |
} else{ | |
return (front > back) - (front < back) | |
} | |
}) |
This file contains 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
function solution(s){ | |
var check = ""; | |
var pNum = 0, yNum = 0; | |
for(var i = 0; i < s.length; i++){ | |
check = s.charAt(i); | |
console.log(check); | |
if(check == 'p' || check == 'P'){ | |
pNum += 1; | |
} | |
else if(check == 'y' || check == 'Y'){ |
This file contains 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
function solution(seoul){ | |
var answer = ''; | |
for(var i = 0; i < seoul.length; i++){ | |
if(seoul[i] === 'Kim'){ | |
answer = '김서방은 ' + i + '에 있다'; | |
break; | |
} | |
} | |
return answer; | |
} |
OlderNewer