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
30 votes
21 answers
3k views

Can we spell a third number?

You are given two strings, each consisting of the English word for a number between 1 and 13: ...
Arnauld's user avatar
  • 194k
21 votes
23 answers
1k views

Compatible strings

When studying numerology, you can say two words (strings consisting entirely of letters) are compatible if they produce the same number under the following operation (let's use the string ...
caird coinheringaahin g's user avatar
22 votes
38 answers
5k views

Is It A Rainbow Color?

Challenge: The challenge is to determine whether or not a color, given it's name, is one of the colors in the rainbow. When supplied with a color, your program should output a truthy value if it is a ...
Scott's user avatar
  • 1,117
28 votes
17 answers
3k views

Which side should I serve on?

Introduction In Tennis, the server alternates serving on the left side or the right side of the court every point, starting on the right. It is possible to figure out which side to serve on for that ...
EphraimRuttenberg's user avatar
18 votes
7 answers
877 views

What valence does this APL train have?

Context In APL, trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we ...
RGS's user avatar
  • 14.1k
38 votes
17 answers
4k views

Is it a digit haiku?

We can read 13576870234289 digit-by-digit in English, and it makes a haiku: one three five seven six eight seven zero two three four two eight nine We say it's a &...
lynn's user avatar
  • 68.9k
23 votes
17 answers
2k views

A Portuguese sequence of integers

Context Consider the following sequence of integers: $$2, 10, 12, 16, 17, 18, 19, ...$$ Can you guess the next term? Well, it is \$200\$. What about the next? It is \$201\$... In case it hasn't become ...
RGS's user avatar
  • 14.1k
25 votes
12 answers
3k views

Decide a C integer literal

Objective Given an ASCII string, decide whether it is a valid C integer literal. C integer literal A C integer literal consists of: One of: 0 followed by zero or ...
Dannyu NDos's user avatar
  • 5,961
33 votes
9 answers
2k views

Dice Paths on a Grid

You place a standard die at the origin of a 2D grid that stretches infinitely in every direction. You place the die such that the 1 is facing upwards, the 2 is facing in the negative y direction, and ...
Sisyphus's user avatar
  • 14.8k
15 votes
16 answers
1k views

Concatenations of powers and their squares

At time of writing, my reputation is \$16,256\$. As I noted in chat, Oh cool my rep is the concatenation of two powers of 2: 16,256 Or even the concatenation of a power of 2 and its square, which is ...
caird coinheringaahin g's user avatar
9 votes
21 answers
816 views

Word Length-Sum Multiples

A port of my other question: Double Prime Words Consider a word/string of n alphanumeric characters with sum of the characters, s...
Sumner18's user avatar
  • 1,926
23 votes
16 answers
2k views

Delicate primes

Inspired by Find the largest fragile prime. By removing at least 1 digit from a positive integer, we can get a different non-negative integer. Note that this is different to the ...
caird coinheringaahin g's user avatar
20 votes
14 answers
1k views

sporeball numbers

Background We've studied at least five different types of numbers based on the IDs of different users on this site. Why not study another? My user ID is \$91030_{10}\$. Its binary representation is \$...
sporeball's user avatar
  • 1,656
15 votes
15 answers
1k views

Dovetail two blocks of bits

Check if two blocks of bits dovetail perfectly. Specifications A block of bits is a fixed sequence of 8 bits just like this for example : 11110101. For simplicity we refer to ...
AZTECCO's user avatar
  • 10.8k
-6 votes
2 answers
408 views

Is my Processor 32 or 64 bit?

Not to be confused with Is my OS 32-bit or 64-bit. This one is very simple, tell me whether or not my CPU supports 64-bit instructions. If my CPU supports 32-bit instructions, print '32', if my CPU ...
tuskiomi's user avatar
  • 3,831
16 votes
21 answers
1k views

Double Prime Words

Consider a word/string of length \$n\$, only including the letters A-Z, a-z. A word/string is a double prime word if and only if n is prime and the sum of the letters, s, is also prime, using their ...
Sumner18's user avatar
  • 1,926
35 votes
40 answers
5k views

Is it almost-prime?

Sandbox Definition: A positive integer n is almost-prime, if it can be written in the form n=p^k where ...
infinitezero's user avatar
  • 1,646
25 votes
10 answers
2k views

Are they connected by a Brussels choice?

Background Two numbers, \$a\$ and \$b\$, are said to be connected by a Brussels choice operation* if \$b\$ can be reached from \$a\$ by doubling or halving (if even) a substring (the substring must ...
Mukundan314's user avatar
  • 12.5k
28 votes
4 answers
3k views

Never trust a mastermind

You probably know the game mastermind: The player tries to guess a code of 4 slots, with 8 possible colors - no duplicates this time. Let's call those colors A through H, so possible solutions could ...
Zsolt Szilagy's user avatar
14 votes
7 answers
2k views

Can I exit the maze with this many bombs?

Inspired by this Puzzling challenge, and easier version of my previous challenge. Challenge A 2D rectangular grid is given, where each cell is either an empty space or a wall. You start at the top ...
Bubbler's user avatar
  • 77.5k
29 votes
31 answers
3k views

Antisymmetry of a Matrix

A matrix is antisymmetric, or skew-symmetric, if its transpose equals its negative. The transpose of a matrix can be obtained by reflecting its elements across the main diagonal. Examples of ...
golf69's user avatar
  • 2,059
17 votes
6 answers
565 views

Play a Game of Minigolf

Background I feel that for a site named code-golf we have a shockingly little amount of golf being played. Let's fix that. Challenge Determine whether the hole of a minigolf course can be reached ...
user197974's user avatar
  • 1,161
22 votes
20 answers
2k views

Verify a Superpermutation

A superpermutation on n symbols is a string which contains every permutation of n symbols in its body. For instance, 123121321 is a superpermutation on three ...
golf69's user avatar
  • 2,059
13 votes
4 answers
273 views

Is it a uniform polyhedron?

Objective Given a vertex figure consisting of regular convex polygons, determine whether it represents a convex uniform polyhedron. What is a uniform polyhedron? A uniform polyhedron is a polyhedron ...
Dannyu NDos's user avatar
  • 5,961
17 votes
18 answers
2k views

JFor? More like XNor

As it turns out, Python allows for 1j for to be compressed to 1jfor. However, jfor sounds ...
fireflame241's user avatar
  • 16.3k
18 votes
12 answers
3k views

Are These Scores Possible?

Background In the sport of Table Tennis (aka Ping-Pong or Whiff Whaff), two opponents play a sequence of rounds, where each round consists of players hitting a ball back and forth until one player (...
fireflame241's user avatar
  • 16.3k
9 votes
2 answers
863 views

Tents and Trees feasibility

Sequel to Verify Tents and Trees solution. Background Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically ...
Bubbler's user avatar
  • 77.5k
24 votes
19 answers
3k views

Solve a 2xN Maze

Given a \$2\times N\$ maze, determine if you can get from the start top left corner to end bottom right corner using only up, down, left, and right moves. Input A \$2\times N\$ block (\$1 \le N \le ...
qwr's user avatar
  • 12.1k
16 votes
20 answers
2k views

Are they collinear?

Task Write a program/function that when given three 2d points in cartesian coordinates as input outputs a truthy value if they are collinear otherwise a falsey value Three points are said to be ...
Mukundan314's user avatar
  • 12.5k
12 votes
5 answers
1k views

Verify Tents and Trees solution

Background Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically adjacent to each of the trees, so that no ...
Bubbler's user avatar
  • 77.5k
5 votes
8 answers
284 views

Is it a geometric sequence or not? [closed]

Well, last time I asked for an arithmetic sequence, now comes the geometric sequence Challenge In this challenge, the input will be an unordered set of numbers and the program should be able to tell ...
math scat's user avatar
  • 9,408
-8 votes
4 answers
258 views

Is it an Arithmetic Sequence or not? [closed]

Challenge In this challenge, the input will be an ordered set of numbers and the program should be able to tell if the set of numbers is an Arithmetic Sequence. Input The input will be a list ...
math scat's user avatar
  • 9,408
35 votes
11 answers
6k views

Is there a face in this image?

Help, I've been diagnosed with prosopagnosia! This means I'm no longer able to recognise faces.... :( Can you help me? The challenge You will be given an image as a matrix of regular ASCII characters ...
Daniel H.'s user avatar
  • 3,428
14 votes
8 answers
1k views

Is a statement of propositional logic always true?

The challenge is to golf a program that checks if a statement of propositional calculus/logic is a logical tautology (i.e. it is true for all possible values of the variables). Input Input formulas ...
nph's user avatar
  • 1,428
22 votes
6 answers
2k views

The matrix has U

Given a matrix of size at least 3×3 formed by positive integers, determine if it contains at least one "U" pattern, defined as ...
Luis Mendo's user avatar
  • 105k
7 votes
3 answers
436 views

Is this stack of CNN layers valid?

Background This challenge is about Convolutional neural networks, and its two main building blocks, namely Convolutional layer and Pooling layer. For simplicity, we ignore the "depth" of the ...
Bubbler's user avatar
  • 77.5k
26 votes
4 answers
1k views

Baba is golf, flag is win

If you haven't played the game Baba is You, I think you really should. Whether you’ve played it or not, have a go at implementing it as a code golf. The idea behind this challenge is to have a bit ...
MarcinKonowalczyk's user avatar
17 votes
2 answers
1k views

Is this a valid Shakashaka solution?

Background Shakashaka is a puzzle on a grid, whose objective is to place some half-squares (right triangles) on the empty cells so that all the remaining contiguous regions form rectangles, either ...
Bubbler's user avatar
  • 77.5k
13 votes
3 answers
646 views

Can this polyomino tile the toroidal grid?

Inspired by certain puzzles on Flow Free: Warps. Background We all know that L-triominos can't tile the 3x3 board, and P-pentominos can't tile the 5x5 board. But the situation changes if we allow the ...
Bubbler's user avatar
  • 77.5k
20 votes
35 answers
4k views

Does this month start on a Monday?

June 2020 is a month in which June 1st corresponds to Monday, June 2nd corresponds to Tuesday, ... June 7th corresponds to Sunday. For reference, here's the cal of ...
user avatar
15 votes
4 answers
442 views

Validate Blokus Board

Blokus is a board game in which players take turns placing pieces on a \$ n \times n \$ square grid. In this version of the game, there will be just one person playing. The person is given \$ 21 \$ ...
dingledooper's user avatar
  • 22.7k
11 votes
14 answers
1k views

Is this a half-sort?

The problem over here introduces an new type of strings: if you split the string into equal halfs and swap the pairs, it produces the same output as sorting the string. We call that a half-sort. ...
user avatar
25 votes
11 answers
3k views

Make true and false global!

We all know true and false, but what do speakers around the globe say? ...
Dingus's user avatar
  • 11.2k
26 votes
19 answers
2k views

Bubbler numbers

Background My user ID is 78410, or \$1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0_2\$. One interesting property of this number is that, in binary, it doesn't have three consecutive identical digits, and yet it ...
Bubbler's user avatar
  • 77.5k
11 votes
10 answers
2k views

Cheat activated

Background The game Grand Theft Auto: San Andreas went down in history also thanks to its wide selection of cheats. They're almost 90 and anyone who has ever touched this game, no doubt has tried ...
Domenico's user avatar
  • 2,333
23 votes
70 answers
3k views

Check if an array (or equivalent) has the same number of odd and even numbers - Code Golf Edition!

Inspired by this code review question, I am curious to see what happens if we turn that into a code-golf challenge! The description is easy, the input is an array or any similar data structure with ...
bracco23's user avatar
  • 431
6 votes
3 answers
269 views

Can I trade today?

Back in 2018, there has been introduced new law in Poland to ban trading on sundays, but certain exceptions have been made (listed below). The task today is to determine, can one trade on the sunday ...
Kamila Szewczyk's user avatar
11 votes
6 answers
555 views

Is this a cube?

This challenge is a riff on Dion's challenge "Is this a rectangle?". The goal of this challenge is to write a program to decide whether or not some collection of tuples of integers represents a ...
Peter Kagey's user avatar
  • 8,689
8 votes
1 answer
579 views

Test a polyomino against Conway criterion

Background Conway criterion is a method to test if a given polygon can tile (i.e. cover without overlapping) an infinite plane. It states that a polygon can tile the plane if the following conditions ...
Bubbler's user avatar
  • 77.5k
20 votes
18 answers
5k views

Can I Type This With My Left Hand?

Inspiration The longest words that can be typed with only the left hand on a standard QWERTY keyboard are "sweaterdresses", "tesseradecades", and "aftercataracts" (Source: Wikipedia). Challenge ...
math junkie's user avatar
  • 7,237

1
3 4
5
6 7
16