题目
快慢指针判断是否相遇
public boolean hasCycle(ListNode head) {
if(head == null || head.next == null) return false;
ListNode p = head;
ListNode q = head;
while(q != null && q.next != null){
q = q.next.next;
p = p.next;
if(p == q) return true;
}
return false;
}