Skip to content

[hyedall] WEEK 04 Solutions - #2971

Open
hyedall wants to merge 6 commits into
DaleStudy:mainfrom
hyedall:week-04
Open

hyedall wants to merge 6 commits into
DaleStudy:mainfrom
hyedall:week-04

Conversation

@hyedall

@hyedall hyedall commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!

  • 바로 이전에 올라온 PR에 본인을 코드 리뷰어로 추가해주세요.
  • 본인이 검토해야하는 PR의 답안 코드에 피드백을 주세요.
  • 토요일 전까지 PR을 병합할 수 있도록 승인해주세요.

@dalestudy

dalestudy Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI 리뷰(알고리즘 패턴, 시간/공간 복잡도, 학습 현황) 결과는 Checks 탭에서 볼 수 있어요.

@hyedall hyedall moved this to Completed in 리트코드 스터디 9기 Dec 5, 2026
@hyedall hyedall moved this from Completed to In Review in 리트코드 스터디 9기 Dec 5, 2026

@parkhojeong parkhojeong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

수고하셨습니다. ci 실패 확인 부탁드려요.

Comment thread word-search/hyedall.py Resolved
Comment thread merge-two-sorted-lists/hyedall.py Resolved
Comment thread merge-two-sorted-lists/hyedall.py Resolved
Comment thread word-search/hyedall.py

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

깔끔하게 풀어주셨네요!

Comment thread word-search/hyedall.py Resolved
@ehlung
ehlung self-requested a review December 5, 2026 14:11

@ehlung ehlung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

저도 이번 주에 21번을 풀어서 이 문제 위주로 봤습니다. 저랑 같은 시작용 노드 방식인데 조건을 더 짧게 쓰셔서 배웠어요. 이번 주차도 고생하셨습니다!

"""
https://leetcode.com/problems/merge-two-sorted-lists/description/
시간 복잡도 : O(n)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

n이 무엇인지 적어 두면 읽는 사람이 더 빨리 알 수 있을 것 같아요. 저는 list1 길이를 n, list2 길이를 m으로 두고 O(n + m)으로 적었는데, n을 두 리스트 노드 수의 합으로 정하셨다면 지금처럼 O(n)도 맞는 것 같습니다!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

n을 두 리스트의 전체 노드 수로 생각하고 작성했습니다! 말씀주신 것처럼 변수의 의미도 함께 적는 게 명확할 것 같네요. 감사합니다 :)

dummy = ListNode(0)
tail = dummy

while list1 and list2:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is not None 없이 while list1 and list2:로 쓰셨네요! 노드 객체는 val이 0이어도 참이고 None만 거짓이라 이렇게 써도 되는군요. 저는 is not None을 붙여서 조건이 길어졌는데, 이렇게 쓰는 게 더 간결한 것 같아요 👍🏻

# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

스택을 이용한 DF 풀이군요. 흥미롭게 잘봤습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

4 participants