Top 20 Puzzles Commonly Asked During SDE Interviews
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?
- 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?
- 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.
- Mislabeled Jars
There are 3 jars, namely, A, B, C. All of them are mislabeled. 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.
- 50 red marbles and 50 blue marbles
Give two boxes B1 and B2 one has 50 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.
- 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?
- 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., 2nd, 4th, 6th, 8th, … In the third walk, the person toggles every third door, i.e. 3rd, 6th, 9th, … Likewise, In the 100th walk, the person toggles the 100th door.
Which doors are open in the end?
- 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.
- 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.
- 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?
- 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.
- The Two Water Jug
You are on the side of the river. You are given an m liter jug and an n liter jug where 0 < m < 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.
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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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).
We would love to suggest you other puzzles as well, try to solve these when you feel bored. https://www.geeksforgeeks.org/puzzles/
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!