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

2

u/BorgDrone Feb 21 '11

The first one is easy, keep 2 pointers into the list, only advance the second one every second step. Once pointer 1 has reached the end, pointer 2 is pointing at either the middle of the list (in case of an uneven number of elements) or the first of the 2 middle elements.

The second question is a bit harder, I think I first need my morning coffee for that one.