Skip to main content

Questions tagged [algorithm]

A puzzle related to algorithms (a main concept in computer science). Puzzles may ask for an algorithm as an answer or require the analysis of a given algorithm.

Filter by
Sorted by
Tagged with
5 votes
0 answers
159 views

I’ve made a small browser puzzle called Codextri where you have to identify a hidden set of three letters by guessing words. Each guess returns a score based on how many of those hidden letters your ...
Celestialien's user avatar
2 votes
0 answers
99 views

I'm working on a CayleyPy project where we study the diameters of graphs that come from different combinatorial puzzles. At the moment I’m focusing on the Picture-Cube, a 3×3×3 puzzle where each move ...
LillyPilly's user avatar
3 votes
0 answers
124 views

I'm working on a CayleyPy project. We study the diameters of various graphs. These graphs are often associated with physical puzzles. One of these puzzles is Megmainx. To test various hypotheses, I ...
Michael Litvinov's user avatar
1 vote
0 answers
182 views

The diamond-shaped Light Out game refers to a Light Out variant with a diamond-shaped grid, characterized by the following structural properties: Total number of rows/columns: $2k+1$ rows (where k is ...
DSTBP's user avatar
  • 183
7 votes
2 answers
449 views

On an m × n grid, pressing a cell flips the state (turning a lit cell dark and a dark cell lit) of that cell and its four adjacent cells (the cells above, below, to the left, and to the right). ...
DSTBP's user avatar
  • 183
16 votes
2 answers
800 views

There are 100 full water tanks and 100 empty ones. You are given a hose that can connect any two of them in order to equilibrate the water level between them. All the tanks are cubical in shape, of ...
Tobias Fritz's user avatar
3 votes
0 answers
249 views

I’ve become interested in puzzle games that combine traditional Sokoban mechanics (box pushing) with shortest-path optimization—specifically puzzles where your objective isn’t merely to reach a goal ...
K2xL's user avatar
  • 131
12 votes
1 answer
757 views

A postage stamp collector, once, bought a, supposedly complete, rare set of original postage stamps laid out 5x6. Each item in the set features a unique, rather peculiar, 5x6 pixel artwork. One day ...
FirstName LastName's user avatar
12 votes
2 answers
840 views

A card shuffling machine always rearranges cards in the same way relative to the order in which they are given to it. The thirteen spades arranged in the order A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K ...
Will.Octagon.Gibson's user avatar
1 vote
3 answers
393 views

This puzzle has a flavor of Hamiltonian puzzles. You are given a set of N rocks placed on a two-dimensional integer grid. The task is to find an orthogonal closed simple path with N orthogonal line ...
Mohammad Al-Turkistany's user avatar
3 votes
4 answers
438 views

Problem: You are given N items. You need to figure out what combination of these objects gives a certain unknown target weight. You do not know the target weight and the weight of each item. Each time ...
BlueTrin's user avatar
  • 189
1 vote
2 answers
253 views

How do fix this? All other sides are fixed
N. Pradeep's user avatar
3 votes
0 answers
254 views

I wonder if there is an algorithm for the worst game to keep as many pegs as possible. I tried to search for "peg solitaire worst score/ max leave" etc, but it’s not quite that. The question ...
Denis Ivanov's user avatar
1 vote
1 answer
173 views

I implemented the CFOP method in my Rubik's cube solver. Now I am trying to add the Roux method. I couldn't find the right CMLL algorithm for this particular case. After consulting the CMLL algorithms ...
Arun's user avatar
  • 113
5 votes
1 answer
473 views

You are faced with the difficult task to set up a dungeon for adventurers. However you made a deal with the guild: any adventurer brave enough to beat the dungeon and reach the treasure room will be ...
Fluorine's user avatar
  • 1,212
17 votes
4 answers
3k views

Let me start with a formulation of the problem for people who aren't familiar with Magic: the Gathering. You have a stack of distinct cards face-down. You can apply the following actions arbitrarily ...
A. P.'s user avatar
  • 6,160
9 votes
3 answers
1k views

Source: My school teacher, it was just given as a problem statement. Problem: You are given a binary sequence $S$ of up to $10^6$ bits. You wish to set all the bits in the string to $1$, but the catch ...
user88178's user avatar
  • 103
13 votes
1 answer
1k views

There are four pegs in a row; let's call them A, B, C, and D from left to right. Peg A has a stack of $n$ differently sized disks, sorted in size so the smallest disk is at the top. All other pegs are ...
Bubbler's user avatar
  • 17.8k
0 votes
0 answers
125 views

I am trying to write a program for solving nurikabe puzzle. I need a method to approximately represent the state of the game in one number, to choose the best way for the algorithm to continue. I can'...
Papouc's user avatar
  • 1
-2 votes
1 answer
299 views

The problem to solve: Let's say we have a set of $n$ points on the 2D plane. Determine whether it has axial symmetry. My attempt so far: For n=2 the answer is trivially "yes". For n=3 ...
Nick's user avatar
  • 1,701
2 votes
1 answer
334 views

Can anyone help me solve this robozzle? It is called bigPlus id 1251 http://www.robozzle.com/puzzle.aspx?id=1251
user86831's user avatar
7 votes
3 answers
910 views

Fibonacci words are defined as $F_0 = a, F_1 = b, F_{n+2} = F_nF_{n+1}$ where $a, b$ are letters. How can you find the longest Fibonacci sub-word in a given string? Try to solve it in linear time ($O(...
popcorn's user avatar
  • 171
1 vote
1 answer
380 views

Some malevolent entity (me) asks you to construct a Turing Machine which, given an input on its tape of the form $LbR$ where $b$ is some binary string, changes this to $Lb^{-1}R$ then halts (where $b^{...
volcanrb's user avatar
  • 121
5 votes
1 answer
378 views

Imagine that you are given a box with n nuts and n screws. Each screw have different size (diameter) and on each screw there is ...
popcorn's user avatar
  • 263
6 votes
1 answer
722 views

Let's say you have a cable that has n wires. Each wire on the left side corresponds to one wire on the right side. However you cannot distinguish between the wires ...
popcorn's user avatar
  • 263
2 votes
1 answer
1k views

I have a problem with solving the "Dispersion V2" puzzle on robozzle.com: The puzzle has a robot that can be moved and turned with a program. The goal of the puzzle is to have the robot ...
user avatar
1 vote
1 answer
1k views

[companion question here] I was given an 11x11x11 Rubik's cube as a gift. It came with a guide book that I have been following to solve the cube. After solving four of the 9x9 sub-centers of the cube,...
Abraham's user avatar
  • 141
1 vote
1 answer
272 views

[companion question here] I was given an 11x11x11 Rubik's cube as a gift. It came with a guide book that I have been following to solve the cube. I have solved four of the 9x9 sub-centers of the cube,...
Abraham's user avatar
  • 141
1 vote
1 answer
254 views

Problem: Alien Protein Codes Dr. Muzabique figured out how to manipulate six alien proteins to do three functions: construct, cut, and pack. The alien genetic code used to manipulate the proteins was ...
MeltedStatementRecognizing's user avatar
17 votes
17 answers
2k views

A group of (possibly over-polite) people have just finished their meal at a restaurant. One of them asks, "Does anyone want dessert?" The table goes quiet. Some of the people might want ...
Mark Green's user avatar
3 votes
1 answer
206 views

Consider the set $S := \{$ "the number of lies in the set $S$ is a multiple of $n$" $|$ $n = 1, 2, 3, ... , 120 \}$. Question: Which elements/sentences in the set $S$ are true in every ...
user avatar
1 vote
1 answer
369 views

I have seen Donald Knuth's Algorithm to guess the correct pattern in maximum 5 tries. However, I want to write a program to find the correct pattern effectively however the code maker can only make a ...
Mounir Zouhari's user avatar
5 votes
1 answer
3k views

I have a very strange state on my 4x4 Pyraminx. The green side is solved and the other sides are almost solved, the problem is, on these 3 remaining sides the centers are not solved. The state looks ...
Missing User's user avatar
0 votes
1 answer
288 views

Considering a general fake coin problem. There are $n$ coins in total and $k$ of them are fake. Fake coins are lighter than the normal ones. You only have a balance to compare two groups of coins (no ...
picker's user avatar
  • 1
8 votes
1 answer
308 views

In the highest tower of her castle, a princess has N bedrooms which are arranged in a circle. She never sleeps in the same room on two consecutive days. Every morning she moves to another room by ...
SecretAdmirer's user avatar
16 votes
1 answer
932 views

On an infinite square grid, some of the squares are occupied by little creatures called blobs. Cute as they are, it is your mission to exterminate all of them! You only have two methods at your ...
Mike Earnest's user avatar
30 votes
12 answers
15k views

Wordle is a game by Josh Wardle in which you try to guess a 5-letter word in at most six attempts. After each guess, the letters which are not in the word are highlighted in grey, the letters which ...
EmilyR's user avatar
  • 577
2 votes
1 answer
358 views

This is the story of the sister of the princess in this puzzle. I will shamelessly copy-paste some parts of this post. I have no reference to give for this version as I adapted a Computer Science ...
Nathaniel's user avatar
  • 193
5 votes
4 answers
746 views

There are millions of Rubik's cube combinations possible. If I have two 3×3 Rubik's cubes and both are scrambled, I want to make one scrambled cube exactly the same as the other without solving them. ...
Mayur Garde's user avatar
4 votes
1 answer
192 views

This copy machine program prints the solution to a well-known puzzle.  Explanation of the syntax will follow. What solution will be printed for which well-known puzzle?  EXECUTION CODE .--> LoopA-...
humn's user avatar
  • 22.1k
2 votes
1 answer
1k views

(So I made this puzzle, and I wanted it to be fun rather than difficult! I hope it’s original enough) Given a 5x5 grid as input, here’s an algorithm: randomly select any 3x3 grid within the 5x5 grid ...
numdar335's user avatar
10 votes
2 answers
937 views

You have probably played the classic game of Mastermind with 4 pegs and 6 colours. It turns out that the codebreaker can always find the pattern in 5 moves or fewer. Now consider the 2D version of the ...
Dmitry Kamenetsky's user avatar
12 votes
1 answer
858 views

Each square of an 8x8 chessboard is marked with a positive integer. The integers can be changed according to the following two rules: (1) all integers in a row are doubled (2) all integers in a column ...
ThomasL's user avatar
  • 13.2k
5 votes
2 answers
295 views

Suppose I had a little robot on the coordinate grid that moves according to the following rule. If it's at the point $(x,y)$, it can move to either $(x+y,y)$ or $(x,x+y)$. If the robot starts at the ...
sirpuzzle's user avatar
1 vote
1 answer
220 views

TLDR Just the Puzzle Given a number n and a weight w the function f will result in a weighted number r as follows. f(n, w) = r n can be a number from 0 to 200 w can be a number from -100 to 100 (...
thinktt's user avatar
  • 111
4 votes
0 answers
73 views

Imagine: You have a group of people in a room that is completely dark. Half of the group has red t-shirts and the other half blue t-shirts. The group gets told to think about a strategy to solve the ...
Lazloo Xp's user avatar
  • 141
-4 votes
1 answer
156 views

Imagine that you possess a very simple electronic calculator. It has a screen and ten buttons from 0 to 9 to enter natural decimal numbers (positive integers). However, it can perform just two unary ...
Alexander's user avatar
  • 615
2 votes
1 answer
340 views

So, I got curious if I could solve from the cube in a cube in a cube in a cube position to the solved state just using its own algorithm. This is the one I was using: B' 2R2 2L2 U2 2R2 2L2 B F2 R U' ...
Caters's user avatar
  • 121
4 votes
0 answers
8k views

WARNING: I solved this puzzle and posted a solution below. I'm posting this more for muse. Hello! I don't know if anyone's enjoyed this puzzle on The New York Times website, but I find it rather fun. ...
Aaron's user avatar
  • 41
4 votes
1 answer
215 views

A constant is hiding behind this puzzle, can you tell which? 4 $\rightarrow$ 2 $\rightarrow$ 1 $\rightarrow$ 1 $\rightarrow$ 1 $\rightarrow$ $\dots$ ? $\rightarrow$ ? $\rightarrow$ ? $\rightarrow$ $\...
JKHA's user avatar
  • 7,968