Software Engineering Interview Questions | Glassdoor

Find jobs for Software Engineering

Software Engineering Interview Questions

36,080

Software engineering interview questions shared by candidates

Top Interview Questions

Sort: RelevancePopular Date

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?

45 Answers

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

In front of you are three light switches. Only one does anything, and it turns on the light downstairs. From here you can't see the light, and it makes no sound. You must determine which switch operates the light, BUT you can only go check it once. How do you figure out which switch is for the light?

26 Answers

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 Answers

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.

37 Answers

There are three boxes, one contains only apples, one contains only oranges, and one contains both apples and oranges. The boxes have been incorrectly labeled such that no label identifies the actual contents of the box it labels. Opening just one box, and without looking in the box, you take out one piece of fruit. By looking at the fruit, how can you immediately label all of the boxes correctly?

38 Answers

Given the list of points of the skyline of a city in order (from East to West) Find the maximal rectangle contained in this skyline. I was asked to write the code. I managed to find the algorithm but was not sufficient.

21 Answers

The only unexpected question was to design a employee database because it wasnt in the previous thread :) but it was easy

18 Answers

A train leaves San Antonio for Huston at 60mph. Another train leaves Huston for San Antonio at 80mph. Huston and San Antonio are 300 miles apart. If a bird leaves San Antonio at 100mph, and turnes around and flies back once it reaches the Huston train, and continues to fly between the two, how far will it have flown when they collide.

16 Answers

Given the daily values of a stock, find how you can lose the most with one buy-sell trading.

14 Answers

Given a list of n objects, write a function that outputs the minimum set of numbers that sum to at least K. FOLLOW UP: can you beat O(n ln n)?

15 Answers
110 of 36,080 Interview Questions