News for hackers. Stuff that matters.
Re:Hiring the Smartest People in the World by 6ren on Wednesday May 02, 2012 @05:48AM (#3918263)
For the first one, if they are in an order, and in an array, you can do a binary search, O(log2 n) time - better than linear time. Perhaps the question was misstated. Also, the friend's relationship is accidentally disclosed as a son.
Re:Hiring the Smartest People in the World by zheng on Wednesday May 02, 2012 @05:58AM (#3918280)
The problem wasn't misstated, when they aren't in order the solution isn't obvious unless you remember a bit about sums. Most interview problems, if restricted, can either be solved very quickly, or aren't interesting anymore. Either way, as it was stated, it's a fairly common interview question as another comment has pointed out.
Re:Hiring the Smartest People in the World by 6ren on Wednesday May 02, 2012 @07:59AM (#3918603)
The question states they are in an order - ah, by that, they probably mean "not ordered".
Re:Hiring the Smartest People in the World by zheng on Wednesday May 02, 2012 @12:28PM (#3919888)
You're probably right, although as of right now it reads "in some order", ergo there is no guarantee that i comes before i+1 for all i. It could have been updated though.
Re:Hiring the Smartest People in the World by jyothi on Wednesday May 02, 2012 @07:58AM (#3918595)
yeah i noticed the "son's interview" part in first read itself - it was amusing O(n) solution for who the friend is.