Questions tagged [algorithm]
A puzzle related to algorithmics (a main concept in computer science).
108
questions
7
votes
1answer
219 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
306 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
318 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
68 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
168 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. ...
7
votes
1answer
334 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
261 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
180 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
295 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
232 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
257 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
934 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 is.
...
5
votes
2answers
204 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 ...
3
votes
2answers
148 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
90 views
30
votes
8answers
2k 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 ...
17
votes
5answers
879 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 ...
5
votes
2answers
189 views
Find the result of this dual key cipher
I came up with a neat little cipher that I'm calling the dual key cipher. The basic premise is that there are two cipher keys that, when used together can decode the cipher text against a given ...
3
votes
2answers
151 views
The fantastic matrix
Here's another question that I have been asked in an interview lately.
Let $M$ be an $n × n$ matrix whose values are $”+”$ and $”-”$. M is called fantastic if it is possible to make all it's values $”...
9
votes
1answer
255 views
Scoring Oracle: Bob easily wins, but how much?
Bob meets a magician with two bags and a chest on a bridge. The magician challenges him with the following enigma:
Here is a bag A, holding 5080 pebbles.
Here is another bag B.
Most of the pebbles ...
4
votes
4answers
274 views
Weighing Counterfeit coins
There are $n=4$ coins and we know exactly $2$ of them are counterfeit. In $2$ weighings, how can we find which of the four coins are the counterfeit ones?
Assumptions: the counterfeit coins look ...
8
votes
3answers
126 views
Creating a maze that is traversed by a pair of compasses
Normal mazes require you to move a point-like object from the entrance of the maze to the exit.
I am wondering whether a different kind of maze would work as a puzzle:
Imagine a maze printed on a ...
5
votes
3answers
256 views
Fill $N$ by $M$ grid with numbers in such a way that any given cells' neighbors are different
Create an $N$ by $M$ grid with numbers in such a way that satisfies following conditions:
numbers should be integers that range from $1$ to $r$.
for any cell $C$, all its adjacent neighbors (i.e. ...
5
votes
1answer
118 views
Shortest path for delivering packages [duplicate]
A version of the Travelling Salesman Problem, but with certain points.
We are talking about a town where 8 canals run from the middle boathouse into the city. You can only travel one way on the green ...
9
votes
1answer
308 views
Puzzles like Sokoban?
I am looking for some puzzles like Sokoban or 15-puzzle but more difficult to solve and satisfy the following requirements:
The number of possible moves at each step should be limited, let's say < ...
13
votes
4answers
358 views
20-Questions on a grid
Posted this on /r/puzzles too, none have given the right strategy as of now :)
There is a square grid of width and height $m$. Three facts about the grid:
Each cell has a value, and no two cells ...
7
votes
1answer
164 views
It's getting harder and harder for my friends to like me
What is the next number in this sequence?
2, 3, 6, 7, 9, 18, 25, 27, 54, 73, 97, 129, 171, 231, 313, 327, 649, 703, ... ?
Hint 1
Hint 2
This is my first puzzle and I'm new to PSE, so feedback is ...
8
votes
4answers
435 views
Ten users, three lights but it's a chatroom
This is a variant of the classic problem of m prisoners n lights. (Example may be found here but note that the requirements are not exactly the same)
The goal for you, however, is different. You want ...
2
votes
0answers
126 views
Ten users, ten deadly collars and three lights [duplicate]
One day, 10 puzzling.SE users, including you, find yourselves in a horrible prison. Each of you has a deadly collar, presently lethal. It is safe to take off only when all of the 10 collars have been ...
6
votes
1answer
181 views
A couples therapy mixer situation
During couples-group-therapy, where two therapist and multiple couples consisting of two people each are present and we all sit on chairs forming a circle in the middle of the room. We often discuss ...
3
votes
1answer
91 views
How can these people cross the bridge? [duplicate]
There are 4 people that must cross an old dilapidated bridge at night, All four walk at different speeds:
There is a young teenager that can cross the bridge in 1 minute.
There is teenager's older ...
24
votes
7answers
6k views
Hacking an electronic keypad
You are a spy trying to break into an enemy facility. The back door is protected by an electronic keypad lock. You know that this particular lock is opened by a four digit code. Any stream of button ...
1
vote
1answer
269 views
Scheduling Meetings
I came across this problem in real life and thought it could be made into an interesting puzzle. I will enjoy seeing how my eventual solution could be improved!
Here's the situation.
There ...
1
vote
3answers
845 views
Is my 5x5 cube on an “illegal” position?
I've never met this postion before, and i'm starting to think it's an "illegal" one because i lend it to a friend before and he said he had to glue some fallen stickers. Am i missing an alorithm or do ...
1
vote
0answers
224 views
Finding all possible solutions of a japanese sums puzzle
I'm trying to think of an algorithm that gives out all possible solutions to a japanese sums puzzle. It's not an a college assignment or anything, I'm giving puzzles to my cousin for fun, but want to ...
0
votes
1answer
324 views
Is there a name for this Rubik's cube algorithm?
$RUR'U RU2R'$
I use this algorithm to:
permute UL and UF edges (messing up corners)
orient LL from a fish (possibly using its mirror)
orient pairs of LL corners by combining above algorithm with its ...
3
votes
2answers
230 views
Figure out when a data usage cycle restarts
Your cell phone carrier sends you a text message when you have reached your data limit (which you know) for the month, after which you are charged for extra data usage.
Question 1: You want to ...
11
votes
3answers
1k views
The Generous Taco stand
There are a group of people standing in line for a taco stand. This taco stand is special in that it's slogan is "The older you are, the more you get!". To make sure though that there isn't any funny ...
0
votes
2answers
2k views
Measuring volumes with oil drums of 8 and 5 litre [duplicate]
You have two drums of capacity 8 litre and 5 litre and a resource of oil, can you use these two drums to give 1 litre, 2 litre, 3 litre, 4 litre, and 6 litres and 7 litres to any customer? If yes, ...
-4
votes
2answers
666 views
Sub-30second solving the $3\times3\times3$ Rubik's cube
I just wanna learn cubing under 30 secs. Please help me:( As i've already learned the Beginner's method. Is there any easiest way to learn the CFOP method as i am unable to understand this method. I ...
18
votes
4answers
2k views
Consecutive Towers of Hanoi
Consider the following variant of the Towers of Hanoi puzzle. There are six pegs. One of the pegs has a stack of $n$ differently sized disks, sorted by size so the smallest disk is at the top. All ...
2
votes
1answer
134 views
How many moves are at least needed to change the order of cubes to a arbitrary order? [closed]
We have several cubes that are ordered as in the picture below:
What is the smallest number of moves with which we are able to reach every possible order?
Only the order of the cubes in the ...
2
votes
1answer
216 views
Doubts about algorithm
Hello I came across a really good algorithm perfect for a minigame I'm making.
When I was trying to implement the algorithm I stumbled with some doubts and I can't the algorithm right.
I'm talking ...
1
vote
1answer
217 views
When will inverting an algorithm allow it to function the same as the original?
Let's say I have this zperm algorithm:
R' U' R U' R U R U' R' U R U R2 U' R' U2
Now, let's suppose I invert it.
U2 R U R2 U' R' U' R U R' U' R' U R' U R
Assuming the cube is in a state of its pll ...
4
votes
1answer
3k views
Is it possible to scramble a Rubik's cube so that each face has no more than 2 squares of the same color?
So the complete conditions for this scrambled cube can be described alternatively as the following:
Each face has less than 3 squares of the same color, which leads to
1a. Each face has 5 or 6 ...
1
vote
1answer
902 views
The swap puzzle
The swap puzzle
Place small coins heads up on the squares marked H and tails up on the squares marked T.
Swap the positions of the Heads for the Tails in as few moves as possible.
There are two ways ...