Skip to main content

Questions tagged [decision-problem]

For challenges which involve deciding whether or not the input meets certain criteria, and outputting some data, representing that decision.

Filter by
Sorted by
Tagged with
17 votes
13 answers
2k views

Wait, ASCII was 128 characters all along?

Challenge In this challenge, you have to take a nonnegative integer as input, convert it into base-128 bytes (0 → 0x00, 127 → ...
squareroot12621's user avatar
20 votes
15 answers
2k views

Sorting with a deque

You're given an array of positive integers. Your job is to sort them using an initially empty deque (double-ended queue) by the following procedure: Take a number from the front of the array, and ...
Bubbler's user avatar
  • 77.5k
9 votes
13 answers
1k views

Is it an option for the ls utility specified in POSIX.1-2017?

The ls utility lists specified directory content. It is infamous for stupidly lots of options which is known for anti-pattern design of implementing software.(...
鳴神裁四点一号's user avatar
11 votes
15 answers
2k views

Is this a Hadamard matrix?

Hadamard matrices is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. In other words, it means that each pair of rows has matching entries in exactly half of ...
Fmbalbuena's user avatar
  • 4,167
3 votes
1 answer
118 views

Detect revokes in Jass

Jass is a trick-taking game for four players and the national card game of Switzerland. It is played with a 36-card deck, four suits each with ranks 6, 7, 8, 9, 10, J, Q, K, A. We will be using French ...
Parcly Taxel's user avatar
  • 3,845
20 votes
23 answers
1k views

Is this a valid PZN?

Is this a valid PZN? A Pharmazentralnummer, or PZN, is an eight-digit code which uniquely identifies medications, medical products, and similar items in the German healthcare system. Examples include ...
Ciaran_McCarthy's user avatar
15 votes
5 answers
1k views

Is this a solvable Numberlink?

Challenge Per Wikipedia: Numberlink is a type of logic puzzle involving finding paths to connect numbers in a grid. The player has to pair up all the matching numbers on the grid with single ...
badatgolf's user avatar
  • 1,477
25 votes
14 answers
2k views

Is it a cartesian product?

The cartesian product of two multisets \$A\$ and \$B\$ is the multiset of all ordered pairs consisting of an element of \$A\$ and an element of \$B\$. For example, the cartesian product of \$\{1, 2, 7,...
emanresu A's user avatar
  • 39.2k
5 votes
1 answer
301 views

Dishonest dungeon staff

This is a joint post with https://puzzling.stackexchange.com/questions/126255/dishonest-dungeon-staff You are faced with the difficult task to set up a dungeon for adventurers. However you made a deal ...
Fluorine's user avatar
  • 151
29 votes
5 answers
2k views

Can I Clear The Grid?

I recently found this game and have been enjoying it. Basically, there is a grid of colored tiles and you act by clicking on empty spaces. When you click an empty space, the first tile (if any) in ...
hyper-neutrino's user avatar
  • 42.5k
10 votes
5 answers
972 views

Manipulate integers to zero

Objective Given a nonempty unordered list of positive integers, decide whether they can be added, negated, or multiplied to yield a single zero. Each given number must be used exactly once. There is a ...
Dannyu NDos's user avatar
  • 5,961
21 votes
15 answers
2k views

Can I follow this recipe?

You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient. So you can add pasta, oil, salt then pesto, but not pasta, pesto, ...
Wheat Wizard's user avatar
  • 99k
18 votes
26 answers
2k views

Is it a tetrate of two?

The tetration operation consists of repeated exponentiation, and it is written ↑↑. For instance, 3↑↑3 =3 ^(3^3) = 3^27 = 7,625,597,484,987 A tetrate of two is an ...
isaacg's user avatar
  • 42.1k
10 votes
5 answers
550 views

Is the king in check?

Challenge: Given a 2D array (8x8) of characters, is the enemy king in check? The program should return true if and only if the king is currently in check. Standard chess rules apply. Specifications: ...
Mickey's user avatar
  • 111
18 votes
12 answers
2k views

Is it a valid ARM immediate value?

Exposition In this challenge, I am talking about ARM assembly language. ARM is a 32-bit RISC processor; I'll use instruction set up to architecture v6. To load a constant ("immediate") value ...
anatolyg's user avatar
  • 13.7k
7 votes
4 answers
398 views

Busy Letters & Evil CEOs

Imagine you are given an array/string containing \$5\$ letters of the English alphabet, with each letter having any value from A to Z (inclusive). Every day, each letter will perform a job, which can ...
Trivaxy's user avatar
  • 487
9 votes
9 answers
721 views

Validate a codice fiscale

Validate a codice fiscale Every Italian resident/citizen is given a 16-character alphanumeric codice fiscale Challenge The final letter is a check code, which is calculated as follows : Characters of ...
Nicolas Formichella's user avatar
16 votes
20 answers
3k views

Doubleouble Talkalk

Input A non-empty string or list of capital letters k with length between 3 to 5000. Output A value indicating whether k can be ...
Sny's user avatar
  • 439
18 votes
15 answers
3k views

Validate a CPF number

Every Brazilian citizen has a national identification number associated with them, named CPF. This number has 11 digits (formatted as XXX.XXX.XXX-XX) and it's validated by the following (real) ...
enzo's user avatar
  • 2,093
19 votes
31 answers
2k views

Is this number tetrahedral?

Happy New Year 2024! 2024 is a tetrahedral number. A tetrahedral number is a number that can be represented in the form \$n(n+1)(n+2)/6\$ for some positive integer \$n\$. Or, equivalently, they are ...
alephalpha's user avatar
  • 48.7k
7 votes
12 answers
958 views

Can their first appearance happen together?

Given two non-empty 01 strings, check if there is string containing both given strings, and their first appearance end at same position. Test cases: ...
l4m2's user avatar
  • 24.9k
18 votes
24 answers
2k views

Test whether a sequence is bitonic

You know what a monotonic sequence is: each element is bigger than its predecessor (monotonically rising) or as its successor (monotonically falling). Bitonic means you have two arms of the sequence, ...
Philippos's user avatar
  • 2,590
6 votes
4 answers
246 views

Is it stuck in a counting loop? [duplicate]

Given a list of non-negative integers the function \$f\$ replaces every integer with the number of identical integers preceding it (not necessarily contiguously). So ...
Wheat Wizard's user avatar
  • 99k
6 votes
0 answers
281 views

Solve the word problem*

In this challenge you will receive a list of positive integers \$W\$ called a word, and a square symmetric matrix \$M\$. Your task is to determine if the word can be turned into the empty list by ...
Wheat Wizard's user avatar
  • 99k
6 votes
1 answer
242 views

Determine if a Spider Solitaire game is stale

Let's introduce a simplified variant of the well known Spider Solitaire. From Wikipedia: The main purpose of the game is to remove all cards from the table, assembling them in the tableau before ...
Kamila Szewczyk's user avatar
9 votes
8 answers
1k views

Is it a valid hidden word?

The Universal Crossword has a set of guidelines for crossword puzzle submissions. In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists ...
Wheat Wizard's user avatar
  • 99k
26 votes
9 answers
3k views

Is it a Valid Crossword Grid?

In crossword terminology, the grid is the region into which the crossword answers are inserted, consisting of white and black squares. The crossword answers, called entries, are inserted into ...
97.100.97.109's user avatar
21 votes
8 answers
3k views

Do you win a Numeric Mahjong?

Background Numeric Mahjong is a hypothetical variation of Japanese Mahjong, played with nonnegative integers instead of Mahjong tiles. Given a list of nonnegative integers, it is a winning hand if it ...
Bubbler's user avatar
  • 77.5k
22 votes
19 answers
3k views

Is it an Element?

𝖧ello all, I hope this finds you well. There are 118 elements on the Periodic table at the moment, each one corresponds to the number of protons in an atom's nuclei. Each element also has a 'symbol'. ...
tuskiomi's user avatar
  • 3,831
17 votes
12 answers
971 views

Is it a canonical elementary CA rule number?

Background Given an elementary cellular automaton rule number like, for example, 28 = 00011100… We can swap \$\color{red}{\text{the 2nd bit with the 5th bit}}\$ ...
lynn's user avatar
  • 68.9k
6 votes
4 answers
524 views

Walk by walls in a room

Challenge You just entered a room. Here's how it looks (you are the X): |\ /| | \/ | | X | | | |----| You challenge yourself to see if you can reach where you ...
Joao-3's user avatar
  • 1,223
16 votes
6 answers
3k views

Is it a valid Go type?

Write the shortest program or function that will determine if an input is a valid Go type. Spec This challenge will use the following simplified subset of Go types. For more information, see the ...
bigyihsuan's user avatar
  • 10.1k
21 votes
18 answers
2k views

Is this set laminar?

A family of sets is called laminar if for any two sets \$A\$ and \$B\$ in the family one of the following is true: \$ A \subseteq B \$ \$ A \supseteq B \$ \$ A \cap B = \emptyset \$ Or less ...
bsoelch's user avatar
  • 6,035
23 votes
31 answers
3k views

Is this a powerful number?

A powerful number is a positive integer \$n\$ such that for every prime \$p\$ that divides \$n\$, \$p^2\$ also divides \$n\$. Or equivalently, \$n\$ is powerful if and only if it can be written in the ...
alephalpha's user avatar
  • 48.7k
14 votes
15 answers
1k views

Two Parallel Linked Chains

Background We define the two types of chain to be a string that contains only dashes, "-", or only underscores, "_". We link two chains using one equals sign, "=". ...
Jacob Creutzfeldt's user avatar
21 votes
34 answers
2k views

Reversed Squares

Given an integer n, your task is to determine whether it is a perfect square that when reversed, is still a perfect square. You may assume n is always positive. When numbers such as 100 (10x10) are ...
Larry Bagel's user avatar
  • 4,193
11 votes
9 answers
1k views

Decide Contiguous Binary Tree

Objective Given an unlabelled binary tree, decide whether it is contiguous in indices. Indices This challenge gives one-indexing on binary trees. The exact definition expresses all indices in binary ...
Dannyu NDos's user avatar
  • 5,961
25 votes
16 answers
4k views

Is it a plausible chess move?

Not a duplicate of the valid move challenge because that asks for specific pieces. Backstory The other night I was doing a little trolling with ChatGPT and chess. I was trying to get it to call me out ...
lyxal's user avatar
  • 33.7k
15 votes
20 answers
2k views

String Comparison

You are given two strings \$a\$ and \$b\$ consisting of characters from a to z in lowercase. Let \$n\$ be the length of \$a\$. Let \$m\$ be the length of \$b\$. Let \$a'\$ be the string \$a\$ repeated ...
Huỳnh Trần Khanh's user avatar
9 votes
5 answers
777 views

On The Subject Of Simon Says

This challenge is from a game, Keep Talking And Nobody Explodes. This is like one of those toys you played with as a kid where you have to match the pattern that appears, except this one is a knockoff ...
Dannyu NDos's user avatar
  • 5,961
26 votes
6 answers
1k views

Detect sonar imposters

You are the sonar captain aboard an underwater submarine. The way sonar works is that every submarine sends out a ping at regular intervals. Each interval is a whole number of seconds. Each submarine ...
Wheat Wizard's user avatar
  • 99k
13 votes
4 answers
1k views

Is it a Frog List?

Challenge: A Frog List is defined by certain rules: Each frog within a Frog List has an unique positive digit [1-9] as id (any 0...
Kevin Cruijssen's user avatar
30 votes
13 answers
3k views

Is it a valid chemical?

Non-metals typically* have a fixed number of covalent bonds in every chemical they are part of. Given the number of bonds every element requires, output whether it's possible to construct a single ...
mousetail's user avatar
  • 12.7k
29 votes
17 answers
3k views

Is it traversable?

Imagine that a list of integers describes the heights of some two-dimensional terrain as seen from the side. Stamina: [ 4 4 4 4 4 4 3 3 3 3 2 2 2 - ] O ...
chunes's user avatar
  • 25.4k
4 votes
2 answers
201 views

Ragged list pattern matching, Part 2

This is a sequel to Ragged list pattern matching. In this challenge, the wildcard may match a sequence of items of any length instead of just a single item. Given a pattern and a ragged list of ...
alephalpha's user avatar
  • 48.7k
16 votes
6 answers
1k views

Detect round trips on a hyperbolic grid

You're driving a car in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to continue left, ...
Karl's user avatar
  • 621
10 votes
9 answers
978 views

Language Word Checker

Develop a program to check if a given word is part of a language defined by the following rules: The language has a set of rules. The empty string is considered a valid word in the language. Two ...
Huỳnh Trần Khanh's user avatar
13 votes
7 answers
763 views

Guessing on straws

Dedicated to Martin Gardner, taken from his book Background In the old days, the Slavs had a divination method for finding out whether a girl would get married. The girl would clutch six straws in her ...
lesobrod's user avatar
  • 3,413
4 votes
1 answer
230 views

Triangularly embed a graph on a surface

This challenge arises from a claim made in a MathOverflow answer and a paper linked in that answer which seems to back up the claim: Searching for triangular embeddings is much quicker than ...
Parcly Taxel's user avatar
  • 3,845
11 votes
2 answers
231 views

Making one shape out of dissections of another

Introduction One question that I have come across recently is the possibility of dissecting a staircase of height 8 into 3 pieces, and then re-arranging those 3 pieces into a 6 by 6 square. Namely, is ...
Aiden Chow's user avatar
  • 13.7k

1
2 3 4 5
16