Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [decision-problem]

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

7
votes
4answers
418 views

The Onion, or Not The Onion?

The Onion (warning: many articles are NSFW) is a satirical news organization that parodies traditional news media. In 2014, The Onion launched ClickHole (warning: also frequently NSFW), a satirical ...
29
votes
2answers
4k views

Primality testing formula

Your goal is to determine whether a given number n is prime in the fewest bytes. But, your code must be a single Python 2 expression on numbers consisting of only ...
12
votes
6answers
380 views

Golf a Solubility Chart

Given the name of a cation and anion, output "S" (soluble) or "I" (insoluble). The table we will be using is from wikipedia: https://en.wikipedia.org/wiki/Solubility_chart. It is copied at the end of ...
7
votes
3answers
157 views

Evaluate Words Based on “Rules” (Skeptics.SE Crossover)

I came across this picture, which I initially questioned and thought about posting to Skeptics. Then I thought they'll only tell me if this one case is true, but wouldn't it be great to know how true ...
27
votes
73answers
12k views

Is this number evil?

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 ...
19
votes
11answers
3k views

Is this a straight flush?

Related: Name the poker hand A straight flush is a poker hand containing five cards of sequential rank, all of the same suit. As part of a straight flush, an ace can rank either above a king or ...
15
votes
25answers
2k views

Mixed Fraction Equality

In elementary school, children learn about proper fractions, where the numerator is less than the denominator, and thus the value of the fraction is less than one. Later, they are taught about ...
10
votes
2answers
202 views

Solve the Halting Problem for Modilar SNISP

In the spirit of Solve the Halting Problem for Befinge, let's define another 2D language called Modilar SNISP. Modilar SNISP has the following six instructions: \ ...
37
votes
28answers
4k views

Is the matrix centrosymmetric… and so is the code?

Defintion A centrosymmetric matrix is a square matrix that is symmetric about its center. More rigorously, a matrix \$A\$ of size \$n \times n\$ is centrosymmetric if, for any \$i,\: j \in ([1, n] \...
19
votes
12answers
1k views

Socket - Plug compatibility

Traveling with electronics is always fun, especially when you need an adapter to charge them. Your challenge is to make planning a trip a little easier by checking if a given plug will be compatible ...
15
votes
11answers
2k views

In for a bumpy ride

Your task is to write a computer program or function that takes a list of positive integers of at least length 2 and determines if they are a "zigzag". A sequence is a zigzag if and only if the ...
8
votes
8answers
1k views

Was it a Superb Shuffle™️

According to this question a Superb Shuffle™️ is defined as a full deck of cards (including jokers) which follows this set of rules: No two cards (except Jokers) of the same suit are adjacent. No ...
17
votes
3answers
435 views

Dead Frog Walking

Introduction Jonny wants to play Frogger. However, he's not very good. In fact, he will only try to move forward, and only after the platforms have moved. Find out if Jonny's frog manages to reach ...
19
votes
15answers
2k views

Upper or Lower Wythoff?

First, let's talk about Beatty sequences. Given a positive irrational number r, we can construct an infinite sequence by multiplying the positive integers to r in order and taking the floor of each ...
18
votes
2answers
313 views

Is this a Weyr matrix?

There's a type of n×n matrix W called the basic Weyr canonical form. Such a matrix is described by its blocks and has the following properties, using the following reference diagram: the main ...
0
votes
0answers
107 views

Validate Sudoku (N by N) [duplicate]

Challenge : Create a random (pseudo random) Sudoku board with dimension n x n Input : Given : ...
16
votes
12answers
2k views

Is it an exercise set?

We all know that a lot of exercises only affect one half of your body, so you have to do them twice, once for each side. Such exercises have two counterparts, one for the left side and one for the ...
19
votes
47answers
5k views

Determining Yes or No?

After inputting a string [length 1-20], only containing the chars y for yes and n for no, your program should output the result (y or n). Example input: yynynynny ...
20
votes
5answers
345 views

Modified Boggle Checker, with Modified Boggle-able Code

Background Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("...
14
votes
3answers
272 views

Are there mountain rings?

Challenge Given a matrix of positive integers, determine if there are any "rings" of mountains. The formal definition for this challenge is: given a matrix of positive integers, is there any positive ...
19
votes
16answers
2k views

Is this a consecutive-prime/constant-exponent number?

A while ago, I had a look at the prime factorization of 27000: 27000 = 23 × 33 × 53 There are two special things about that: consecutive-prime: The primes are consecutive: 2 is the ...
27
votes
14answers
3k views

Fridge magnet substitution

When writing a message with fridge magnets, you'll often find yourself substituting a 1 for an I. In this challenge, your goal ...
20
votes
11answers
3k views

Can You Spell This Word With These Dice?

Letter dice are common in word games. It can be fun to try to spell funny words with boggle dice, for instance. If you grab a handful of dice, chances are you won't be able to spell certain words. ...
19
votes
19answers
2k views

Detect Rectangular Text with Rectangular Code

Given a string of printable ASCII text (including newlines and spaces) that contains at least one character that is neither a newline nor a space, output a truthy value if the string is rectangular, ...
16
votes
21answers
2k views

Is this a staircase number?

Challenge : Check if the given number forms a number staircase or not Input : A integer (greater than 0 and not decimal). NOTE : You can take input as string , ...
8
votes
0answers
189 views

Is this a Boggle pad?

Given a list of case-insensitive ASCII letter strings ("words"), output whether the entire list can be found on some four-by-four configuration ("board") of letter squares, in which no square can be ...
10
votes
10answers
961 views

Am I a Pillai prime?

A Pillai prime is a prime number \$p\$ for which there exists some positive \$m\$ such that \$(m! + 1) \equiv 0 \:(\text{mod } p)\$ and \$p \not\equiv 1\:(\text{mod }m)\$. In other words, an ...
-4
votes
2answers
230 views

??? Question Marks? [closed]

Challenge Create a function that takes an string as a parameter. (Easy as far) This string will contain Single digit numbers Letters from the alphabet Question marks (Of course) Your function will ...
10
votes
1answer
309 views

Checkers Checker

The goal of this challenge is to determine if a move is a legal English Checkers move. This challenge will use an 8x8 board. A moved piece should be treated as a man (not a king) that can only move ...
43
votes
41answers
5k views

Detect heat waves

Background The Royal Netherlands Meteorological Institute defines a heat wave* as a series of at least 5 consecutive days of ≥25°C weather (“summery weather”), such that at least 3 of ...
9
votes
35answers
697 views

Isogram checker

Challenge : Given a word, check whether or not it is an isogram. What : An isogram is a word consisting only of letters with no duplicates (case insensitive). The empty string is an isogram. ...
16
votes
17answers
700 views

Ordinal string check

Description : Given a string as input, check if it is a valid ordinal number in English or not. If it is valid return truthy value otherwise return falsy value. (Suggested by @Arnauld. Thanks . Also ...
18
votes
21answers
2k views

The repetitive byte counter

Your task is to write a non-empty program / function of byte count L, which, when repeated M times, checks whether a given positive integer N is equal to L × M. You should, in theory, support an ...
15
votes
10answers
1k views

Limit your numbers by your runs

Self-limiting lists Consider a nonempty list L containing nonnegative integers. A run in L is a contiguous sublist of equal elements, which cannot be made longer. For example, the runs of [0,0,1,1,3,...
29
votes
31answers
5k views

Am I a Self Number?

A self number (also called a Colombian or Devlali number) is a natural number, x, where the equation ...
25
votes
1answer
366 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! ...
47
votes
31answers
4k views

Does it Lead or Follow?

In this challenge you are to write a program or function, that takes a string as input and outputs one of two possible values. We will call one of these values truthy and one falsy. They do not need ...
19
votes
3answers
361 views

Swap program halves to test divisors

Four integer sequences In this challenge, you will test four different properties of a positive integer, given by the following sequences. A positive integer N is perfect (OEIS A000396), if the sum ...
20
votes
14answers
1k views

Is this a truncated triangular number?

Related OEIS sequence: A008867 Truncated triangular number A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of <...
14
votes
18answers
873 views

Find relevant digit groupings

Recently, my reputation was 25,121. I noticed that each digit grouping (i.e. the numbers separated by commas) was a perfect square. Your challenge is, given a non-...
70
votes
32answers
11k views

Non-discriminating Programming

We say a string is non-discriminating if each of the string's characters appears the same number of times and at least twice. Examples "aa!1 1 !a !1" is non-...
20
votes
0answers
391 views

Halting Problem for Simplified Hexagony

Introduction Decide whether a Hexagony program composed solely of the characters .)_|\/><@ will halt using least bytes. Challenge Hexagony is a language ...
16
votes
18answers
3k views

Hermitian matrix?

Note that this challenge requires no handling or understanding of complex numbers. Given a non-empty square matrix where every element is a two-element (Re,Im) integer list, determine (giving any ...
59
votes
18answers
3k views

There are two new sheriffs in town – Identifying DJMcMego pairs!

We have some new sheriffs moderators in town, Mego and DJMcMayhem. We need a challenge to properly honour them for their new positions, so there we go. Here's something that has caught my attention ...
18
votes
14answers
2k views

We do tower hopping

Task Given an array of non-negative integers a, determine the minimum number of rightward jumps required to jump "outside" the array, starting at position 0, or ...
22
votes
22answers
2k views

Verifying a horizontal ASCII pet snake

Recently there have been a couple of ASCII pet snake challenges (e.g. here) ...
17
votes
8answers
763 views

Conjugate permutations

A permutation of size n is a reordering of the first n positive integers. (meaning each integer appears once and exactly once). Permutations can be treated like functions that change the order of a ...
39
votes
40answers
5k views

Is there a bump?

Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first ...
146
votes
15answers
26k views

Is My Swipe Pattern Legal?

Most Android smartphones allow the user to use a swipe pattern to open their phone: Certain patterns are legitimate, and others are impossible. Given an input swipe pattern, return a truthy or falsy ...
14
votes
9answers
637 views

Verify Cyclic Difference Sets

A cyclic difference set is a set of positive integers with a unique property: Let n be the largest integer in the set. Let r be ...