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

11
votes
0answers
135 views

Finding all-but-one matches

This challenge is about writing code to solve the following problem. Given two strings A and B, your code should output the start and end indices of a substring of A with the following properties. ...
31
votes
6answers
3k views

Write a Quine in Plain English

Write a quine that consists of real English words separated by single spaces. A "word" is defined as a string containing only lowercase and uppercase letters (/[a-zA-Z]+/ in regex). To be "real" your ...
-1
votes
0answers
49 views

Write a polyglot in as many languages as possible [duplicate]

(Wikipedia article on polyglots)[http://en.wikipedia.org/wiki/Polyglot_(computing)] A polyglot is a program which will compile in 2 or more languages. For this chanllenge, try writing one that would ...
6
votes
5answers
581 views

Rosetta Stone Code Golf Challenge: Print Certain Numbers; all snippets must be same length

Rosetta Stone Code Challenges are challenges where you must complete the task in as many languages as possible. The Challenge You will be given two numbers, n and s, in a list as input. The n will ...
7
votes
2answers
567 views

Finding Programs in the Primes

Let's assign the numbers 0 through 94 to the 95 printable ASCII characters: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Space is 0, ! is 1, and ...
3
votes
2answers
247 views

Generate unique non-sequential string of length n without memory of previously generated strings

Scenario: Imagine a situation where you wish to share a unique alphanumeric code. Perhaps it is a one-time-use coupon code you hand write on business cards, or some other scenario where it is ...
4
votes
2answers
553 views

Recognize Twin Primes by Crashing

Background Story Bob was handed the following assignment for his programming class. Please note: this is not the actual challenge. Homework assignment 11: Twin primes Input: an integer n ...
32
votes
8answers
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 ...
6
votes
3answers
459 views

Your Language in a Box

Now with BONUS for run-time placement. Write a program to fill a text box with the identifiers used in your program while keeping your program small. With all the identifiers you have used (excluding ...
-4
votes
5answers
182 views

How many contiguous “strings” can you find in a set of strings?

Consider the set of 16-character strings containing only the 95 printable ASCII characters. There are 9516 ≈ 4.4×1031 such strings. Imagine these strings are put into a list and sorted ...
18
votes
3answers
1k views

Anagramming Stack Exchange question titles into programs

Stack Exchange currently has 134 question and answer sites. This includes all beta sites (such as PPCG) but not Area 51 proposals nor any meta sites, except for the "mother meta". To answer this ...
9
votes
2answers
450 views

Build a Mining Robot

Your program will control a mining robot searching underground for valuable minerals. Your robot will tell the controller where you want to move and dig, and the controller will provide feedback on ...
8
votes
4answers
692 views

Counting k-mers

The task is to count the number of distinct substrings of length k, for k = 1,2,3,4,..... Output You should output one line per k you manage to complete with one number per output line. Your output ...
0
votes
1answer
128 views

Printing a “Hello World” one-liner in bourne shell without directly using white space char [closed]

I'm currently trying to solve a tricky/silly challenge and i've come to a dead end. The challenge is basically to form a one-liner /bin/sh compatible command line which essentially outputs "Hello ...
11
votes
2answers
915 views

The number of reachable snake orientations

This challenge is not about the game Snake. Imagine a 2d snake formed by drawing a horizontal line of length n. At integer points along its body, this snake can rotate its body by 90 degree. If we ...
8
votes
7answers
897 views

User Scored Code Golf - Drawing Diamonds [experimental]

This challenge will behave more or less like a traditional code-golf. The only difference is that instead of scoring answers by their number of characters or bytes, users will assign weights to ...
14
votes
36answers
3k views

The Jigsaw Code Puzzle

This is an answer-dependent challenge! The order of answers matters, and your exact task depends on the last answer that was posted. You might want to sort the answers by oldest. Let's piece ...
15
votes
8answers
666 views

Building a long chain of words

This challenge is to find the longest chain of English words where the first 3 characters of the next word match the last 3 characters of the last word. You will use an common dictionary available in ...
2
votes
0answers
114 views

Cell-phone golf [duplicate]

Older cellphones have 3 or 4 characters mapped to each number from 2-9 and that number must be pressed a certain number of times to get the required character. Let's assume our cellphone has this map: ...
10
votes
4answers
583 views

Put the line in the code you nut and shake it all up

Using one programming language write 5 single-line programs, each of which outputs a different line of the first verse to Harry Nilsson's 1972 song "Coconut" when run individually: Brother bought ...
0
votes
4answers
351 views

All those duplicate questions deserve duplicate code to show them off

All those questions that are duplicates... Ignored and marginalized by society. It is just not... right. We have to do something. There surely must be love for them too. They feel appreciated if a ...
90
votes
24answers
9k views

Lab Rat Race: an exercise in genetic algorithms

This is Fortnightly Challenge #3. Theme: Genetic Algorithms This challenge is a bit of an experiment. We wanted to see what we could do, challenge-wise, with genetic algorithms. Not everything may be ...
24
votes
3answers
977 views

Looking for programs in a huge Boggle board

Each character in this 64 by 64 block of text has been chosen randomly and uniformly from the 95 printable ASCII characters. /rq$:Zy5*g'$DeGXX2o8y "{@Cg:FR9qih}xh >5$DsF1Fs5Ao~smFp;.RJbV )U ...
6
votes
1answer
211 views

Combinator quines

Background You have just learned what combinatory logic is. Intrigued by the various combinators you spend quite a bit of time learning about them. You finally stumble upon this particular ...
6
votes
0answers
218 views

Delivery Robots and Destroyer Drones

Program your robots to deliver packages in a warehouse infested with destroyer drones. Avoid the drones and get your packages to the right place as fast as you can. Delivery Robots There are ...
13
votes
2answers
691 views

Go and make it starry

In this contest you have to write a program, that accepts a black and white pixel image, and tries to alter it, such that the white shape forms star domain, with as few changes as possible. Allowed ...
6
votes
3answers
388 views

Retrograde morse (d)e(n)coder

This question is inspired by retrograde music. Retrograde music is a piece of music that can both be played normally (from the beginning to the end) as reversed (from the end the beginning). A similar ...
12
votes
1answer
268 views

Robot roadie needed to pack the truck

As the band's roadie, you have to pack the truck. Your program will place the packages so that they fit in the smallest height. A badly packed truck Rules Packages may be rotated through ...
12
votes
0answers
300 views

Build a fewest-moves freecell solver

In the game of Freecell, you are tasked with building four foundation piles in suit from ace to king, on a layout where you build downward in alternating colours. However, you can only build one card ...
30
votes
4answers
991 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 ...
17
votes
4answers
1k views

Draw A Snowflake

Joe lives at the Bahamas. It is winter. His children are disappointed that there is no snow. Joe needs to make snow for his children. Fortunately, he has a 3-d printer. He plans to make snowflakes ...
13
votes
3answers
1k views

Computer: you do the math

This challenge is partly an algorithms challenge, involves some math and is partly simply a fastest code challenge. For some positive integer n, consider a uniformly random string of 1s and 0s of ...
5
votes
2answers
697 views

Coding a recursive function for highest possible input

Challenge You are given the following function:- which is the same as:- with the base cases q(r, b, L) = 1 whenever r ≤ L, q(r, 0, L) = 0, if r > L and q(r, 0, L) = 1, if r ≤ L. Your task is to ...
29
votes
9answers
3k 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 ...
16
votes
3answers
1k views

Distinguish between Masculine and Feminine Nouns in French within 100 characters

You are to write a very small program within 100 characters. Your program must distinguish between masculine and feminine french nouns. The output should be un if it is masculine and une if it is ...
7
votes
2answers
594 views

Divide food to the poor equally!

The problem Through a terrible procastination accident you are reborn as Scrooge McDuck for a day. To make the most out of the situation you decide to give away food to the poor. Since you also are a ...
9
votes
5answers
641 views

Smallest Bytecode Interpreter/VM

Leaderboard - JIT Compiled (Lower is better) es1024 - 81.2 points (including a working compiler!) Kieth Randall - 116 points Ell - 121 points Leaderboard - Interpreted (Lower is ...
11
votes
5answers
395 views

Generalized Gematria Calculator

Create a bidirectional Gematria calculator, for any given sequence of Unicode characters as the alphabet. Gematri-What? Gematria is a system of assigning numerical values to symbols, developed by ...
28
votes
12answers
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 ...
21
votes
6answers
2k views

Find the largest fragile prime

Consider the function Remove(n, startIndex, count) that removes count digits from the number n starting from the digit at position startIndex. Examples: Remove(1234, 1, 1) = 234 Remove(123456, 2, 3) ...
7
votes
1answer
422 views

Digesting Polygons

Digesting a polygon is a process in which you take an input polygon, and create another polygon that can contain the entirety of the input polygon, while having one side less than it. The goal of ...
28
votes
14answers
3k views

Sudoku Compression

Your job is to write a program (or two separate programs) in any language that: Can take a completed Sudoku board as input (in any logical format) and compress it into a string of characters Can ...
10
votes
4answers
702 views

Tiling, given vertex configuration

Task The task is to tile polygons, given a vertex configuration. Scoring Your score is equal to the "complexity level" your submission reaches. Complexity levels are cumulative, meaning that to ...
44
votes
6answers
4k views

Let's Judge Some Books By Their Covers

Everyone knows that the content makes the question. But a good title helps too, and that's the first thing we see. It's time to turn that first impression into a program, and figure out what kinds of ...
5
votes
0answers
255 views

Tic-Tac-Toe and Chess, with fewest [distinct] characteers

In this form of the game Tic-Tac-Chec, the goal is to move chess pieces to get four-in-a-row. Your goal here is to figure out if a position has a winning move. Rules The rules are similar, but not ...
19
votes
4answers
2k views

The Fatal Error Challenge

Objective Write a routine that accepts a string of printable ASCII characters, s, and returns a string containing the same characters as s, reordered so that no two-character substring appears more ...
10
votes
3answers
1k views

Find highest scoring matrix without property X

This challenge is partly an algorithms challenge, partly an optimization challenge and partly simply a fastest code challenge. A cyclic matrix is fully specified by its first row r. The remaining ...
61
votes
9answers
5k views

Counting Grains of Rice

Consider these 10 images of various amounts of uncooked grains of white rice. THESE ARE ONLY THUMBNAILS. Click an image to view it at full size. A: B: C: D: E: F: G: H: I: J: Grain ...
12
votes
5answers
685 views

RadioASCII Elements: Output the elements of the periodic table while slowly losing characters

Here is a list of the 118 (current) elements of the periodic table (in a collapsed Stack Snippet for your convenience): Hydrogen Helium Lithium Beryllium Boron Carbon Nitrogen Oxygen ...
21
votes
5answers
1k views

Sort a List With Swaps and Pops

Consider a randomized list of the integers 1 to N. You want to sort it using only the following actions: Swap the first and last list elements. (S) Pop off the first element and append it to the end ...