Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5461935

Browse files
feat: 파일이름 형식 변경
1 parent 6432ede commit 5461935

File tree

3 files changed

+37
-42
lines changed

3 files changed

+37
-42
lines changed

‎level-3/이중우선순위큐&42628&.js‎

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44
function solution(operations) {
55
var answer = [];
66
for (let i = 0; i < operations.length; i++) {
7-
8-
// 숫자 삽입
9-
if(operations[i][0]=='I'){
10-
letm=operations[i].substring(2,operations[i].length)
11-
answer.push(m)
12-
}
13-
// if 최댓값 삭제
14-
elseif(operations[i][0]=='D'&&operations[i][2]=='1'&&operations.length>0){
15-
answer.pop()
16-
}
17-
// if 최솟값 삭제
18-
elseif(operations[i][0]=='D'&&operations[i][2]=='-'&&operations[i][3]=='1'&&operations.length>0){
19-
20-
answer.shift()
21-
}
22-
23-
answer.sort((a,b)=>{returna-b});
7+
// 숫자 삽입
8+
if(operations[i][0]=='I'){
9+
letm=operations[i].substring(2,operations[i].length);
10+
answer.push(m);
11+
}
12+
// if 최댓값 삭제
13+
elseif(operations[i][0]=='D'&&operations[i][2]=='1'&&operations.length>0){
14+
answer.pop();
15+
}
16+
// if 최솟값 삭제
17+
elseif(operations[i][0]=='D'&&operations[i][2]=='-'&&operations[i][3]=='1'&&operations.length>0){
18+
answer.shift();
19+
}
20+
21+
answer.sort((a,b)=>{
22+
returna-b;
23+
});
2424
}
25-
if (answer.length == 0) return [0, 0]
25+
if (answer.length == 0) return [0, 0];
2626
else {
27-
return [parseInt(answer.pop()), parseInt(answer.shift())];
28-
}
27+
return [parseInt(answer.pop()), parseInt(answer.shift())];
28+
}
2929
}
3030
/* 풀이 과정
3131
1. 연산 처리를 구별하기 위해 배열의 0번째 자리, 2번째 자리에 있는 등을 비교하여 조건에 따른 명령을 실행한다.
3232
2. answer 배열을 정렬 해준다
3333
3. 큐가 비어있으면 ( length == 0 ) 0을 반환. , 그렇지 않으면 [최댓값, 최솟값]을 반환한다.
34-
*/
34+
*/

‎level-3/입국심사&43238&.js‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
//완벽한 정답이 아닙니다.
33
//정답 1 - codeisneverodd
44
function solution(n, times) {
5-
//최소로 걸릴 수 있는 시간 left, 최대로 걸릴 수 있는 시간 right
6-
let [left, right] = [1, Math.max(...times) * n]
7-
while (left <= right) {
8-
const mid = Math.floor((left + right) / 2)
9-
const sum = times.reduce((acc, time) => acc + Math.floor(mid / time), 0)
10-
//sum은 mid 시간 동안 처리 할 수 있는 사람의 수
11-
if (sum < n) {
12-
left = mid + 1
13-
} else {
14-
right = mid - 1
15-
}
5+
//최소로 걸릴 수 있는 시간 left, 최대로 걸릴 수 있는 시간 right
6+
let [left, right] = [1, Math.max(...times) * n];
7+
while (left <= right) {
8+
const mid = Math.floor((left + right) / 2);
9+
const sum = times.reduce((acc, time) => acc + Math.floor(mid / time), 0);
10+
//sum은 mid 시간 동안 처리 할 수 있는 사람의 수
11+
if (sum < n) {
12+
left = mid + 1;
13+
} else {
14+
right = mid - 1;
1615
}
17-
// left 가 right를 넘어갔다는 것은 left가 n보다 크거나 같아져서 n명을 수용할 수 최소값이 되있다는 것이다.
18-
return left;
19-
}
16+
}
17+
// left 가 right를 넘어갔다는 것은 left가 n보다 크거나 같아져서 n명을 수용할 수 최소값이 되있다는 것이다.
18+
return left;
19+
}

‎level-4/단어-퍼즐&12983&.js‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,13 @@ function solution(strs, t) {
1919
minCountToIndex[currentIndex] = 1;
2020
} else {
2121
//앞쪽에 남은 것이 있다면, 현재 검사중이 영역까지 필요한 조각 수는, 지금까지 구한 최소 값과 지금 구한 값 중 최소값
22-
minCountToIndex[currentIndex] = Math.min(
23-
minCountToIndex[currentIndex],
24-
minCountToIndex[frontLength - 1] + 1
25-
);
22+
minCountToIndex[currentIndex] = Math.min(minCountToIndex[currentIndex], minCountToIndex[frontLength - 1] + 1);
2623
}
2724
}
2825
}
2926
}
3027
//마지막 영역이 Infinity 이면 만들기 불가능한 단어, 아니라면 마지막 영역의 값을 리턴
31-
return minCountToIndex[tLength - 1] === Infinity
32-
? -1
33-
: minCountToIndex[tLength - 1];
28+
return minCountToIndex[tLength - 1] === Infinity ? -1 : minCountToIndex[tLength - 1];
3429
}
3530

3631
//리드미 테스트용 코멘트

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /