```
// 初始化快慢指針,指針是指向對象結點的引用
ListNode slow = head;
ListNode fast = head;
/**
* Change this condition to fit specific problem.
* Attention: remember to avoid null-pointer error
**/
while (slow != null && fast != null && fast.next != null) {
slow = slow.next; // move slow pointer one step each time
fast = fast.next.next; // move fast pointer two steps each time
if (slow == fast) { // change this condition to fit specific problem
//是環形鏈表
return true;
}
}
//不是環形鏈表
return false;
```
*****

*****
