[togo26] WEEK 04 Solutions#2757
Merged
Merged
Conversation
Contributor
📊 togo26 님의 학습 현황이번 주 제출 문제
누적 학습 요약
문제 풀이 현황
🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다. 🔢 API 사용량 (gpt-5-nano)
|
togo26
force-pushed
the
main
branch
2 times, most recently
from
July 18, 2026 15:59
3e298cb to
ad69c87
Compare
parkhojeong
approved these changes
Jul 18, 2026
parkhojeong
left a comment
Contributor
There was a problem hiding this comment.
수고하셨습니다. 한 문제라 아쉽지만 다음 주 토고님의 풀이 기다리겠습니다!
Comment on lines
+15
to
+45
| var mergeTwoLists = function (list1, list2) { | ||
| let mergeHead = null; | ||
| let mergePointer = null; | ||
|
|
||
| let head1 = list1; | ||
| let head2 = list2; | ||
|
|
||
| const mergeNode = node => { | ||
| const temp = node.next; | ||
| if (!mergeHead) { | ||
| mergeHead = node; | ||
| mergePointer = node; | ||
| } else { | ||
| mergePointer.next = node; | ||
| mergePointer = mergePointer.next; | ||
| } | ||
| return temp; | ||
| }; | ||
|
|
||
| while (head1 && head2) { | ||
| if (head1.val <= head2.val) { | ||
| head1 = mergeNode(head1); | ||
| } else { | ||
| head2 = mergeNode(head2); | ||
| } | ||
| } | ||
|
|
||
| if (head1) mergeNode(head1); | ||
| if (head2) mergeNode(head2); | ||
|
|
||
| return mergeHead; |
Contributor
There was a problem hiding this comment.
dummy 류의 노드를 두면 훨씬 간결하게 풀 수 있어서 이렇게도 풀어보시는걸 추천드립니다.
다른 방법으로는 재귀로 풀면 아주 직관적으로도 풀 수 있어서 이 방법도 풀어보시면 좋을 거 같습니다.
parkhojeong
requested changes
Jul 18, 2026
alphaorderly
self-requested a review
July 19, 2026 03:00
alphaorderly
approved these changes
Jul 20, 2026
Contributor
There was a problem hiding this comment.
🏷️ 알고리즘 패턴 분석
- 패턴: Two Pointers, Linked List
- 설명: 두 개의 정렬된 리스트를 하나의 정렬된 리스트로 합치는 문제로, 두 포인터를 번갈아가며 각 리스트를 순회하며 노드를 이어 붙인다. 공간복잡도 O(1)로 목적으로 두 포인터와 기존 노드를 재사용하는 패턴이다.
📊 시간/공간 복잡도 분석
| 유저 분석 | 실제 분석 | 결과 | |
|---|---|---|---|
| Time | O(n + m) | O(n + m) | ✅ |
| Space | O(n + m) | O(1) | ❌ |
피드백: 두 포인터와 인라인 노드 재사용으로 추가 공간 없이 합치도록 구현했다.
개선 제안: 현재 구현이 적절해 보입니다.
Contributor
Author
|
@parkhojeong 커밋 정리하였습니다. 감사합니다. |
okyungjin
approved these changes
Jul 20, 2026
parkhojeong
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Notes
사정상 늦게 한문제 풀이만 올립니다. Approval만 주셔도 됩니다. 양해 부탁드립니다🙏
답안 제출 문제
작성자 체크 리스트
In Review로 설정해주세요.검토자 체크 리스트
Important
본인 답안 제출 뿐만 아니라 다른 분 PR 하나 이상을 반드시 검토를 해주셔야 합니다!