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
0 votes
1 answer
62 views

Solving Robozzle puzzle

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
84 views

Help with solving 7x7 sub-centers inside 11x11x11 Rubik's cube -- errors in guide book

[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,...
  • 141
1 vote
1 answer
61 views

Help with solving 5x5 sub-centers inside 11x11x11 Rubik's cube -- errors in guide book

[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,...
  • 141
1 vote
1 answer
147 views

Panini Linguistics Olympiad: Genes from Space

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 ...
18 votes
17 answers
2k views

The dessert problem (blind ballot remaining blind if non-unanimous) [closed]

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

Which sentences in S := {"the number of lies in S is a multiple of n" | n = 1,...,120} are true in every possible non-contradictory case?

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
162 views

Mastermind algorithm but for unique colors only

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

Orientate the centers of a Master Pyraminx (Pyraminx 4x4)

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

General Fake Coin: k fake coins out of n coins

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 ...
  • 1
0 votes
0 answers
79 views

Disguising a Rubik's Cube rotation

I'm wondering if there's a way to disguise the total rotation of a Rubik's Cube? For example, if I wanted to rotate the (solved) cube I could obviously just apply a 90 degree yaw rotation. However, I ...
8 votes
1 answer
242 views

O princess, where art thou?

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

Exterminating blobs on a grid

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 ...
  • 31.7k
28 votes
12 answers
12k views

What's the optimal strategy for Wordle?

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 ...
1 vote
1 answer
206 views

How can the princess escape the prince?

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 ...
  • 183
5 votes
4 answers
487 views

Algorithm to make two scrambled Rubik's cubes be exactly the same on all faces

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

Copy that solution

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 .--> ...
  • 21.5k
1 vote
1 answer
303 views

Find the hidden message in... this grid

(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 ...
10 votes
2 answers
776 views

Two dimensional Mastermind

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

Transform each square of a chessboard to zero

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 ...
  • 11.7k
4 votes
2 answers
266 views

All possible locations of a robot going from $(x,y)$ to $(x+y, y)$ or $(x,x+y)$ [closed]

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 ...
1 vote
1 answer
146 views

Reverse Engineer Chess Software Calculations

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 (...
  • 111
4 votes
0 answers
69 views

Find the strategy: How to order without knowing [duplicate]

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 ...
  • 141
-4 votes
1 answer
123 views

A simple two-operation calculator. How to obtain any natural number from any other?

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 ...
  • 183
2 votes
1 answer
186 views

Is it possible to solve the Cube in a Cube in a Cube in a Cube state using its own algorithm on a 4x4?

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' ...
  • 121
3 votes
0 answers
2k views

The New York Time's "Letter Boxed" Puzzle (spoiler)

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. ...
  • 31
4 votes
1 answer
167 views

Constant puzzle

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$ $\...
  • 5,881
9 votes
0 answers
201 views

Rolling dice in a box

A box containing identical dice that were arranged to have same orientation has a missing die at the center (see figure). The dice moves to the free space for they can change orientation and ...
  • 6,616
12 votes
1 answer
385 views

Infection (Information Dissemination) Puzzle

There are 2020 people in a room. One person has COVID. After each minute, each person $\mathrm{P}$ is paired with some other person $\mathrm{Q}$ who was never paired with $\mathrm{P}$ before, and they ...
1 vote
1 answer
125 views

Minimise battle time in Monster's Den

So there is this excellent flash game, Monster's Den. In order to make a high score, I must complete many battles..this question is about battles with the Legendary Monsters. The target is to reduce ...
2 votes
1 answer
334 views

A robot moving on a grid

In the spirit the question I propose the puzzle: A robot is placed on a vertex of a grid. At each move the robot must take three steps along the edge of the grid. After each step the robot must turn ...
  • 1,701
3 votes
1 answer
2k views

A robot visiting every edge of a 4x4 grid

This is a harder version of this puzzle: A robot visiting every edge of a 3x3 grid A robot is placed on the top-left vertex of a 4x4 grid. At each move the robot can take one step (up, down, left or ...
2 votes
1 answer
4k views

A robot visiting every edge of a 3x3 grid

A robot is placed on the top-left vertex of a 3x3 grid. At each move the robot can take one step (up, down, left or right) along the edge of the grid to the adjacent vertex, but he cannot go outside ...
12 votes
3 answers
2k views

Find Local Maximum in an Integer Sequence

An element of an integer sequence is called a local maximum if it is not smaller than all its neighbors. E.g., all local maximums of the following sequence are bolded. 3, * 4 *, 2, 1, * 3 *, 2, * 8 *, ...
2 votes
1 answer
226 views

Based on 9-trains puzzle

Based on this problem, we have got some algorithms that can sort the 9 train cars in a given specific arrangement. But say if the 9 train cars are given in any-arrangement? Say ABC ABC ABC ...
3 votes
1 answer
134 views

demystify and paint me!

To demystify me, look and say. Then paint me not with colors but with array. ...
  • 133
2 votes
2 answers
376 views

Missing number in a set of four segment circles

This is a puzzle posted on a social networking site that I have been trying hard since yesterday to solve: My approach has been to find out a mathematical function with the numbers in the yellow, ...
14 votes
1 answer
585 views

GameDev: stuck with first puzzle design, would love resources to study from or algorithm suggestions!

First time posting here and I'm really, really hoping this is the community I've been looking for. I'm developing a game, right now I'm in the middle of designing levels as the core mechanics have ...
  • 143
7 votes
1 answer
196 views

Has Connect Four been solved on arbitrary board sizes?

Victor Allis in his program VICTOR used his algorithm for six by seven connect four, his algorithm has proven to give a sure win. Is it possible to have similar algorithm for x by y board?
  • 301
4 votes
1 answer
292 views

Cutting a Rectangular Board

There is an $m \times n$ rectangular board drawn on a graph paper. You need to cut it into $mn$ $1 \times 1$ squares by straight cuts along the grid lines. You are allowed to stack several pieces ...
4 votes
2 answers
207 views

Minimum number of flips required to turn a sequence into alternating A and Bs

You are given this sequence composed of the characters A and B: A B B B A B B A A B A A B A A B A B A A A B B A B B B A At ...
  • 5,042
5 votes
2 answers
2k views

Oriented Rubiks Cube 4x4 re-arrange center pieces

There are a lot solutions for oriented 3x3. They rotate all center pieces. I'm trying to solve oriented 4x4 with GabbasSoft Cube Demo. Luckily blue and green ...
9 votes
5 answers
286 views

An $n$-sided polygon with area $n$

Here is a $10$-sided polygon which area is $23$ (i.e. it contains exactly 23 unit squares). Can you draw a polygon with: $6$ sides and area $6$? $8$ sides and area $8$? $12$ sides and area $12$? ...
  • 5,042
5 votes
1 answer
828 views

Shift and Sort the Sequence [closed]

Given a permutation of integers 1 through N, we need to determine whether it is possible to sort this list in an increasing order by following certain conditions. The conditions imposed are : We are ...
7 votes
3 answers
674 views

Algorithm for creating a "Dot" logic maze

I've been looking at Robert Abbott's logic mazes, in particular his Dot maze, and I'm trying to understand how they can be constructed so I can write an algorithm to do this automatically for ...
user avatar
4 votes
2 answers
398 views

The Genius Bank Robber

StackVille Bank & Trust - Robbed! The Robbery The bank is being robbed. There are millions in cash in the vault. The lone robber takes the manager to the safe and demands he opens it. The manager ...
  • 2,105
6 votes
2 answers
185 views

The Balls of Death

You have nightmares about a pool ball with the number 1 on it, and an empty box. Why? Immortality Imagine, if you will, we are 5000 years into the future. Medicine has evolved and we now are immortal -...
  • 2,105
3 votes
2 answers
375 views

The Marble Game

Johnny vs. Vinny As brothers, these two are competitive in every aspect of life. Just check out some of my other puzzles, and you'll see my brothers in action. Today is a classic Marble Battle! The ...
  • 2,105
11 votes
2 answers
2k views

Two Cannons - A Beginner's Physics Puzzle

Standoff Let's say we have two cannons aimed directly at one another ( as my horrible attempt shown in the image ). The Angles The cannon on top is aiming down towards the one on bottom right, and ...
  • 2,105
5 votes
1 answer
17k views

Programmatically solving a math puzzle with four unknowns and four equations

I have this puzzle and I want to solve by code. I wrote simple code trying to brute force but it fail in one condition https://dotnetfiddle.net/cJyu3w How can I solve such problems?
  • 53
5 votes
2 answers
167 views

Determine a polynomial with nonnegative integer coefficients with minimum queries

A friend of us makes up a polynomial with nonnegative integer coefficients. Our task is to find it out with a minimum number of queries. For each query we give him a nonnegative integer $L$ and he ...