Linked List Cycle LeetCode solution in Python

1
class Solution:
2
def hasCycle(self, head: Optional[ListNode]) -> bool:
3
for i in range(0, 10001):
4
if head == None:
5
return False
6
head = head.next
7

8
return True

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0