Adobe Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
1
of 1 vote

14 27 39 50 60 69 77 84 90 95 99 100
Maximum 14 throws are required.
Method:
x x+(x-1) x+(x-1)+(x-2)........100

nth term of this series nx-(1+2+3.....till(n-1))
=nx-(n)(n-1)/2


{nx-n(n-1)/2}>=100

for any value of n [1,2,3,4.....]
min value of x which satisfy the equation is 14.
so the answer is 14.
pls guide if i am wrong.

- garg.shobhit1 June 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hmmn I think this is good approach

- Anonymous April 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hmmn I think this is good approach

- Anonymous April 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

isn't it binary search until one ball breaks and then applying rethrow from lower end

- netappreject May 21, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

worst case or max in binary search algo can be 49 throws. Its not the optimal solution

- guest211 May 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

max throws # 43
8 (to check where 1st ball breaks, i.e. 1->2->4->8->16->32->64->100) +
35 at max (to check if it breaks from 65 to 99)

- buried.shopno May 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A better solution,

Go to 14th floor and throw first ball,
if breaks, try 1st to 13th floor.
if doesn't break, go to 13(14-1) floor above i.e. on 27 th floor
if breaks, try 15th to 26th floor.
if doesn't break, go to 12th (13-1) floor above i.e. on 39th floor
........ Continue till solution ..............


The solution can always be found in maximum 14 attempts.

- Anonymous May 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

it will take 14 attempts assuming that the ball will break at 14th floor. Otherwise we need to add the attempts failed at 14th, 27th, 39th... in worst case scenario..

- careerSavvy June 10, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

This is optimum solution as load balancing is done for egg 1 and egg 2 attempts.
X (1st attempt) X-1 second so on till 1
X + X-1 + x-2 + 1 = 100
x(X+1)/2 = 100
X^2 + X = 200 14 being the closest.....



why we cant resort to binary search is because we have only 2 eggs.
A binary search wud consume log2(100) 7 attempts.
but we have lesser eggs recall

- Amit Priyadarshi July 18, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Can I just point out that the optimal solution is 2 assuming I get lucky and find the riumber on the first try and then to make sure, I try one number below it. Problem solved.

- Michael. May 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Its not a clear answer problem....Its answer will be algorithmic complexity terms...I feel 'netappreject' is correct!

- nagabhushana.s July 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Minimum number of throws depends on what X is.

- Anonymous August 19, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

if we drop a glass after every nth floor, if the first glass will break at (k+1)nth floor, but will not break at (kn)th floor. we will then use the second glass to find which floor between kn and (k+1)n the glass will break... by dropping it from each floor one by one between kn and (k+1)n.

so total number of throws is 100/n + n (in worst case)...
and we have to find the value of n for which the above eqauation is max...

so d/dn(100/n + n)=0

n=11....

- Ankit Manocha February 25, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

we have to basically minimize the no. of throws so that we are able to cover the entire building that is 100 floors...

1.I throw from floor x, and it breaks hence I need to check all the x-1 floors (linearly) for the second egg to break .. i.e. if I start at x then I need x throws at least ( and we are minimizing x)

2. now observe that if I throw at x I cover x floors at first then x-1 floors then x-2 and so on... we have to minimize x such that the some of each spans reaches 100
e.g.
for x = 16
drop at 16, now have 15 drops for 1-15 (now drops left =15 (16-1))
drop at 31, now have 14 drops for 32-44 (now drops left =14(16-2))
.
.
.
.

i.e. at each step I span x + x-1 + x-2 + ...... until the sum reaches 100
in the optimal soln I should have just one drop left in the end and also just one floor to check ...
i.e. x + x-1 + x-2 + .... + 1 >=100
solving for x(min) gives 14 (ans)

i.e.
thow at 14, 28, . ... , 99, 100

- fabregas March 05, 2011 | 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