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

0
votes
0answers
29 views

Predict result from combinations of number [on hold]

Assuming you are given a number 822486, summation of all the characters as digit in the number gives you 30. that is, 8 + 2 + 2 + 4 + 8 + 6 = 30. Now, given 17 9 (9 in 17 places) and a constant C = ...
6
votes
6answers
365 views

Make a long type signature

Challenge Find an expression, at most 100 bytes long, with the longest type signature. Rules Any statically typed language with type inference is allowed The type must be non-ambiguous, but ...
156
votes
5answers
9k views

Upgoat or Downgoat?

Given an image of a goat, your program should best try to identify whether the goat is upside down, or not. Examples These are examples of what the input may be. Not actual inputs Input: Output: ...
15
votes
1answer
302 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 seperate link, and these may be just the tip of the iceberg). With so much jealousy ...
-3
votes
1answer
169 views

“I know that language - that's Java. No? It's Perl?” [duplicate]

Introduction A known fact is that Jon Skeet can code Perl and make it look like Java. In this challenge you will try to do something similar. Challenge Write a piece of code of any length that can ...
1
vote
0answers
61 views

Windows batch polyglot/hybrids challenge with any language possible [closed]

/* I hope such question is suitable for here*/ As the batch scripts are pretty limited, hybrid files that embed a code from another language into a batch file are used a lot lately. Though usually ...
23
votes
2answers
479 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 ...
-7
votes
1answer
141 views

Generate Euler's Number without using ANY modules/libraries using only powers of 10 [closed]

To complete this challenge: Generate Euler's Number to 0.001 precision (2.718) Avoid any method that uses a pregenerated constant (like math.e or math.pi) The only integers that are allowed to be ...
-9
votes
2answers
138 views

Longest output in 1024 bytes or less [duplicate]

Your job is to generate the largest output in a program with 1024 bytes or less. Rules: Only finite lengths allowed Must be completely self-contained and deterministic In particular, standard ...
172
votes
31answers
24k views

Paint Starry Night, objectively, in 1kB of code

Below is a 386x320 png representation of van Gogh's Starry Night. Your goal is to reproduce this image as closely as possible, in no more than 1024 bytes of code. For the purposes of this ...
15
votes
4answers
979 views

What's the Language?

Recently, the PPCG design leaderboard has been having some trouble parsing answer html headers. In this challenge you'll be taking your own shot at parsing answer headers. Example Test Cases ...
15
votes
1answer
231 views

Know a sequence by its subsequences

Introduction Suppose you and your friend are playing a game. Your friend thinks of some particular sequence of n bits, and your task is to deduce the sequence by asking them questions. However, the ...
7
votes
6answers
307 views

The branch predictor challenge

Every day, every minute, ... every microsecond, many decisions are made by your computer. In high-level languages, these typically take the form of statements like if, while and for, but at the most ...
12
votes
2answers
284 views

A register calculator challenge

A simple register calculator This challenge involve a simple register calculator that works in the following way: It has some registers named A,B,C,...,Z, each of them can contain an integer, they ...
9
votes
1answer
187 views

Sort scrambled two-dimensional array filled with numbers by swapping adjacent numbers [closed]

A two-dimensional array of size n×n is filled with n*n numbers, starting from number 1. Those numbers are to be sorted per row in ascending order; the first number of a row must be greater than the ...
7
votes
6answers
317 views

Inverse symbolic calculator

This challenge is based on the idea of Plouffle's Inverter. Write a program in any language that does the following: Takes as input a non-negative rational number X written in decimal, for example ...
-6
votes
2answers
205 views

Stop Internet Warming! [closed]

Task Write a program that will output another distinct program, and so on, while using as few distinct characters (and as few bytes) as possible. For example, program 1 should output program 2, and ...
26
votes
3answers
381 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 ...
223
votes
14answers
27k views

Build a Compiler Bomb

Introduction You're probably familiar with zip bombs, XML bombs, etc. Put simply, they are (relatively) small files which produce enormous output when interpreted by naïve software. The challenge ...
14
votes
2answers
307 views

Befunge Brain Teasers

Introduction For the ones wondering what Befunge exactly is, it is a two-dimensional stack based language made in 1993 by Chris Pressy. I made 7 brain teasers that need to be solved in Befunge-93. ...
8
votes
3answers
396 views

Egg dropping contest

Your challenge: You are on the 0th floor of a infinitely tall building. At any floor, you can walk to the window and drop an egg. Your goal is to figure out the highest floor that the egg can ...
117
votes
77answers
10k views

What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?

I think the question as above is clear, but just in case: Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline. Qualifying ...
7
votes
4answers
407 views

Staircase Program

The challenge is simple: given two parameters, x and y, output y staircases with x steps. For example: f(3,1) - 1 staircase with 3 steps. _ _| _| f(5,2) - 2 staircases with 5 steps. ...
17
votes
10answers
2k views

Print the QWERTY keyboard using keys that are as close together as possible

Normally, challenges are scored in bytes, or sometimes Levenshtein distance, but for this one we're using keyboard distance -- the number of keys between the keys used to type the program (use the ...
22
votes
10answers
2k views

Chaining Programs

Challenge In this challenge, you will be writing the first program, p1, of an infinite sequence of programs, in which running pn outputs/generates program pn+1. When concatenating the first n >= 2 ...
7
votes
19answers
465 views

Maximizing output from minimal input

Obviously, code golfing is all about making the most of the least code. Who really cares what the actual output is? While we have had a challenge for highest input-to-output ratio, this is a call for ...
13
votes
4answers
574 views

An executable script file that runs on POSIX and Windows

Challenge: write a single script file foo.cmd which can be invoked from the vanilla Windows cmd.exe prompt (not PowerShell, not in administrator mode), to execute arbitrary Windows-specific code... ...
4
votes
0answers
157 views

Finding the smallest grid of squares [closed]

Inspiration from Puzzling.SE. Suppose we have an m × n grid such that each element is a base 10 digit. We can read the numbers from such a grid so that we fix a starting element, go to one of the ...
27
votes
10answers
1k views

Find the largest gap between good primes

Following the fine tradition of questions such as Find the largest prime whose length, sum and product is prime , this is a variant on a largest prime challenge. Input Your code should not take any ...
58
votes
23answers
5k views

The versatile integer printer

Write a piece of code that is executable in at least three different languages. The code must output the integer 1 in language number one, 2 in language number two, 3 in language number three etc. ...
7
votes
3answers
245 views

Guess the hidden communities

Background This challenge is about the stochastic block model. Basically, you are given an undirected graph, where the nodes represent people, and the edges represent social connections between them. ...
-2
votes
1answer
105 views

Creating a colour chart in PHP will all colours [duplicate]

Now, before we begin, this has already been done here. But!, there are no PHP answers. With that in mind, my CodeGolf is thus: create a program to show all the colours in the html CSS spectrum using ...
4
votes
0answers
168 views

Encode a steganographic encoder into a package

Introduction By steganography we mean hiding a message along an existing text or image so the result would be unsuspicious of the existence of the original message. This challenge is about hiding ...
-4
votes
1answer
216 views

Check my program! [closed]

Challenge Make an error-checker in the least amount of possible bytes! If you received an HTML program as a string through standard input, your program will be able to find all the errors and return ...
2
votes
1answer
196 views

Quine Pride Parade!

These days, I watched on TV a Gay Pride parade; at the time, I was thinking about quines and how they're a bit queer, outputting themselves (out of the closet?) and, well, why not combine both things ...
17
votes
7answers
585 views

Finding sum-free partitions

Executive summary Given input k, find a partition of integers 1 to n into k sum-free subsets for the largest n you can within 10 minutes. Background: Schur numbers A set A is sum-free if its ...
13
votes
3answers
671 views

An optimization challenge with strange coins

You have n coins which each weigh either -1 or 1. Each is labelled from 0 to n-1 so you can tell the coins apart. You have one (magic) weighing device as well. At the first turn you can put as many ...
15
votes
6answers
427 views

Who's that probability distribution?

Introduction In this challenge, you are given a list of nonnegative floating point numbers drawn independently from some probability distribution. Your task is to infer that distribution from the ...
13
votes
2answers
640 views

Carrots. So. Many. Carrots

The Inspiration The Task You must create a program, that, in as many languages as possible, replaces every instance of ^ with a markdown formatted link (meaning that if I was to post it in an ...
11
votes
3answers
202 views

Fit the factors in the field

Given a positive integer below 1000, display all possible rectangles with that area. Task Let's say the input is 20. We can make a rectangle 20×1, 10×2, or 5×4, so this is a valid output: ...
9
votes
1answer
416 views

Variant of racetrack with exact finishing point and zero terminal velocity

Introduction The challenge is a very interesting variant of the game racetrack and those two challenges: To Vectory! – The Vector Racing Grand Prix Program a Racing Car Source of this ...
3
votes
9answers
1k views

How's your string theory?

Back to the basics! You're in you comp sci class again, except wiser and golfier. You have the tools, you have the power… but do you have the skill? Probably. Crash Course for the non-Computer ...
6
votes
5answers
439 views

Remove Whitespace from a Java Program [closed]

In this challenge, you will be given the source code of a Java program. Your task is to write a function or full program that will remove the whitespace from this program. The whitespace-removed ...
2
votes
2answers
206 views

Greater Average Submatrix

Objective Write a program in any language that reads a matrix from stdin in which all columns are space delimited and all rows are newline delimited. The program must output a sub matrix so as that ...
13
votes
1answer
326 views

Make a (software) modem!

Objective Design a modulator/demodulator pair to accurately transmit data as quickly as possible over simulated plain old telephone service (POTS). Steps Generate some random (/dev/random or the ...
37
votes
26answers
3k views

Difference should make no difference

Your company lately hired a new bunch of extremely dedicated sysadmins. They feel that just watching computer screens is quite limiting (I mean, 60Hz refresh rate is just NOT enough), so they hooked ...
93
votes
36answers
5k views

Source code ecological footprint

You've just been hired by a German car manufacturing company. Your first task, as an engineer, is to write a program that computes the ecological footprint of ASCII strings. The ecological footprint ...
8
votes
4answers
447 views

Write two programs that compresses and decompresses data

Challenge: Create a program that compresses a semi-random string, and another program that decompresses it. The question is indeed quite similar to this one from 2012, but the answers will most ...
27
votes
7answers
2k 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 X XXX ...
35
votes
5answers
738 views

Overcoming cluster size

Fed up with the reliability of flash storage, you decided to store all your programs on one of those good old 1,440 KiB floppies. However, after copying not even 3,000 programs, the disk was full. ...