网站首页 站内搜索

搜索结果

查询Tags标签: fakeHead,共有 2条记录
  • python实现合并两个有序链表

    def merge_list(self, l1, l2):if l1 and l2:p1, p2 = l1, l2fakeHead = ListNode(None)cur = fakeHeadwhile p1 and p2:if p1.val <= p2.val:cur.next = p1p1 = p1.nextelse:cur.next = p2p2 = p2.nextcur = cur.nextcur.next = p1 if p1 else p2return fakeHead.nex…

    2021/7/12 20:07:47 人评论 次浏览
  • python实现合并两个有序链表

    def merge_list(self, l1, l2):if l1 and l2:p1, p2 = l1, l2fakeHead = ListNode(None)cur = fakeHeadwhile p1 and p2:if p1.val <= p2.val:cur.next = p1p1 = p1.nextelse:cur.next = p2p2 = p2.nextcur = cur.nextcur.next = p1 if p1 else p2return fakeHead.nex…

    2021/7/12 20:07:47 人评论 次浏览
扫一扫关注最新编程教程