Search This Blog

Friday, June 12, 2020

Puzzles asked in interview

1) You have a birthday cake and have exactly 3 cuts to cut it into 8 equal pieces. How do you do it?
The  answer is to cut the cake in quarters (4 pieces) using 2 of the cuts, then stack all 4 of the pieces and then split all four of the stacked pieces with the third cut.


2)You are given 8 pennies, 7 of which weigh exactly the same, but one penny weighs less than the other 7. You also have a judge scale. Find the one penny that weighs the least in less than 3 steps.
First,  split the 8 pennies into 3 groups of pennies – 2 groups with 3 pennies each and 1 group with 2 pennies. Then, you compare the weight of the first two groups of 3 pennies each by putting them on the scale.
  • Scenario #1: The 2 groups weigh the same. This means the lightest coin is in the group of 2. So, take those 2 pennies and compare them to each other and find the lightest coin.
  • Scenario #2: The 1st group weighs more than the 2nd group. Take group #2 (3 pennies) and pick any 2 pennies out of that group of 3. If they weight the same, then the third penny is lighter. If they don’t weigh the same then the lighter one is obviously the lightest penny.
3)Suppose you have a 3 liter jug and a 5 liter jug (this could also be in gallons). The jugs have no measurement lines on them either. How could you measure exactly 4 liter using only those jugs and as much extra water as you need?

  •  First, fill the 5 liter jug and then pour it into the 3 liter jug. The 5 liter jug now has only 2 liters left.
  •  Next, empty out the 3 liter jug. Then, pour the 2 liters from the 5 liter jug to the 3 liter jug. So, now the 3 liter jug has 2 liters.
  •  Fill the 5 liter jug again, and pour 1 liter into the 3 liter jug. Now, what’s left in the 5 liter jug? Well, exactly 4 liters! There’s your answer.
4)There are twenty coins sitting on the table, ten are currently heads and tens are currently tails. You are sitting at the table with a blindfold and gloves on. You are able to feel where the coins are, but are unable to see or feel if they heads or tails. You must create two sets of coins. Each set must have the same number of heads and tails as the other group. You can only move or flip the coins, you are unable to determine their current state. How do you create two even groups of coins with the same number of heads and tails in each group?

 Create two sets of ten coins. Flip the coins in one of the sets over, and leave the coins in the other set alone. The first set of ten coins will have the same number of heads and tails as the other set of ten coins.

5)Four people need to cross a rickety bridge at night. Unfortunately, they have only one torch and the bridge is too dangerous to cross without one. The bridge is only strong enough to support two people at a time. Not all people take the same time to cross the bridge. Times for each person: 1 min, 2 mins, 7 mins and 10 mins. What is the shortest time needed for all four of them to cross the bridge?

A-1,B-2,C-7,D-10

Move                                             Time
A & B cross with torch                    2
A returns with torch                         1
C & D cross with torch                    10
B returns with torch                          2
A & B cross with torch                     2
-----------------------------               ---------
Total Time                                        17


















No comments:

Post a Comment