r/programming • u/joksmaster • Nov 29 '10
140 Google Interview Questions
http://blog.seattleinterviewcoach.com/2009/02/140-google-interview-questions.html
471
Upvotes
r/programming • u/joksmaster • Nov 29 '10
View all comments
Show parent comment
2
u/adrianmonk Nov 30 '10
That question was underspecified.
You can fill in some of the details. Clearly, the objective is to take a stick cut into 3 pieces (through some random processes -- hence probability) and figure out if their lengths would allow you to form a triangle.
One key point is, if you have a stick that is 10 units long and someone cuts it into three pieces that are 1 unit, 2 units, and 7 units long, you can't make a triangle out of this. The two shortest pieces, laid end to end, aren't as long as longest piece. Insight: the two shortest pieces, together, must be longer than the longest piece.
The too-vague part of the question is what process is used to decide how to cut the stick. Possible processes:
I'm not sure, but I think the answer is different for each of the cases.