⚡ Build the skills to land top-paying quant jobs. Offer ends in 25d 09h 49m 28s25 days 9 hours 49 minutes 28 seconds.
A singly linked list has 8 nodes, labelled in order from the head. Node points to node for , and the tail node points back to node , creating a cycle.
To detect the cycle, Floyd's algorithm starts two pointers, slow and fast, both at node . In each iteration slow advances one node and fast advances two nodes. The algorithm stops at the first iteration after which both pointers are on the same node.
How many iterations are performed, counting the iteration in which they first meet?