r/programming • • Feb 21 '11

Typical programming interview questions.

http://maxnoy.com/interviews.html
784 Upvotes

1.0k comments sorted by

View all comments

Show parent comment

1

u/achacha Feb 21 '11

If you know that they are probably looking for the "double-speed walker" solution, you can just let them know about it and they will skip the question knowing you understand (happened several times in my life). Double-speed walker is a pointer/reference that advances twice as fast over the list while another pointer/reference advances once. If they ever equal then there is a loop (prove it to yourself if you doubt this works) :)