Skip to content

[Chaedie] Week 1 #625

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 9 commits into from
Dec 13, 2024
Merged

[Chaedie] Week 1 #625

merged 9 commits into from
Dec 13, 2024

Conversation

Chaedie
Copy link
Contributor

@Chaedie Chaedie commented Dec 3, 2024

답안 제출 문제

체크 리스트

  • PR을 프로젝트에 추가하고 Week를 현재 주차로 설정해주세요.
  • 바로 앞에 PR을 열어주신 분을 코드 검토자로 지정해주세요.
  • 문제를 모두 푸시면 프로젝트에서 Status를 In Review로 설정해주세요.
  • 코드 검토자 1분 이상으로부터 승인을 받으셨다면 PR을 병합해주세요.

@github-actions github-actions bot added the py label Dec 3, 2024
@Chaedie Chaedie marked this pull request as ready for review December 3, 2024 12:03
@Chaedie Chaedie requested a review from a team as a code owner December 3, 2024 12:04
@Chaedie Chaedie marked this pull request as draft December 3, 2024 12:06
@Chaedie
Copy link
Contributor Author

Chaedie commented Dec 3, 2024

안녕하세요,
Project 설정 버튼이 활성화 되지 않는 상황인데 권한이슈가 있는걸까요??
(draft 풀어도 재현되는 현상이라 draft 상태와는 무관합니다. )

image

@DaleSeo
Copy link
Member

DaleSeo commented Dec 3, 2024

@Chaedie 와, 3기 두 번째 PR의 주인공이 되셨네요. 🥈 축하드립니다! 👏
프로젝트 설정이 안 되시는 것은 권한 문제 맞는 것 같습니다.
leetcode03 팀에 저장소 쓰기 권한을 부여해드렸는데 다시 한 번 시도해보시겠어요?

@Chaedie Chaedie requested a review from GotPrgmer December 3, 2024 13:03
@Chaedie
Copy link
Contributor Author

Chaedie commented Dec 3, 2024

@DaleSeo 축하해주셔서 감사합니다. 꾸준히 진행해서 꼭 완주하도록 하겠습니다..! 😀
덕분에 프로젝트 설정 완료했습니다.
감사합니다..!

@DaleSeo
Copy link
Member

DaleSeo commented Dec 3, 2024

@Chaedie 님, 권한 이슈가 해결되어 다행입니다!
프로젝트 상태로 문제를 풀고 계시다고 충분히 나타나고 있으니, Draft PR 까지는 굳이 안 쓰셔도 될 것 같습니다 :)

@Chaedie Chaedie marked this pull request as ready for review December 3, 2024 13:09
@GotPrgmer
Copy link
Contributor

GotPrgmer commented Dec 4, 2024

contains Duplicate 문제 set으로 변환해서 기존 배열이랑 길이가 다르면 true 같으면 false...
이런 관점도 있네요 감사합니다.

@Chaedie
Copy link
Contributor Author

Chaedie commented Dec 4, 2024

@GotPrgmer 저도 다른 분 솔루션 통해 얻은 관점입니다. 다양한 좋은 솔루션들이 많더라구요... 감사합니다..!

Comment on lines +12 to +24
Time Complexity:
1. remove duplicate by hash set -> O(n)
2. sort the list -> O(n log n)
3. iterate sorted_nums -> O(n)

so time complexity of this solution will be O(n log n)

Space Complexity:
1. set() -> O(n)
2. sorted_nums -> O(n)
3. count , maxCount -> O(1)

space complexity of this solution will be O(n)
Copy link
Contributor

Choose a reason for hiding this comment

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

Big O 분석 정성스럽게 해주시는 것 아주 모범적입니다 :) bb

for num in nums:
counts[num] += 1

result = sorted(counts.items(), key=lambda x: x[1], reverse=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

python의 built-in sort 알고리즘을 찾아보니 Timsort라는 것을 사용하는 것 같은데, 이게 merge sort의 일종이라는 것을 알게 되었습니다 (링크)

결과적으로 해당 풀이의 space complexity가 변하진 않겠지만, space complexity 고려에 해당 sort기능의 space complexity인 O(N)이 포함되면 더 좋았을 것 같습니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

wow 감사합니다.
Timsort의 time complexity 는 검색해서 추가했지만, Space complexity 는 전혀 고려하지 않았습니다.
짚어주셔서 감사합니다..!

if char.isalnum():
string.append(char)

return string == string[::-1]
Copy link
Contributor

Choose a reason for hiding this comment

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

이 부분도 최종적인 space complexity에는 영향을 미치지 않지만, string[::-1]의 space complexity까지 고려해주시면 더 좋을 것 같습니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@obzva 리뷰 감사합니다..!
리뷰사항 반영해서 Commit 했습니다.
감사합니다.

@Chaedie Chaedie requested a review from obzva December 11, 2024 22:45
@Chaedie Chaedie merged commit ced8e07 into DaleStudy:main Dec 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Completed
Development

Successfully merging this pull request may close these issues.

4 participants