Min Li's Note
KVM,QEMU, X86 virtualization
Pages
Home
Collection
About
Sunday, September 14, 2014
Linked List Cycle
Problem
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
Idea
设置两个指针,一个每次移动2步,一个每次移动1步。 若最终相遇则有环,若一个指针走到了NULL,则没环
Solution
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment