You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var hasCycle = function(head) {
const res = [];
let f =false;
while (head) {
if (res.includes(head)) {
f = true;
break
}
res.push(head);
head = head.next;
}
return f;
};
Activity
hzy-caiji commentedon May 15, 2021
var hasCycle = function(head) {
const res = [];
let f =false;
while (head) {
if (res.includes(head)) {
f = true;
break
}
res.push(head);
head = head.next;
}
return f;
};
seafronthu commentedon Jun 11, 2024