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

7
votes
1answer
94 views

Build a top-front-side puzzle solver

A top-front-side puzzle is a puzzle where you are required to construct a 3-D shape of (usually cubic) blocks given three orthogonal views: a top view, a front view, and a side view. For example, ...
3
votes
0answers
83 views

Evening Commute Solver

I recently moved to an apartment overlooking the inner ring-road of town, and every day, a beautiful scene unfolds. The traffic lights are apparently so confusing (mostly because the Dutch are used to ...
-5
votes
5answers
138 views

Print the Longest Sentence

I've searched around, and cannot find a challenge too similar to this one--however, it would not surprise me if this is not the first of its kind. My apologies if I've overlooked something. The ...
-5
votes
0answers
77 views

Please rate my obfuscated C code [on hold]

This is my first attempt at writing obfuscated C code. Please tell me what you think and if you like it!!!!! It took me a long time to figure out the trick =) int main(){char b[] = {72, 101, 108, ...
13
votes
1answer
335 views

Help our robots reach the teleporter

UPDATE: Added a Python framework to get started. The space-station has been overtaken by crusher-bots. You must direct as many of our expensive and fragile tech-bots called "rabbits" to an exit ...
16
votes
3answers
643 views

Reconstruct a Permutation

Introduction Suppose that you are handed a random permutation of n objects. The permutation is sealed in a box, so you have no idea which of the n! possible ones it is. If you managed to apply the ...
-3
votes
0answers
68 views

Fix the indent size of masked code using any language or even human logic [closed]

Do your best to fix the indent size issues with this file w/o knowing the contents of the code. Go ahead and paste the same code block into your answer and adjust the indentation until you "think" you ...
7
votes
3answers
577 views

Self-shortening Prime Tester

Let's get right in to it. Your challenge is to make a program that does these things depending on its input: If the input is a number, output "Prime" if the number is a prime number and "Not prime" ...
6
votes
3answers
512 views

Finding Collatz-like rules with many loops

This code-challenge is related to the code-golf question Analyzing Collatz-like sequences but the goal is quite different here. If you are familiar with Collatz-like sequences you can skip to the ...
35
votes
5answers
2k views

Adding Numbers with Regex

I want to try a new type of regex golf challenge, which asks you to solve nontrivial computational tasks with nothing but regex substitution. To make this more possible and less of a chore, you will ...
4
votes
0answers
244 views

Tetris Tangrams

Introduction Tangrams are a classic puzzle involving arranging/fitting blocks into various shapes. From the Chinese 七巧板 - literally meaning "seven boards of skill". Let's take this idea and use the ...
14
votes
9answers
1k views

Keep the unique characters down

It's very simple: Your program or function should generate the following text: Elizabeth obnoxiously quoted (just too rowdy for my peace): "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG," giving me a ...
18
votes
4answers
930 views

How to count the syllables in a word

Input: You will be passed a string containing a single english word. All letters will be lowercase, and there will be no non-alphabetic characters in the string. Output: You will return an integer ...
18
votes
3answers
711 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. ...
34
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 ...
6
votes
5answers
685 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 ...
8
votes
2answers
593 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
285 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
632 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
469 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
192 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
491 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
711 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
133 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
939 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
924 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
690 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
115 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
601 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
354 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 ...
92
votes
24answers
10k 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
991 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
213 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
230 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
712 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
392 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
281 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 ...
13
votes
0answers
322 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 ...
31
votes
4answers
1k 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
701 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 ...
31
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
598 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
672 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
401 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 ...