class Solution:
def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode:
root = ListNode(x=None)
cur = root
while l1 and l2:
if l1.val <= l2.val:
cur.val = l1.val
cur.next = temp_node = ListNode(x=None)
cur = temp_node
l1 = l1.next
else:
cur.val = l2.val
cur.next = temp_node = ListNode(x=None)
cur = temp_node
l2 = l2.next
if l1:
cur.val = l1.val
cur.next = l1.next
else:
cur.val = l2.val
cur.next = l2.next
return root
老师您看一下我的代码哪里出错 了,在Leetcode上运行的时候是可以的,提交的时候就出现内部出错。请问哪里错了呢?