/*
* function ListNode(x){
* this.val = x;
* this.next = null;
* }
*/
/**
*
* @param head ListNode类
* @return bool布尔型
*/
function hasCycle( head ) {
let fast = head,
slow = head
if (fast === null || fast.next === null || fast.next.next === null) {
return false
}
while (fast && fast.next) {
slow = slow.next
fast = fast.next.next
if (slow === fast) {
return true
}
}
return false
}
module.exports = {
hasCycle : hasCycle
};