标签:style blog color io ar div new amp
1 public boolean hasCycle(ListNode head) { 2 ListNode s=head; 3 ListNode f=head; 4 while(f!=null&&f.next!=null){ 5 s=s.next; 6 f=f.next.next; 7 if(s==f){ 8 return true; 9 } 10 } 11 return false; 12 13 }
leetcode--009 Linked List Cycle I,布布扣,bubuko.com
leetcode--009 Linked List Cycle I
标签:style blog color io ar div new amp
原文地址:http://www.cnblogs.com/thehappyyouth/p/3880640.html