[Leetcode] Linked List 1 - 21. Merge Two Sorted Lists

[Leetcode] 21. Merge Two Sorted Lists 문제 링크 이 문제는 제목 그대로 2개의 리스트를 정렬해서 결합하는 문제입니다. 구현되어있는 ListNode class를 이용해서 mergeTwoLists method를 완성하면 됩니다. 풀이 과정 다음의 조건을 갖고 있다고 가정하고 실행 과정을 정리해보겠습니다. # Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next a = [1,2,4] b = [1,3,4] dummy = cur = ListNode(0) Code (python) # Definition for singly-linked list....

September 13, 2022 · 1 min · 146 words · Me