You are viewing a single comment's thread. Return to all comments →
I use Set instead of Dict
def has_cycle1(head): if head == None: return False lmap = set() while head: if head not in lmap: lmap.add(head) else: return True head = head.next return False
Seems like cookies are disabled on this browser, please enable them to open this website
Linked Lists: Detect a Cycle
You are viewing a single comment's thread. Return to all comments →
I use Set instead of Dict