https://leetcode.com/problems/linked-list-cycle-ii/ ## タグ ## 概要 ## 方針 ### Intuition ### Floyd ```python class Solution: def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]: def find_catchup_node(head): slow = head fast = head while fast and fast.next: slow = slow.next fast = fast.next.next if slow == fast: return slow return None catchup_node = find_catchup_node(head) if catchup_node is None: return None from_start = head from_catchup = catchup_node while from_start != from_catchup: from_start = from_start.next from_catchup = from_catchup.next return from_start ``` ### Discussion