Skip to content

[jongwanra] WEEK 01 solutions #1678

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 8 commits into from
Jul 27, 2025
Merged

[jongwanra] WEEK 01 solutions #1678

merged 8 commits into from
Jul 27, 2025

Conversation

jongwanra
Copy link
Contributor

@jongwanra jongwanra commented Jul 21, 2025

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@changhoon-sung changhoon-sung self-requested a review July 21, 2025 01:25
Copy link
Contributor

@printjin-gmailcom printjin-gmailcom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

첫 주 수고하셨습니다. 4문제도 잘 끝내시고 남은 14주도 화이팅합시다 :)

@jongwanra
Copy link
Contributor Author

@printjin-gmailcom 리뷰 감사합니다. 반영 해뒀습니다:)

[문제 접근 방법]
Set 자료구조를 활용하여 중복 여부를 개수로 확인한다.

[Complexity]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

주어진 입력이 set으로 전환되는 비용에 대해 조금 더 구체적인 설명이 있으면 좋을 것 같아요!

return answer

"""
다른 사람의 풀이
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

정렬 시 보편적으로 시간 복잡도 O(NlogN), 기수 정렬은 작성하신 바와 같이 입력 범위에 민감하기 때문에, 정렬 없이 문제를 해결하는 것이 포인트였습니다. 다양하게 접근해보신 고민이 보입니다.

구간의 시작점을 찾아 끊어질 때까지 증가하면서 찾는 다른 사람의 풀이도 흥미롭네요. 고생하셨습니다.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

union-find를 사용하는 풀이도 확인해보시면 좋을 것 같습니다. 조건에 따라 그룹핑하는 문제에 유용합니다.


[Plan]
1. nums를 순회하면서 Hash Table에 key:element value:count 저장한다.
2. nums를 순회하면서 Heap에 (count, element)를 count를 기준으로 Max Heap 형태로 저장한다.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 1번 수행 후, count:value로 추가적인 정렬 hash table을 만들었는데요, 빈도의 종류 S <= N이므로 빌드 비용 O(SlogN) 발생 후 인덱스 K로 접근하는 방향을 생각했습니다. heapify 비용이 싸니까 이 방식도 유용하네요. 배워갑니다!

@jongwanra jongwanra moved this from Solving to In Review in 리트코드 스터디 5기 Jul 27, 2025
@jongwanra jongwanra merged commit 1c6ecc7 into DaleStudy:main Jul 27, 2025
1 check passed
@github-project-automation github-project-automation bot moved this from In Review to Completed in 리트코드 스터디 5기 Jul 27, 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