How would you detect a loop in a linked list? This was a technical question, finding the answer was difficult since I forgot how linked lists worked, but the interviewer didn't mind helping out with hints and guiding me along. They weren't, obviously interested in the exact answer, but how my thinking works
Sigiloso
My initial answer was to store the "address" or pointer to each node in the linked list in memory, and stop when a node was visited twice. This was satisfactory since he didn't specify memory was an issue, but then he changed the question adding that you have little to no memory accessible. The answer, mostly suggested by the interviewer, was to use to pointers to traverse the linked list, one going from node to node, the other jumping every two nodes. If there was a loop, eventually they'd meet and you'd know you have a loop.