Leetcode1 [LeetCode] 21. Merge Two Sorted Lists (Python) - Linked List ๋์ ์ฝ๋ # 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]: # empty list cNode = result = ListNode() while list1 and list2: if list1.val < list2.val: cNode.next = list1 list1, cNode = list1... 2023. 4. 10. ์ด์ 1 ๋ค์ ๋ฐ์ํ