142 Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull
.
Note:Do not modify the linked list.
Follow up: Can you solve it without using extra space?
同上题一样,花空间的要用hashset。不用的话,就双指针。解法竟然跟287 Find the Duplicate number 一样
Last updated