标签:efi solution 链表 link pytho code 节点 get 完成
我还是自己没有完成。
先建立新节点,然后进行操作。
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: p=rst=ListNode(0) while True: try: while l1.val<=l2.val: p.next=l1 l1,p=l1.next,p.next while l1.val>l2.val: p.next=l2 l2,p=l2.next,p.next except:break p.next=l1 or l2 return rst.next
标签:efi solution 链表 link pytho code 节点 get 完成
原文地址:https://www.cnblogs.com/taoyuxin/p/11728315.html