Google Software Developer Mock Interview

Practice 30 Google Software Developer interview questions covering algorithms, system design, and coding challenges.

Question 3 of 30

How do you find the starting node of a cycle if a link contains a cycle?

  • How to Answer

  • Example Answer

  • Community Answers

William Swansen
William Swansen

William Swansen has worked in the employment assistance realm since 2007. He is an author, job search strategist, and career advisor who helps individuals worldwide and in various professions to find their ideal careers.

Let's say for argument's sake that two cyclists (no pun intended) are pointed at the beginning of the starting line with their cycles. For clarification purposes, the two cyclists are the pointers. In this example, if we move cyclist one step at a time and the second cyclist two steps at a time, they would eventually meet at a single point. An interviewer wants to know whether you can explain how you arrive at an answer and the reasoning behind your findings. This is important because when you explain if a link contains a cycle, you need to back that up with a verbal or written (whiteboard) example. A common response might be the mention of, let's say, that a meeting point is 'P' steps away from the beginning of the cycle, and the 'cyclists' meet when cyclist one has taken a '7' total steps toward the point.

Unlock All 30 Google Questions

Prepare with questions that reflect Google's rigorous technical interview process.

Get Started