Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def hasCycle(self, head):
- if head==None or head.next==None:
- return False
- ListNode.visited = False
- while head != None:
- if head.visited == True:
- return True
- head.visited = True
- head = head.next
- return False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement