Skip to content

[박종훈] 5주차 답안 제출 #102

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 1 commit into from
May 31, 2024
Merged

Conversation

dev-jonghoonpark
Copy link
Contributor

@dev-jonghoonpark dev-jonghoonpark commented May 29, 2024

5주차 답안 제출합니다.


Top K Frequent Elements

Encode and Decode Strings

Product of Array Except Self

Longest Consecutive Sequence

3Sum

@dev-jonghoonpark dev-jonghoonpark force-pushed the main branch 2 times, most recently from 3e7d5e7 to 954fece Compare May 29, 2024 15:15
@dev-jonghoonpark dev-jonghoonpark marked this pull request as ready for review May 29, 2024 18:51
@dev-jonghoonpark dev-jonghoonpark changed the title week5 mission partially done [박종훈] 5주차 답안 제출 May 29, 2024
@@ -0,0 +1,52 @@
- 문제 : https://leetcode.com/problems/3sum/
- time complexity : O(n^2)
- space complexity : O(1) (결과값을 고려하지 않은 알고리즘 자체의 공간 복잡도)
Copy link
Contributor

@SamTheKorean SamTheKorean May 30, 2024

Choose a reason for hiding this comment

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

저는 이부분이 궁금했는데 결과값을 고려하지 않는다는 걸 따로 명시하지 않아도 결과값을 고려하지 않는게 당연한 걸까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

조합이 어떻게 나오냐에 따라서 공간복잡도가 달라질 것 같아서 저도 뭐라고 적을까 고민하다가
달레님 블로그를 보니깐 위와같이 표현하신것 같아서 참고해보았습니다 : )

Copy link
Contributor

Choose a reason for hiding this comment

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

아 그렇군요! 설명 감사합니다!

Copy link
Member

Choose a reason for hiding this comment

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

출력 결과 때문에 반드시 필요한 메모리 사용량은 공간 복잡도 분석을 할 때는 무시하는 것이 일반적입니다.

@dev-jonghoonpark
Copy link
Contributor Author

커밋이 사라지면 자동으로 closed로 바뀌군요 ㄷㄷ...
당황했네요

Copy link
Contributor

@SamTheKorean SamTheKorean left a comment

Choose a reason for hiding this comment

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

이번 한 주도 고생 많으셨습니다!

Copy link
Member

@DaleSeo DaleSeo left a comment

Choose a reason for hiding this comment

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

수고하셨어용!

- space complexity : O(n)
- 블로그 링크 : https://algorithm.jonghoonpark.com/2024/05/08/leetcode-238

## case 나눠서 풀기
Copy link
Member

Choose a reason for hiding this comment

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

저는 이게 더 재밌는 방법 같은데요? ㅋㅋ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

앗...! ㅋㅋ 주관적인 기준이였군요 ㅎㅎ

아래 풀이를 들었을 때 워낙 혁신이였어서 저는 재밌게 느꼈었네요...! ㅎㅎ

Comment on lines +15 to +18
return Arrays.copyOfRange(counter.entrySet().stream()
.sorted(Map.Entry.<Integer, Integer>comparingByValue().reversed())
.mapToInt(Map.Entry::getKey)
.toArray(), 0, k);
Copy link
Member

Choose a reason for hiding this comment

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

자바 스크림 API 잘 쓰시네요!

@DaleSeo DaleSeo merged commit a0e4583 into DaleStudy:main May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants