# Engineering Interview Questions in New York, NY

Engineering interview questions shared by candidates

## Top Interview Questions

How do you handle irate clients that are having technical trobules and need to work immediately. 3 AnswersRefrain from using technical jargon when explaining technical problems and solutions to clients and speak confidently. Approach the situation with 'we' working on the issue. Know that your are there to help solve this and act towards that, being calm and accurate towards solution. Even if the solution is that you will have to find out more and have to return to solve this issue. Ask for the ip address, then ask if it is an on or near-air emergency. Ask for the symptoms and if others are experiencing the same problem. If no one else is then have them jump on another pc if possible/feasible. Remote into the pc or tx the ip to the relevant trouble-shooter. |

### Systems Engineer at Avanade was asked...

What is the difference between RAID 0 & RAID 5? 2 AnswersIt should a simple question if you have worked with computers & HDDs. RAID 0 - Block striping (req. 2 HDDs) and no mirroring or parity RAID 5 - Block striping with 1 dedicated parity drive (req. 3 HDDs) To expand on the previous answer, RAID 0 improves HDD performance dramaticaly, but since there is no mirroring if one drive dies data is lost. RAID 0 should never be used on a system with critical data. In RAID 5, performance is slower, but it allows for the failure of a HDD with no loss of data. Consider instead, RAID 10. It requires a minimum of four HDD's, but provides an increase in performance with redundancy. |

Hypothetical question: you have a team of ten software developers that have worked on a product for 5 years. They now have to develop a new version of this application but only have 3 months to develop and test it. What would the QA estimate be? 2 AnswersThis was my favorite question as it completely illustrated how bad these guys were at interviewing. I began to ask the manager that asked the question for more information and he snapped back at me " You have all the information you need!" Really? He might as well have asked me how much it costs to build a house. Because the answer would be the same - "I need more info and detail in order to give you my estimate". Any QA worth their salt will asks tons of questions in order to understand what it is they are working on. In the end I told the panel that if I had worked on the product or similar products I would base my estimate on prior experience. If I had no prior experience I would research historical metrics from similar projects and also discuss those historical project actual development/test hours with other QA and developers to come up with an estimate. I said "Rather than answering with the standard 'I will need more information' 'lets make it less hypothetical. "'Before I can give you an answer I will need to gather more information from your people'. This gives the interviewer an out when they don't have any additional information, and you the chance to get the information you need" Converting from 'Hypothetical' to 'Real' helped make my answer stand out from other candidates. It also made it harder for the interviewer to return with the Hypothetical "you have all the information you need" |

If you had a great idea to implement something new for a CA software product but management wouldn't take your word on it, how would you convince management to go along with your idea? 1 AnswerI would try to create a form of a prototype of said idea and present it along with taking ownership and compassion for the new feature. |

What is a typical sales call for you? 1 AnswerI would focus on entertaining clients and finding their motivations and needs. I spent too long talking about end-user type sales and solving their problems, reacting to unexpected events, etc. |

### Devops Engineer at SiriusXM was asked...

What will you do if you notice that one of the MS Server Crash? 1 AnswerRestart the Server and go to the Event Logs to find the Error Code. Then check out the Error Code on Technet to find a solution. |

### Devops Engineer at SiriusXM was asked...

What is Control Access? 2 AnswersI miss this question as it is a industry terminology. It means you can control the access of any subscriber base on his payment plan. Control Access allows you to grant or restrict access of a subscriber based on his/her payment plan. |

Suppose you had eight identical balls. One of them is slightly heavier and you are given a balance scale . What's the fewest number of times you have to use the scale to find the heavier ball? 48 Answers3 times. (2^3 = 8) Two. Split into three groups of three, three, and two. weigh the two groups of three against each other. If equal, weigh the group of two to find the heavier. If one group of three is heavier pick two of the three and compare them to find the heaviest. Brian - this would be correct if you in fact were using a weighing scale, and not a balance scale. The ability to weigh one group against another with a balance scale allows Marty's answer to be a correct answer. Although - the question as worded provides a loophole. If it had been worded as "What's the fewest number of times you have to use the scale to CONSISTENTLY find the heavier ball", then Marty's answer would be the only correct answer. However, it is possible that you could get lucky and find the heavier ball in the first comparison. Therefore, the answer to the question as stated, is ONE. Show More Responses This question is from the book "How to move Mt Fuji".... Marty has already got the right answer. Actually Bill, by your interpretation of the question the answer is zero, because you could just pick a ball at random. If you get lucky, then you've found the heaviest ball without using the scale at all, thus the least possible amount of times using the scale would be zero. The answer is 2, as @Marty mentioned. cuz its the worst case scenario which u have to consider, otherwise as @woctaog mentioned it can be zero, u just got lucky picking the first ball.... None- weigh them in your hands. Assuming that the balls cannot be discerned by physical touch, the answer is 3. You first divide the balls in two groups of 4, weigh, and discard the lighter pile. You do the same with the 4 remaining, dividing into two groups of 2, weighing, and discarding the lighter pile. Then you weigh the two remaining balls, and the heavier one is evident. 2 3a+3b+2 = 8 if wt(3a)==wt(3b) then compare the remaining 2 to find the heaviest if wt(3a) !== wt(3b) then ignore group of 2 discard lighter group of 3 divide the remaining group of 3 into 2+1 weigh those 2 If == the remaing 1 is the heaviest if !== the heaviest will be on the scale With the systematic approach, the answer is 3. But, if you randomly choose 2 balls and weigh them, and by coincidence one of these two is the heavier ball, then the fewest number of times you'd have to use the scale is 1. Although the real question is: are the balls truly identical if one is heavier than the rest? just once. Say you are lucky and pick the heavy ball. One use of the scale will reveal your lucky choice so once, or the creative answer zero if you allow for weighing by hand Without judging by hand: Put 4 balls on one side, and 4 on the other. Take the heavier group and divide again, put 2 balls on one side, and 2 on the other. Take the 2 that were heavier, and put one on each side. You've now found the heaviest ball. This is using the scale 3 times, and will always find the right ball. Show More Responses None. They are identical. None is heavier. 2 weighings to find the slightly heavier ball. Step 1. compare 2 groups of three balls. Case 1. if they are both equal in weight, compare the last 2 balls - one will be heavier. case 2. If either group of 3 balls is heavier, take 2 balls from the heavier side. compare 1 ball against the 2nd from the heavy group result 1. if one ball is heavier than the other, you have found the slightly heavier ball. result 2. if both balls are equal weight, the 3rd ball is the slightly heavier ball. Easy Shmeezi Fewest - get lucky and pick the heaviest one. But wait! How would you know it is the heaviest one by just weighing one ball? Your logic is flawed. Two groups of four. Split heavier one, weigh. Split heavier one, weigh. 3 times. i think its 3. i would take it like this OOOO OOOO then OO OO then OO problem solved. i do this everyday. bye. praise be to allah. thats it. It's 2. Period. If you can't figure it out look it up online or in "How Would You Move Mount Fuji" (like somebody else said). This is one of the most basic brainteasers you could be asked in an interview. The answer is 2. 1) Divide the balls into 3 groups. 2 piles with 3 balls each, 1 pile with 2 balls. 2) Weigh the 2 piles of 3 balls. If both piles are the same weight, discard all 6 and weigh the last 2 to find the heavier one. 3) If 1 pile of 3 is heavier than the other, discard the lighter pile and the pile of 2 balls. Weigh 2 of the remaining 3 balls from the heavier pile. If both of the weighed balls are equal, the last ball is the heavier one. 2=if all the balls are identical and you pick up the first...weigh it and the second one is lighter or heavier then you've found the heavier ball in the least amount of attempts. 1=if all the balls are identical and you pick up the first...balance it and the second one is lighter or heavier then you've found the heavier ball in the least amount of attempts. Amy is 100% correct for the following reason: everyone (except Amy) is solving the theoretical problem. The practical side of the problem - notwithstanding jimwilliams57's brilliant observation that if one weighs more than the others IT IS NOT IDENTICAL (would have loved to see the interviewer's face on that one) - in order to 'weigh' them on a scale, one has to pick them up, therefore, you will immediately detect the heavier one without weighing: pick-up three and three ... no difference, no need to weight. Pick-up the remaining two to determine the heavier one. Steve First off, take yourself through the process visually and forget square roots, that doesnt apply here and here is why: The question is the Minimum, not the MAXIMUM. BTW, the max would be 7 ( 8-1); you are comparing 2 objects, so 1 ball is eliminated automatically in the first step. Anyway, you have a fulcrom of which you are placing 2 of 8 objects on each end. If by chance you pick the slightly heavier object as one of the two balls, you have in fact, found the slightly heavier one in the first round... btw dont be a smartass with your interviewer, he is looking for smarts not smarmy;) Show More Responses Respectfully, the folks who are answering "3" are mathematically modeling the nature of the balance incorrectly. Performing a measurement on a balance scale is not binary. It is trinary. Each measurement gives you one of three responses: The left is heavier, the right is heavier, or they are equal. So while you do need three binary bits to specify a number from one to eight, you need only two TRINARY-DIGITS Formally, you want the smallest value of n such that 3^n >= 8. The answer is 2. Note that you could add a ninth ball, and still, you'd only need to make two measurements. Of course, the smarty pants answer would be one. Just pick two balls at random and be lucky to have chosen the heavy one. But you're not guaranteed to be able to do it in just one measurement. English isn't my mother tongue... What is a balance scale? If looking up on Google, I find some devices with two bowls on a bar bearing in the center. Hence, the answer is once (if I'm luck enough to select the heavier ball in teh first measurement) If a balance scale allows to measure only one ball at a time, then it would take two measurements, unless you'd have more information on the weight, which is not listed here, hence doesn't exist in the context of the question^. 3 times. Not having looked at the other comments, hopefully, I am the 26th to get this right. Put the balls 4 and 4 on the scale, Take the heavier side and place those balls 2 and 2 on the scale. Take the heavier side and place them 1 and 1 giving the heaviest ball. OK, now I read the comments and see that the people, like the question are divided into to groups, systematic approach people that say 3 (like I did) and analytic people that say 2. It takes a systematic person (me) a minute to get the answer. I'm guessing it took the analytic 5 minutes just to interpret all the ramifications of the question, i.e. they aren't idenitical if..., do it by hand..., get lucky. minimum is 1 (if lucky - 25% chance by picking 2 balls at random) & max is 2 (using most efficientl process to absolutely determine without luck - 3/3/2 scenario) While Symantec was busy weighing my balls I took a job with NetApp.... They need to focus on hiring good, capable security engineers, not weighing their balls. The point of these interview questions is to both check your logical brain function and to hear how you think. Most of you are just posting jerk off answers trying to be funny, or you are really dumb. These answer get you nowhere with me in an interview. Think out loud, go down the wrong path back track try another logic path, find the answer. None of this "0 if you use your hands". That is fine if you are interviewing for a job in advertising where creativity is desired, nobody wants you writing code like an 8 year old. You have 12 balls, equally big, equally heavy - except for one, which is a little heavier. How would you identify the heavier ball if you could use a pair of balance scales only twice? The problem is based on Binary Search. Split the balls into groups of 4 each. Choose the heavier group. Continue till you get the heavier ball. This can be done in log(8) (base 2) operations, that is, 3. Since there is only one scale available to weigh. You first divide the balls in half. Weigh each group, take the heaviest group. This is using the scale twice so far. Now, divide the previous heaviest group into half, weigh both groups. Take the heaviest. Divide this last group and take the heaviest. This is the heaviest ball. We have used the scale 5 times. Show More Responses Would it be wrong to say for a sample size as small as 8, we might as well not waste time thinking about an optimal solution and just use the scale 7 times, as this will be more efficient than coming up with an ideal solution prior to using the scale? 3. I stumbled across this while looking for something else on Google but I had to answer. It is 2, split balls into 2,3 and 3. weigh the 2 groups of 3 against each other. If equal weigh the group of 2 and the heaviest is obvious. If they are not equal keep heavy group of 3 and weigh 2 of the balls. if equal heaviest ball is one you didn't weigh. If not equal the heavy ball is obvious. 2 times. 8 balls. 1st step: [3] [3] [2] 2nd step: [[1] [1] [1]] [[1] [1] [1]] [[1] [1]] No idea The fewest number of times to use the scale to find the heavier would be Eight to One times ? It will actually be 1 because the question asks what's the fewest amount of times which is one because you could just get lucky you can use any method you want it would still be one because that is the fewest amount of turns you can have It's one. The fewest number of tries on using a balance scale would be one. If you put one ball on each side and one is heavier, you have the found the heavier ball. Use an equilateral triangular lamina which is of uniform mass throughout. It is balanced on a pole or a similar structure. Steps: Place 2 balls at each corner (total 6 balls) i. if the odd ball is one of those, one side will either go up or go down. Now repeat the process with one ball at each corner including the 2 unbalanced ones. ii. if balance is perfect, repeat the process with the remaining two balls and one of the already weighed balls. test answer 2016-01-12 00:34:07 +0000 Show More Responses You would not be able to find a ball heavier than the others. All eight balls are identical; therefore, they must all be the same weight. Correct answer has already been posted. I just want to contribute some theoretical analysis. Given N balls, one of them is heavier. Finding out the ball requires log3(N) trit of information. (trit is the 3-base version of bit). Each weighing may give you one of the three outcomes: equal, left-heavier, right-heavier. So the amount of information given by each weighing is upper-bounded at 1 trit. Therefore, theoretical lower-bound for number of weighings in the worst case is log3(N), which is actually attainable. So 27 such balls need only 3 weighings and 243 balls need only 5 weighings, etc. 3 2 as many have indicated above. The 3 is the kneejerk reaction but 2 is the correct answer. Marty's answer is correct, but he does not explain why. The logic of the balance scale is three-valued: . Its most efficient use is the recursive application of the three-valued logic until there is only one item left. The integral ceiling of ln(x)/ln(3) thus gives the fewest number of times you have to use the balance scale to find the uniquely heaviest ball of x balls. Ceiling(ln(8)/ln(3)) = 2. |

GIven 9 balls all of which weigh the same except for one, what is the minimum of weighings necessary to find the ball weighs more (or less). 28 AnswersAnswer = Maximum of three steps to find heavy ball. Put one tennis ball aside and put the other 8 on the scale - 4 on each side. If the scale is balanced you're done - the one you put aside is the heavy ball If not Remove the 4 balls on the light side of the scale. The heavy ball is one of the four still on the scale. Spit these four in two on each side of the scale. Remove the two on the light side of the scale. The heavy ball is one of the two remaining balls on the scale. Split the two remaining balls. Your done. Solution #2 - heavier ball found in two steps: Step 1: group 9 balls in sets of 3. Reserve 3 balls(a), put 3 on each side of scale(b) and (c). Observe that heavier ball is in one of three sets, (a), (b) or (c) - either the scale side that dropped or the reserved set, if the scale balanced. Step 2: Split the set with the heavier ball - reserve one and place one on each side of the scale. Observe that heavier ball is one of the 3 balls, - either the scale side that dropped or the reserved ball, if the scale balanced. Solved in two steps. While the solution above is correct, more or less, you first should clarify the question and spell out any assumptions. The assumption here is that you know or are aware beforehand that only one ball is of different weight. Sometimes your ability to clarify and state assumptions is more valuable than getting the right answer. Sometimes you can arrive at the right answer with the wrong logic which helps you solve this problem, but may mess you up in the future. You could do this with two weighings assuming its a two pan balance - (1) place three balls on each side - if they balance out then its the remaining three that has abnormal ball (2) out of that group, place one ball on each side - if balances it out, the abnormal ball is the remaining one. If the weighing in step (1) does not balance out, grab the group of three balls that is light or heavy and repeat step (2) described above. Show More Responses I began with the assumption you could do this with a minimum of three, but I now believe it's four. Perhaps I'm over thinking it though, so I'll explain my "solution". Step 1. Start with three balls on either side of the scale, with a third set waiting on the sidelines. If the scale is balanced, you can move onto the three waiting. 2. place one ball on either side, again with the last one waiting. Should the scales be balanced, it's the last one. 3. If they aren't, take the heavier side off, and place the waiting ball on, if they balance. It's the one you just removed. If they're off canter again, it's whichever side was inconsistent. The hitch with the fourth measurement comes due to the little trip up in the question "To find the ball that weighs more (or less)." If you don't know from the start if you're looking for a heavier or lighter ball, should the scales be off on the first measurement, you'll need to replace three of the balls with the reserves to determine which ones are the odd batch out. The comment about the assumptions is absolutely spot on. For example, I like the answer that says ONE step (weighing) but this assumes a balance scale is used not a device that weighs each ball. Based upon a weighing device that weighs each ball and remembering the question is the MINIMUM number of weighings then the answer is THREE - here is the logic. Each weighing weighs one ball. The minimum number of weighings to identify a difference is two, i.e the first two balls are different in weight. The third weighing will confirm which of the previous two is part of the set of eight balls with the other being the odd one out. Simple....8 of the balls are hollow.....1 is not. Maybe I'm slow but....if I put set A and set B on the scale while reserving set C, and if set A is heavier than set B, how do I know if set C is equal to set A or B without weighing it? Notice the question says "more (or less)". In other words, why wouldn't I have to weigh set C? (This is assuming each set is of 3 balls.) Suncoastgal has a point, and most of the answers above are simplifying this problem a bit. You are not told if the odd ball is heaver or lighter, which complicates things. The most efficient method is that described by 'questions like this...' as method 2. Split balls into 3 groups and weigh two. The worst outcome is if the groups do not weigh the same, so assume that happens. All you know now is that the odd ball is NOT in the reserved group of 3, so set those aside. You don't know which of the two weighed groups contains the odd ball, so now you have 6. Repeat the first step with groups of 2 balls. Again the worst outcome is that the scales don't balance, so you've eliminated 2 more balls and only know that the odd ball is one of 4. As near as I can tell, you still need 2 more steps now to guarantee finding the odd ball: Choose any two balls from the 4 and compare. If they are the same, the odd ball is in the reserved 2, if they differ the odd ball is one of the two you weighed. Now take one of the two balls that might be odd, and weigh against one of the balls you have been setting aside as 'normal'. By the way, although you now know which ball is odd, you may still not know if it's heavier or lighter. If the last weighing balances, you only know that the other ball is odd, and you would have to weigh it against one of the 'normal' balls to see how it is off. You can do this problem in only 2 weighings if you are told whether the odd ball is heavy or light before you begin. Suncoastgal has a point, and most of the answers above are simplifying this problem a bit. You are not told if the odd ball is heaver or lighter, which complicates things. The most efficient method is that described by 'questions like this...' as method 2. Split balls into 3 groups and weigh two. The worst outcome is if the groups do not weigh the same, so assume that happens. All you know now is that the odd ball is NOT in the reserved group of 3, so set those aside. You don't know which of the two weighed groups contains the odd ball, so now you have 6. Repeat the first step with groups of 2 balls. Again the worst outcome is that the scales don't balance, so you've eliminated 2 more balls and only know that the odd ball is one of 4. As near as I can tell, you still need 2 more steps now to guarantee finding the odd ball: Choose any two balls from the 4 and compare. If they are the same, the odd ball is in the reserved 2, if they differ the odd ball is one of the two you weighed. Now take one of the two balls that might be odd, and weigh against one of the balls you have been setting aside as 'normal'. By the way, although you now know which ball is odd, you may still not know if it's heavier or lighter. If the last weighing balances, you only know that the other ball is odd, and you would have to weigh it against one of the 'normal' balls to see how it is off. You can do this problem in only 2 weighings if you are told whether the odd ball is heavy or light before you begin. If the question to identify the odd ball (heavy or light) out of 9 balls is read literally, then the answer is 1 weighing (under the most luckiest of circumstances): weigh 2 sets of 4 balls against each other using a double-pan balance and if you're lucky it will weigh evenly, allowing identification of the not-weighed 9th ball as the odd ball. (The question doesn't say you need to identify whether it was heavy or light.) If the question is what is the least number of weighings it takes to identify the odd ball under the least lucky circumstances then the answer is 4, as best I can come up with. 1. Weigh 2 sets of 3 balls against each other, setting aside the 3rd set of 3 balls. The least lucky result ("LLR") is an imbalance. However, this does identify the 3rd unweighed set as all standard balls. 2. Here's where creative problem solving/out-of-box thinking comes into play. Take a red and black marker and mark one of the heavy balls red and one of the light balls black. Switch the marked balls. LLR --> still an imbalance, though imbalance must remain in the same direction since there is only 1 odd ball (yet to be identified). 3. Repeat step 2 (mark one of the unmarked heavy balls red and one of the unmarked light balls black, switch them and reweigh). LLR --> still an imbalance. 4. Take one of the 3 unweighed balls, previously set aside from the 1st weighing, and substitute it for the last remaining unmarked heavy ball. If this last weighing results in an imbalance then the odd ball is the last remaining light ball (and is light, obviously). If the weighing results in a balance, then the removed unmarked heavy ball was the (heavy) odd ball. These type of interview questions are so lame. They don't sniff out the lazy people, the coders who write crap no one can decipher, and can't or won't write maintainable code. Yes you want people who can problem solve and break down problems into manageable chunks, but how often do software projects fail? Answer = 70-90% and that's mostly due to poor management, not giving clients what they want, feature creep, poor quality, etc. So how is answering this question going to tell me that this new hire has integrity and can throw out his ego and write code for a real life product that people want to use? No wonder so much software is trash. (And yes I've been programming for 25 years and see the same errors happening over and over, it's pathetic and completely fixable.) I read the question as "determine if the odd ball weighs more or less", not "determine which ball is the odd one out". After re-reading the question, it seems like the word "IF" (i.e. "...to find [IF] the ball weighs more (or less)") or the word "THAT" (i.e. "...to find the ball [THAT] weighs more (or less)") is ommitted (purposefully?). I went about answering the my first interpretation and came up with 2 weighings as the MINIMUM required. I assumed we have a scale that can accurately measure the weight in grams (or whatever unit of measurement needed to accurately measure the ball). Step 1. Weigh 8 balls. Divide the total weight by eight. Step 2. Weigh the remaining ball. If you compare the result from each step you'll know if the ball is heavier or lighter than the others. Only 1 step required. Throw all of the balls in a sufficiently deep enough pool of water. The ball that sinks the fastest/slowest is the ball that doesn't weigh the same. If all of the balls float, then it is the ball that is lowest/highest in the water that doesn't weigh the same. Show More Responses The answer should 1 as it asked "the minimum". When you weight 4 balls on each side of the scale and find it equally weight then the 9th ball is definitely the odd ball. You can always got lucky on the first attempt! I understand the Question to be what the minimum of weightings needed is to find out if the different ball weighs more or less than the other 8. The answer is three. 1. You way 1 ball and get its weight 2. Weigh a second and get its weight 3. If they do not weigh the same way a third to see if the different ball is the heavier or lighter one. Or If they weigh the same weigh all the balls and divide by 9 if it is less than one of the balls you weighed the different ball is lighter. If it is more than one of the balls you weighed the different ball is heavier. I agree with Anonymous in that these questions don't tell much about character. However, I can't beleive nobody here is analytical enough to come up with the correct answer. First off, the question is not stated correctly. The scale should be a simple balance, and the objective is to find the "odd" ball AND determine if it is heavy or light. The answer is three. First separate into three groups of three, G1, G2, and G3. In the first two weighings you can determine which group has the "odd" ball AND if the odd ball is heavy or light. Weighing 1 - weigh G1 against G2: Two outcomes 1) G1 == G2 --> Odd ball is in G3, in Weighnig 2, use either G1 or G2 against G3 to determine if Oddball is H or L 2) G1 != G2 -> Odd ball is NOT in G3 but you now know if G1 is heavier or lighter than G2, in Weghing 2, use either G1 or G2 against G3, for instance use G2 and G3, if same, then G1 has oddball and you know if its H or L, if G2 != G3, then G2 has odd ball and you know if it is H or L Now that you know which G it is in And the disposition of the Oddball (Heavy or Light), weigh any two of the Group containing the oddball, and based on your knowledge of wether the oddball is H or L, you know which one it is and its disposition. Any offers?? The question is perfect to define how the person takes directions - how many assumptions the person does before start the job - how many questions the person asks (if asks) to make clarifications before start the job. Also, I see there another result - all answers come finally to two groups of getting result : 1) to get faster the first result but more steps for guaranteed result - from 1 to 4 steps or 1 to 4 weightings for combination 4+4+1 2) to get faster guaranteed result - from 2 to 3 steps for starting combination 3+3+3, I would say that BMF scheme contains one additional step (comparison of weight lighter/heavier - definition what of them is consider to be "odd" ), which in solution structure should be equal to the additional step, so it comes to from 2 to 4 steps but still in 2 to 3 weightings. After all, I would say that you may get from this question: How the person understand the task How many assumptions the person does before start the job How many questions the person asks before start the job How many solutions and ideas the persons generates. How the person make a choice to present one solution from multiple (say fastest first result vs fastest guaranteed result). Etc. The candidate should clarify if they truly mean the minimum to find the odd-weighted once, or everytime. I agree that it only takes one weighing (and some luck) to find it. Actually, the person could randomly guess (not weigh any) and get the right ball. So you need to understand the balance of risk vs. cost. By the way, simple logic problems do trip up people that you don't want working for you (depending on the job). So I like the question. It is interesting to speculate if the question wording is being cute or tricky by saying "more (or less)". Is it just being general and saying find the odd ball, or is it being tricky and saying find the odd ball AND tell me if it is lighter or heavier. I think it is being over thought here and just means find the odd. In that case the answers saying 2 weighings is the best you can guarantee. None of this lucky crap. BMF had it if you had to determine if it was in fact heavier or lighter instead of being told. So if the question had the added clause that if you really tried it and didn't get it in the number of tries you answered (or fewer), then you would be killed, would you still say "just one if you get lucky"? Keep it simple. If it's 3-state balance you need log2(9) / log2(3) attempts since you can encode 9 states using 2 3-bit states. I don't understand why everyone is confused. The question clearly asks to not only find the odd ball out but to also determine if the odd ball is lighter or heavier. The only assumption is that it is a standard two pan balance. My solution is 4 weighings: 1. Divide 9 balls in three groups of 3. Let's name them A,B,C 2. Weigh any two groups of 3. Let's say A and C. (1st weigh) 3. If A and C are equal then the B group is the culprit. 4. Now lets label the B group as B1, B2, and B3 5. Take either two balls from either A or C and measure against two from B let's say B2 and B3. (2nd weighing). If both are equal then B1 is the odd ball. Now weigh B1+ one good ball against the same two good balls used in the previous weighing and compare to see if the ball is heavier or lighter. (3 weighings) If they are not equal then determine if the B group is currently heavier or lighter. Go to step 6. 6. Switch either B2 or B3 with B1. Let's say we replaced B2 with B1. If the weighing is now equal then B2 is the odd ball out. If the weighing is still unequal then B3 must be the ball. Thus we have used a total of only 3 weighings. Since we made note of the weighing in step 5 we know if the odd ball is heavier or lighter. 7. Now if the 1st weighing (between group A and C) was unequal then we need to determine which is the bad group. Thus we need to weigh one of them against group B (which we know is correct) and then proceed with the steps 2-6. So in this case it is one extra weighing which brings a worst case total of 4 weighings. I hope everything made sense. I don't think its possible to get it in 3 AND also find whether the odd ball is lighter or heavier. One thing is for sure: I would have never solved it during the interview since this took way more than 5 min to figure out. I believe the answer is 2. Step 1: Before weighing anything, you separate the balls into groups of three. Step 2: Put one group of three on one side of the scale, and the other group of three on the other side of the scale, leaving still one other group of three somewhere on the side. ---visualization ooo /\ ooo <--------1st weighing ooo <------side group Step 3: If the scale is balanced that means that the heavier ball is in the side group. At this point, you would weigh any two of the remaining three balls. Again, if the scale is balanced, then you know that the only ball left is the heaviest one. If the scale tips to any particular side, on the other hand, then you know that the heavier ball is on that side. Up to this point the number of weighings is 2. Step 4: if on your first weighing with three balls on each side, the scale tips, then your next weighing will be of any two of the three balls which were on the tipping side of the scale. Again.. if the scale is balanced, then the remaining ball must be the heaviest. And if the scale tips to a side, then you know that side has the heaviest ball. Up to this point the number of weighings is also 2. Therefore the minimum number of weighings is 2. You obviously can get away with 1 weighing, but only if you are lucky; weighing 4 against 4 and hoping that the other ball (not weighed) is the heavier one. Otherwise, starting out weighing 4 against 4 will lead to 3 weighings, therefore that solution is not the optimal one. Even starting out with a 2 against 2 scheme, you can have up to 3 weighings until you are absolutely sure of which ball is the heaviest. So, optimally, you will be weighing 3 balls against 3, and the least amount of times you would have to weigh the balls to know for sure which one is heaviest is 2. In lieu of the fact that we don't know whether the ball is heavier or lighter then the rest, you would have to do 3 weighings. 1: ooo/\ooo ooo Do the first weighing as pictured above to isolate the set of balls that you know for a fact weigh the same. Then, in the second weighing, use that set to isolate the set that contains the odd ball. The second weighing should also tell you whether the odd ball is heavier or lighter because of how the scale reacts when you replace the control set with the unknown set. If the scale stays tipped down to the side opposite the control set, then it's heavier. If it stays tipped up, then it's lighter. If the scale was balanced before the second weighing, then you know that the remaining set is the set that has the odd ball, and replacing it with a set that you know all weigh the same should still tell you whether the ball is heavier or lighter by watching how the scale behaves. Then you can proceed to the 3rd weighing to isolate the heavier/lighter ball. So my mistake everyone -- the correct answer is 3 weighings when you don't know if the ball is heavier or lighter. Show More Responses I had this interview question this morning. Those of you who say it has no bearing on determining character are wrong. An arrogant person will present their answer, right or wrong, and say that they are done and it is perfect. It takes humility to consider that your first answer may be wrong, and the interviewer will want to see your process for checking that your answer is correct. Remember, it is the path you take to get to the answer that is more important than getting the answer right. Given 3 step, divide the balls into 3 groups A, B, C, Not knowing which has the heavier or the lighter ball, #1 Step: scale A vs B, If it balanced then we already know that C has the different weight.(but we still dont know if the ball is heavier or lighter. If it did not balance we will know that the OTHER ball is maybe in group A or B. (Note: e.g. A raises and B dropped) #2 Step: scale A vs C, If it balanced then we will know that the OTHER ball is in group B. If it did not balance e.g A raises and C dropped. we now conclude that C and B has the same weight and the OTHER ball is lighter #3 Step: Using the group A ball. scale the 2 balls, if they balance they we will know that the 3rd ball is the one that is different. if it did not balanced then the side where the ball raises is the OTHER ball because from step 2 we already notice that the ball is Lighter. Problem solved! Divide the 9 balls into groups of 3 3 - 3 -3 take first 2 groups on the scale. If they balance out: Take the last group of 3 Divide the last group into 1 - 2 Take the 2 (above) one each of the scale. If they balance out, then the '1' is the heavier one else u get the heavier one. Number of scale measurements required = 2 Balance 4 vs 4, - if balance the excess 1 is the lightest or the heaviest. Don't mind which is the heaviest nor the lightest since the question is OR - you can just have one answer. the minimum would be two. First ball and second ball either one would weight more... since they are asking the "minimum'... if they asked for the maximum then it will take 8 times. |

### Software Engineer at Google was asked...

One independent survey showed that 70% on people asked like coffee. Another independent survey showed that 80% of people like tea. What is the upper and lower bound of peoples who likes both coffee and tea 14 AnswersUpper: 70% Lower: 50% 20, 80 50, 70 Show More Responses It is 70% Both High & Low. Any higher and people don't like Coffee, any lower and they don't like coffee. This is assuming 0% margin of error and a perfect survey. Take 100 people. 1-100. Assume, 1st 70 likes coffee (1-70) and 1st 80 likes tea(1-80). So, atmost 70 can like both tea and coffee. Now, take the same 100 people. Assumed, 1st 70 likes coffee and last 80 likes tea(21-100). So, that make atleast 50 people likes both coffee and tea. So, upper is 70 and lower is 50. Only 70% of people like coffee, so that would be the upper bound since they need to like both coffee and tea. 80% of people like tea, which leaves 20% that don't like tea. Once again, they need to like both coffee and tea, so you subtract the 20% that don't like tea from the upper bound which leaves 50% for the lower bound. This assumes the survey was 100% accurate and had 0% margin of error, which means they would have had to interview the same 100 people in both surveys and the results are only valid for the 100 people surveyed. Only 70% of people like coffee, so that would be the upper bound since they need to like both coffee and tea. 80% of people like tea, which leaves 20% that don't like tea. Once again, they need to like both coffee and tea, so you subtract the 20% that don't like tea from the upper bound which leaves 50% for the lower bound. This assumes the survey was 100% accurate and had 0% margin of error, which means they would have had to interview the same 100 people in both surveys and the results are only valid for the 100 people surveyed. The fact that these are two independent surveys suggests that they were not conducted on the same group of people. Therefore, if we were to extrapolate this survey data for people in general, you can only conclude that the upper limit is 70% but the lower limit can be zero since 100% of the set of people who like coffee may not like tea. Seventy percent of people like coffee so the upper bound is limited by that seventy. 80 percent of the people who like tea multiplied by 70 percent who may like coffee is 56 percent, so 56 lower 70 upper. This problem reminds me of a convolution operation. Convolve 1111111000 with 1111111100 and you sortof get your answer. Assuming the two independent surveys have been done on the same sample of people, following a consistent set of rules: n(AUB) = n(A)+ n(B) - n(A intersection B) Assuming a population of 10 people: 10 = 7 + 8 - x or, x= 5 or, 50% = lower limit And of course the max will the min(coffee lovers, tea lovers) = min(7,8)= 7 ~ 70% Rock has it right. The trick is that it is; two independent studies, not we asked the same group. 70% is the easy part but of those 70% that like coffee 80% like tea so that means at least 56% like both Given that they were the same set of people. Or assuming that the sample size was large and a representative of entire population, the lower bound is 50% and the upper bound is 70%. Here's how: Let the population be represented by 10 dashes: Worse Case: - - - - - - - - - - (total) - - - - - - - (70% coffee) - - - - - - - - (80 % tea) If you take the common of above two, you get 5 dashes. Meaning 50% atleast like both coffee and tea Best case: - - - - - - - - - - (total) - - - - - - - (70% coffee) - - - - - - - - (80 % tea) Which gives you 70% Show More Responses Key is "two independent surveys". Also note that it is not mentioned anywhere that both surveys had options of coffee and tea or they were the only options. So, lets say there are 200 people of which 70 like coffee and 80 like tea. We don't anything about remaining 50. They could like liquor for all we know. Maximum liking both tea and coffee: 150 out of 200 i.e. in survey one who said they like coffee also like tea and similarly in survey two who said they like tea also like coffee. Hence, 3/4 or 75% is the upper limit. Lower bound: 0%. None of them liking coffee like tea and vice-versa. Remaining ones like coconut water :) |

**1**–

**10**of

**8,900**Interview Questions

## See Interview Questions for Similar Jobs

- Pharmacy Technician
- Social Worker
- Hospitality
- Graphic Designer
- Accountant
- Healthcare
- Dental Assistant
- Registered Nurse
- Receptionist
- Engineering
- Marketing
- Security Guard