Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




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

1> Place 3 balls on each side of balance
2> If it is balanced, Put the remaining 2 of the balls on the second iteration and find the different.
3> If not balances, take out the 3 balls of the side which is heavier and put 2 balls among these 3 in the second iteration.
4> If it is balanced, the 3rd one is the heavy else, the one the one with the heavier side is heavy.

- hprem991 April 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
3
of 3 vote

Divide 8 balls into:
Set A: (3)
Set B: (3)
Set C: (2)

Comparison 1: A and B
if(A=B):
Compare Set C, Keeping one ball in each Pan and find the wrong one!
else:
Either A or B has to has Odd one!
Compare two balls: B1 and B2 and
if(B1=B2): B3 is thewrong one
else: B2/ B1 will be the wrong one :)

- Sunil B N May 02, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Name the balls as 1,2,3,4,5,6,7,8
Pick first 6 (or any 6) balls and put on either side of balance
Case 1:
If it matches then take remaining to balls say 7 and 8 and put on either side.
Now which ever is heavier is the one
Case 2:
If first 6 does not match, then take the 3 balls from heavier side and pick any 2 of them and weigh it.
Case A:
If not same then the heavier is one.
Case B:
If same then the remaining 3rd ball is the heavier one

- rizwan.amd April 25, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
1
of 1 vote

Sanjay, in first cut it divided into two then put one on otheq and cut make 4 then put 2 on other 2 and cut make 8 equal peices

- Wasim August 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote
{{{ Step 1) Pick any 6 ball and weight 3 balls on each rim of justice scale. Step 2) if (weigh's are exactly same in Step1) ) then heavier ball is in remaining 2 balls, put the remaining ball on each rim of justice scale and get the heavier ball. else Get the 3 balls which are on the heavier side of the scale. Pick any 2 balls from 3 and put a ball on each rim of justice scale. If the weighs are same then 3 ball is heavy otherwise heavier ball should be shown in the justice scale - Anonymous April 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Name the balls as 1,2,3,4,5,6,7,8
Pick first 6 (or any 6) balls and put on either side of balance
Case 1: 
	If it maches then take reaminig to balls say 7 and 8 and put on either side. Now which ever is heavier is the one
Case 2: 
	If first 6 does not match, then take the 3 balls from heavier side and pick any 2 of them and weigh it. 
	Case A:
		If not same then the heavier is one.
	Case B:
		If same then the remaining 3rd ball is the heavier one

- Anonymous April 25, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Name the balls as 1,2,3,4,5,6,7,8
Pick first 6 (or any 6) balls and put on either side of balance
Case 1:
If it matches then take remaining to balls say 7 and 8 and put on either side. Now which ever is heavier is the one
Case 2:
If first 6 does not match, then take the 3 balls from heavier side and pick any 2 of them and weigh it.
Case A:
If not same then the heavier is one.
Case B:
If same then the remaining 3rd ball is the heavier one

- rizwan.amd April 25, 2013 | 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