Skip to content
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

[mintheon] Week 5 #850

Merged
merged 3 commits into from
Jan 12, 2025
Merged

[mintheon] Week 5 #850

merged 3 commits into from
Jan 12, 2025

Conversation

mintheon
Copy link
Member

@mintheon mintheon commented Jan 5, 2025

답안 제출 문제

체크 리스트

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

@mintheon mintheon requested a review from dusunax January 5, 2025 11:26
@mintheon mintheon self-assigned this Jan 5, 2025
@mintheon mintheon requested a review from a team as a code owner January 5, 2025 11:26
@github-actions github-actions bot added the java label Jan 5, 2025
Copy link
Member

@dusunax dusunax left a comment

Choose a reason for hiding this comment

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

안녕하세요! 3개 문제 푸신 코드 잘 봤습니다. 풀이가 간결하고 깔끔하네요
저는 요즘 python으로 문제를 풀고 java로 변환하는 식으로 학습하고 있어요
잘 부탁드립니다🙂

Comment on lines +8 to +11
/**
시간복잡도: O(n)
공간복잡도: O(n)
*/
Copy link
Member

Choose a reason for hiding this comment

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

for문 내부의 문자열 정렬이 O(k log k)이라서
전체 시간 복잡도는 O(n * k log k)로 수정하는 것이 더 정확할 것 같습니다:)

Comment on lines +20 to +25
if(!anagramMap.containsKey(sortedStr)) {
anagramMap.put(sortedStr, new ArrayList<>());

}

anagramMap.get(sortedStr).add(str);
Copy link
Member

Choose a reason for hiding this comment

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

해시맵에서 키가 없는 경우 새로운 리스트를 생성하는 computeIfAbsent라는 메소드가 있더라구요.
코드를 간결하게 작성할 수 있어서 사용해보시는 걸 추천드립니다!

anagramMap.computeIfAbsent(key, k -> new ArrayList<>()).add(str);

@TonyKim9401 TonyKim9401 merged commit a267cd5 into DaleStudy:main Jan 12, 2025
3 checks passed
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