Pergunta de entrevista da empresa Apple

They asked me to design a memory-efficient algorithm to detect if a linked list contains a cycle, then optimize it for both time and space complexity. After solving it, they wanted me to explain how I'd test it and handle edge cases like empty lists or single-node lists. The interviewer really focused on my thought process and communication style throughout.