Questions tagged [algorithm]

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

Filter by
Sorted by
Tagged with
5
votes
0answers
127 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 ...
12
votes
1answer
351 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
1answer
89 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 ...
1
vote
0answers
94 views

Robot's Step, Step, Sent Back!

So there is this robot. Its origin is at (0, 0), index 0. Each pair of coordinates will have same numbers for x and y. How the robot moves is this: ...
2
votes
1answer
224 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 ...
3
votes
1answer
208 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
1answer
237 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 ...
7
votes
3answers
446 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 highlighted. Consider an integer ...
2
votes
1answer
191 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
1answer
130 views

demystify and paint me!

To demystify me, look and say. Then paint me not with colors but with array. ...
2
votes
2answers
173 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, ...
13
votes
1answer
497 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 ...
6
votes
1answer
111 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?
4
votes
1answer
189 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
2answers
187 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 ...
4
votes
2answers
143 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
5answers
239 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
votes
1answer
757 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
2answers
301 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 ...
4
votes
2answers
321 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 ...
6
votes
2answers
164 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 -...
3
votes
2answers
343 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 ...
11
votes
2answers
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 ...
5
votes
1answer
10k views

How to programmatically solve math puzzle

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 Anyone know of a link or source how to solve ...
5
votes
2answers
121 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 ...
8
votes
2answers
1k views

Stacking pancakes for your wife

You are cooking pancakes for your lovely wife. You want to sort the pancakes such that they increase in diameter as you move from the top to the bottom of the stack. The only operation you can perform ...
2
votes
3answers
267 views

Two of 18 coins are counterfeit

There are $n=18$ coins, and we know exactly $2$ of them are counterfeit. All counterfeit coins differ from normal coins in weight, but otherwise their weight is not known. They can be heavier or ...
1
vote
3answers
465 views

Move all the stones into a single cell of a 3x4 grid

A 3x4 grid contains a heavy stone in each cell. Walking from a cell to an adjacent cell (horizontally or vertically) without any stones requires 1 second. Moving one stone from a cell to an adjacent ...
14
votes
4answers
2k views

Emoji primes - what's the smallest positive integer this doesn't work for?

Driven by a silly conversation at work, here's the puzzle. Slack allows users to send emoji as a reaction to a message. Emoji are listed left to right in chronological order of reaction, and 'stacks' ...
3
votes
1answer
109 views

Reapply *some* stickers on scrambled cube

I have this weird cube which have some pieces printed on the plastic and some are detachable. The cube was scrambled not solved and it fell on the floor being cheap cube almost all detachable faces ...
2
votes
1answer
138 views

Looking for an old Rubiks cube algorithm

I learnt rubiks cube before the YouTube days from a blog. I do not find the algorithm anymore online but it is something like White cross White corners (except one) Second layer corners (except one) ...
5
votes
1answer
240 views

Brute-force solver for Gear Octahedron - flawed method?

I am working on a program to brute-force a LanLan Gear Octahedron I bought second-hand (and scrambled). I have no background in "cubing" and just fancied solving the problem. The structure comprises ...
11
votes
1answer
2k views

Worst way to solve Rubik's in one algorithm

If you apply the same algorithm over and over again the cube will be solved. I want to know what algorithm is the worst one (the one with the longest cycle) I have found RU (cycle of 60 times) I have ...
7
votes
1answer
289 views

Heavy-duty computing challenge — maximum-density word packing

Caution: This is a challenge for computers only. Humans are advised to stand well clear of the protective safety cage. There may be CPUs on fire before it's over. Introduction Nothing makes a ...
13
votes
12answers
2k views

2 Person Same Number Verification

Alice and Beth both receive a random integer from 1 through 10, inclusive. They only know the number that they are given. The two of them want to come up with an algorithm to check that their ...
5
votes
3answers
335 views

land of light bulbs

Leuks is the land of light bulbs, where the bulbs are leading a peaceful life, with no humans at all. Presently there are 100 residents . (Of course, they all are light bulbs!). Let $a_{1}, a_{2}, . . ...
11
votes
2answers
2k views

Three knights searching for a princess in a castle

There is a castle with rooms arranged in a 4x4 square grid. The princess living in the castle sleeps in a different room each night, but always one adjacent to the one in which she slept on the ...
4
votes
1answer
351 views

Two knights searching for a princess in a castle

There is a castle with rooms arranged in a 3x3 square grid. The princess living in the castle sleeps in a different room each night, but always one adjacent to the one in which she slept on the ...
3
votes
1answer
70 views

Arranging people to be in a group with every other person at least once

There are 12 people. These people start in 4 groups - each with 3 people. They swap groups 4 times, so they are in a total of 5 groups. Is it possible for each person to be in a group with every other ...
0
votes
2answers
179 views

Hunting for treasure in 1-d grid [duplicate]

In a castle, there are N rooms in a line. Each room has a door to the two neighbouring rooms (or the one neighbouring room, for the rooms at either end). A treasure is hidden in one of the rooms. ...
8
votes
1answer
466 views

Cube Scrambling

Take a normal 3x3 rubiks cube (the Classic unmodded cube). I know the WCA method for scrambling is to pick a random (valid) cube state and calculate a sequence of moves to go from solved to that state,...
1
vote
2answers
285 views

Minimize sum of guesses to win lottery

Ten boxes are given with $a_1,a_2,a_3,a_4,a_5 ......a_{10}$ number of balls in them respectively .These boxes are randomly ordered but $a_1,a_2 .....a_{10}$ is told.We can arbitrary select a box and ...
2
votes
2answers
194 views

How to find number of times sequence element $1$ is approached and from where?

Consider a sequence $1,-1,-1,-1,-1,-1,...,-1$. Start at the first element and move down the sequence according to the following rules: 1) If you jump from a $-1$ to another $-1$, turn the latter into ...
7
votes
4answers
314 views

Savage Road Signs (Part 2)

Please read part 1 or this might be confusing Since part 1, you have replaced the stolen stickers and your daughter has forgiven you. The highway ended up being a full 700km long, so you are happy ...
2
votes
2answers
1k views

Finding numbers having exactly two distinct digits

We have $10^K$ road signs (numbered 0 through $10^K−1$). For each valid $i$, the sign with number $i$ has the integer $i$ written on one side and $10^K−i−1$ written on the other side. We need to ...
4
votes
1answer
2k views

Finding Round Integer

An integer is round if it is greater than $0$ and the sum of its digits in decimal representation is a multiple of $10$. Find an optimal procedure to compute the $N^\text{th}$ smallest round integer. ...
6
votes
1answer
249 views

$4\times4\times4$ Rubiks cube Top Layer Issue

The only way i am able to solve is to jumble the whole cube again. If you know the way to solve pls give images or algorithm.
6
votes
2answers
296 views

The CompuTaria Quest - A young Wizard's journey

Once Upon A Time In A Land FAR, FAR Away... Our adventure begins in the enchanted land called "CompuTaria". You are, "Binaryian" a 3rd year Wizard In Training. Today began like any other day - you ...
-4
votes
10answers
963 views

SafeCracker #3 - We've Been Blocked [closed]

Our Last Safe To Conquer Ok, team, this one might give us a little trouble. Nothing we can't handle though... let's go... This safe model is "The NevaCrak 9000" - the most secure safe there ...
5
votes
2answers
223 views

SafeCracker #2 - The Mission Continues

Thanks to an alert StackE user, we were able to get the first safe open. Mission Details This next safe is in a former employee's house. He is gone for now, so we have no time to spare. We weren't ...