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
36 votes
9 answers
8k views

Program a Racing Car

CONGRATULATIONS to @kuroineko. Wins the bounty for excellent speed (672 moves) on the Gauntlet track. LEADER:* Nimi scoring a lightweight 2129. Other entries are larger but showing some serious speed. ...
Logic Knight's user avatar
  • 6,772
36 votes
1 answer
2k views

Domino Circuits

Scoreboard Here are the raw scores (i.e. domino counts) for VisualMelon's submission. I'll turn these into the normalised scores described below, when more answers come in. The existing solution can ...
Martin Ender's user avatar
36 votes
2 answers
1k views

The PPCG Handicap System

As we all know, meta is overflowing with complaints about scoring code-golf between languages (yes, each word is a separate link, and these may be just the tip of the iceberg). With so much jealousy ...
Sanchises's user avatar
  • 9,496
35 votes
27 answers
4k views

Code-generator with unique characters

Challenge Your task is to write a piece of code that outputs another piece of code. That code must in turn output yet another code until the final code outputs the integer 1. The chain ends the first ...
Stewie Griffin's user avatar
35 votes
11 answers
15k views

Brainf*** Golfer

One of easiest code written by a programming language is a program printing sequence of characters (ex. "Hello, world!"). However, some esoteric programming languages like Brainfuck, even this ...
JiminP's user avatar
  • 3,472
35 votes
4 answers
2k views

Image Battle of Colours

CONGRATULATIONS to @kuroineko for the best entry and winning the 200 bounty from @TheBestOne (excellent sportsmanship!). Write a program to colour as much of an image as possible before opposition ...
Logic Knight's user avatar
  • 6,772
35 votes
21 answers
4k views

Longest Non-Repeating Substring

Given a string as input find the longest contiguous substring that does not have any character twice or more. If there are multiple such substrings you may output either. You may assume that the ...
Wheat Wizard's user avatar
  • 98.6k
35 votes
11 answers
8k views

How high can you go? (A coding+algorithms challenge)

Now that everyone has developed their (often amazing) low level coding expertise for How slow is Python really? (Or how fast is your language?) and How Slow Is Python Really (Part II)? it is time for ...
user avatar
34 votes
9 answers
4k views

One hundred passwords

I have one hundred vaults, each one within another. Each vault has a password, consisting of a single number. 95 43 81 89 56 89 57 67 7 45 34 34 78 88 14 40 81 23 26 78 46 8 ...
Ypnypn's user avatar
  • 10.9k
34 votes
17 answers
5k views

Create a Flood Paint AI

In the game of Flood Paint, the goal of the game is to get the entire board to be the same colour in as few turns as possible. The game starts with a board that looks something like this: ...
Joe Z.'s user avatar
  • 34.9k
34 votes
22 answers
4k views

I'm thinking of a number (Cop's Thread)

Robber's Thread here In this cops-and-robbers challenge cops will think of a positive integer. They will then write a program or function that outputs one value when provided the number as input and ...
Wheat Wizard's user avatar
  • 98.6k
34 votes
9 answers
5k views

A "Sorting" algorithm

There is a "sorting algorithm" sometimes called Stalin sort in which in order to sort a list you simply remove elements from the list until it is sorted in increasing order. For example the list <...
Wheat Wizard's user avatar
  • 98.6k
34 votes
0 answers
3k views

Rubik's Revenge [closed]

Everyone likes a good puzzle. After all, that's the basis for Code Golf and Code Challenge! What better puzzle exists than the famous Rubik's Cube? Well what else but her slightly larger sister, ...
Alex Brooks's user avatar
33 votes
145 answers
10k views

The Programming Language Quiz, Mark II - Robbers

Cops challenge The Robbers' Challenge Find a vulnerable answer. That is, an answer which hasn't been cracked yet and which isn't safe yet either. Crack it by figuring out its language. That is, find ...
caird coinheringaahin g's user avatar
33 votes
13 answers
8k views

Programming Dichotomies (Literally)

Consider a question written in plain English whose answer involves two reasonably accurate (but potentially clever) words or phrases that can be separated by the word 'and': Q: What are the two sides ...
Calvin's Hobbies's user avatar
33 votes
23 answers
9k views

R.E.P.A.I.R. T.H.E. K.E.Y.B.O.A.R.D

Sequel of this AWESOME challenge You, a genius tech prodigy detective, have successfully disarmed the bomb and want to break into the computer. The police found the password ...
Wasif's user avatar
  • 12.3k
33 votes
3 answers
3k views

OOP: Overlapping Oriented Programming

One of the lesser known programming paradigms which seems rather fitting for code golfing is Overlapping Oriented Programming (OOP) *. When writing partly identical code, many bytes can be saved by ...
Laikoni's user avatar
  • 26.2k
33 votes
3 answers
2k views

Underhanded Password Hashing [closed]

In the spirit of the Underhanded C Contest, I'm starting an Underhanded Code Contest. The objective of this contest is to straightforwardly implement some code, while subtly hiding a nefarious bug ...
Keith Randall's user avatar
32 votes
22 answers
5k views

Pass on your radiation

The task here is pretty simple. You should write a program that takes a string as input and outputs it (that is a cat program). Additionally when the \$n\$th byte of your program is removed (without ...
Wheat Wizard's user avatar
  • 98.6k
32 votes
16 answers
3k views

This is the sort of challenge that bytes

I need to stop thinking of punny names Your task is to create as many snippets (programs that have input and output built-in), functions or full programs as possible that sorts whatever your language'...
clismique's user avatar
  • 6,980
32 votes
31 answers
16k views

Rand5() to Rand7() [closed]

You are provided with a function Rand5(). This function returns perfectly random (equal distribution) integers between 1 and 5. Provide the function Rand7(), which uses Rand5() to produce perfectly ...
Dan McGrath's user avatar
  • 1,017
32 votes
5 answers
2k 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. ...
Rushabh Mehta's user avatar
32 votes
2 answers
7k views

Implement QuickSort in BrainF*** [closed]

As discussed in the Lounge room on Stack Overflow: if you can't implement the Quicksort algorithm given en.wikipedia.org/wiki/Quicksort in any language you have minimal knowledge of, you might want ...
Ronald's user avatar
  • 431
32 votes
12 answers
3k views

Say Hello to the Pioneers of Computer Science

Choose your favorite famous computer scientist or computer science pioneer who was born in 1942 or earlier (as 1943 marks the start of the creation of the 'first' computer). They should have a ...
Calvin's Hobbies's user avatar
32 votes
8 answers
3k 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 ...
Nathan Merrill's user avatar
31 votes
12 answers
2k views

Write a Quine Suite

We've had a lot of quine challenges, but a lot of the quine formats are similar, lets create some variance in our quines. Your task is to create a selection of programs in the same language (at least ...
Dom Hastings's user avatar
  • 23.5k
31 votes
16 answers
2k views

Substandard deviation

The mean of a population \$(x_1,\dots,x_n)\$ is defined as \$\bar x=\frac1n\sum_{i=1}^n x_i\$. The (uncorrected) standard deviation of the population is defined as \$\sqrt{\frac1n\sum (x_i-\bar x)^2}\$...
Robin Ryder's user avatar
  • 15.6k
31 votes
2 answers
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 ...
A. Rex's user avatar
  • 2,579
31 votes
2 answers
3k views

Compress an image to a 4 KiB preview

In this challenge you will be creating an image preview compression algorithm. It's goal is to reduce an arbitrary image file to a 4 KiB preview image, that can be used to quickly identify images with ...
orlp's user avatar
  • 39.1k
31 votes
1 answer
801 views

Unrestricted Languages

One of my favorite types of challenges on this site are restricted-source challenges. These challenges impose a computer tractable restriction that the sources of potential answers must pass. I like ...
Wheat Wizard's user avatar
  • 98.6k
30 votes
44 answers
4k views

Repeat your program to print Fibonacci numbers

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
  • 12.5k
30 votes
18 answers
5k views

Take a stand against long quine lines

or: Build a vertical quine Inspired by Take a stand against long lines. Your task is to build a vertical quine with as short a line length as possible. Scoring Shortest line length (excluding ...
Dom Hastings's user avatar
  • 23.5k
30 votes
11 answers
3k views

Make StackOverflow Explode (bookmarklet) [closed]

Sometimes people get frustrated on the StackExchange network (specifically SO). Your task is to create a bookmarklet that causes StackOverflow to explode/implode/destroy in some fashion. This will ...
Brigand's user avatar
  • 1,179
30 votes
8 answers
3k views

Beatles Songs and Hexagons

Write two triangle (i.e. pyramid) shaped programs. The first one should be an upwards pointing text triangle with a minimum base width of three characters. So it would have a structure like ...
Calvin's Hobbies's user avatar
30 votes
28 answers
2k views

Concatenative counting

Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any ...
Conor O'Brien's user avatar
30 votes
15 answers
3k views

Create the slowest growing function you can in under 100 bytes

Your job is to create the slowest growing function you can in no more than 100 bytes. Your program will take as input a nonnegative integer, and output a nonnegative integer. Let's call your program ...
Christopher King's user avatar
30 votes
21 answers
41k views

List of first n prime numbers most efficiently and in shortest code [closed]

Rules are simple: First n primes (not primes below n), should be printed to standard output separated by newlines (primes should be generated within the code) primes cannot be generated by an inbuilt ...
Optimus's user avatar
  • 549
30 votes
4 answers
3k views

Orientation Oriented Programming

Write a program for a specific language that in different orientations performs different tasks. Your code should have at least two non-empty lines and at least two non-empty columns and should ...
Dom Hastings's user avatar
  • 23.5k
30 votes
4 answers
2k views

Create a rotating quine

A rotation of a string is made by splitting a string into two pieces and reversing their order, for example "world!Hello, " is a rotation of ...
Gordon Bailey's user avatar
30 votes
4 answers
1k views

Smallest region of the plane that contains all free n-ominoes

On Math Stack Exchange, I asked a question about the smallest region that can contain all free n-ominos. I'd like to add this sequence to the On-Line Encyclopedia of Integer Sequences once I have ...
Peter Kagey's user avatar
  • 8,679
30 votes
4 answers
809 views

Plurality Voting with Cellular Automata

There's a really important problem in cellular automata called the Majority problem: The majority problem, or density classification task is the problem of finding one-dimensional cellular automaton ...
PhiNotPi's user avatar
  • 29.1k
30 votes
2 answers
5k views

What code compiles in the most number of languages? [closed]

Excluding trivial programs, what code compiles in the most number of languages? (By "trivial" I mean to exclude answers such as the empty program or text that will be echoed directly.) The following ...
shamp00's user avatar
  • 1,261
30 votes
3 answers
734 views

Count spelling errors in text; minimize the number of spelling errors in your code

Write a program or function that takes two inputs: A text message The dictionary of English language, as it appears in this Github file (containing about 60000 words) and outputs the number of ...
anatolyg's user avatar
  • 13.6k
29 votes
75 answers
6k views

Adding without using a + or - sign [closed]

There have been many "Do __ without __" challenges before, but I hope that this is one of the most challenging. The Challenge You are to write a program that takes two natural numbers (whole numbers ...
PhiNotPi's user avatar
  • 29.1k
29 votes
9 answers
2k views

Display OEIS sequences

The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It contains nearly 280000 sequences of mathematical interest. Examples of sequences: positive ...
Arnaud's user avatar
  • 8,513
29 votes
21 answers
4k views

Add a hidden language to a polyglot

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
  • 37.8k
29 votes
7 answers
2k 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 ...
Nathan Merrill's user avatar
29 votes
1 answer
2k views

Conway's Hello World

It is often said, that all programmers should be able to write a "hello world" program in any programming language after a few glances on that language (And quicksort after a few more glances). As ...
vsz's user avatar
  • 8,137
29 votes
9 answers
3k views

Approximate when you are going to die

A mortality table or life table is an actuarial tool that gives the probability that a person aged \$A\$ years will die in the next year, and is used to help calculate the premiums for life insurance, ...
Giuseppe's user avatar
  • 28.6k
29 votes
15 answers
19k views

Short Deadfish Numbers

Deadfish is one of the best known non Turing-complete programming languages. It has only one accumulator (which starts at 0) to store data, and only four commands: ...
MegaTom's user avatar
  • 4,266

1 2
3
4 5
19