-
-
Notifications
You must be signed in to change notification settings - Fork 195
[SAM] Week 7 solutions #128
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
Conversation
reorder-list/samthekorean.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
데크 자료 구조를 쓰신 접근도 재밌네요 : )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메모리를 더 효율적으로 쓸 수 있던데 시간이 나면 다시 짜보겠습니다 ㅎㅎ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 리뷰를 빼앗겼네요 🤣
deque을 사용하는 방법도 있었네요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사실 deque를 잘 몰랐었는데 chatgpt에 stack의 아랫부분과 윗부분을 동시에 pop할 수 있는 방법을 물어보니 deque가 그런 자료구조라고 해서 처음 배웠습니다! 그런데 메모리 효율적인 방법은 아닌 것 같네용
while current: | ||
if p.val > current.val and q.val > current.val: | ||
current = current.right | ||
elif p.val < current.val and q.val < current.val: | ||
current = current.left | ||
else: | ||
return current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 문제가 이렇게 간단히 풀이될 수 있는 거였군요.. 바로 코드 수정하러 갑니다 💨
@SamTheKorean 이터레이션 설정 안 하고 병합하면 미워할꺼야! 😈 |
오 죄송합니다 ㅠㅠ |
No description provided.