Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [code-challenge]

A code challenge is a competition for creative ways to solve a programming puzzle with an objective winning criterion not covered by other scoring tags (e.g. code-golf).

Filter by
Sorted by
Tagged with
4 votes
1 answer
176 views

Given a wall maze of 50x50, exactly same generating algorithm, at different RNG, so every two positions are connected by exactly one path, etc. Write two functions: One takes the maze as input and ...
l4m2's user avatar
  • 32.4k
2 votes
0 answers
170 views

Given a wall maze of 50x50, write two functions: One takes the maze as input and returns a positive integer; The other takes the integer and walk through the maze from left-top to right-bottom. At ...
l4m2's user avatar
  • 32.4k
18 votes
3 answers
992 views

Here is a game: Start with the set {1,2,3,...,n} of natural numbers. At any turn of the game, you may pick two numbers from this set, a and b, then replace them with their product a*b. Since it is a ...
Fabius Wiesner's user avatar
9 votes
2 answers
437 views

Write a program with the following properties: it must be a quine, i.e. running it outputs precisely the program itself; it must take no input; for at least one integer k, it must be the case that ...
aeh5040's user avatar
  • 2,072
6 votes
2 answers
331 views

from Latexmk: If you use cross-references, you often have to run LaTeX more than once ... Sometimes cross-referenced locations change and you need to run LaTeX again to create the correct reference. ...
InQβ's user avatar
  • 453
8 votes
1 answer
393 views

Challenge You must produce an infinite sequence of programs \$P_0, P_1, P_2,\$ … such that each program \$P_n\$, when run, prints the exact source code of \$P_{n+1}\$ and then halts. Each program \$...
Bryle Morga's user avatar
4 votes
8 answers
934 views

I am interested in the following problem: What is the minimum number of distinct characters used in any programming language that can implement Boolean Algebra? In particular, what is the set that ...
dnn25519's user avatar
  • 169
3 votes
1 answer
299 views

Challenge We define a Minsky machine as a program made of the following two instructions: +X which increments the register X and continues to the next instruction -Xn which simply continues if X is ...
malediscord kitten's user avatar
3 votes
1 answer
303 views

CHALLENGE This problem has a math background. For n=1,2,3,4 we want to count the number of families of sets with maximum n elements that satisfy many criteria of the form: $$\bigoplus_{k\in A,A\in \...
Fabius Wiesner's user avatar
3 votes
5 answers
407 views

You are in charge of running a board game tournament. Unfortunately, you only have one copy of the game and only so much time, so only a limited number of games can be played. Similarly, you have a ...
Spitemaster's user avatar
  • 2,189
22 votes
2 answers
2k views

The task is to find parameters that make a fast leap year check correct for the widest range of years. We assume the Proleptic Gregorian calendar, which extends the Gregorian calendar backward from ...
Falk Hüffner's user avatar
4 votes
8 answers
3k views

Goal Input is a Brainfuck program for 8 bit cells, output it for 1 bit cells. Explanation We all know Brainfuck, normally it uses 8 bit cells. But there are implementations where a cell is just 1 bit, ...
12431234123412341234123's user avatar
3 votes
2 answers
553 views

Output \$20\$ float64s with absolute value between 1 and 2 inclusive whose sum has the largest possible relative error. We can assume the true sum is not zero. The sum is to be computed from left to ...
Simd's user avatar
  • 3,167
16 votes
3 answers
2k views

Input Integer \$n > 1\$ Output Ten 64 bit floating point numbers between \$-n\$ and \$n\$, inclusive, whose sum is the least accurate. Details and examples. These examples are not claimed to be ...
Simd's user avatar
  • 3,167
-3 votes
5 answers
400 views

Introduction This is a small challenge I came up with while trying to make some compact code for my younger brother to use. I don't think it's particularly interesting, but I believe it presents some ...
Mel's user avatar
  • 109
5 votes
9 answers
3k views

"nimi ale lon toki pona" is a song by YouTuber jan Misali which lists 137 common words in the constructed language Toki Pona. This challenge is not a duplicate of "How high can you ...
3-1-4-One-Five's user avatar
7 votes
2 answers
367 views

Background The newest version of the C standard, C23, adds preprocessor macros like INT_WIDTH, ULONG_WIDTH, and ...
Tavian Barnes's user avatar
19 votes
3 answers
1k views

Challenge In this challenge, we will use a language that is very similar to Brainfuck but slightly different. This variant of BF does not have any input and output commands; instead, it simply takes ...
Bubbler's user avatar
  • 79.3k
1 vote
2 answers
351 views

The well known cat command simply copies its stdin directly to stdout unchanged. But there are plenty of other commandline tools that exist... What other commands ...
CarmenCarmen's user avatar
-3 votes
2 answers
325 views

So simple: Provide some code that outputs foo and with the reversed source outputs bar. But before you come up with something ...
Philippos's user avatar
  • 2,688
5 votes
13 answers
2k views

This is an answer-chaining post, so in this challenge every answer (except the first answer) depends on the previous answer. The goal of this challenge is to output the restricted characters. Define \$...
Fmbalbuena's user avatar
  • 5,085
20 votes
31 answers
3k views

Your challenge, should you choose to accept it, is to write a program in a language of your choice that, when given a string (limited to printable ASCII) as input, outputs a new program in the same ...
noodle person's user avatar
4 votes
5 answers
1k views

Here is a challenge: What is the shortest possible compiled program? Writing one line programs are fun, but they often lean on language libraries that get pulled into the final bits. How lean can you ...
Roger Hill's user avatar
16 votes
6 answers
4k views

Your task is to write a program \$p\$ which outputs a string \$s\$ with the same length as \$p\$, where \$s \neq p\$. If I remove the \$n\$th byte from your program to get program \$q\$, then either \$...
Wheat Wizard's user avatar
  • 103k
30 votes
44 answers
5k views

Write a program fragment so that, when repeated N times it prints the Nth Fibonacci number. For example, if your program is print(x) then: ...
mousetail's user avatar
  • 14.4k
12 votes
16 answers
3k views

Problem You are tasked with creating a program that performs emoji encryption on a given string of emojis. In this encryption scheme, each emoji is replaced by a unique character (from ...
3.14's user avatar
  • 403
21 votes
10 answers
3k views

Find the maximum possible number of disjoint sets of characters, that are Turing complete subsets of your language. Rules: You can assume your Turing complete subset is contained in/called from a ...
bsoelch's user avatar
  • 6,095
8 votes
8 answers
819 views

This is the robbers' thread. See the cops' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the ...
dingledooper's user avatar
  • 23.4k
12 votes
9 answers
942 views

This is the cops' thread. See the robbers' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the ...
dingledooper's user avatar
  • 23.4k
1 vote
1 answer
278 views

Challenge You find yourself in a bash terminal, and want to do some simple tests on sqlite3. So you issue the following command: ...
ChrisB's user avatar
  • 119
2 votes
0 answers
272 views

Problem You are given a binary string A of length N. You can perform the following type of operation on the string A: Choose two different indices \$i\$ and \$j\$ (\$1 \le i\$, \$j \le N\$) Change \$...
hemanth's user avatar
  • 21
3 votes
4 answers
1k views

Languages, such as C++, have introduced a new comparison operator: <=>. This operator returns -1, 0, or 1† when comparing two items together: −1 means the ...
Alexis Wilke's user avatar
19 votes
17 answers
2k views

Each element on the periodic table of the elements has an atomic weight. For example, boron (element 5) has an atomic weight of 10.81. Your challenge is to write a program which takes as input the ...
Ginger's user avatar
  • 6,098
12 votes
3 answers
569 views

I struggle to easily encode big numbers in ><>. If only there was a program that could find the best way for me? What is ><> ...
mousetail's user avatar
  • 14.4k
26 votes
58 answers
4k views

Your task Given a string, output the range of ASCII values. Example Let's say we have the string Hello. We get the ASCII values: ...
The Thonnu's user avatar
  • 18.7k
40 votes
5 answers
5k views

Background HQ0-9+-INCOMPUTABLE?! is a half-joke programming language introduced in Internet Problem Solving Contest 2011, Problem H. HQ9+ is an esoteric programming language specialized for certain ...
Bubbler's user avatar
  • 79.3k
3 votes
4 answers
924 views

The wizard is determined to pose the most challenging challenge yet for which he believes the previous solution techniques will not work. He decides to go multidimensional. If there is a number line ...
user avatar
17 votes
11 answers
2k views

inspired by thejonymyster's idea Rules This challenge is about finding languages that are very suitable for one task but quite the opposite in the other. The two tasks share a theme, but Task 1 is ...
Bubbler's user avatar
  • 79.3k
10 votes
1 answer
568 views

Turing Machine Preliminaries A Turing machine is specified by the following data A finite set of symbols S = \$\{s_1,s_2,...\}\$ A finite set of states M = \$\{m_1,m_2,...\}\$ A partially defined ...
QCD_IS_GOOD's user avatar
25 votes
12 answers
4k views

Print or return the following text: Hello world! The quick brown fox jumps over a lazy dog. However, your submission will not be scored in bytes. Instead, ...
Sisyphus's user avatar
  • 15.1k
6 votes
4 answers
686 views

The wizard has a cunning cousin who is a witch. She looks down on the wizard, regarding him and his puzzles as mathematically naive. On reading his latest puzzle, she scorned him for always asking ...
user avatar
6 votes
2 answers
1k views

In this game, you can look inside one box at a time chosen by you. When you do that, you can see how many coins there are in that box. The wizard has one last twist for you. At any point, you can ...
user avatar
21 votes
12 answers
3k views

If the agent is at the origin it always moves right when you choose it. The goal is to get one agent to 10. The cost is the sum of the square of the total number of moves (left or right) taken by each ...
user avatar
6 votes
2 answers
331 views

Your task is to write a program that performs case conversion from plain text, and other case formats, into one of the specified formats below. Inputs will be either plain lowercase text, or one of ...
Dom Hastings's user avatar
  • 24.6k
5 votes
7 answers
918 views

Background I was working on a system where for convenience (not security) people could use four digit codes to identify themselves. I figured this is something that may actually be useful in many real ...
Dennis Jaheruddin's user avatar
4 votes
0 answers
311 views

You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your ...
Command Master's user avatar
20 votes
11 answers
2k views

A pristine program is a program that does not have any errors itself but will error if you modify it by removing any contiguous substring other than the entire program. A crystalline program is sort ...
Wheat Wizard's user avatar
  • 103k
1 vote
1 answer
296 views

I have recently been on a quest to create really really slow sorting algorithms that make Bogosort seem like it is the best. The task is simple: Sort an array of integers in as long average time as ...
Eknoma's user avatar
  • 27
-14 votes
5 answers
479 views

This is my 12th question, so I thought of this idea. Goal: Output 12, with any preceding or trailing whitespace permitted In as many languages as possible (where different versions or flags count as ...
Number Basher's user avatar
29 votes
21 answers
5k views

Inspired/mostly copied but I don't think it's a dupe. Also Inspired. In this challenge, you will create polyglots that include all languages from previous answers, and another language which you won't ...
emanresu A's user avatar
  • 46.2k

1
2 3 4 5
19