# Top 20 Puzzles Commonly Asked During SDE Interviews

Last Updated :
11 Mar, 2024

Improve

Puzzles are one of the ways to check your problem-solving skills. These are tricky questions that let you think logically.

To answer any puzzles you have to be focused & careful with given conditions. It proves how calm you will be in the presence of pressure. That’s why we prepared the top 20 puzzles commonly asked in the top companies like Amazon, Microsoft, Adobe, etc. Solving these puzzles does not give you the enormous logical ability because we never know what will be asked in the interviews, but this ** Puzzle sheet will help you in the Interviews for sure**.

**Here you go:**

**3 Ants and Triangle**

There are 3 ants sitting on three corners of a triangle. All ants randomly pick a direction and start moving along the edge of the triangle.**What is the probability that any two ants collide?**https://www.geeksforgeeks.org/puzzle-21-3-ants-and-triangle/**Solution:**

**Heaven and Hell**

There are two gates, one to hell and the other to heaven. Two gatekeepers, one for each gate. One of them always speaks the truth and the other always lies but you don’t know which one guards which gate. You are allowed only one question and you need to find out the gate to heaven.

What is the question?https://www.geeksforgeeks.org/puzzle-heaven-hell/**Solution:**

**10 Coins Puzzle**

You are blindfolded and 10 coins are placed in front of you on the table. You are allowed to touch the coins but can’t tell which way up they are by feel. You are told that there are 5 coins head up, and 5 coins tails up but not which ones are which. Can you make two piles of coins each with the same number of heads up? You can flip the coins any number of times.https://www.geeksforgeeks.org/puzzle-24-10-coins-puzzle/**Solution:**

**Mislabeled Jars**

There are 3 jars, namely, A, B, C.. Following are the labels of each of the jars:A: CandiesB: SweetsC: Candies and Sweets (mixed in a random proportion)You can put your hand in a jar and pick only one eatable at a time. Tell the minimum number of eatable(s) that has/have to be picked in order to label the jars correctly.**All of them are mislabeled**https://www.geeksforgeeks.org/puzzle-mislabeled-jars/**Solution:**

**50 red marbles and 50 blue marbles**

Give two boxesand**B1**one has**B2**red marbles and the other has**50**blue marbles. A ball is selected randomly from any of the boxes and the task is to maximize the probability of selecting a red ball, by reshuffling marbles in both boxes.**50**https://www.geeksforgeeks.org/puzzle-50-red-marbles-and-50-blue-marbles/**Solution:**

**Minimum cut Puzzle**

You have got someone working for you for five days and a gold bar to pay him. You must give them a piece of gold at the end of every day.**What are the fewest number of cuts to the bar of gold that will allow you to pay him 1/5th each day?**https://www.geeksforgeeks.org/puzzle-31-minimum-cut-puzzle/**Solution:**

**100 Doors**

There are 100 doors in a row, all doors are initially closed. A person walks through all doors multiple times and toggle (if open then close, if close then open) them in the following way: In the first walk, the person toggles every door In the second walk, the person toggles every second door, i.e., 2^{nd}, 4^{th}, 6^{th}, 8^{th}, … In the third walk, the person toggles every third door, i.e. 3^{rd}, 6^{th}, 9^{th}, … Likewise, In the 100^{th}walk, the person toggles the 100^{th}door.**Which doors are open in the end?**https://www.geeksforgeeks.org/puzzle-16-100-doors/**Solution:**

**Find the fastest 3 horses**

There are 25 horses among which you need to find out the fastest 3 horses. You can conduct a race among at most 5 to find out their relative speed. At no point, you can find out the actual speed of the horse in a race. Find out the minimum no. of races that are required to get the top 3 horses.https://www.geeksforgeeks.org/puzzle-9-find-the-fastest-3-horses/**Solution:**

**Calculate total distance traveled by the bee**

Two trains are on the same track and they are coming toward each other. The speed of the first train is 50 km/h and the speed of the second train is 70 km/h. A bee starts flying between the trains when the distance between two trains is 100 km. The bee first flies from the first train to the second train. Once it reaches the second train, it immediately flies back to the first train … and so on until trains collide. Calculate the total distance traveled by the bee. The speed of the bee is 80 km/h.https://www.geeksforgeeks.org/puzzle-3-calculate-total-distance-travelled-by-bee/**Solution:**

**3 cuts to cut the round cake into 8 equal pieces**

You have a birthday cake and have to cut it into 8 equal pieces by making 3 cuts only. How do you do it?https://www.geeksforgeeks.org/puzzle-3-cuts-cut-round-cake-8-equal-pieces/**Solution:**

**Find the last ball to remain after the entire process**

There are 20 red balls and 16 blue balls in a bag. Any 2 balls are removed at each step and are replaced with a new ball on the basis of the following conditions: If they are of the same color, then they are replaced by a blue ball. If they are of different colors, then they are replaced with a red ball. Find the last ball to remain after the entire process.

Here replacement means that the new ball is inserted into the bag. Once you take out the balls, you do not put them back in the bag – so the balls keep reducing.https://www.geeksforgeeks.org/puzzle-find-last-ball-remain-entire-process/**Solution:**

**The Two Water Jug**

You are on the side of the river. You are given anliter jug and an**m**liter jug where**n**. Both the jugs are initially empty. The jugs don’t have markings to allow measuring smaller quantities. You have to use the jugs to measure d liters of water where d < n. Determine the minimum no of operations to be performed to obtain d liters of water in one of the jugs.**0 < m < n**

The operations you can perform are:

Empty a Jug

Fill a Jug

Pour water from one jug to the other until one of the jugs is either empty or full.https://www.geeksforgeeks.org/two-water-jug-puzzle/**Solution:**

**3 Bulbs and 3 Switches**

There is a room with a door (closed) and three light bulbs. Outside the room, there are three switches, connected to the bulbs. You may manipulate the switches as you wish, but once you open the door you can’t change them. Identify each switch with its bulb. All bulbs are in working condition.https://www.geeksforgeeks.org/puzzle-7-3-bulbs-and-3-switches/**Solution:**

**How to Measure 45 minutes using two identical wires?**

How do we measure forty-five minutes using two identical wires, each of which takes an hour to burn? We have matchsticks with us. The wires burn non-uniformly. So, for example, the two halves of wire might burn in 10 minutes and 50 minutes respectively.https://www.geeksforgeeks.org/puzzle-1-how-to-measure-45-minutes-using-two-identical-wires/**Solution:**

**Find ages of daughters**

Alok has three daughters. His friend Shyam wants to know the ages of his daughters. Alok gives him the first hint.- The product of their ages is 72.

Shyam says this is not enough information Alok gives him a second hint. - The sum of their ages is equal to my house number.

Shyam goes out and looks at the house number and tells “I still do not have enough information to determine the ages”.

Alok admits that Shyam can not guess and gives him the third hint - The oldest girl likes strawberry ice cream.

Shyam is able to guess after the third hint.**Solution: https://www.geeksforgeeks.org/puzzle-2-find-ages-of-daughters/**

- The product of their ages is 72.
**10 Balls in 5 Lines**

Given are ten balls, the task is to place these 10 balls in five lines such that each line contains exactly 4 balls.https://www.geeksforgeeks.org/puzzle-10-balls-in-5-lines/**Solution:**

**Pay an employee using a gold rod of 7 units?**

An employee works for an employer for 7 days. The employer has a gold rod of 7 units. How does the employer pay the employee, so that the number of employee’s rod units increases by one at the end of each day? The employer can make at most 2 cuts in the rod.https://www.geeksforgeeks.org/puzzle-4-pay-an-employee-using-a-gold-rod-of-7-units/**Solution:**

**Torch and Bridge**

There are 4 people (A, B, C, and D) who want to cross a bridge at night.- A takes 1 minute to cross the bridge.
- B takes 2 minutes to cross the bridge.
- C takes 5 minutes to cross the bridge.
- D takes 8 minutes to cross the bridge.
https://www.geeksforgeeks.org/puzzle-18-torch-and-bridge/**Solution:**

**Poison and Rat**

There are 1000 wine bottles. One of the bottles contains poisoned wine. A rat dies after one hour of drinking the poisoned wine. How many minimum rats are needed to figure out which bottle contains poison in hour.https://www.geeksforgeeks.org/puzzle-19-poison-and-rat/**Solution:**

**Camel and Banana Puzzle**

A person has 3000 bananas and a camel. The person wants to transport the maximum number of bananas to a destination which is 1000 KMs away, using only the camel as a mode of transportation. The camel cannot carry more than 1000 bananas at a time and eats a banana every km it travels. What is the maximum number of bananas that can be transferred to the destination using only camel (no other mode of transportation is allowed).https://www.geeksforgeeks.org/puzzle-15-camel-and-banana-puzzle/**Solution:**

We would love to suggest you other puzzles as well, try to solve these when you feel bored. https://www.geeksforgeeks.org/puzzles/