- Notifications
You must be signed in to change notification settings - Fork2.4k
Closed
Description
Bug Report forhttps://neetcode.io/problems/linked-list-cycle-detection
Solved the problem with this code:
Definition for singly-linked
class ListNode:
definit(self, val=0,
self.val = val
self.next = next
class Solution:
def hasCycle(self, head) -> bool
l, r = head, head
r = head.next
while r:
if l.val > r.val:
return True
l = l.next
r = r.next
return False
which I do not think is valid
Metadata
Metadata
Assignees
Labels
No labels