A.5. Brain teasers

A.5.1. Estimation

What’s an estimate for how many mini shampoo bottles are used by all the hotels in the United States in a year?

Example answer

I estimate the number of bottles by using the following formula:

number of hotels in the US * average number of rooms per hotel * 1 shampoo
bottle per occupied room per night * average room utilization * 365 days per
year = number of shampoo bottles per year

Then I estimate the numbers in the formula:

  • Number of hotels in the United States— If I assume that there is a hotel for every 5,000 people in the country, and there are around 300 million people in the country, that’s 60,000 hotels.
  • Number of rooms per hotel— Fifty seems like a decent guess for the average number of rooms in a hotel from the hotels I’ve stayed in.
  • Average room utilization— Because hotels need to be profitable, I’ll guess that each night, a room has an 80 percent chance of being occupied.

This makes the formula 60,000 * 50 * 1 * 0.8 * 365 = 876 million bottles.

Notes

The solution to this question is to come up with a formula for the number you’re trying to estimate and take a guess at the numbers to put in the formula. There are many, many versions of this question, from “How many ping-pong balls can fit into a Boeing 747 airplane?” to “How many pianos are there in France?” The interviewer is looking to see whether you can come up with a formula that makes some sense and that your logic for guessing each of the numbers in the formula makes sense. There’s almost no chance that you’ll get the number close to right during the interview (we have no idea whether 50 is a good guess for the average number of hotel rooms, for example), but that’s not important.

There isn’t much you can do to prepare for these questions except practice the improvisational component of coming up with formulas and estimates on the fly.

A.5.2. Combinatorics

Imagine a grid like the one pictured above, with a mouse at the bottom-left corner of the grid. At the top-right corner is a piece of cheese. The mouse can travel only along the lines in the grid and would never move away from it. How many paths are there from the mouse to the cheese?

Example answer

To get to the cheese, the mouse has to move one space alone a horizontal line in the grid nine times and then move one space along a vertical line in the grid six times (because the grid is 9x6). Let’s call a horizontal move H and a vertical move V. Then any string with 9 Hs and Vs is a valid path from the start to the end. Going straight up and then to the right, for example, would be VVVVVVHHHHHHHHH. There are 15 factorial (15!) ways to arrange 15 distinct characters, which are called permutations, but because 6 of them are the same letter (V) and 9 of them are the same letter (H), we have to remove all the duplicate arrangements. We can remove them by counting how many duplicates there are of each. The Vs are duplicated 6! times (the number of ways they can be arranged), and the Hs are duplicated 9! times. That means that the answer is 15!/(6!)/(9!), or 5,005 paths.

Notes

This question is a really hard one to answer. First, it’s hard to know the right answer. If you’ve somehow studied the field of combinatorics, you may know it; otherwise, it’s hard to suddenly realize that you can think of the problem as arranging paths. Even if you see that way of formulating the problem, you may not know how to count the number of solutions.

Second, even if you know the answer, it’s hard to give it in a way that clearly explains the problem and solution without being verbose. You can’t assume that everyone knows terms such as permutation, yet if you were to explain it all, you’d spend too much time on it.

Finally, there really is no way to study for this question. There are so many combinatorics questions that you can’t have answers for all of them prepared in advance. Your best bet for questions like these is to explain your thought process and how you might approach the problem. If the interviewer is putting a lot of weight on questions like this one, that’s a red flag.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset