algorithmic-puzzles

Blog Cover
Box Unstacking Problem

There is a stack of n boxes. Now in each move, we divide one stack of boxes into 2 non-empty stacks. The game ends when we have n stacks of a single box. We earn points for each move i.e. for dividing a stack of heights A + B into 2 stacks of heights A and B, we will score AB points for that move. Overall score is the sum of points that we earn for each move. How can we maximize the total score?

Blog Cover
Tower of Hanoi Puzzle

Problem description of the tower of Hanoi: Given a stack of n disks arranged from largest on the bottom to smallest on top placed on a rod A, together with two empty rods B and C. The objective is to move the n disks from rod A to rod C using rod B.

Blog Cover
The Birthday Paradox

The birthday paradox is strange and counter-intuitive. It's a "paradox" because our brain find it difficult to handle the compounding power of exponents. Real-world applications for this include a cryptographic attack called the "birthday attack".

Blog Cover
Find out the Fastest 3 Horses

There are 25 horses among which we need to find out the fastest 3 horses. In each race, only 5 horses can run simultaneously because there are only 5 tracks. What is the minimum number of races required to find the 3 fastest horses without using a stopwatch?

Blog Cover
Bridge Crossing at Night

A group of four people, who have one torch, need to cross a bridge at night. A maximum of two people can cross the bridge at one time, and any party that crosses (either one or two people) must have the torch with them. The torch must be walked back and forth and cannot be thrown. Person A takes 1 minute to cross the bridge, person B takes 2 minutes, person C takes 5 minutes, and person D takes 10 minutes. A pair must walk together at the rate of the slower person’s pace. Find the fastest way they can accomplish this task.

Blog Cover
The Celebrity Problem

There are n+1 people at a party. They might or might not know each other names. There is one celebrity in the group, and the celebrity does not know anyone by their name. However, all the n people know that celebrity by name. You are given the list of people present at the party. And we can ask only one question from each one of them. “Do you know this name”? How many maximum numbers of questions do you need to ask to identify the actual celebrity?

Blog Cover
N-Bulb in a Circle Puzzle

You have given n-bulbs connected in a circle with a switch for each bulb. The connection is such that if you change the state of anyone bulb may be on or off, it will toggle the state of its adjacent bulbs. All the bulbs are initially switched off. You have to find the number of steps such that all the bulbs are switched on.

Blog Cover
Gold For 7 days of Work

You’ve got someone working for you for seven days and a gold bar to pay him. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. What is the fewest number of cuts to the bar of gold that will allow you to pay him 1/7th each day?

Blog Cover
Magic Square Puzzle

Fill the 3 × 3 tables with nine distinct integers from 1 to 9 so that the sum of the numbers in each row, column, and corner-to-corner diagonal is the same.

Blog Cover
Monty Hall Problem

There are 3 doors behind which are two goats and a car. You pick door 1 hoping for the car but don’t open it right away. Monty Hall, the game show host who knows what's behind the doors, opens door 3, which has a goat. Here's the game: do you want to pick door No. 2? Is it to your advantage to switch your choice?

Blog Cover
A Fake Among Eight Coins

There are eight identical-looking coins, and one of these coins is fake, which is lighter than genuine coins. What is the minimum number of weighings needed to identify the fake coin with a two-pan balance scale without weights?