Drawing based on a shutterstock image

The top 5 coolest questions I was asked during tech interviews

César Ferreira
3 min readJan 13, 2016


These are some of the best logical/reasoning questions/puzzles that I’ve been asked during tech interviews in the past few years.

Water in a bottle

You have an unlimited supply of water. Given a 3 gallon empty bottle and a 5 gallon empty bottle, get me exactly 4 gallons.

The solution is restricted to the exclusive use of the 3 gallon and the 5 gallon containers.

3 bulbs in a room

There is a room which has 3 bulbs inside it and one door. Now the switches of all three are placed outside, behind the room. The three switches are similar to each other and you don’t know which switch corresponds to which bulb. You have one chance to set the configuration of the switch in such a manner that you can determine which switch corresponds to which bulb?

Which is the bad coin?

You have 12 coins. One of them is either heavier or lighter than the others — you don’t know which. You only have a jeweler’s balancing scale — so, there are just two sides that will either balance or not, according to which coins you put on each side.

What is the minimum number of weighings with which you can find out the bad coin and also tell whether it is heavier or lighter than the others?


You are in a dark room. In the sock drawer you’ll find 5 blue socks, 5 red socks and 10 white socks.

What is the minimum number of socks that you need to bring to the corridor to be sure that you have at least 1 pair of socks with the same color?

Blind pills

You are blind. You are in your kitchen and on the kitchen’s table there are 4 pills, 2 blue and 2 red. They have the same weight, size, form and smell, so they can’t be distinguished by someone who can’t see. You need to take only 1 red and 1 blue pill, if you take 2 blue or 2 red you’ll die instantly.

Given that you are alone, how can you be sure that you are taking one of each?




César Ferreira

Senior Android Developer, currently working as a Tech Lead @GlueHome. More on me @ https://cesarferreira.com