Questions tagged [decision-problem]
For challenges which involve deciding whether or not the input meets certain criteria, and outputting some data, representing that decision.
802 questions
17
votes
11
answers
1k
views
Directory traversal attack detection
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.
...
18
votes
24
answers
910
views
Is there an even distance pair?
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 ...
19
votes
9
answers
828
views
Is the union of these rectangles a rectangle?
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 ...
14
votes
18
answers
1k
views
Identify Redundant Regex
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 ...
10
votes
2
answers
405
views
Check if a number is a power with its program value being a power
Task:
Your task is make a program to check if there exists integers \$a \ge 2, b \ge 2\$ such that \$a^b=i\$ where \$i\$ is the input integer at least 2.
The catch is that your program must return a ...
15
votes
17
answers
2k
views
IMO 2025: Divisor sums that go forever
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 ...
23
votes
15
answers
3k
views
Write two very different programs with the same characters
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 ...
12
votes
3
answers
2k
views
The shortest NP-complete problem
Find an NP-complete problem that covers all finite ASCII strings, and present a solver for the problem in the programming language of your choice.
By the definition, if there is a finite ASCII string ...
29
votes
42
answers
4k
views
Does your source code contain this character?
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 ...
8
votes
12
answers
702
views
The Array Walker (part 2)
The Array Walker (part 2)
Input: A non-empty array of integers (without nesting1). This can have negative values!
Output: A boolean value2 indicating whether we can reach the end of the array when ...
7
votes
23
answers
998
views
Can we escape from array?
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 ...
10
votes
2
answers
715
views
Intersection check in the fewest operations
Challenge
Given two line segments, your goal is to write a function which determines if they intersect using only the operations given below:
Multiplication: x*y
...
3
votes
2
answers
226
views
Winding a Queue
You will be given a matrix. It contains a ride exit (with a direction), some path, as well as some obstacles. Your goal is to build the longest possible queue line in that space, which connects the ...
13
votes
7
answers
1k
views
Traverse the list
Update 2025-06-04: Thanks for the submissions everyone! It seems like a lot of the solutions are quite slow / timeout for the 100 length test case, so I don't think any will be able to do the 10k. ...
16
votes
12
answers
4k
views
A broken clock is right n times a day
You will be provided with a string containing a digital clock. You must determine how many times per day that clock could be correct. You can ignore daylight savings time. You do not know if the clock ...