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
14
votes
4answers
306 views

Longest Prime Sums

Sandbox There are special sets S of primes such that \$\sum\limits_{p\in S}\frac1{p-1}=1\$. In this challenge, your goal is to find the largest possible set of primes that satisfies this condition. ...
1
vote
1answer
79 views

Polyglot Iterative Quine

Introduction A polyglot is a program that is valid in multiple languages at once. An iterative quine is a program that outputs another program that outputs another program that outputs the source of ...
13
votes
14answers
1k views

Smallest Fibonacci Multiples

Sandbox Background (not necessary for the challenge) A standard number theory result using the pigeonhole principle is the fact that given any natural number k, there is a Fibonacci number that is a ...
23
votes
12answers
3k views

Largest smallest gap

Write a function or program which takes as input a set of distinct, non-negative integers \$\{x_1, \ldots, x_n\}\$ and outputs the smallest gap between any two values in the set, i.e. \$\min_{i\neq j}|...
-3
votes
0answers
89 views

Circles in a square [closed]

There are 2 methods i need to implement the second method that mentioned as triangle packing How I can implement the method by which he calculated the triangle packing in the site below https://www....
7
votes
0answers
243 views

Morpion solitaire

Morpion solitaire This is a game that I remember having learnt from my grandparents in my childhood. Initially I didn't know the name. G B has found it to be Join Five (or less ambiguously - Morpion ...
15
votes
3answers
2k views

How divisible are you?

You are to create a program which, when given a positive integer \$n\$, outputs a second program. This second program, when run, must take a second positive integer \$x\$ and output one of two ...
13
votes
1answer
347 views

How short can you get?

You are to write a program that, when given an integer between 1 and 5 (or 0 and 4 if you wish to use 0-indexing), outputs one of Code, ...
2
votes
1answer
112 views

Gaussian integer division reminder [closed]

Gaussian integer is a complex number in the form \$x+yi\$, where \$x,y\$ are integer and \$i^2=-1\$. The task is to perform such operation for Gaussian integers \$a,b\$, that \$a=q \cdot b+r\$ and \$|...
10
votes
3answers
505 views

A guess the word game

A guess the word game The agreed dictionary. All words are 6 letters long with all letters distinct Rules: This is a game of two players and the task will be to implement Player 2. Player 1 ...
-5
votes
7answers
253 views

Busy beaver of sorts [duplicate]

I'm surprised this hasn't been done yet, but here we go. Create a program which prints some number of 1s (ideally as large as possible) before halting. The rules are simple: Your program is bounded ...
22
votes
42answers
6k views

Hell0 W0rld! scored by ASCII values

Write a program that outputs Hell0 W0rld!. It must match this output exactly, including capitalization, zeroes instead of o's, exactly one space, etc. Trailing ...
10
votes
7answers
435 views

A Change in Perspective

In this challenge you will write a piece of text which when viewed from two different angles will create two different programs. Your string as viewed from above must take a string containing only ...
13
votes
0answers
386 views

Gerrymander North Carolina

The challenge How well can you gerrymander North Carolina into 13 voting districts? In this challenge, you use the following files to draw different maps for Republicans and Democrats. File 1: ...
17
votes
2answers
565 views

Number of distinct tilings of an n X n square with free n-polyominoes

The newest "nice" OEIS sequence, A328020, was just published a few minutes ago. Number of distinct tilings of an n X n square with free n-polyominoes. This sequence counts tilings up to symmetries ...
10
votes
2answers
801 views

Find the largest root of a polynomial with a neural network

The challenge Find the smallest feedforward neural network such that, given any 3-dimensional input vector \$(a,b,c)\$ with integer entries in \$[-10,10]\$, the network outputs the largest (i.e., "...
15
votes
1answer
702 views

Sort with a neural network

The previous neural net golfing challenges (this and that) inspired me to pose a new challenge: The challenge Find the smallest feedforward neural network such that, given any 4-dimensional input ...
21
votes
2answers
748 views

Create a uniquely solvable crossword … without clues

Can you imagine solving the New York Times crossword puzzle without any clues? Maybe not with all of the creativity and new words and phrases appearing in modern crosswords, but with a fixed word ...
-1
votes
4answers
325 views

Compress my Malbolge!

Background Malbolge is truly intriguing language. But programs written in it are also extraordinairly huge (and in some cases, unpostable on PPCG). Your challenge (shall you accept it) is, to ...
-3
votes
2answers
205 views

Write a “hello world” program that can be compiled/interpreted as two different languages simultaneously [duplicate]

Rules: Your program must print "hello world" when executed Your program must be interpretable or compilable into 2 or more languages Your program must require no input or arguments Languages with ...
-9
votes
1answer
164 views

Bot Problem.How to solve this problem in c? [closed]

Programming problem: In BotLand, Robots can understand all words of any combination of letters and letters with leading or trailing (not both) numeric value. Given a word W (string of alphanumeric). ...
1
vote
9answers
746 views

Lazy brainfuck programmer [closed]

Background Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation ...
12
votes
2answers
634 views

Create the least compressible picture

"A picture is worth a thousand words"—so the old saying goes. The average word is about four characters long, so a picture conveys 4kB of information. But how much entropy, rather than information, ...
34
votes
15answers
7k views

Generate Brainfuck for the numbers 1–255

Write a program that, for the numbers 1 through 255, prints out BF code that will produce the given number in some byte of the array, plus a newline. For example, the first four lines of the output ...
2
votes
3answers
153 views

Golf range minimum queries of a list [closed]

(Inspired by the first problem solved in Stanford’s advanced data structures course.) Despite the academicese-heavy name, the problem we're going to solve is almost unbearably simple. We have a list ...
14
votes
3answers
431 views

Bridge the Gaps

Given a black and white image with a white background and a set of black dots, paint a set of white pixels red, such that there is a path between each pair of black pixels. Details A path is a set ...
37
votes
27answers
4k views

Cops: The Hidden OEIS Substring

This is a Cops and Robbers challenge. This is the cop's thread. The robber's thread is here. As a cop, you must pick any sequence from the OEIS, and write a program p that prints the first integer ...
4
votes
0answers
102 views

Make a slow monotonic injection [duplicate]

In 256 bytes or fewer write a function, \$f\$, from the positive integers to the positive integers that is: Monotonic: larger inputs always map to larger outputs. (\$a < b \implies f(a) < f(b)\$...
12
votes
2answers
551 views

Counting generalized polyominoes

This challenge will have you count pseudo-polyforms on the snub square tiling. I think that this sequence does not yet exist on the OEIS, so this challenge exists to compute as many terms as possible ...
3
votes
2answers
751 views

Point-free madness

This challenge is about Haskell point-free style polynomial functions. Although you don't need to know Haskell language to do this challenge, Haskellers might have an advantage here. Point-free ...
5
votes
7answers
394 views

Print the previous answer in reverse - with a catch (pt. 2)

Your challenge is very simple: output the previous answer, in reverse. However, as with this similarly-titled question, there's a catch: in this case, you cannot use characters from the answer before ...
1
vote
3answers
320 views

Print the previous answer in reverse - with a catch [duplicate]

Your challenge is very simple: output the previous answer, in reverse. However, as with this similarly-titled question, there's a catch: in this case, you can only use characters from the answer ...
32
votes
8answers
6k views

Cut the gold chain

A traveler needs to stay for n days in a hotel outside town. He is out of cash and his credit card is expired. But he has a gold chain with n links. The rule in this hotel is that residents should ...
11
votes
21answers
1k views

An OEIS polyglot

This is an answer-chaining challenge relating to the OEIS. Oh, the justification for this is because a company needs one program to print out their OEIS sequences real bad and they have every ...
5
votes
2answers
261 views

Generate Aheui Number

Make a Number Expression is related : actually, it is also about Aheui. But it just made number expression, but this made real Aheui code. Aheui is esolang written in only Korean character. Because ...
10
votes
1answer
289 views

Self-displaying image [closed]

Background There are self-extracting .ZIP files. Typically they have the extension .EXE (and by executing the file they will be ...
5
votes
1answer
277 views

Make Plan 9 Cat Turing Complete in as Few Bytes as Possible [closed]

Your task is to modify the original Plan 9 cat tool for UNIX, in order to make it a fully turing complete language interpreter. You may make use of ANSI escape codes and the backspace character (\x08) ...
13
votes
7answers
2k views

Generate ladder of integers using the least number of unique characters (in C++)

I am new to the sport of code golf. I am trying to generate a ladder of integers using the least number of unique characters in C++. Let's say we are given an integer 4. We will generate the ...
12
votes
13answers
2k views

Output the ŋarâþ crîþ alphabet song without using (m)any letters

Your goal is to write a program that takes no input and outputs the following text: ...
26
votes
2answers
1k views

Can a neural network recognize primes?

Background Recognizing primality seems like a poor fit for (artificial) neural networks. However, the universal approximation theorem states that neural networks can approximate any continuous ...
0
votes
0answers
87 views

Output the Missing Character [duplicate]

When writing a programm 1 missing character can ruin everything, wouldn't it be great if the programm told you what was missing ? Task: Create any (non Empty) programm, that takes no input and ...
-1
votes
2answers
122 views

Find efficient seating arrangement in a line [closed]

We have X Girls and Y Boys in a class. If more girls sit together they will not behave. Similarly if more boys sit together they will not behave. Write a program/algorithm to get maximum same gender ...
3
votes
3answers
849 views

Words hidden in my phone number [closed]

Telephones in the United States (and perhaps some other places) have letters associated with some of the numbers. ...
4
votes
3answers
375 views

Convert ASCII art numbers to integers

Inspired by this game Challenge: Given an ASCII art string representing a number, output that number. Example: ...
9
votes
2answers
579 views

ASCII Maze Compression

Challenge Design a compression algorithm specialized for compressing ASCII mazes. You will need to create both a compression algorithm and a decompression algorithm. Your score will be based on the ...
14
votes
11answers
898 views

Source permutation

A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a ...
-2
votes
5answers
297 views

45 degree quine [closed]

A very simple golf this time, but should be fun to do. Challenge Output your code, but rotated 45 (or -45) degrees. E.g: lorem ipsum dolor sit amet becomes <...
6
votes
2answers
558 views

A nasty little memory leak

Below Python code generates memory leak. Challenge: Fix the memory leak with minimal changes to the code as measured by Levenshtein distance to the original code. You may only change the code before ...
87
votes
33answers
16k views

Eww, those bytes are gross

Write a program or function that, when given a string, filters out as many distinct bytes as it can and returns the cleaned string. However, since your program hates them, none of these bytes can be ...
26
votes
10answers
1k views

How fast can I say your program?

I recently decided to download some dictation software, in order to help with my writing. However, it doesn't work very well when I'm coding, since I have to change from saying words to symbols and ...