Questions tagged [algorithm]

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

Filter by
Sorted by
Tagged with
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: ...
2
votes
2answers
161 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, ...
2
votes
1answer
182 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
125 views

demystify and paint me!

To demystify me, look and say. Then paint me not with colors but with array. ...
13
votes
1answer
480 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
108 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
180 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 ...
9
votes
5answers
230 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$? ...
3
votes
2answers
182 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
73 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 ...
5
votes
1answer
743 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 ...
8
votes
4answers
2k views

Is there a simple algorithm for solving Kami 2 puzzles?

I'm finding my life has been consumed by Kami 2, partly because I seem to have achieved some "insight" and am able to solve the puzzles reliably, almost always on the first try. The rules are simple: ...
7
votes
2answers
261 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
303 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
157 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
329 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
7k 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
119 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 ...
2
votes
3answers
259 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 ...
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 ...
1
vote
3answers
459 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
106 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
122 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
235 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 ...
35
votes
9answers
3k 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 ...
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
279 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
333 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
343 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
69 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
175 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. ...
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 ...
6
votes
2answers
288 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 ...
8
votes
1answer
420 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
281 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 ...
7
votes
1answer
360 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' ...
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. ...
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 ...
85
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 ...
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 ...
6
votes
1answer
246 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.
5
votes
2answers
218 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 ...
-4
votes
10answers
954 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 ...
3
votes
2answers
159 views

SafeCracker #1 - Look who's talking

The Plot You work for a tech company in Tampa, FL. Recently there was a break-in, and the company's trade secrets were stolen. Company PI have tracked the briefcase containing the secrets to the ...
2
votes
1answer
110 views

The NANNP Grid ( Not another Next Number Puzzle )

Simply figure out the last row...
17
votes
5answers
979 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 ...