其实我最佩服的是joke版那帮人了 (转载)# Joke - 肚皮舞运动
t*e
1 楼
#1 There is a linked list. The last node could point back to any node in
the list (including the head). Find the node in the list to which the last
node points. Or in other words at which node does the circular linked list
start.
think of a O(n) solution with O(1) space, or space efficient.
We all know how to detect the cycle.
for O(n^2) solution is also easy. just move the pointer from head to the
next, and loop the cycle.
I was thinking break up the link list in loop for O(n) solution.
Any so
the list (including the head). Find the node in the list to which the last
node points. Or in other words at which node does the circular linked list
start.
think of a O(n) solution with O(1) space, or space efficient.
We all know how to detect the cycle.
for O(n^2) solution is also easy. just move the pointer from head to the
next, and loop the cycle.
I was thinking break up the link list in loop for O(n) solution.
Any so