Skip to content

[Raft] Week 01 solutions #318

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 6 commits into from
Aug 17, 2024
Merged

[Raft] Week 01 solutions #318

merged 6 commits into from
Aug 17, 2024

Conversation

coloryourlife
Copy link
Contributor

No description provided.

@coloryourlife
Copy link
Contributor Author

Projects 달아두려고해도 Add할 수가 없는데 확인 가능 할까요?

@yolophg
Copy link
Contributor

yolophg commented Aug 13, 2024

Projects 달아두려고해도 Add할 수가 없는데 확인 가능 할까요?

아래 저희 디스코드 채널 내 메시지 참고해보시면, leetcode 팀 초대 수락을 안하셨을 가능성이 높은데, 한 번 확인해보시겠어요?
=> https://discord.com/channels/775115965964222492/1229860988170403901/1272508847382204489

@coloryourlife
Copy link
Contributor Author

@yolophg 감사합니다 :)

@taekwon-dev
Copy link
Contributor

@coloryourlife 안녕하세요! (저도 받은 코멘트 입니다 ㅎㅎ) 시간 복잡도, 공간 복잡도도 같이 주석으로 남겨주시면 좋을 것 같습니다~~

@coloryourlife coloryourlife marked this pull request as ready for review August 17, 2024 05:28
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.

수고하셨습니다. 모임 전까지 PR 병합 부탁드리겠습니다.

r += 1
return count
# T: O(n^2)
# S: O(n^2)
Copy link
Member

Choose a reason for hiding this comment

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

공간 복잡도가 어떻게 O(n^2)으로 분석 되셨는지 설명 좀 부탁드려도 될까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

단순하게 count를 n^2 번만큼 저장한다고 생각했는데 다시보니 O(n) 같아보이네요..!

Comment on lines +1 to +13
class Solution:
def kthSmallest(self, root: Optional[TreeNode], k: int) -> int:
stack = []

while True:
while root:
stack.append(root)
root = root.left
root = stack.pop()
k -= 1
if not k:
return root.val
root = root.right
Copy link
Member

Choose a reason for hiding this comment

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

와, 이 풀이 완전 신선합니다. 혹시 이번 주 모임에 참석하신다면 다른 분들께 답안 소개해주시면 좋을 것 같습니다.

@coloryourlife coloryourlife merged commit 3c0af16 into DaleStudy:main Aug 17, 2024
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