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).
18
votes
1answer
136 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 ...
25
votes
8answers
1k 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 ...
46
votes
18answers
7k views
Exit Code Golfing
Inspired by this default for IO.
The Task
Write a program that, given an input integer x between 0 and 255, crashes with exit code x.
Restrictions
You may not call anything which is intended ...
-3
votes
0answers
42 views
Code Challenge Help [closed]
In this assignment you will draw a student schedule by using a while loop. You will ask the user for their first and last names, and then a list of their classes and room numbers.
The loop should ...
10
votes
1answer
177 views
Split arrays and programs in half
Introduction
You have been tasked to write a program that splits a rectangular integer array evenly in half (for whatever reason).
This task is computationally intensive, but luckily you have a dual-...
-2
votes
0answers
90 views
Write a /(meta-)*Quine/ [duplicate]
Okay, fine it's a /(?:meta-)*quine/
So what is a Meta-Quine?
Quine: program which outputs its own source code.
Meta-Quine: Program which takes no input and outputs a quine.
Meta-meta-quine: Program ...
38
votes
7answers
2k views
Sharing (characters) is Caring!
Consider the following task:
Given a positive integer n > 0, output its integer root. The integer root of a number n is the largest value of x where x2 ≤ n, usually expressed with the formula floor(...
24
votes
10answers
1k views
2016 Time Capsule String: Climb The Integer Ladder
Using the 74 characters from the 2016 time capsule string
H@~*^)$.`~+1A|Q)p~`\Z!IQ~e:O.~@``#|9@)Tf\eT`=(!``|`~!y!`) Q~$x.4|m4~~&!L{%
write N code snippets all in the same language where:
The ...
64
votes
23answers
5k views
2016 Time Capsule String: How Versatile Is Your Language?
About a year ago on Dec 31, 2015, I had the idea that:
We should make a time capsule string. Everybody gets to add one character and next new years we'll see who can make the best program out of ...
5
votes
1answer
162 views
Shrink your language's character set [duplicate]
We often get restricted-source questions here on PPCG that favour submitting solutions using only a subset of characters (sufficiently so that there's a tag printable-ascii that identifies a ...
7
votes
4answers
377 views
Busy Brain Beaver reboot [duplicate]
Introduction
I found a really interesting puzzle it was called Busy Brain Beaver. But it has been 3 years since the latest activity and there are some things I didn't like about it. So I decided to ...
89
votes
27answers
9k views
What are the five most powerful characters in your language?
Choose any five characters your language supports. There are 5! = 5×4×3×2×1 = 120 ways these can be arranged into a 5-character string that contains each character once; 120 ...
20
votes
7answers
568 views
Print Polyglot Pieces
Typically, polyglots are constructed in such a manner that each language can ignore parts of the code that are present for other languages, by wrapping them in string literals, using comment syntax, ...
0
votes
0answers
79 views
What path will santa take? [duplicate]
Question
Santa must get to every house in the world to deliver gifts, can you make a program that will calculate the shortest path that Santa could take, and still visit all the cities listed?
...
17
votes
1answer
378 views
Make a regex polyglot
Write a regex that works in at least 2 regex flavors (or versions), and match a different string in each flavor (or version) it is running in.
The strings to be matched in this challenge are the ...
18
votes
3answers
741 views
Piet (Mondrian)'s Puzzle
For more information, watch this video, and go to A276523 for a related sequence.
The Mondrian Puzzle (for an integer n) is the following:
Fit non-congruent rectangles into a n*n square grid. What ...
7
votes
2answers
149 views
Create a version series
The Definition
Given an integer x, a version series is a set of digits (base 10) from which any x-length subset of consecutive members is unique compared to all other possible subsets of the same ...
10
votes
9answers
526 views
Multi-lingual Challenge
After all the fun we've had with polyglot challenges in the (recent) past, how about a challenge where the output can be in two languages?
Your answer needs to accept boolean input b and output the ...
9
votes
4answers
254 views
Abstract Syntax Tree Golfing: FizzBuzz, Python
Summary
Implement FizzBuzz in Python, with the fewest possible tokens.
Challenge
Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” ...
7
votes
1answer
304 views
Comment-free polyglot with different, nontrivial, behaviour per language
This challenge is inspired by this other challenge, which you may want to read first for some context. However, a competitive answer is likely to look very different, so after reading some posts on ...
36
votes
14answers
2k views
What will you bring for Thanksgiving?
Thanksgiving in the United States is coming up on November 24th. Many people will have a large dinner with their families, traditionally including turkey and many side dishes. This typically means the ...
-5
votes
4answers
164 views
Your Search Returned No Results [closed]
Your task is simple. Write a program (or function) whose output returns no search results on google.
Rules:
It must take no input.
It must not cause an error.
It must terminate.
It must produce the ...
22
votes
2answers
491 views
On this site we obey the laws of thermodynamics!
And in particular the second law: the entropy of an isolated system increases over time.
For this challenge,
An "isolated system" will be taken to be a program or function (abbreviated as "program" ...
10
votes
3answers
506 views
Manoeuvre the grid!
Briefing
You are a bot, in a 2D grid that extends infinitely in all four directions, north, south, east and west. When given a number, you must move the bot so that you get to the target number.
...
6
votes
0answers
125 views
Out Steganograph Me! [duplicate]
Out Steganograph Me
As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them.
The Challenge
Your goal is to write a function or ...
8
votes
2answers
291 views
The logical quine
The challenge
Simply write a program that outputs its own source code.
Nothing more than a regular quine.
The problem
We don't have a computer so we have to run the program on a programmable logic ...
5
votes
0answers
170 views
Solve a Single Player Tron Game [closed]
Solve a Tron Game
Tron is a great game, and if you haven't played it the internet has MANY online versions available.
A fun challenge is to try to write an AI that plays Tron, which is normally much ...
0
votes
0answers
61 views
find the period of one division [duplicate]
We have a division a/b where a is one not negative integer, and b is one positive integer. Write the complete program, or a function that from the input a and b, return the period of the division a/b. ...
1
vote
0answers
168 views
Code that detects changes on itself [closed]
Challenge: Write a piece of code that only runs when the code is not being altered. If you change anything, the code should detect this and deny running. Of course, it should not be possible to just ...
15
votes
2answers
839 views
A game of atomic proportions
Your task make a bot that plays Atomas, with the highest score.
How the game works:
The gameboard starts with a ring of 6 "atoms", with numbers ranging from 1 to 3. You can "play" an atom between ...
10
votes
3answers
388 views
Print a specific value in the Wythoff matrix modulo 2
The Wythoff matrix is an infinite matrix consisting of the Grundy numbers of each square on a chessboard in Wythoff's game.
Each entry in this matrix is equal to the smallest nonnegative number that ...
25
votes
2answers
441 views
Hyper about quines
Inspired by Hyperprogramming: N+N, N×N, N^N all in one.
Thanks to @MartinEnder and @trichoplax for their help in the sandbox.
Definitions
Hyperquines
Define a hyperquine of order n as a quine-...
1
vote
0answers
127 views
Adding One to a number stored as an Array [closed]
I was challenged by one of my friends to solve this coding problem:
Given a non-negative number represented as an array of digits, add one to the number. The digits are stored such that the most ...
70
votes
15answers
12k views
When was this language released?
Your challenge is simple. You need to write a program that prints to either STDOUT or a file the year the language it is written in was released. Because this is such a simple task, the twist is that ...
2
votes
10answers
302 views
Shortest way to strip the commas from column n given a .csv file/input
Ok, so the input here is going to be a .csv file and so is the output. Now, given a .csv file/input like so
"apple","banana","apple,banana","orange"
"grape","orange","grape,orange","sprout"
# 0 ...
0
votes
0answers
124 views
Hangman solver algorithm [duplicate]
Please do not delete this without reading it completely. Put it in unclear if there are some questions. I will respond immediately.
This is different from the question "Write a Hangman Solver" because ...
14
votes
0answers
991 views
Write a Palindrome-Polyglot-Quine
Write a "palipolyquine": a program that is a quine, a polyglot, and a palindrome.
Rules:
The number of polyglot languages is more preferable than code size.
The shortest answer (in bytes) wins, in ...
41
votes
9answers
3k views
There can be only 1!
Your task is, given a positive integer n, to generate an expression that equals the number n.
The catch is: you're only allowed the number 1 in the output.
The operators at your disposal are:
+, -, ...
16
votes
2answers
363 views
Chuck Norris vs Travelling Salesman
Introduction
Almost everyone is familiar with the Travelling Salesman Problem (TSP). The task is to, given a list of N cities, find the minimum Hamiltonian cycle which is to say the shortest path ...
-8
votes
11answers
277 views
Outputting x to y
Challenge
You must choose one number x (y = x + 9) and create ten unique programs which each print out one of the numbers in the range x to y inclusive. However, there are three twists:
Each program'...
7
votes
10answers
712 views
DNA Encode a String
Challenge
You must write an encoder (and a separate decoder) which takes a string as input and outputs the string encoded in the style of a strand of DNA.
DNA
DNA is made up of four types of ...
4
votes
4answers
409 views
The longest period iterating quine
As we know, a quine is a program that outputs its own source code. However, it's also possible to write a program that outputs another, different program, that outputs the first program again. For ...
3
votes
24answers
1k views
Enterprise Quality Code Prime Sieve
Enterprise Quality Code!
TL;DR
Answers will consist of a full program (of length < 30k) prints the the first N Prime numbers (as a base 10 representation without leading zeros unless the chosen ...
2
votes
0answers
230 views
100KB image compression [closed]
Your task is to, given an image, compress it to 100000 bytes or less, while following all of the below rules:
No cheating/loopholes.
Your code must not be optimized to work best only on the test set ...
17
votes
4answers
377 views
Minimal Word Search
Last week, we worked to create the shortest 1-D string using the top 10,000 words in the English language. Now, lets try the same challenge in 2D!
What you need to do is to take all of the above ...
73
votes
53answers
8k views
Can you outgolf me? (Cops section)
Cops section
The robbers section can be found here.
Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.
Challenge
Your task is to write ...
20
votes
0answers
571 views
Build a digital clock in Conway's Game of Life
Since my Tetris question seems to evade being answered even to this day, I thought I'd create a slightly easier challenge, one that doesn't need any user input.
Your task is to build a Game of Life ...
19
votes
1answer
379 views
Diff compression [closed]
For this challenge, you need to compress a diff. A diff is some data that represents the difference between two strings. For this challenge, you need to provide one or more programs that can:
Input ...
27
votes
7answers
1k 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 ...
2
votes
0answers
150 views
Brute force my code lock [duplicate]
The code lock for my garage has 5 buttons, labeled "1 2", "3 4", "5 6", "7 8", and "9 0". To open the garage door, you have to enter the correct 4-digit PIN.
As you can see, every button represents ...