-
-
Notifications
You must be signed in to change notification settings - Fork 195
[mintheon] WEEK 01 solutions #1199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (3)
two-sum/mintheon.java:18
- Consider returning a fixed-size array or an explicit error indicator based on the problem constraints; if a solution is guaranteed, document that this branch should never be reached.
return new int[]{};
top-k-frequent-elements/mintheon.java:10
- [nitpick] Consider using Integer.compare(b[1], a[1]) in the comparator to improve robustness against potential integer overflow.
PriorityQueue<int[]> queue = new PriorityQueue<>((a, b) -> b[1] - a[1]);
longest-consecutive-sequence/mintheon.java:4
- [nitpick] Consider renaming 'max' to 'longestSequence' to clearly reflect its purpose in tracking the length of the longest consecutive subsequence.
int max = 0;
|
||
for(int key : count.keySet()) { | ||
queue.offer(new int[]{key, count.get(key)}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(key, count) 쌍을 int[] 로 표현한 점이 좋으며, PriorityQueue 기반의 정렬 로직을 포함한 점이 인상깊습니다!
현재 count.keySet()을 써서 key를 순회하여 해당 key로 value를 조회하고 있는데, entrySet() 을 이용하여 키와 값을 한 번에 조회할 수도 있을 것 같습니다.
for (Map.Entry<Integer, Integer> entry : count.entrySet()) {
queue.offer(new int[]{entry.getKey(), entry.getValue()});
}
@mintheon 1주차 마감 기한이 지나서 pr이 병목중이니 병합부탁드리겠습니다! |
답안 제출 문제
작성자 체크 리스트
In Review
로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!