We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This old chestnut has been around since I first started interviewing. The list constraint makes it so you don't have to go through the trouble of fast slow pointers. you just advance through the list until you hit null or you've done it 101 times. It's three lines.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Linked Lists: Detect a Cycle
You are viewing a single comment's thread. Return to all comments →
This old chestnut has been around since I first started interviewing. The list constraint makes it so you don't have to go through the trouble of fast slow pointers. you just advance through the list until you hit null or you've done it 101 times. It's three lines.