# software engineer Interview questions in Boston

# 363K

software engineer interview questions shared by candidates### A frog is at the bottom of a 30 meter well. Each day he summons enough energy for one 3 meter leap up the well. Exhausted, he then hangs there for the rest of the day. At night, while he is asleep, he slips 2 meters backwards. How many days does it take him to escape from the well?

105 Answers↳

Never....the frog would be dead by day 10 since nothing to eat or drink.

↳

I agree -- it's 28...because on that morning, he'll be at 27 metres and he can jump to the top in one bound. Less

↳

Assuming it doesn't die of starvation, the answer is 28 days.* start of day 1 (0 days elapsed): 0m --> 3m (then falls back 2m by start of day 2) start of day 2 (1 day elapsed): 1m --> 4m start of day 3 (2 days elapsed): 2m --> 5m ... start of day 28 (27 days elapsed): 27m --> 30m start of day 29 (28 days elapsed): 28m --> 31m In other words, 28 days will have elapsed before the frog can jump to a height exceeding 30m.* * This answer assumes the frog is not able to walk away after it hits 30m. I would assume it has no energy left to climb out based on the problem description. If the questioner disagrees with this assumption, then the answer is 27 days. Less

### Out of 25 horses, pick the fastest 3 horses. In each race, only 5 horses can run at the same time. What is the minimum number of races required?

63 Answers↳

7 races. We run five races with five horses. The five winners race in a sixth race while the 4th and fith place finishers are eliminated from further consideration. The sixth race show horse is faster than all the horses that participated in the preliminary races where the 4th and 5th place horses participated and they are eliminated from further consideration. The other horses in the preliminary race where the 6th race show horse participated are also eliminated. The show horse in the preliminary race where the 6th race place horse participated is eliminated since there are at least three remaining horses that are faster. We are left with 6 horses. We know the winner of the 6th race is fastest overall, so that leaves five horses to enter a 7th race for the overall place and show. Less

↳

Seems to me the correct answer is five. Assuming that each horse's performance is timed, by running five races with five horses each, you'll know the speed of all 25 horses. The three with the shortest times are the three fastest horses. Most responses assume you need multiple rounds, but these responses seem to assume that the five horses that finish first in the first round are the fastest five overall. That may not be the case. Just because a horse beat its four competitors doesn't mean it's one of the five fastest overall ... just that it was faster than the four it competed against. Less

↳

12 RACES ARE REQUIRED -------------------------------------- In the worst case scenario the 'best three' can be from a single team of 5 horses. So 5 races in round one. Chose all the first three of each of the 5 races. 3 races of all the 15 horses which were the 3 winners of the first round. Chose the 9 horses which were winners in round two and have 2 races for the 9 winners[ 5 & 4 horses] you get 6 winners. 1 race of 5 horses, out of the 6 round three winners, keeping one standby 1 race of 4 horses of round four winners with the standby. This will give you the best 3 horses out of 25 So you need to have 5+3+2+1+1 = 12 races in order to get the best three horses. Answer 12 races required. Sometimes the 2nd and/or 3rd best athlete do not get selected if they are teamed in a race along with the best athlete. Less

### Calculate the angle of two clock pointers when time is 11:50.

61 Answers↳

30+25=55 angle between them...

↳

You know that there is 30 degrees between each number on the clock because 360/12 = 30. You know that the minute hand is at exactly 10, while you know that the hour hand is 5/6th of the way to the 12 (from the 11) because 50/60 = 5/6. Therefore to get the total angle, you must add the 30 degrees from the 10 to 11 plus the 5/6 distance from 11 to 12, and you get 30 degrees + (5/6 * 30) = 30 + 25 = 55 degrees. So the final answer is 55 degrees. Less

↳

Anonymous is on the right track with the hour hand going 0.5 degree/minute, but at 11:50 the hour hand is no longer near the 11, it's near the 12. 10 minutes before 12, it is 5 degrees from the 12. The minute hand is 60 degrees from the 12 in the same direction (360 deg=60 minutes, so 60 deg=10 minutes). Angle between the hands is the difference between these two: 60-5 = 55. Less

### How many people flew out of Chicago last year?

62 Answers↳

Actually the answer is zero. Plans fly, people don't.

↳

Roughly as many who flew into Chicago.

↳

My estimate off the top of my head is 30 planes/hr x 24 hr/day x 365 days/yr x 180 people/plane (avg) = 47M and change. Actual for 2014, Domestic and International, is 70M. This is Passenger Volume so # leaving is 35M. Less

### 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?

47 Answers↳

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. Less

↳

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 Less

↳

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 Less

### Allergy,posting date according to timezone,person demographics problem Medication Frequency problem and given error log to identify error Fever temperature problem and discuss a time when you automated a task to make life easier

43 Answers↳

For some questions answers are posted in glassdoor!

↳

Hi...did you answer all the questions correctly?? They asked me the same questions. I have answered the programs correctly except that fever program there i got bit confusion.but I couldn't properly explain the error log. Less

↳

Hey i didnt answer all the questions correctly ..they helped me if i am struck .. Less

### attributes of <tr> tag

41 Answers↳

please let me know if anyone got Job

↳

36. If you get call then follow this interview experience

↳

please let me know if any one get offer after 3rd Round .

### What is machine learning, difference between dl and ml?

39 Answers### Puzzle: How do you weight an elephant without using a weigh machine?

39 Answers↳

Not quite. The volume of the water is not the same as the weight of the elephant. You'd have to estimate the density of an elephant and multiply that by the volume of the water to get the mass, then multiply that by the acceleration due to gravity in water system (SI, English Customary, etc.) you're using. Luckily, mammals are mostly water (humans are around 70% water on average), so about 2/3 of the weight of the elephant would be equivalent to the weight of the water displaced. So you would have to estimate how dense the rest of the elephant is (since it'd be minerals and such, I'd say it's more dense than water) and follow the steps described above. Less

↳

As it is not specified that the International System of Units must be used, define the Elephant unit (E) as the weight of your elephant. Your elephant then weights exactly 1E. Less

↳

Simple answer : Use a beam balance . Put elephant on one side and start throwing weights on the other side . When the beam is balanced you got the weight of the elephant equal to the sum of weights on the other ! Less

### You have two lightbulbs and a 100-storey building. You want to find the floor at which the bulbs will break when dropped. Find the floor using the least number of drops.

36 Answers↳

Actually, 16 is not the optimal, nor is 15; you can do it in 14. Here is one solution (there are at least 5 other equivalents): * Drop first bulb at 14th, 27th, 39th, 50th, 60th, 69th, 78th, 85th, 91st, 96th, and (optionally) 100th until it breaks. * Go to the highest floor where the first bulb didn't break. * Repeatedly go up one floor and drop the second bulb. When it breaks, you have your answer. Why is 14 optimal? Since you are decrementing each time, you want (n) such that sum(1..n) barely reaches 100. The answer is n=14. Generally, if the number of floors is (f), the lowest number of drops is ceil((sqrt(8*f+1)-1)/2). This is the best worst-case scenario. An interesting related question is what gives the lowest expected number of drops. And no, I could not have gotten this in an interview. Less

↳

19 drops is not the best worst case scenario... imagine trying floor 16, if it breaks, you try 1 - 15 and thats 16 tries. if it doesn't break, then try floor 31 and if it breaks, then try 17 - 30 (so 16 tries, including the try on floor 16). And on and on (45, 58, 70, 81, 91, 100). If you reach 91, you'll have tried 7 floors so far and if it doesn't break, then there's 9 more tries to get to 100 (thus 16 in the worst case) Less

↳

Go to the 100th floor and drop the first bulb. It WILL break. Done, 1 drop. It doesnt say whats the lowest floor it will break at, just at what floor will it break with least drops. Thus floor 100. Less