SolarCity Interview Question: 1. About the projects that yo... | Glassdoor

Interview Question

Software Engineer Video Interview Interview San Francisco, CA

1. About the projects that you did. 2. If you need same

  database for 2 different applications how would you approach? 3. There are 10 stacks, each stack contains 10 bricks. Out of these 10 stacks.. one complete stack contains fake bricks and other 9 stacks has real bricks. Now when you take some collection of bricks (say 2 bricks from 1st stack, 3 from 4th stack, etc..) and weighing that collection of those picked bricks only once how would you identify which stack has fake bricks?? Note: Real bricks weighs 10 pounds and fake brick weighs 1 pound.
Answer

Interview Answer

1 Answer

5

Take
1 brick from 1st stack
2 bricks from 2nd stack
3 from 3rd
4 from 4th
5 from 5th
6 from 6th.

So now if I take only bricks from the above mentioned 6 stacks in the above said manner.. And when we weigh this collection what the weight should be? if all bricks are real - the weight will come to 210 pounds.

if the weight is not 210 pounds then one of these stack has a fake brick.

if the weight is
201 pounds then it means only 1 brick is fake. That means we have taken only one brick from 1st stack. So as we came to know that only 1 brick is fake, then that would be 1st stack.

In the same way, if the weight is 192 pounds, then 2 bricks are fake. Which means the 2 bricks count is from 2nd stack. So 2nd stack is fake.

and so on..

Interview Candidate on Sep 17, 2015

Add Answers or Comments

To comment on this, Sign In or Sign Up.