Thomson Reuters Interview Question for Software Engineer / Developers


Team: Eikon
Country: United States
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
5
of 7 vote

say there's a minimal number of tryouts X, then you want to try the Xth floor and if it breaks you try every floor 1..X-1 (that's how you get no more than X tryouts).
Thus, if the egg doesn't break you jump X-1 floors, since you already used 1 tryout, and again if it breaks this time you try the floors X+1..(X+[X-1] - 1) , or in other words all the floors between those two you tried.
Again, the next jump will be X-2 since you tried twice already.
In order to find X you need X+[X-1]+[X-2]+...+2+1 >= 100 (floors)
Sum(X=13) = (1+13)*(13/2) = 91 < 100
Sum(X=14) = (1+14)*(14/2) = 105 >= 100

So that X is 14.

- avico81 November 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

This is a classic one. You start from the second floor - if the egg breaks, then quit. Else go up one level with the same egg and try again. Once this egg breaks, you find the answer. Actually don't know what the second egg is for.

- helen2211 November 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

In worst case,u need to try 99 times. Try to minimize number of trials. It is possible.

- pradegup November 13, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

With 2 eggs, with a modified version of helen2211's method, you can get the worst tries to 50 times.

Drop first egg from the 50 floor
if(first breaks){
start dropping second egg from 1st floor
// You may find egg breaks on the first floor.
// worst case, max 50 tries
}else{ 
start dropping the second egg from 51st going to 100th floor
// max 50 tries
}

- xdoer November 14, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

Go to 50th floor and use your first egg. If it breaks, then use remaining egg to test lower floors beginning from 1 as helen 2211 proposed. If it doesn't break, go to 75th floor e.t.c. dividing remaining number of floors by 2 until your first egg is not broken.

- Rail.Suleymanov November 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Start on ground floor:
step-1-> go to current floor + two floors.
step-2-> Throw one egg.
If the egg does not break;
Repeat from step-1 to 2,

If the egg breaks;
go to one floor lower and throw second egg and check if it is breaking or not.

- Avi November 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Probably u will find on Datagenetics's july blog two egg problem.

- Nitish Raj November 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Minimum number will be 19. y = (100/X) + X-1 . Maximize y. Hence, X will be 10. Hence , throw eggs at every interval of 10 and then go linear.

- Mukand November 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

See highest answer by avico81

- Rail.Suleymanov November 13, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

There are two ways to solve this problem :
* binary search for the first egg (risked to know where we need to look up)
* Fibonaccy sequence search 1,2,3,5,8,13,21,34,55,89 for the first egg

Once first egg is broken we know where we need to look:
binary example: we tried 50 if it broke we search from 1 to 50 incrementing by 1 if not we throw it from 50+100/2 (75) if it broke we search from 50 to 75 if not we throw it from 75+100/2 (87) if it broke we search from 75 to 87 incemrenting by one floor at a time and so on and so forth.

fibonacy example: same thing : we try 1,2,3,5,8.13,...
if first egg broke we get back to the last interval's minimum and increment by 1.

- Mehdi December 18, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Even if thrown in groundfloor ... It ll break ;)

- vidya October 30, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

If u don't throw or break, it ll remain even in 100 the floor

- vidya October 30, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

vcv  dbcidnkc

- Anonymous December 10, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

EGG KITANE V FLOOR SE FEKO TUTEGA HI TABLE PER SE RAKHE EGG TUT JATE HAI FIR TOH YE 100 KA FLOOR HAI

- suvi December 16, 2016 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More