Questions tagged [algorithm]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
480 views

How do I solve this F2L case quickly?

I have been unable to find a solution for this f2l case. It takes about 3 seconds to do, and I do it really slowly. Basically, the f2l case is solved, but the edge is inverted. The way I do it right ...
22
votes
2answers
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 ...
30
votes
5answers
4k 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 ...
22
votes
1answer
2k views

Is there an algorithm to decide that the nonogram puzzle is unique

A good nonogram puzzle has a unique solution. However, some nonograms do not. For example, this puzzle: ...
11
votes
4answers
290 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 ...
27
votes
7answers
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 ...
3
votes
2answers
2k views

Algorithm for a single diagonal on each face of the Rubik's Cube

Right now I am trying to get the following distorted position: On each face only one diagonal is solved and the rest of the cubes are a different colour than the diagonal. For example: If I am ...
3
votes
2answers
777 views

Strategy for getting out of Hedge maze?

I often wonder: suppose I wake up one day and find myself in a maze of Hedges, like the one in "The Shining", what is the best strategy to get out of it? We can assume we have sunlight or a torch if ...
8
votes
2answers
224 views

How to beat “Strata”?

Recently I purchased a bunch of mobile puzzle games for my iPhone and one of them was the famous top-rated app "Strata" by Graveck. The rules are simple - you begin with an $n \times n$ board, some ...
11
votes
2answers
1k views

Let's deal with “Names in Boxes” Safely

I met a puzzle, which is basically well known 100 Prisoners' Names in Boxes , but... it has an algorithm, which gives prisoners 100% chance to survive! This is achieved by a small change in the ...
2
votes
2answers
320 views

Closing taps (generalisation) [closed]

You have a tanker that can hold any amount of water. You have $n$ taps that either let in or let out water. The rate of flow of water (in $ml/min$) for each tap is given by $f_n$ (positive for inflow, ...
-1
votes
1answer
289 views

This code shouldn't be working [closed]

Today I wrote some C# code to generate all subsets of a set. It all worked correctly but then I realized about I'd made a rookie mistake. The puzzle here is not that the code is not working but rather ...
8
votes
3answers
372 views

A problem of inequalities

The puzzle Given a set of numbers $\{1,2,\ldots,n\}$ and an expression of inequalities, e.g., $ x_1 > x_2 < \cdots > x_n$. Prove that there always exists a solution such that $x_i \in \{1,2,\...
14
votes
6answers
2k views

Radioactive Rods

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 ...
7
votes
1answer
362 views

Avoiding Incest and Intergenerational Mating

On the planet of Caturn, God created $m$ male cats and $f$ female cats, each with zero stripes. At any time, two cats of opposite genders can mate, giving birth to a cat with a gender of the parents' ...
10
votes
2answers
524 views

Maze Solving Robot, More Difficult Variant

You are trying to design a maze solving robot, capable of solving "valid" mazes. A valid maze is an 8 by 8 checkerboard, surrounded by walls, where Between each pair of orthogonally adjacent squares, ...
21
votes
4answers
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 ...
12
votes
2answers
396 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 ...
19
votes
4answers
3k 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-...
18
votes
5answers
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 ...
22
votes
5answers
948 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 ...
-4
votes
1answer
202 views

What is the encryption algorithm used here? [closed]

Can you decipher what encryption algorithm has been used here. I have several examples but I cannot decipher the algorithm used. ...
7
votes
2answers
556 views

Numbers on a Blackboard

You are given an empty blackboard. Once a minute, you are allowed to do one of the following: Write two $1$'s on the blackboard Erase two copies of a number, $n$, and replace them with $n-1$ and $n+...
4
votes
1answer
571 views

Generalisation of Nim

I'm asking for a general formula/algorithm that can be used in such a game. There are $n$ piles, with varying number of pebbles. The number of pebbles in each pile is given by an array from $pile[...
3
votes
2answers
618 views

How does a common man solve impossibly hard truthteller/falsifier questions?

How does one solve the World's hardest puzzle, and other questions of the type? Is there a proper approach to such a question, or does one just have to be incredibly smart to do so? And here's an ...
3
votes
3answers
375 views

The salary of three of Alice's coworkers

Alice would like to determine the relative salaries of three coworkers using two facts. First, she knows that if Pauline is not the highest paid of the three, then Paul is. Second, she knows that if ...
5
votes
2answers
228 views

Patriotic Solitaire

You are given a $3\times n$ checkerboard, covered with $n$ red, $n$ white, and $n$ blue checkers. Call a board patriotic if every column has a red, white and blue checker. You want to make the given ...
8
votes
5answers
1k views

Minimum cells to fill grid without consecutive neighbours

Imagine you have a m x n grid which is initially colored white. you can fill in a cell with black color if and only if there are no immediately neighboring black cells (no black cells to the left/...
11
votes
3answers
38k views

What is the Official notation on rubik's revenge(4x4)?

When solving a 4x4 cube you have specific notation to inner and outer lines, like R = Clockwise outer right and r = Clockwise ...
7
votes
2answers
2k views

Figure out this algorithm by analyzing the sequence of numbers generated

You are given a function f that, using an algorithm (that uses an old method), performs a calculation on four distinct values _ and generates a sequence of ten numbers. Now, your task is to figure ...
16
votes
8answers
2k 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 ...
19
votes
2answers
8k 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 ...
6
votes
4answers
672 views

Lining Up Recruits

The good soldier Schweik had been ordered to line up a band of new recruits before their officer gave them a speech. The desired line sought to minimize the average difference in height of adjacent ...
-4
votes
2answers
4k views

Maze Generation Algorithm [closed]

You must design an algorithm for a 16x17 rectangle grid. Each "cell" is either a wall or an opening. This algorithm must achieve a maze without long hallways in 1 general direction, and must have dead ...
4
votes
2answers
951 views

Counting triangle algorithm

There is a type of puzzle where one needs to count triangles in a figure, generally a large triangle full of lines which create smaller ones. One example Is there, or can someone develop ;), an ...
11
votes
7answers
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 ...
5
votes
2answers
6k views

Is there an algorithm for the Rubik's 360?

Is there an algorithm to help me solve the Rubik's 360? Usually I just do it at random, but I rarely succeed.
86
votes
7answers
20k 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 ...

1 2
3