You are viewing a single comment's thread. Return to all comments →
My C++ solution...!
bool has_cycle(Node* head) { if(head != NULL) { Node* temp = head; while (true) { if(temp >= temp->next) return (temp->next == nullptr) ? false : true; temp = temp->next; } } return false; }
Linked Lists: Detect a Cycle
You are viewing a single comment's thread. Return to all comments →
My C++ solution...!