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).

learn more… | top users | synonyms

5
votes
0answers
114 views

A game of atomic proportions

Your task make a bot that plays Atomas, with the highest score. Here is a (very long) run-down of how this game (or at least, my port of the game) works: You start off with a ring of 6 "atoms", ...
9
votes
3answers
309 views

Print a specific value in the Wythoff matrix

The Wythoff matrix is an infinite matrix consisting of the Grundy numbers of each square on a chessboard in Wythoff's game. Each entry in this matrix is equal to the smallest nonnegative number that ...
24
votes
2answers
356 views

Hyper about quines

Inspired by Hyperprogramming: N+N, N×N, N^N all in one. Thanks to @MartinEnder and @trichoplax for their help in the sandbox. Definitions Hyperquines Define a hyperquine of order n as a quine-...
-4
votes
0answers
115 views

Sort as many as possible! [closed]

I have recently been interested in sorting algorithms, and have found many different kinds. I recently thought of this challenge; Implement as many sorting algorithms in as few bytes as possible! ...
1
vote
0answers
102 views

Adding One to a number stored as an Array [closed]

I was challenged by one of my friends to solve this coding problem: Given a non-negative number represented as an array of digits, add one to the number. The digits are stored such that the most ...
61
votes
15answers
11k views

When was this language released?

Your challenge is simple. You need to write a program that prints to either STDOUT or a file the year the language it is written in was released. Because this is such a simple task, the twist is that ...
3
votes
10answers
277 views

Shortest way to strip the commas from column n given a .csv file/input

Ok, so the input here is going to be a .csv file and so is the output. Now, given a .csv file/input like so "apple","banana","apple,banana","orange" "grape","orange","grape,orange","sprout" # 0 ...
0
votes
0answers
118 views

Hangman solver algorithm [duplicate]

Please do not delete this without reading it completely. Put it in unclear if there are some questions. I will respond immediately. This is different from the question "Write a Hangman Solver" because ...
9
votes
0answers
854 views

Write a Palindrome-Polyglot-Quine

Write a "palipolyquine": a program that is a quine, a polyglot, and a palindrome. Rules: The number of polyglot languages is more preferable than code size. The shortest answer (in bytes) wins, in ...
41
votes
9answers
3k views

There can be only 1!

Your task is, given a positive integer n, to generate an expression that equals the number n. The catch is: you're only allowed the number 1 in the output. The operators at your disposal are: +, -,...
11
votes
11answers
2k views

Output “Lorem ipsum” with minimal number of characters

I remember people saying that code size should be measured in bytes, and not in characters, because it's possible to store information with weird Unicode characters, which have no visual meaning. How ...
16
votes
2answers
298 views

Chuck Norris vs Travelling Salesman

Introduction Almost everyone is familiar with the Travelling Salesman Problem (TSP). The task is to, given a list of N cities, find the minimum Hamiltonian cycle which is to say the shortest path ...
-9
votes
11answers
242 views

Outputting x to y

Challenge You must choose one number x (y = x + 9) and create ten unique programs which each print out one of the numbers in the range x to y inclusive. However, there are three twists: Each ...
7
votes
10answers
641 views

DNA Encode a String

Challenge You must write an encoder (and a separate decoder) which takes a string as input and outputs the string encoded in the style of a strand of DNA. DNA DNA is made up of four types of ...
4
votes
4answers
371 views

The longest period iterating quine

As we know, a quine is a program that outputs its own source code. However, it's also possible to write a program that outputs another, different program, that outputs the first program again. For ...
3
votes
24answers
1k views

Enterprise Quality Code Prime Sieve

Enterprise Quality Code! TL;DR Answers will consist of a full program (of length < 30k) prints the the first N Prime numbers (as a base 10 representation without leading zeros unless the chosen ...
2
votes
0answers
184 views

100KB image compression [closed]

Your task is to, given an image, compress it to 100000 bytes or less, while following all of the below rules: No cheating/loopholes. Your code must not be optimized to work best only on the test set ...
17
votes
4answers
355 views

Minimal Word Search

Last week, we worked to create the shortest 1-D string using the top 10,000 words in the English language. Now, lets try the same challenge in 2D! What you need to do is to take all of the above ...
70
votes
51answers
8k views

Can you outgolf me? (Cops section)

Cops section The robbers section can be found here. Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions. Challenge Your task is to ...
17
votes
0answers
398 views

Build a digital clock in Conway's Game of Life

Since my Tetris question seems to evade being answered even to this day, I thought I'd create a slightly easier challenge, one that doesn't need any user input. Your task is to build a Game of Life ...
13
votes
0answers
244 views

Diff compression

For this challenge, you need to compress a diff. A diff is some data that represents the difference between two strings. For this challenge, you need to provide one or more programs that can: ...
27
votes
7answers
1k views

Compounding english

A compound word is a word that contains 2 or more words in it. We can do better than that, though. We need you to create 1 (nonsensical) word that contains every word. However, we want this word to ...
2
votes
0answers
147 views

Brute force my code lock [duplicate]

The code lock for my garage has 5 buttons, labeled "1 2", "3 4", "5 6", "7 8", and "9 0". To open the garage door, you have to enter the correct 4-digit PIN. As you can see, every button represents ...
8
votes
4answers
224 views

Sort a list of unknown values with the least amount of comparisons

In this optimization challenge you will write a program that sorts a single array by only comparing elements through asking the user on stdout to input comparison results on stdin. The below protocol ...
16
votes
2answers
359 views

Thwart Lepton compression

Dropbox recently released Lepton (GitHub), a method that losslessly compresses JPEG images round-trip, saving an average of 22%. Because of the pigeonhole principle, any general compression ...
28
votes
8answers
1k views

Latin square compression

A Latin square is a square that has no repeated symbols in the rows or columns:. 13420 21304 32041 04213 40132 And as many Sudoku players know, you don't need all of the numbers to deduce the ...
22
votes
2answers
651 views

Guess the language

Introduction This site is rapidly building up a huge dataset of code snippets, so let's do something with it! Here's a data file. It contains 9,066 unique language+snippet pairs for 113 languages, ...
25
votes
1answer
451 views

Domain Name Appraisal

Domain name trading is big business. One of the most useful tools for domain name trading is an automatic appraisal tool, so that you can easily estimate how much a given domain is worth. ...
0
votes
1answer
146 views

Meta Obfuscate a String [closed]

There are numerous reasons for trying to obfuscate input. These include preventing decompiling, and being a nuiscance. With this in mind your challenge should your choose to accept it is to write a ...
55
votes
20answers
8k views

Rube Goldberg Hello World

For this golf, you will need to use more than one language. The task A Rube Goldberg machine is a contraption that takes an enormous number of complicated steps in order to execute a very simple ...
15
votes
3answers
2k views

Write a program that always prints N when it is shifted N times up the ASCII alphabet

Write a program using only printable ASCII characters that takes no input. For reference, here are the 95 printable ASCII characters in order: !"#$%&'()*+,-./0123456789:;<=>?@...
1
vote
0answers
158 views

Cosmic ray-proof programming [closed]

Cosmic rays are bad for computers. They corrupt RAM, and that causes problems. Computer chips are shrinking, and that makes them more vulnerable to the cosmic rays. We will not give in to these high-...
2
votes
0answers
168 views

What's so great about 1729? [closed]

This is not a duplicate of this question. This is asking for the nth number that can be represented as the sum of two cubes in two different ways, while that is asking for the n-th number that can be ...
1
vote
10answers
532 views

Hi, can you draw some odd art? Bye!

Create a program that outputs "Hi, Hello!" in k bytes. By altering n bytes, the code should output all odd numbers in the range 5 <= x <= 25. Changing another m bytes should result in a code ...
2
votes
1answer
231 views

Find the last three words of each paragraph if they are shorter than 20 characters in total

Based on my SO question, but more specifically: Find a RegEx such that, given a text where paragraphs end with an empty line (or $ at the very end), match the up to twenty last characters of a ...
8
votes
15answers
1k views

Traveling on a flat Earth

Coordinates in the flat-Earth world consist of latitude (x) and longitude (y), which are integers in the range 0...9999. Much like Gaussian integers, but they are always written using this notation: ...
7
votes
1answer
282 views

Reconstruct a missing RGB channel

Look at these photographs of natural scenes, with one of the RGB channels taken out of them: Source (with red): https://en.wikipedia.org/wiki/File:Altja_j%C3%B5gi_Lahemaal.jpg Source (with green)...
20
votes
2answers
394 views

Virtual Keyboard Text Input

On modern game consoles and other devices without traditional keyboards, trying to input text is a nightmare. Having to type with a few buttons and a joystick on a virtual keyboard is annoying, and I ...
17
votes
2answers
822 views

Where will the cat go? (orbital mechanics)

A nearly massless cat is dropped in space (don't worry, with a space suit and everything) at the point (x, y, z) with velocity (vx, vy, vz). There is an fixed, infinitely dense planet (with volume of ...
10
votes
4answers
357 views

Find the shortest way to advance a counter to a certain number

I have a counter. It's a small device that looks like this: The display goes from 0000 to 9999. It has a little push-button at the top that increases the count by 1, and a little knob at the right ...
59
votes
19answers
3k views

Tweetable hash function challenge

In this code-challenge you will write a hash function in 140 bytes1 or less of source code. The hash function must take an ASCII string as input, and return a 24-bit unsigned integer ([0, 224-1]) as ...
17
votes
2answers
977 views

Fun with flags!

Write a full program with a source code of 256 bytes or less that looks at an image of a flag and determines what country that flag is from. A zip file containing the 196 different flags in the ...
-7
votes
2answers
243 views

Use all your language's keywords, ideally minimally [closed]

Your program must contain all your language's keywords. Ideally, you should have each one exactly once (see Scoring). Of course, this means your language must actually have keywords, so esoteric ...
15
votes
23answers
2k views

Good Old Suffix Vector

Inspired by an old manual... The challenge I define the ath suffix vector of b as the boolean list of length a with b trailing truthy values. Write a program or function that, given a and b by any ...
-2
votes
16answers
392 views

Print all the numbers! (At least, as many as possible.) [closed]

Your task is to print a number. Simple, right? It is simple, but not as simple as this. The first answer is to print the number 1, the second answer is to print the number 2, etc. Rules The first ...
12
votes
1answer
787 views

Generate ASCII Art

Given a black-and-white image in any reasonable lossless format as input, output ASCII art that is as close to the input image as possible. Rules Only linefeeds and ASCII bytes 32-127 may be used. ...
27
votes
3answers
847 views

Stuffing primes in a box

Your task is write a program or function that can fill a given rectangle with prime numbers. The width and height of the rectangle will be the input. The output must be a list of height strings ...
14
votes
6answers
756 views

Who said that? 2016 Presidential election

In this challenge, your task is to make write a program with less than 300 characters that takes a short paragraph or a few sentences that a candidate has said and output who said it. Input: Can be ...
7
votes
1answer
253 views

Model a probability table using 15-bit fixed probabilities

A histogram is an array of integers that counts the number of times a symbol occurs. For example, for the string "aaabbbabbdebabbbebebdbaaabbabaaaaeebeaabaaba" a histogram is a: 18, b: 18, c: 0, d: 2, ...
8
votes
5answers
407 views

Word or near-word?

Write a program or function that given a string (or your language's equivalent), determine if the string is a word, or not, and output a truthy or falsy value. (This is not a duplicate of Is this ...