Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Table of contents
1.
Introduction 
2.
Puzzle Interview Questions
2.1.
3 Bulbs & 3 Switches Puzzle
2.2.
10 Coins Puzzle
2.3.
Heaven & Hell Puzzle
2.4.
8 Balls Problem Puzzle
2.5.
Measuring Time with Hourglasses Puzzle
2.6.
Two Pills Each Day Puzzle
2.7.
Two Numbers Puzzle
2.8.
Arrange Cubes Puzzle
2.9.
Desired Gender Ratio Puzzle
2.10.
Next Number Puzzle
2.11.
Balls in Lines Puzzle
2.12.
Melting Candles Puzzle
2.13.
Red Hat vs Blue Hat Puzzle
2.14.
Bee Travel Puzzle
2.15.
Finding the Defective Ball Puzzle 
3.
Conclusion
Last Updated: Jul 1, 2024
Easy

Puzzle Interview Questions

Introduction 

Puzzle interview questions are a type of brainteaser used by some companies during job interviews. These questions test a candidate's problem-solving skills, creativity & logical thinking. They usually involve solving a tricky problem or puzzle that requires "thinking outside the box." 

Puzzle Interview Questions

In this article, we'll answer 15 common puzzle interview questions with explanations of how to approach & solve each one. You'll learn strategies for tackling these types of questions which might help you to impress interviewers with your sharp analytical abilities.

Puzzle Interview Questions

3 Bulbs & 3 Switches Puzzle

Problem: You have 3 light bulbs in a room upstairs & 3 switches downstairs that control them. You can turn the switches on & off & leave them in any position. How would you figure out which switch corresponds to which bulb if you can only go upstairs one time?

3 Bulbs & 3 Switches Puzzle

Solution:

  1. Turn on switch 1 for a few minutes. Turn it off.
     
  2. Turn on switch 2 & go upstairs.
     
  3. The bulb that is on corresponds to switch 2.
     
  4. Feel the two off bulbs. The warm one corresponds to switch 1 (which you turned on earlier). The cold one corresponds to switch 3.

10 Coins Puzzle

Problem: You have 10 coins, one of which is counterfeit & weighs less than the others. Using a balance scale only 3 times, how can you find the fake coin?

10 Coins Puzzle

Solution:

  1. Split the coins into 3 groups: 3, 3 & 4 coins. Weigh any 2 groups.
     
  2. If they balance, the counterfeit is in the group of 4. Weigh 2 of those 4 coins against each other.
  • If they balance, the fake coin is one of the other 2.
     
  • If they don't, you found the fake coin.
  1. If the 2 groups didn't balance in step 1, take the lighter group of 3. Weigh any 2 of those 3 coins.
  • If they balance, the fake coin is the 3rd one.
     
  • If not, you just weighed the fake coin against a real one.

Heaven & Hell Puzzle

Problem: In a room, there are 3 switches. Each corresponds to one of three light bulbs in a 2nd room. You can manipulate the switches as you wish & then go into the lightbulb room. How can you tell which switch corresponds to which bulb?

Solution:

  1. Turn on switch 1 for a few minutes & then turn it off.
     
  2. Turn on switch 2 & enter the 2nd room.
     
  3. The on bulb corresponds to switch 2.
     
  4. Feel the off bulbs. The warm one corresponds to switch 1 (which you turned on earlier). The cold one corresponds to switch 3.

8 Balls Problem Puzzle

Problem: You have 8 balls, 7 of equal weight & 1 heavier. Using a balance scale, find the heavy ball using the least number of weighings.

8 Balls Problem Puzzle

Solution: Divide the balls into 3 groups: 3, 3 & 2.

  1. Weigh 2 of the groups of 3 balls against each other.
     
  • If they balance, the heavy ball is in the group of 2. Weigh them to find it.
     
  • If they don't balance, the heavy ball is in the group that weighs more. Take those 3 balls & weigh any 2 of them. -- If they balance, the heavy ball is the one you didn't weigh.
    -- If not, you just weighed it.

Measuring Time with Hourglasses Puzzle

Problem: What time can be measured using only a 4-minute hourglass & a 7-minute hourglass, with the process taking no longer than the time we're trying to measure?

Measuring Time with Hourglasses Puzzle

Solution:

  • 1 minute: Start both hourglasses. When the 4-min one finishes, flip it. When the 7-min one finishes, 1 min has passed in the 4-min glass.
     
  • 2 minutes: Start the 7-min hourglass. Flip the 4-min one when the 7-min one finishes.
     
  • 3 minutes: Start the 7-min hourglass & flip the 4-min one when there is 1 min of sand left in the 7-min one.
     
  • 5 minutes: Start the 4-min glass, & then flip the 7-min one when the 4-min one finishes. When the 7-min one runs out, 5 mins have passed.
     
  • 6 minutes: Start both hourglasses. Flip the 4-min one when it finishes & again when the 7-min one finishes.
     
  • 8 minutes: Start the 7-min hourglass. When it finishes, flip it & start the 4-min one. When the 4-min one finishes, 8 mins have passed.
     
  • 9 minutes: Start both hourglasses. Flip the 4-min one each time it runs out (3 flips total). When no sand remains in either hourglass, 9 mins have passed.
     

So the times possible to measure are 1, 2, 3, 5, 6, 8 & 9 minutes.

Two Pills Each Day Puzzle

Problem: You have 20 pills, 19 of weight 1 gram & 1 pill of 2 grams. You have to take 2 pills per day. How would you make sure that the 2 gram pill is the last one remaining?

Solution: Take 1 pill each day from the bottle & 1 from the pile of pills outside the bottle. This way, the 2 gram pill will always be the last one left.

Initial state: Bottle: 19 (including 2g pill) Outside: 1 Day 1: 18, 2 Day 2: 17, 3 ... Day 9: 10, 10 Day 10: 9, 10 ... Day 18: 1 (2g pill), 1 Day 19: 0, 1 (2g pill)

Two Numbers Puzzle

Problem: Find 2 numbers whose sum is 12 & product is 32.

Two Numbers Puzzle

Solution: Let the numbers be x & y. Given: x + y = 12 x * y = 32
To find: x & y We can write: x * y = (12 - x) * x = 32 12x - x^2 = 32 x^2 - 12x + 32 = 0 (x - 8)(x - 4) = 0 So, x = 8 or 4 If x=8, y=4 & if x=4, y=8 Both satisfy the given conditions. Therefore, the numbers are 4 & 8.

Arrange Cubes Puzzle

Problem: You have two cubes, & put a number on each side of both cubes, if the sum of both cubes' visible numbers was 14, what is the number on the bottom side of each cube?

Arrange Cubes Puzzle

Solution: Let's call the two cubes A & B.

  • The sum of all 6 sides of a cube will be 21 (1+2+3+4+5+6).
     
  • Since the visible sum is 14, the sum of the hidden sides (bottom + top) will be 21-14 = 7.
     
  • We know the top & bottom sides are equal, so each hidden side is 7/2. Therefore, the number on the bottom side of each cube is 3.5 (an impossible scenario with regular number cubes). The puzzle is meant to be tricky as it leads you to believe the cubes are standard dice, but this is not explicitly stated. The numbers could be any values, including fractions, as long as they sum to 14 on the 4 visible sides & 7 on the 2 hidden sides.

Desired Gender Ratio Puzzle

Problem: Each family continues to have babies until they have a son in a country where everyone desires a boy. After a period of time, the country's boy-to-girl ratio is X: 1. What is the value of X?

Desired Gender Ratio Puzzle

Solution: The ratio will be 1:1. Here's why:

  • Each family has a 50/50 chance of having a boy or girl with each birth.
     
  • Families that have a girl will continue having children. Families that have a boy will stop.
     
  • So if the 1st child is a boy, the family has 1 boy. If the 1st child is a girl, they'll continue until they have a boy.
     
  • If the 2nd child is a boy, the family has 1 girl & 1 boy. If the 2nd is a girl, they continue.
     
  • If the 3rd is a boy, it's 2 girls & 1 boy, & so on. This continues with each subsequent birth. When we average this out over the whole population, the gender ratio is 1:1. Mathematically, the expected number of girls in each family is: (0 x 0.5) + (1 x 0.25) + (2 x 0.125) + ... = 1 So on average, each family will have 1 boy & 1 girl, giving a 1:1 ratio.

Next Number Puzzle

Problem: What's the next number in this sequence: 10, 3, 8, 5, 6, 7, 4, 9, 2, 1, 0

Next Number Puzzle

Solution: The next number is 11. The numbers are arranged according to their spellings' lengths:

10 = three letters 3 = five letters 8 = five letters 5 = four letters 6 = three letters 7 = five letters 4 = four letters 9 = four letters 2 = three letters 1 = three letters 0 = four letters

The next number in the sequence with a unique spelling length is 11 (eleven), which has 6 letters.

Balls in Lines Puzzle

Problem: Given 10 balls, arrange them in 5 lines such that each line has exactly 4 balls.

Balls in Lines Puzzle

Solution: 

o

o o 

o o o 

o o 

oo

One ball is shared by 2 lines at each intersection point. With this arrangement, each of the 5 lines has exactly 4 balls.

Melting Candles Puzzle

Problem: You have 2 candles of equal size, each burning for 1 hour. How can you measure 45 minutes using these candles & without melting them? You also have a lighter.

Melting Candles Puzzle

 

Solution: Light candle 1 at both ends & candle 2 at one end.

  • Candle 1 will burn for 30 mins (60/2)
     
  • When candle 1 finishes (at 30 mins), light the other end of candle 2
     
  • Candle 2 will take another 15 mins to finish burning (30/2) So when candle 2 is completely burned, 45 mins have passed.

Red Hat vs Blue Hat Puzzle

Problem: 100 prisoners are given the chance to be set free tomorrow. Each prisoner will be given either a red hat or a blue hat in the morning & will be lined up in fixed order facing forward so each can see the hats of those ahead of them but not their own hat or the hats behind them.

Red Hat vs Blue Hat Puzzle

Solution: Starting from the back, each prisoner will be asked what color his own hat is. He can only say "Red" or "Blue." If his guess is correct, he will be freed. At least 99 prisoners must go free for this to happen. The night before, they can discuss a strategy but cannot communicate once the hats are placed. What strategy maximizes their chance of freedom?

Solution: The 1st prisoner counts the # of red hats. If odd, he says "Red," if even, he says "Blue." This allows the other prisoners to figure out their hat colors.

Here's how:

  • Each prisoner can see all hats in front.
     
  • Prisoner 2 counts red hats. If the 1st prisoner said the opposite color of what Prisoner 2 counted, Prisoner 2 has that color hat. If they match, Prisoner 2 has the other color.
     
  • Prisoner 3 does the same, adding Prisoner 2's known color to the count.
     
  • This continues, with each prisoner saying the color that makes the total red hat count even or odd to match what the 1st prisoner said.
     

All prisoners go free unless the 1st one miscounts or misspeaks, so the odds are at least 99/100.

Bee Travel Puzzle

Problem: Bees want to collect as much nectar as possible in the least time. But they also wish to cover the shortest possible distance in their nectar search. In what pattern do they search to accomplish this?

Bee Travel Puzzle

Solution: This is a classic optimization problem. Research has shown that bees use what's called a "lévy flight" pattern.

A lévy flight is a random walk where the step-lengths have a probability distribution that is heavy-tailed. In practice, this means the bees will take many short flights & occasionally (based on a power-law probability) take a long flight. This strategy has been shown mathematically & through simulations to be the optimal way to find randomly distributed resources (like nectar) when the exact locations are unknown in advance.

So the bees will mostly search nearby flowers but occasionally take longer flights to new areas to avoid over-harvesting & to discover new resource patches. This strategy balances exploitation (of known resources) with exploration (for new resources) in a provably optimal way given the constraints & uncertainties the bees face.

Finding the Defective Ball Puzzle 

Problem: There are 9 balls, one of which has a weight flaw. Using a balance scale, locate the defective ball using the fewest comparisons possible.

Finding the Defective Ball Puzzle

Solution: This can be solved in just 2 weighings:

  1. Divide the balls into 3 groups of 3. Weigh any 2 groups against each other.
     
  • If they balance, the defective ball is in the unweighed group. If they don't, it's in the group that's heavier or lighter.
     
  1. Take the group of 3 that has the defective ball & weigh any 2 of them against each other.
     
  • If they balance, the unweighed ball is the defective one.
     
  • If not, the heavier or lighter ball is the defective one. So in just 2 weighings, you can always find the defective ball from the group of 9.

Conclusion

We hope you have gained some insights on Puzzle Interview Questions through this article. This will help you excel in your puzzles when you are asked in your upcoming interviews.You can also practice coding questions commonly asked in interviews on Coding Ninjas Code360

Also, check out some of the Guided Paths on topics such as Data Structure and AlgorithmsCompetitive ProgrammingOperating SystemsComputer Networks, DBMSSystem Design, etc., as well as some Contests, Test Series, and Interview Experiences curated by top Industry Experts.

Live masterclass