题目:
题解:
func detectCycle(head *ListNode) *ListNode {slow, fast := head, headfor fast != nil {slow = slow.Nextif fast.Next == nil {return nil}fast = fast.Next.Nextif fast == slow {p := headfor p != slow {p = p.Nextslow = slow.Next}return p}}return nil
}