leetcode 142. 環形鏈表 II (python3)

142. 環形鏈表 II 給定一個鏈表,返回鏈表開始入環的第一個節點。 若是鏈表無環,則返回 null。python 相遇以後,fast 和slow都用一倍速跑,相遇的地方即是起點 web # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.nex
相關文章
相關標籤/搜索