Skip to content

[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

Merged
merged 4 commits into from
Apr 12, 2025
Merged

[mintheon] WEEK 01 solutions #1199

merged 4 commits into from
Apr 12, 2025

Conversation

mintheon
Copy link
Member

@mintheon mintheon commented Apr 5, 2025

답안 제출 문제

  • Contains Duplicate
  • Two Sum
  • Tok K Frequent Elements
  • Longest Consecutrive Sequence
  • House Robber

작성자 체크 리스트

  • 우측 메뉴에서 PR을 Projects에 추가해주세요.
  • Projects의 오른쪽 버튼(▼)을 눌러 확장한 뒤, Week를 현재 주차로 설정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 StatusIn Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@mintheon mintheon requested a review from Copilot April 5, 2025 15:07
@mintheon mintheon self-assigned this Apr 5, 2025
@mintheon mintheon moved this from Solving to In Review in 리트코드 스터디 4기 Apr 5, 2025
@github-actions github-actions bot added the java label Apr 5, 2025
Copy link

@Copilot Copilot AI left a 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)});
}
Copy link
Contributor

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()});
}

@SamTheKorean
Copy link
Contributor

@mintheon 1주차 마감 기한이 지나서 pr이 병목중이니 병합부탁드리겠습니다!

@mintheon mintheon merged commit 4501713 into DaleStudy:main Apr 12, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 4기 Apr 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

3 participants