Middle Node and Cycle Start
Asked at Amazon · Coding Questions · Difficulty: Medium
Given a singly linked list (as `values`, plus `cycle_pos` = the index the tail links back to, or `-1` for no cycle), return a tuple `(middle, cycle_start)`. If there is a cycle, `middle` is `None` and `cycle_start` is the value of the cycle's start node; otherwise `cycle_start` is `None` and `middle` is the middle node's value (the second of the two middles for even length).
Loading the problem…