public static ListNode detectCycle(ListNode head) {
		ListNode p = head;
		ListNode q = head;
		while (null != p && null != q) {
			p = p.next;
			q = q.next;
			if (null == p || null == q) return null;
			q = q.next;
			if (null == q) return null; 
			if (p == q) break;
		}
        ListNode r = head;
        while (r != p) {
        	r = r.next;
        	p = p.next;
        }
		return r;
    }