2020年8月19日

环形链表()

摘要: 法一: class Solution: def hasCycle(self, head: ListNode) -> bool: a = set() while head: if head in a: return True a.add(head) head = head.next return Fa 阅读全文

posted @ 2020-08-19 16:22 不要挡着我晒太阳 阅读(95) 评论(0) 推荐(0) 编辑

合并两个有序链表(21)

摘要: # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None 法一: class Solution: def mergeTwoList 阅读全文

posted @ 2020-08-19 11:28 不要挡着我晒太阳 阅读(106) 评论(0) 推荐(0) 编辑

导航