You are viewing a single comment's thread. Return to all comments →
Another way in python:
def has_cycle(head): cur=head while cur!=None: pointer=cur while pointer!=None: if pointer.next!=cur: pointer=pointer.next else: return 1 cur=cur.next return 0
Cycle Detection
You are viewing a single comment's thread. Return to all comments →
Another way in python: