You are viewing a single comment's thread. Return to all comments →
Yes ,Your Solution is much more general and understandable but you used too much conditionals here is my approch
def has_cycle(head): temp=head;visited=[] while temp.next!=None: if temp.data in visited: return True else: visited.append(temp.data);temp=temp.next return False
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 →
Yes ,Your Solution is much more general and understandable but you used too much conditionals here is my approch