Skip to content

[togo26] WEEK 04 Solutions#2757

Merged
togo26 merged 1 commit into
DaleStudy:mainfrom
togo26:main
Jul 20, 2026
Merged

[togo26] WEEK 04 Solutions#2757
togo26 merged 1 commit into
DaleStudy:mainfrom
togo26:main

Conversation

@togo26

@togo26 togo26 commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Notes

사정상 늦게 한문제 풀이만 올립니다. Approval만 주셔도 됩니다. 양해 부탁드립니다🙏

답안 제출 문제

작성자 체크 리스트

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

검토자 체크 리스트

Important

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

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

@dalestudy

dalestudy Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

📊 togo26 님의 학습 현황

이번 주 제출 문제

문제 난이도 유형 분석
merge-two-sorted-lists Easy ✅ 의도한 유형

누적 학습 요약

  • 풀이한 문제: 15 / 75개
  • 이번 주 유형 일치율: 100% (1문제 중 1문제 일치)

문제 풀이 현황

카테고리 진행도 완료
Array ■■■■□□□ 5 / 10 (Medium 3, Easy 2)
Dynamic Programming ■■■□□□□ 4 / 11 (Easy 1, Medium 3)
Heap ■■□□□□□ 1 / 3 (Medium 1)
Binary ■□□□□□□ 1 / 5 (Easy 1)
String ■□□□□□□ 2 / 10 (Easy 2)
Graph ■□□□□□□ 1 / 8 (Medium 1)
Tree ■□□□□□□ 1 / 14 (Medium 1)
Interval □□□□□□□ 0 / 5 ← 아직 시작 안 함
Linked List □□□□□□□ 0 / 6 ← 아직 시작 안 함
Matrix □□□□□□□ 0 / 4 ← 아직 시작 안 함

🤖 이 댓글은 GitHub App을 통해 자동으로 작성되었습니다.

🔢 API 사용량 (gpt-5-nano)
요청 입력 토큰 출력 토큰 합계 비용
1 466 37 503 $0.000038
2 465 47 512 $0.000042
3 479 44 523 $0.000042
4 479 48 527 $0.000043
합계 1,889 176 2,065 $0.000165

@github-actions github-actions Bot added the js label Jul 18, 2026
@togo26
togo26 force-pushed the main branch 2 times, most recently from 3e298cb to ad69c87 Compare July 18, 2026 15:59

@parkhojeong parkhojeong 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.

수고하셨습니다. 한 문제라 아쉽지만 다음 주 토고님의 풀이 기다리겠습니다!

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;

@parkhojeong parkhojeong Jul 18, 2026

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.

dummy 류의 노드를 두면 훨씬 간결하게 풀 수 있어서 이렇게도 풀어보시는걸 추천드립니다.
다른 방법으로는 재귀로 풀면 아주 직관적으로도 풀 수 있어서 이 방법도 풀어보시면 좋을 거 같습니다.

@parkhojeong parkhojeong 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.

커밋 로그에 관계 없는 풀이들이 있어서 정리 한 번 부탁드립니다.

@alphaorderly
alphaorderly self-requested a review July 19, 2026 03:00

@alphaorderly alphaorderly 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.

깔끔하게 잘 해결하신거 같아요!

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.

🏷️ 알고리즘 패턴 분석

  • 패턴: Two Pointers, Linked List
  • 설명: 두 개의 정렬된 리스트를 하나의 정렬된 리스트로 합치는 문제로, 두 포인터를 번갈아가며 각 리스트를 순회하며 노드를 이어 붙인다. 공간복잡도 O(1)로 목적으로 두 포인터와 기존 노드를 재사용하는 패턴이다.

📊 시간/공간 복잡도 분석

유저 분석 실제 분석 결과
Time O(n + m) O(n + m)
Space O(n + m) O(1)

피드백: 두 포인터와 인라인 노드 재사용으로 추가 공간 없이 합치도록 구현했다.

개선 제안: 현재 구현이 적절해 보입니다.

@togo26

togo26 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

@parkhojeong 커밋 정리하였습니다. 감사합니다.

@okyungjin okyungjin 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.

lgtm!

(승인을 추가로 해도 merge block 상태군요)

@togo26
togo26 merged commit fa6f7b6 into DaleStudy:main Jul 20, 2026
1 check passed
@github-project-automation github-project-automation Bot moved this from In Review to Completed in 리트코드 스터디 8기 Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

4 participants