# Questions tagged [algorithm]

A puzzle related to algorithmics (a main concept in computer science).

99 questions
Filter by
Sorted by
Tagged with
17k views

### Why does this solution guarantee that the prince knocks on the right door to find the princess?

I found this puzzle online: On the top floor of a castle lives a princess. The floor has 17 bedrooms arranged in a row. Each bedroom has doors connecting to the adjoining bedrooms as well as to the ...
2k views

### Wolves and sheep

All the sheep were living peacefully in the Land of Shewo. But suddenly they were struck by a danger. A few wolves dressed up as sheep entered the territory of Shewo and started killing the sheep one ...
3k views

### Switch The Knights

On a small $4 \times 3$ chessboard, the top row is filled with black knights and the bottom row with white knights. On each move, you may move one knight (as it moves in chess) to an unoccupied ...
2k views

### 23 Clones and Two Lightbulbs

Rise and shine, Mister Bond. James awoke to find himself yet again imprisoned by an evil genius. At least, that's what he presumed. He was alone in a room with a strange device: it consisted of a ...
5k views

You are a spy trying to break into an enemy facility. The back door is protected by an electronic keypad lock. You know that this particular lock is opened by a four digit code. Any stream of button ...
925 views

### Confused Soldiers

A squad has $n$ soldiers. Their impatient commander yells at them to form a line going East to West, with everyone facing East. They quickly manage to form an East/West line, but some soldiers are ...
1k views

### Checkerboard Infection: The Aftermath

As in this previous puzzle, we are again playing with our favorite bacteria, C. Coli, whose natural habitat is an 8x8 checkers board. These are very nasty bacteria - once they are in a cell of a ...
1k views

### Desegregate the Knights

You are given a 3 by 3 chessboard with a knight on each corner, where the knights in the top row are black and in the bottom row are white. On each turn, you may move a knight of either color (the ...
2k views

### Checkerboard Infection

There is a dangerous bacteria, Checkerichia Coli, (or C. Coli for short) which lives in the squares of checkerboards. Squares with this bacteria living in their digestive systems are said to have "C-...
1k views

### Mystery operation

In a future not so far way, Earth archaeologists find on a far away planet a fragment from a long lost civilization. This fragment involves an unknown operation *|*...
4k views

### Maze Solving Robot

Archie the archeologist has discovered an Egyptian temple, and plans to send in a robot to explore it. He uncovered the ancient engineers' papyruses which explain almost everything about the temple's ...
2k views

### Consecutive Towers of Hanoi

Consider the following variant of the Towers of Hanoi puzzle. There are six pegs. One of the pegs has a stack of $n$ differently sized disks, sorted by size so the smallest disk is at the top. All ...
708 views

### Blindfold Bingo

Congratulations, you have been selected from among the audience to compete in the fabulous Blindfold Bingo challenge! (cue annoying, yet catchy theme music.) Here you see our perfectly ordinary Bingo ...
7k views

### A general solution to the decanting problem? (aka jug-pouring, water-pouring)

Take a look at these two questions: - A Set of Water Jug Challenges - Pouring problem Now I'm asking for a generalised solution to that problem. I define the problem as follows: You are required ...
4k views

### Can you recreate this fractal I randomly made?

This fractal looks relatively simple, but how would you generate it? On a smaller scale: I made it using a 1D cellular automaton with a four cell neighborhood: ...
1k views

### Rigged casino that prevents pairs

This question is still active as the answer from @Sleafar has just arrived. Not yet solved. Scenario The heads of 3 top terrorist organisations are planning to play an extremely high-stake poker ...
350 views

### 20-Questions on a grid

Posted this on /r/puzzles too, none have given the right strategy as of now :) There is a square grid of width and height $m$. Three facts about the grid: Each cell has a value, and no two cells ...
1k views

You have 8 identical looking rods, 2 of which are radioactive, though you don't know which. You also have a box which can test for radioactivity, which can hold any number of rods. After the test, the ...
3k views

### Fastest way to collect an arbitrary army

I am looking for solution of this puzzle: There is a kingdom with a square shape with sides of length 1. The castle is located at the center of the square. At the castle the king lives under the ...
373 views

### Cubical Infection

You may remember the C. Coli bacteria, which infects checkerboard squares. There is a similar disease which plagues cubes, known as cubic lice. Once a cube gets infested with cubic lice, it will be ...
717 views

### What is the optimal first move in Mastermind?

For a given number of positions/holes and a given number of colors, which initial guess eliminates the most possibilities for the solution at a minimum? For 4 positions, it's AABB. What is it for 5, ...
281 views

### Rank the Fencers

There are five fencers. Each has a particular skill level, all of which are different. When two fencers duel, the one with the higher skill level always wins. How many duels do the fencers need to ...
1k views

### The Generous Taco stand

There are a group of people standing in line for a taco stand. This taco stand is special in that it's slogan is "The older you are, the more you get!". To make sure though that there isn't any funny ...
496 views

### Half-reverse operation on binary strings

Is there an algorithm that you can apply twice to an input string of $0$s and $1$s in order to reverse it? In other words, is there a function $f : \mathrm B \to \mathrm B$ on the set of binary ...
4k views