Google interview question

Check the LinkedList have cycle or not

Interview Answer

Anonymous

19 Sept 2023

Its easy, take two variable Fast and Slow, in every itration make slow+1 and fast+2 and if slow==fast then cycle else NOT