Merged
Conversation
JustDevRae
approved these changes
Jan 22, 2025
Comment on lines
+2
to
+3
| const reversedCard1 = cards1.reverse(); | ||
| const reversedCard2 = cards2.reverse(); |
Collaborator
There was a problem hiding this comment.
reverse & pop을 사용하면 shift를 사용하는 것보다 시간 복잡도 면에서 더 효율적이군요. 배워갑니다!
Collaborator
There was a problem hiding this comment.
이 코드에서 queue 배열이 딱히 우선순위 값을 담는 것 말고 사용이 되지 않는 것 같아요. 혹시 다른 의도가 있었는지 궁금합니다!
JooKangsan
approved these changes
Jan 23, 2025
Collaborator
JooKangsan
left a comment
There was a problem hiding this comment.
이번주도 화이팅입니다!! 코드 보며 한번더 고민하고 찾아보는 시간을 가진거같아서 좋네요!
| @@ -0,0 +1,27 @@ | |||
| function solution(dot) { | |||
| let answer = 0; | |||
| const [x, y] = dot; | |||
Collaborator
There was a problem hiding this comment.
단순히 길이를 반환하는 거라면 const divisors = [];를 count 로 가져가는게 메모리적으로 더 좋을것 같아요
function solution(n) {
let count = 0;
for (let i = 1; i <= n; i++) if (n % i === 0) count++;
return count;
}
console.log(solution(100));| while (prioritiesWithIndex.length) { | ||
| const { priority, index } = prioritiesWithIndex.shift(); | ||
|
|
||
| const checkPriority = prioritiesWithIndex.findIndex((e) => e.priority > priority); |
Collaborator
There was a problem hiding this comment.
some 메소드를 고려해 보시는건 어떨까요??
findIndex는 전체 배열을 순회하지만, some은 조건을 만족하는 요소를 찾으면 즉시 반환합니다!!
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[큐]
📌 푼 문제
📝 간단한 풀이 과정
순서쌍의 개수
점의 위치 구하기
카드 뭉치
햄버거 만들기
프로세스