A code challenge is a competition for creative ways to solve a programming puzzle for an objective criterion other than code size. Challenges to produce the shortest working code should be tagged [tag:code-golf].
24
votes
25answers
1k views
Do something that looks like something else
Write a snippet, a function, a programm, ... that is obfuscated in a way that it looks clear at the first sight that it does something else.
For example: write a bit of code that adds two number, but ...
6
votes
3answers
233 views
Display a bézier curve in the browser
The goal is to display a bézier curve in any classical browser (except maybe old IE versions, because... are they really browsers?) client side.
Rules:
You must provide one or more files (or their ...
18
votes
6answers
632 views
Fault-Tolerant Hello World (a.k.a. the Interview)
At the end of your interview, the Evil Interviewer tells you, "We make all of our applicants take a short coding test, to see if they really know what they are talking about. Don't worry; it's easy. ...
22
votes
24answers
2k views
Print a string in as few distinct characters as possible
The task is simple: print The quick brown fox jumps over the lazy dog using as few distinct characters in your source code as possible.
print "The quick brown fox jumps over the lazy dog" has a score ...
3
votes
9answers
323 views
Eight Queens Obsfucation
You've probably heard of the classic Eight Queens Puzzle. For those of you who haven't it goes something like this:
Position 8 queens on an 8×8 chessboard so that no two queens threaten
each ...
7
votes
3answers
229 views
Rosetta Stone Challenge: Draw a Box Plot
The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism!
The Challenge
Your challenge is to implement a program that ...
12
votes
1answer
406 views
(Re)Implementing Tetris
In the spirit of re-implementing classic video games, I would like to invite the community to create their best implementation of Tetris.
For reference, a screenshot of the official NES version of ...
7
votes
1answer
329 views
Generate a number by using a given list of numbers and arithmetic operators
You have a list of numbers L = [17, 5, 9, 17, 59, 14], a dictionary of operators O = {+:7, -:3, *:5, /:1} and a number N = 569.
Task
Output an equation that uses all numbers in L on the left-hand ...
-2
votes
2answers
229 views
Write a program to print squares of integers up to 25 in java without using variables?
I asked this question on programmers 10 days back but wasn't able to get the answer that I wanted.
Write program in java to print the squares of first 25 integers(1-25) without using any variables.
...
1
vote
1answer
197 views
Build a 12-hour digital clock
In my essay "Use the 24-hour clock", I claim that trying to represent the 12-hour clock directly in data is a terrible exercise in patchy, inelegant programming:
"No problem, we'll just use ...
11
votes
5answers
671 views
Find largest prime which is still a prime after digit deletion
Over at http://math.stackexchange.com/questions/33094/deleting-any-digit-yields-a-prime-is-there-a-name-for-this the following question is asked. How many primes are there that remain prime after you ...
9
votes
5answers
539 views
Swapping numbers
This is a common puzzle many of you have solved manually. Now this is the time to write an algorithm to solve the same.
There are equal number match sticks lined up in two different side facing each ...
5
votes
2answers
302 views
Drawing 3d nets - Archimedean solids
I have a weakness for 3d nets which when cut out and folded allow you to make 3d shapes out of paper or card. The task is simple, written the shortest program you can that draws nets for the 13 ...
7
votes
4answers
679 views
Breakout in half an hour
When I was a young teen I had a very boastful friend who claimed he could code up breakout (http://en.wikipedia.org/wiki/Breakout_(video_game)) in half an hour. Half an hour later he had done a great ...
7
votes
7answers
697 views
Write ASCII-Art Obfuscated Code, read as, and resulting in: “DFTBA”
The challenge is to write the most elaborate code, embedded in ASCII art that reads and prints "DFTBA". For example, the following reads DFTBA:
oooooooooo. oooooooooooo ooooooooooooo oooooooooo. ...