Skip to content
Merged
Changes from 30 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4836151
contains duplicate solution
yuseok89 Jun 23, 2026
cdc00da
two sum solution
yuseok89 Jun 23, 2026
cc0a988
top k frequent elements solution
yuseok89 Jun 23, 2026
c894055
longest consecutive sequence solution
yuseok89 Jun 23, 2026
4e4e412
house robber solution
yuseok89 Jun 23, 2026
32cafb9
add newline
yuseok89 Jun 23, 2026
49ecb59
리뷰 반영
yuseok89 Jun 25, 2026
a6fcc33
리뷰 반영
yuseok89 Jun 25, 2026
38a1f67
개선 - AI assist
yuseok89 Jun 25, 2026
8bd5a32
valid anagram solution
yuseok89 Jun 29, 2026
05685ed
Merge branch 'DaleStudy:main' into main
yuseok89 Jun 29, 2026
cd23e34
climbing stairs solution
yuseok89 Jun 29, 2026
120df1f
product of array except self solution
yuseok89 Jul 1, 2026
1d4ff54
3sum solution
yuseok89 Jul 1, 2026
23142a7
validate binary search tree solution
yuseok89 Jul 1, 2026
0cb14ca
공간복잡도 업데이트
yuseok89 Jul 1, 2026
9465142
공간복잡도 업데이트
yuseok89 Jul 1, 2026
8b4a01f
Merge branch 'DaleStudy:main' into main
yuseok89 Jul 7, 2026
4b09054
validate palindrome solution
yuseok89 Jul 7, 2026
da3aad9
number of 1 bits solution
yuseok89 Jul 7, 2026
5c4d5fb
combination sum solution
yuseok89 Jul 7, 2026
03f3f1a
decode ways solution
yuseok89 Jul 7, 2026
d8d5ea4
maximum subarray solution
yuseok89 Jul 7, 2026
1f003e2
복잡도 업데이트
yuseok89 Jul 7, 2026
a022d10
재귀 로직 개선
yuseok89 Jul 9, 2026
b8248c4
maximum subarray 풀이 개선
yuseok89 Jul 9, 2026
51c1012
valid palindrome 풀이 개선
yuseok89 Jul 9, 2026
65431c0
maximum subarray 풀이 개선
yuseok89 Jul 9, 2026
e514ab2
Merge branch 'DaleStudy:main' into main
yuseok89 Jul 12, 2026
194db1c
merge two sorted lists solution
yuseok89 Jul 12, 2026
419dfc5
merge two sorted lists solution 리뷰 반영
yuseok89 Jul 14, 2026
af586d8
maximum depth of binary tree solution
yuseok89 Jul 14, 2026
e2f0e02
find minimum in rotated sorted array solution
yuseok89 Jul 14, 2026
41107c5
word search solution
yuseok89 Jul 14, 2026
37ecdd8
coin change solution
yuseok89 Jul 15, 2026
fc56573
시간 공간 복잡도 업데이트
yuseok89 Jul 15, 2026
350342d
사전 필터링
yuseok89 Jul 16, 2026
0a99924
코드 개선
yuseok89 Jul 17, 2026
2f86595
Apply suggestion from @parkhojeong
yuseok89 Jul 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions merge-two-sorted-lists/yuseok89.py

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.

이거 2개 비교하는 부분 끝나고 리스트 두개중에 한개 순회 다 끝난 상태에서는 나머지 남은 리스트는 그냥 뒤에 통째로 붙혀주는게 더 좋더라구요!
그니까 while 말구 단일 if문으로 처리가 가능해서 이게 훨씬 깔끔하고 좋은것 같았어요
파이썬의 or가 어떻게 단축평가를 하는지 고려하면 더욱 줄일수도 있구요!

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.

의견 감사합니다.
굳이 더 순회 할 필요 없었네요.
파이썬 or 도 좀 더 살펴보겠습니다.

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, Merge
  • 설명: 두 연결 리스트를 병합하기 위해 두 포인터(list1, list2)로 원소를 차례로 비교하며 새로운 리스트를 만들어가는 패턴입니다. 시간 복잡도 O(N+M), 추가 공간은 상수로 구현됩니다.

📊 시간/공간 복잡도 분석

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

피드백: 두 리스트를 동시에 순회하며 더 작은 노드를 연결한다.

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# TC: O(N)
# SC: O(1)
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]:

ret = ListNode()
cur = ret
Comment on lines +11 to +12

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.

ret은 무슨 약자일까요?

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.

return value 약자로 썼는데,
다음엔 좀 더 가독성 있게 작성해보겠습니다.


while list1 and list2:
if list1.val < list2.val:
cur.next = list1
list1 = list1.next
else:
cur.next = list2
list2 = list2.next
cur = cur.next

while list1:
cur.next = list1
list1 = list1.next
cur = cur.next

while list2:
cur.next = list2
list2 = list2.next
cur = cur.next

return ret.next

Loading