You are viewing a single comment's thread. Return to all comments →
I assumed you had to preserve the integrity of the data in the list, I did this as a joke lol
def has_cycle(head): if head is None: return 0 while(True): if head.data == "foo": return 1 if head.next is None: return 0 head.data ="foo" head = head.next
Though replace foo with something cruder...
Seems like cookies are disabled on this browser, please enable them to open this website
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
I assumed you had to preserve the integrity of the data in the list, I did this as a joke lol
Though replace foo with something cruder...