[togo26] WEEK 04 Solutions#2757
Open
togo26 wants to merge 22 commits into
Open
Conversation
Co-authored-by: Hojeong Park <parkhj062@gmail.com>
Remove unnecessary regex construction Co-authored-by: polymorph <33543196+dahyeong-yun@users.noreply.github.com>
Remove redundant code range validation Co-authored-by: polymorph <33543196+dahyeong-yun@users.noreply.github.com>
Contributor
📊 togo26 님의 학습 현황이번 주 제출 문제
누적 학습 요약
문제 풀이 현황
🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다. 🔢 API 사용량 (gpt-5-nano)
|
Contributor
There was a problem hiding this comment.
🏷️ 알고리즘 패턴 분석
- 패턴: Two Pointers, Linked List
- 설명: 두 개의 정렬된 연결 리스트를 하나로 합치는 과정에서 포인터를 번갈아가며 이동하고, 새로운 리스트를 순차적으로 구성하는 방식으로 구현되어 있습니다. 추가 메모리 없이 기존 노드를 재배치하는 점이 핵심입니다.
📊 시간/공간 복잡도 분석
| 유저 분석 | 실제 분석 | 결과 | |
|---|---|---|---|
| Time | O(n + m) | O(n + m) | ✅ |
| Space | O(n + m) | O(1) | ❌ |
피드백: 두 리스트를 순회하며 값을 비교해 새로운 연결 리스트를 구성합니다. 추가 포인터와 상수 공간으로 동작합니다.
개선 제안: 현재 구현이 적절해 보입니다.
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
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 하나 이상을 반드시 검토를 해주셔야 합니다!