07. Brainteasers Flashcards
You play a game of dice where you are paid the equivalent amount of dollars to the number you roll (i.e., if a 4 is rolled then you get $4). You roll one fair six-sided die. How much are you willing to pay for this roll?
The expected return is every possibility multiplied by the probability of the possibility. The average of all the potential die rolls, which each have equal probabilities, is $3.50, the midpoint between 1 and 6.
How much would you pay to play the same game, but with the option to roll again? If you only roll once you get that score, if you choose to roll again you get the score of the second roll.
Intuitively, you know the price should be higher since you’re given the option to roll again if you’re dissatisfied with your first roll. You should only roll a second time if the first roll is less than 3.5, the expected value. Thus, you have the following six scenarios: rolling 4, 5, 6 and stopping, or rolling 1, 2, 3, and rolling again. Again, the expected roll is 3.5, so the latter three outcomes have expected returns of 3.5. Therefore, a game of two rolls’ expected return is (4 +5 + 6 + 3.5 + 3.5 + 3.5)/6 = $4.25.
Again, same games, option for a third roll now. How much will you pay?
Follow the same logic as before; two rolls have an expected return of 4.25 so you will only roll a third time if you get above that. You have an expected return of (4.25 + 4.25 + 4.25 + 4.25 + 5 + 6)/6 = $4.67. As the number of rolls approaches infinity, the price you pay gets closer to $6.00.
You are given a length of rope, which can be lit to burn for an hour. However, the rope burns unevenly (meaning half of it burnt does not indicate a half-hour has passed). How would you burn the rope to know that a half-hour has passed?
To measure a half-hour, burn both ends at once. One side will burn faster than the other, but the opposite side will burn slower such that when they meet, the equivalent of half the time has passed.
If you were given two ropes, how would you measure 45 minutes?
For two ropes, take one rope and burn both ends like the previous situation. At the same time, light the second rope on only one end. When the first rope burns out, a half hour has passed. The second rope only has 30 more minutes on it. Immediately burn the opposite end of the second rope. The fire will meet at both ends again, which is fifteen minutes.
What is 22 times 22?
The interviewer wants you to solve these types of questions quickly and without using paper. Just break down the numbers to simple ones you can do in your head. 22 times 20 is 440. There is an additional two instances of 22, which is 44 and then you can add it to 440 so that the answer is 484.
What is the sum of the numbers between 0-100?
The trick is you have 50 pairs, which each sum to 100 (e.g. 0 + 100, 1 + 99, 2 + 98…49 + 51). So, 50 * 100 = 5,000 plus the midpoint of 50 = 5,050.
You have stacks of quarters, dimes, nickels and pennies. The number of coins in the stacks is irrelevant. You can take coins from a stack in any amount, any order, and place them in your hand. What is the greatest dollar value in coins you can have in your hands without being able to make change for a dollar with the coins in your hand?
Start adding the highest coin to your hand, the quarter. Four quarters make a dollar, so you can only have three quarters: $0.75. Five dimes would bring it to a dollar, so you can only have four dimes: $1.15 = 0.75 + .40. You can’t add a nickel because three quarter, two dimes, and the additional nickel would create a dollar. But you can add four pennies for a maximum total of $1.19 = 1.15 + .04.
What is the probability of drawing two sevens in a card deck?
You can multiply the individual probabilities to get the cumulative probability. There are four 7s in a deck of 52 cards. Therefore, the probability of drawing the first 7 is 4/52 or 1/13. On the second draw, there are only three 7s in a deck of 51 cards, yielding a probability of 3/51 or 1/17. So 1/13 multiplied by 1/17 equals a cumulative probability of 1/221. (Don’t expect to be able to use paper or a calculator for 13 times 17. You can just simplify the math in your head by saying 17 times 10 is 170, plus 3 times 13 which is 39, and yields 221.)
You’ve got a 10 x 10 x 10 cube made up of 1 x 1 x 1 smaller cubes. The outside of the larger cube is completely painted. On how many of the smaller cubes is there any paint?
First, note that the larger cube is made up of 1000 smaller cubes. Think about how many cubes are NOT painted. 8 x 8 x 8 inner cubes are not painted which equals 512 cubes. Therefore, 1,000 - 512 = 488 cubes that have some paint. Alternatively, you can calculate this by recognizing that two 10 x 10 sides are painted (200) plus two 10 x 8 sides (160) plus two 8 x 8 sides (128): 200 + 160 + 128 = 488.
What is the square root of 7,000,000 (approximately)?
You know that 2 * 2 = 4 and that 3 * 3 = 9, and that 1,000 * 1,000 = 1,000,000 so the answer has to be between 2,000 and 3,000. Edge closer in, 2.5 * 2.5 = 6.25 and 2.7 * 2.7 = 7.29 so the answer is approximately 2,600.
A closet has three light bulbs inside. Next to the door (outside) are three switches for each light bulb. If you can only enter the closet one time, how do you determine which switch controls which light bulb?
Turn on two switches, A and B, and leave them on for a few minutes. Then turn off switch B and enter the room. The bulb that is lit is controlled by switch A. Touch the other two bulbs, which are off. The one that is still warm is controlled by switch B. The third bulb, off and cold, is controlled by switch C.
Four investment bankers need to cross a bridge at night to get to a meeting. They have only one flashlight and 17 minutes left to get to the meeting. The bridge must be crossed with the flashlight and can only support two bankers at a time. The analyst can cross in one minute, the associate can cross in two minutes, the VP can cross in five minutes and the MD takes 10 minutes to cross. How can they all make it to the meeting in time?
First, the analyst takes the flashlight and crosses the bridge with the associate. This takes two minutes. The analyst then returns across the bridge with the flashlight, taking one more minute (three minutes passed so far). The analyst gives the flashlight to the VP and the VP and MD cross together, taking 10 minutes (13 minutes passed so far). The VP gives the flashlight to the associate, who re-crosses the bridge taking two minutes (15 minutes passed so far). The analyst and associate now cross the bridge together taking two more minutes. Now, all are across the bridge for the meeting in exactly 17 minutes.
A lily in a pond doubles every minute. After an hour, the lily fills the entire pond. When is it one-eighth full?
Work backwards. At 59 minutes, it is half full. At 58 minutes, it’s one-fourth full. Thus, after 57 minutes, it is one-eighth full.
What is larger, 3^4 or 4^3?
3^4. In most combinations, the lower number ^ higher number is higher than vice versa because the higher exponential has a powerful multiplier effect. However, 2^3 is higher than 3^2, but you can solve that particular anomaly in your head.
Say you are driving two miles on a one-mile track. You do one lap at 30 miles per hour. How fast do you need to go to average 60 miles an hour?
Don’t be inclined to guess 90, because the average of 90 and 30 mph is 60 mph. You completed half your goal by going 30 mph. So that first mile took you one- 30th of an hour or two minutes. However, if you averaged 60 mph for two miles, then that should take two-60ths of an hour or two minutes to drive two miles. You already drove for two minutes on that first lap, so it’s impossible to average 60 mph. This was a trick question.
You have a five-gallon jug and a three-gallon jug. You must obtain exactly four gallons of water. How will you do it?
- Fill the three-gallon jug with water and pour it into the five-gallon jug. Repeat.
- Because you can only put two more gallons into the five-gallon jug, one gallon will be left over in the three-gallon jug.
- Empty out the five-gallon jug and pour in the one gallon.
- Now just fill the three-gallon jug again and pour it into the five-gallon jug.
(Mathematically, this can be represented 3 + 3 - 5 + 3 = 4)
You are faced with two doors. One door leads to your job offer (that’s the one you want!), and the other leads to the exit. In front of each door is a guard. One guard always tells the truth. The other always lies. You can ask one question to decide which door is the correct one. What will you ask?
The way to logically attack this question is to ask how you can construct a question that provides the same answer (either a true statement or a lie), no matter who you ask.
There are two simple answers. Ask a guard: “If I were to ask you if this door were the correct one, what would you say?” The truthful consultant would answer yes (if it’s the correct one), or no (if it’s not). Now take the lying consultant. If you asked the liar if the correct door is the right way, he would answer no. But if you ask him: “If I were to ask you if this door were the correct one, what would you say,” he would be forced to lie about how he would answer, and say yes. Alternately, ask a guard: “If I were to ask the other guard which way is correct, what would he say?” Here, the truthful guard would tell you the wrong way (because he is truthfully reporting what the liar would say), while the lying guard would also tell you the wrong way (because he is lying about what the truthful guard would say).
If you want to think of this question more mathematically, think of lying as represented by -1, and telling the truth as represented by +1. The first solution provides you with a consistently truthful answer because (-1)(-1) = 1, while (1)(1) = 1. The second solution provides you with a consistently false answer because (1)(-1) = -1, and (-1)(1) = -1.
Why are manhole covers round?
The classic brainteaser, straight to you via Microsoft (the originator). Even though this question has been around for years, interviewees still encounter it.
Here’s how to “solve” this brainteaser. Remember to speak and reason out loud while solving this brainteaser!
Why are manhole covers round? Could there be a structural reason? Why aren’t manhole covers square? It would make it harder to fit with a cover. You’d have to rotate it exactly the right way. So many manhole covers are round because they don’t need to be rotated. There are no corners to deal with. Also, a round manhole cover won’t fall into a hole because it was rotated the wrong way, so it’s safer.
Looking at this, it seems corners are a problem. You can’t cut yourself on a round manhole cover. And because it’s round, it can be more easily transported. One person can roll it.
A car travels a distance of 60 miles at an average speed of 30 mph. How fast would the car have to travel the same 60 mile distance to average 60 mph over the entire trip?
Most people say 90 mph but this is actually a trick question! The first leg of the trip covers 60 miles at an average speed of 30 mph. So, this means the car traveled for 2 hours (60/30). In order for the car to average 60 mph over 120 miles, it would have to travel for exactly 2 hours (120/60). Since the car has already traveled for 2 hours, it is impossible for it to average 60 mph over the entire trip.
You are given 12 balls and a scale. Of the 12 balls, 11 are identical and one weighs slightly more. How do you find the heavier ball using the scale only three times?
(1) Weigh five balls vs five balls.
(2) If the same, weigh the remaining two balls to determine which one is heavier. If not the same, weigh two vs two from the heavier group.
(3) If the same, then the fifth ball is the heavier one. If not the same, weigh one vs one from the heavier group in order to determine which one is heavier
You have 12 balls. All of them are identical except one, which is either heavier or lighter than the rest. The odd ball is either hollow while the rest are solid, or solid while the rest are hollow. You have a scale, and are permitted three weighings. Can you identify the odd ball, and determine whether it is hollow or solid?
For simplicity’s sake, we will refer to one side of the scale as Side A, and the other as Side B.
Step 1: Weigh four balls against four others.
Case A: If, on the first weighing, the balls balance
If the balls in our first weighing balance we know the odd ball is one of those not weighed, but we don’t know whether it is heavy or light. How can we gain this information easily? We can weigh them against the balls we know to be normal. So:
Step 2 (for Case A): Put three of the unweighed balls on the Side A; put three balls that are known to be normal on Side B.
I. If on this second weighing, the scale balances again, we know that the final unweighed ball is the odd one.
Step 3a (for Case A): Weigh the final unweighed ball (the odd one) against one of the normal balls. With this weighing, we determine whether the odd ball is heavy or light.
II. If on this second weighing, the scale tips to Side A, we know that the odd ball is heavy. (If it tips to Side B, we know the odd ball is light, but let’s proceed with the assumption that the odd ball is heavy.) We also know that the odd ball is one of the group of three on Side A.
Step 3b (for Case A): Weigh one of the balls from the group of three against another one. If the scale balances, the ball from the group of three that was unweighed is the odd ball, and is heavy. If the scale tilts, we can identify the odd ball, because we know it is heavier than the other. (If the scale had tipped to Side B, we would use the same logical process, using the knowledge that the odd ball is light.)
Case B: If the balls do not balance on the first weighing If the balls do not balance on the first weighing, we know that the odd ball is one of the eight balls that was weighed. We also know that the group of four unweighed balls are normal, and that one of the sides, let's say Side A, is heavier than the other (although we don't know whether the odd ball is heavy or light). Step 2 (for Case B): Take three balls from the unweighed group and use them to replace three balls on Side A (the heavy side). Take the three balls from Side A and use them to replace three balls on Side B (which are removed from the scale). I. If the scale balances, we know that one of the balls removed from the scale was the odd one. In this case, we know that the ball is also light. We can proceed with the third weighing as described in step 3b from Case A. II. If the scale tilts to the other side, so that Side B is now the heavy side, we know that one of the three balls moved from Side A to Side B is the odd ball, and that it is heavy. We proceed with the third weighing as described in step 3b in Case A. III. If the scale remains the same, we know that one of the two balls on the scale that was not shifted in our second weighing is the odd ball. We also know that the unmoved ball from Side A is heavier than the unmoved ball on Side B (though we don't know whether the odd ball is heavy or light). Step 3 (for Case B): Weigh the ball from Side A against a normal ball. If the scale balances, the ball from Side B is the odd one, and is light. If the scale does not balance, the ball from Side A is the odd one, and is heavy. (more of this brainteaser on next page) Whew! As you can see from this solution, one of the keys to this problem is understanding that information can be gained about balls even if they are not being weighed. For example, if we know that one of the balls of two groups that are being weighed is the odd ball, we know that the unweighed balls are normal. Once this is known, we realize that breaking the balls up into smaller and smaller groups of three (usually eventually down to three balls), is a good strategy - and an ultimately successful one.
A company has 10 machines that produce gold coins. One of the machines is producing coins that are a gram light. How do you tell which machine is making the defective coins with only one weighing?
Think this through - clearly, every machine will have to produce a sample coin or coins, and you must weigh all these coins together. How can you somehow indicate which coins came from which machine? The best way to do it is to have every machine crank a different number of coins, so that machine 1 will make one coin, machine 2 will make two coins, and so on. Take all the coins, weigh them together, and consider their weight against the total theoretical weight. If you’re four grams short, for example, you’ll know that machine 4 is defective.
The four members of U2 (Bono, the Edge, Larry and Adam) need to get across a narrow bridge to play a concert. Since it’s dark, a flashlight is required to cross, but the band has only one flashlight, and only two people can cross the bridge at a time. (This is not to say, of course, that if one of the members of the band has crossed the bridge, he can’t come back by himself with the flashlight.) Adam takes only a minute to get across, Larry takes two minutes, the Edge takes five minutes, and slowpoke Bono takes 10 minutes. A pair can only go as fast as the slowest member. They have 17 minutes to get across. How should they do it?
The key to attacking this question is to understand that Bono and the Edge are major liabilities and must be grouped together. In other words, if you sent them across separately, you’d already be using 15 minutes. This won’t do. What does this mean? That Bono and the Edge must go across together. But they can not be the first pair (or one of them will have to transport the flashlight back).
Instead, you send Larry and Adam over first, taking two minutes. Adam comes back, taking another minute, for a total of three minutes. Bono and the Edge then go over, taking 10 minutes, and bringing the total to 13. Larry comes back, taking another two minutes, for a total of 15. Adam and Larry go back over, bringing the total time to 17 minutes.