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
27
votes
18answers
4k views

Numbers with Rotational Symmetry

Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise. 0, 1, and <...
27
votes
4answers
845 views

Can Gravity Guy Make It?

Gravity Guy is a game where the only user input is a single key that flips the direction of gravity. Given an ASCII art level, determine if it is possible for Gravity Guy to reach the end. Rules The ...
27
votes
21answers
1k views

Primenary Strings

A Primenary (binary-prime) string is one which, when written as a binary grid, every row and column has a prime total. That's quite a vague explanation, so let's break it down with a worked example......
27
votes
9answers
1k views

Verify Topology

Challenge Given a set T of subsets of a finite set S={1,2,3,...,n}, determine whether T is a ...
27
votes
15answers
967 views

Matching Adjacent Words

In this challenge, you are passed two words: Your job is to determine if they are adjacent. Two letters are adjacent if: They are the same letter, or They are lexicographically adjacent. For example,...
27
votes
6answers
3k views

Is the pizza fair?

This question is inspired by, and is the inverse of this one. Dennis (E), Doorknob (D), Martin (...
27
votes
2answers
1k views

Arranging arbitrary rectangles to fill a space

Can these rectangles fill a rectangular space? Given a bunch of rectangles, you are asked whether or not they can be arranged to fill a rectangular space. Specs Given a bunch of arbitrary ...
26
votes
81answers
4k views

Is it a whole number?

A number is whole if it is a non-negative integer with no decimal part. So 0 and 8 and ...
26
votes
37answers
9k views

IP address or not?

Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted. An IPv4 address is a ...
26
votes
11answers
5k views

Is this number an exact power of -2: (Very) Hard Mode

This is a version of the recent challenge Is this number an integer power of -2? with a different set of criteria designed to highlight the interesting nature of the problem and make the challenge ...
26
votes
22answers
6k views

Is it a good 2048 board?

This is my first question here, so any suggestions in the comments would be appreciated! Thanks ;) Introduction One very common strategy for the 2048 game is never ever swiping down. This positions ...
26
votes
22answers
3k views

Is it a weak prime?

A prime is weak if the closest other prime is smaller than it. If there is a tie the prime is not weak. For example 73 is a weak prime because 71 is prime but 75 is composite. Task Write some ...
26
votes
18answers
2k views

Am I a 'Redivosite' Number?

Redivosite is a portmanteau word invented for the sole purpose of this challenge. It's a mix of Reduction, Division and Composite. Definition Given an integer N > 6: If N is prime, N is not a ...
26
votes
11answers
1k views

Does this Set Represent a Natural Number?

In set theory, the natural numbers \$\mathbb{N} = \{0, 1, 2, 3, ...\}\$ are usually encoded as pure sets, that is sets which only contain the empty set or other sets that are pure. However, not all ...
26
votes
4answers
2k views

Golf Me An OOP!

Golf Me An OOP! Two important components of object-oriented programming are inheritance and composition. Together, they allow for creating simple yet powerful class hierarchies to solve problems. ...
26
votes
3answers
3k views

Help, I'm trapped in an infinite factory!

This challenge is loosely inspired by the Zachtronics game Infinifactory. You are given a top-down view of a rectangular grid of conveyors, represented by ...
26
votes
2answers
611 views

Can this village have a wedding?

The quaint hamlet of Кодгольф in the Russian far east has a problem: their population is low (below 66), and no new people have arrived for years. Moreover, after centuries of near-isolation, just ...
26
votes
1answer
555 views

Three-Dimensional Chess

In order to defend someone’s baffling decision, people often say that that person is going over everyone’s heads and playing “3-dimensional chess”. Now it’s your chance to play 3-dimensional chess! ...
25
votes
40answers
5k views

Check if a string is entirely made of the same substring

This is taken from this question (with permission ofcourse). I'll quote: Create a function which takes a string, and it should return true or false based on whether the input consists of only a ...
25
votes
23answers
4k views

Traffic direction

Rules Given an ISO3166-1-Alpha-2 country code your task is to decide on the traffic direction for that country: Input will be a valid country code (valid as in it's an element of the two lists ...
25
votes
31answers
3k views

Is it a Lynch-Bell number?

You will be given a positive, whole number (that will never contain a 0) as input. Your task is to check whether it is a Lynch-Bell number or not. A number is a Lynch-Bell number if all of its digits ...
25
votes
28answers
3k views

#Hashtag_or_not

In this code golf challenge, you will verify hashtags! #What_your_code_should_do Input is a string. Output a truthy value if it is a valid hashtag, and a falsy value otherwise. We define a string ...
25
votes
11answers
3k views

Make true and false global!

We all know true and false, but what do speakers around the globe say? ...
25
votes
26answers
4k views

Am I a Cullen Number?

A Cullen Number is any number that is contained in the sequence generated using the formula: C(n) = (n*2^n)+1. Your Task: Write a program or function that receives an input and outputs a truthy/...
25
votes
34answers
2k views

Where are Champernowne's zeroes?

Consider the infinite string of all nonnegative decimal integers concatenated together in order (akin to Champernowne's constant): ...
25
votes
22answers
1k views

PKCS#7 padding validation

In cryptography, PKCS#7 padding is a padding scheme which adds a number of bytes N ≥ 1, where the value of each added byte is equal to N. For example, Hello, World!...
25
votes
17answers
3k views

Who won a Game of Bar Dice?

Challenge Bar Dice is a simple game played in a Bar with Dice (hence the name). You roll 5 six-sided dice and attempt to make the best hand. Scoring is based on amassing the largest number of ...
25
votes
18answers
3k views

Two roads diverged in a yellow wood (part 2)

This is the second in a series, the third is Two roads diverged in a yellow wood (part 3) This is based on Two roads diverged in a yellow wood (part 1), a previous challenge of mine. It was fairly ...
25
votes
14answers
3k views

Are my triangles similar?

Given (in any structure; flat list, two lists of lists, a tuple of matrices, a 3D array, complex numbers,…) the coordinates for two non-degenerate triangles ...
25
votes
7answers
1k views

A Basic Pyth-like Syntax Checker

Pyth is a golfing language based on Python. It uses prefix notation, with each command having a different arity (number of arguments it accepts). Your task is to write a syntax checker for a (non-...
25
votes
11answers
2k views

Is this Pascal's Matrix?

In Pascal's triangle each number is the sum of the two numbers directly above it, treating empty spots as zero: By rotating the triangle, we can cut out square matrices of varying sizes and rotations ...
25
votes
2answers
922 views

Is it a Rubik's Cube?

A venerated pass time of pedants is to point out that pictures of "Rubik's Cubes" (on t-shirts, posters etc.) are not actually solvable. The first thing that should be checked is that the cube is ...
25
votes
7answers
713 views

Uniquely removable subsequences

Introduction Consider a sequence of integers and one of its subsequences, say A = [4 2 2 4 4 6 5] and B = [2 4 5]. We want to remove the elements of B from A in order, and there are several ways of ...
25
votes
4answers
815 views

Can Jimmy escape the ghosts?

It is Halloween and Jimmy (/o\) has gone into a mysterious neighborhood for trick-or-treating (ask himself why). Now some evil ghosts are chasing him. Can Jimmy ...
24
votes
20answers
2k views

Test if a string can be made with substrings!

Given a string s and an array/list l, determine whether or not s can be made with parts from ...
24
votes
28answers
2k views

Magnanimous numbers

Given an positive integer as input determine if it is a magnanimous number. A magnanimous number is a number such that any insertion of a + sign between any two ...
24
votes
13answers
5k views

Is this a legal date? - April Fools' edition

Task A date can be compactly represented in a 6-character string in the format ddmmyy where the first two characters (dd) ...
24
votes
10answers
1k views

Embedding Sets of Sets

Setup: For two sets \$A,B\$, we say \$A \subseteq B\$ if every element in \$A\$ is also in \$B\$. Another way of saying this, is that we can order the elements of \$A,B\$ into two lists \$L_A,L_B\$, ...
24
votes
4answers
3k views

Ain't no thang! …or is it?

Introduction Street talk can be really difficult to understand, in particular to programmers, who aren't known to be very streetwise. It is your job to create an interpreter to help us all survive ...
24
votes
1answer
721 views

Is it a Cactus?

In graph theory, a Cactus is a connected graph such that any distinct two simple cycles in the graph share at most one vertex. Here is a Cactus with 3 simple cycles outlined with dashed lines. The ...
23
votes
19answers
4k views

Do I have a prime twin?

An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and ...
23
votes
19answers
3k views

Square Triangles

A positive integer x is a square triangle number iff there are two different positive integers, y and z, which are smaller than x such that all of the sums x + y x + z y + z are perfect squares. ...
23
votes
14answers
5k views

Can I Settle Down?

In The Settlers of Catan board game, there are five resource types: Brick, Log, Ore, Wheat, and Sheep. Building a settlement costs a Brick, a Log, a Wheat, and a Sheep. However, you can also trade in ...
23
votes
11answers
6k views

Is this number secretly Fibonacci?

Background Most of you know what a Fibonacci number is. Some of you may know that all positive integers can be represented as a sum of one or more distinct Fibonacci numbers, according to Zeckendorf'...
23
votes
23answers
2k views

Verifying a horizontal ASCII pet snake

Recently there have been a couple of ASCII pet snake challenges (e.g. here) ...
23
votes
15answers
2k views

A Semi-palindrome Puzzle

An palindrome is a word that is its own reverse. Now there are some words that might look like palindromes but are not. For example consider the word sheesh, <...
23
votes
21answers
2k views

Can this list be balanced?

To check whether a list of non-negative integers is balanced, one can imagine putting respective weights on a board and then try to balance the board on a pivot such that the summarized relative ...
23
votes
13answers
1k views

Can you handle the pub?

Background It's late Friday afternoon and you and your friends decide to hit the pub later that evening, but before going to the pub you figure you should have a few beverages. However, things ...
23
votes
7answers
3k views

10-pin bowling split spare

Bowling Bowling is a game where, essentially, each player gets 10 turns to: Take 2 attempts at knocking down 10 pins arranged in a triangle. between turns the pins are reset from the 1st to the 2nd ...
23
votes
5answers
3k views

Is this platform game level winnable?

Given a level from a simple platform game, your task is to make a program or function to determine if a level is winnable. Platform game levels are 4 characters tall and any number of characters wide. ...

1 2 3
4
5
11