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.

17 votes
11 answers
1k views

Given a path to a file or a directory, detect whether the path can traverse to outside the current working directory, or attempt to traverse to the "parent directory" of the root directory. ...
Explorer09's user avatar
18 votes
24 answers
910 views

In this challenge you will receive a list of integers as input. Your program should then determine if there are two equal values in the list at an even distance from each other. This is code-golf so ...
Wheat Wizard's user avatar
  • 104k
242 votes
384 answers
72k views

Believe it or not, we do not yet have a code golf challenge for a simple primality test. While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in ...
Dennis's user avatar
  • 212k
19 votes
9 answers
828 views

The intersection of two rectangles is always a rectangle (if you consider the empty set to be a rectangle). But the union of two rectangles is not necessarily a rectangle. Given two rectangles as ...
Wheat Wizard's user avatar
  • 104k
14 votes
18 answers
1k views

A redundant regular expression (regex) is defined here as a regex which has some amount of characters which can be removed while not affecting its functionality -- i.e. it matches the exact same set ...
97.100.97.109's user avatar
29 votes
42 answers
4k views

Given a character as input, determine if your source code contains that character or not. Shortest code wins. Though, I'd like to see some "normal" languages too. UPDATE: the question ...
YurichBRO's user avatar
  • 383
83 votes
273 answers
28k views

Note: There is not been a vanilla parity test challenge yet (There is a C/C++ one but that disallows the ability to use languages other than C/C++, and other non-vanilla ones are mostly closed too), ...
Matthew Roh's user avatar
  • 5,435
15 votes
17 answers
2k views

Problem 4 of the 2025 International Mathematical Olympiad asked (paraphrased): Let \$f(n)\$ be the sum of the largest three proper divisors of \$n\$, that is divisors excluding \$n\$ itself. For ...
xnor's user avatar
  • 150k
23 votes
15 answers
3k views

Your task is to write two programs/functions, in the same language. Program 1: Verify that two inputs are anagrams of each other. Program 2: Verify that two inputs differ from each other at every ...
Steve Bennett's user avatar
30 votes
53 answers
3k views

Challenge Given three non-negative integers \$a, b\$ and \$c\$, decide if the sum of their cubes is equal to the concatenation of those numbers, aka: $$ a^{3}+b^{3}+c^{3} = a^\frown b ^\frown c $$ ...
Blue's user avatar
  • 559
13 votes
18 answers
2k views

A046386 is the sequence of all natural numbers that are the product of exactly 4 distinct primes. Write the shortest program, function, or code snippet, that, when given a natural number, outputs ...
bigyihsuan's user avatar
  • 11.5k
35 votes
98 answers
9k views

Task Given a non-negative number, check if it's odd or even. In case it's even, output that number. Otherwise, throw any exception/error that your language supports, and stop the program. Example with ...
LeopardL GD's user avatar
59 votes
145 answers
21k views

Introduction In number theory, a number is considered evil if there are an even number of 1's in its binary representation. In today's challenge, you will be identifying whether or not a given number ...
Amphibological's user avatar
7 votes
23 answers
998 views

Can we escape from the array? Input: A non-empty array of non-negative integers (without nesting1). Output: A boolean value2 indicating whether we can reach the end of the array when starting from the ...
JOrE20's user avatar
  • 424
24 votes
31 answers
2k views

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 30 50 per page
1
2 3 4 5
54