Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [code-challenge]

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).

5
votes
0answers
206 views

Goldbach's Comet

Back to back challenges I guess. Hopefully this one is more clear than the last. Background I was playing around with Goldbach's conjecture, and decided to plot evens (on the x-axis) vs the number ...
24
votes
4answers
1k views

Where's Blackhat?

Challenge Write code which, given an image of a panel from a random xkcd comic, returns a truthy value if Blackhat is in the comic or falsey if not. Who is Blackhat? Blackhat is the unofficial name ...
37
votes
28answers
4k views

Is the matrix centrosymmetric… and so is the code?

Defintion A centrosymmetric matrix is a square matrix that is symmetric about its center. More rigorously, a matrix \$A\$ of size \$n \times n\$ is centrosymmetric if, for any \$i,\: j \in ([1, n] \...
12
votes
10answers
3k views

Golfing Emoticons

Introduction Your challenge today (inspired by this challenge) is to write a number of snippets, functions or full programs each that output various ascii emoticons, without reusing characters. ...
23
votes
7answers
2k views

Filthy and Unique

In this question I will talk about programs as strings, this is strings of bytes, not characters. How your resultant program is rendered or displayed is not important to this challenge, only how it ...
1
vote
1answer
177 views

Two Dimensional Waterflow problem [closed]

The one dimensional twitter waterflow problem is this: You are given an array that represents a hill in the sense that the ith entry is the height of the ith location of the hill. When it rains, ...
5
votes
1answer
339 views

Bot: Outsnake the game!

So, I wrote a simple Javascript game (as yet unnamed) and naturally I wanted to write an API so I could write a bot to play it for me, and naturally I wanted to let the PPCG community have a go for ...
27
votes
4answers
684 views

Smallest region of the plane that contains all free n-ominoes

On Math Stack Exchange, I asked a question about the smallest region that can contain all free n-ominos. I'd like to add this sequence to the On-Line Encyclopedia of Integer Sequences once I have ...
4
votes
1answer
298 views

Pair and sort from two integer lists

You are given two arbitrary integer lists, e.g. [-10, 99, -6, 43], [100, 32, 44]. You are to pick one integer from each list and ...
11
votes
2answers
519 views

Block partition a string

Inspiration. Consider a list l, consisting of numbers. Define a block operation at index i on the list ...
35
votes
27answers
3k views

Code-generator with unique characters

Challenge Your task is to write a piece of code that outputs another piece of code. That code must in turn output yet another code until the final code outputs the integer 1. The chain ends the first ...
20
votes
5answers
344 views

Modified Boggle Checker, with Modified Boggle-able Code

Background Boggle is a board game where the players have to find English words on a 4-by-4 board of random alphabets. Words can be constructed by selecting sequentially adjacent cells on the board. ("...
5
votes
0answers
160 views

The N Queens Problem, but with Fairy Chess Pieces

Fairy Chess is a sort of generalized chess that allows unconventional pieces. The eight queens puzzle is a classic problem where you have to put 8 queens on a chess board such that no two queens ...
13
votes
6answers
2k views

Code golf the best permutation

Challenge Given an integer n ≥ 4, output a permutation of the integers [0, n-1] with the property that no two consecutive integers are next to each other. The value of a permutation ...
21
votes
10answers
1k views

Write a Quine Suite

We've had a lot of quine challenges, but a lot of the quine formats are similar, lets create some variance in our quines. Your task is to create a selection of programs in the same language (at least ...
11
votes
3answers
408 views

Polynomial -> Integrate

Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals. For example, -...
20
votes
11answers
1k views

Fruit bagging factory

Your mission is to build an algorithm (program or function) that can optimize packing fruit from a conveyor belt into bags to be sent off to retailers, optimizing for a largest number of bags. Each ...
10
votes
5answers
517 views

Quine of orders

Write a program that, when run in different languages, outputs a different byte permutation of the code in each language. The exact source code is counted as one permutation. Here "different language"...
41
votes
9answers
6k views

Reserved JavaScript

As of ECMAScript 2015, JavaScript has 33 reserved keywords, such as break, const and new, as ...
15
votes
8answers
547 views

The Great API Easter Egg Hunt!

API Easter egg hunt! There's an API at http://easter_egg_hunt.andrewfaraday.com which will provide a special Easter egg hunt, just for you... You can see the API docs at the above address, or try it ...
8
votes
4answers
409 views

Minimize Least Used Binary Bits in Fractions

Introduction For a given rational number r, find a pair of integers p,q so that p/q=r and ...
20
votes
21answers
1k views

Count the Matchsticks

Most people here are familiar with seven segment displays, which are also used in matchstick puzzles. Below are the digits 0 through ...
41
votes
9answers
5k views

Shifting-Oriented Programming

A string can be shifted by a number n by getting the byte value c of each character in the string, calculating ...
13
votes
6answers
758 views

Text to Brain-Flak

Your challenge is to turn input text to brain-flak code that will output the text. Tutorial taken from here with permission here Brain-Flak has two stacks, known as 'left' and 'right'. The active ...
8
votes
3answers
316 views

Compress to Impress

Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "Palindrome ...
11
votes
11answers
1k views

Balanced Zero-One Encoding

Task Encode a string that entirely consists of uppercase alphabets (A-Z) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple! ...
7
votes
2answers
457 views

Creating a function over multiple lines

I'm attempting to create a function over multiple lines. Parameters of the challenge: Function returns 'barbarian' Only 2 characters per line 40 lines maximum. I keep trying to use a fat arrow to ...
36
votes
38answers
4k views

Hast Thou Slain the Jabberwock?

Your task is to output the exact string The Jabberwocky without taking input. Normal rules for input and output apply, so both functions and programs are ...
28
votes
18answers
5k views

Take a stand against long quine lines

or: Build a vertical quine Inspired by Take a stand against long lines. Your task is to build a vertical quine with as short a line length as possible. Scoring Shortest line length (excluding ...
18
votes
1answer
721 views

Tetris strategy

Your task is to implement a Tetris strategy balanced in terms of score vs code size. In this version of the game tetrominoes are rotated and dropped from above into a grid of 20 rows and 10 columns. ...
-3
votes
1answer
249 views

Biggest number challenge (Brainfuck) [duplicate]

This is a brainfuck version of Largest Number Printable, and this. Let's think about brainfuck interpreter such that, Has array that can be stretched left & right arbitrary large Each cell can ...
14
votes
8answers
431 views

Deranged Rearrangements

Your task is to write a computer program such that when it is cut up into lines (split on the newline character) every arrangement of the lines will output a different number between 1 and n! (where n ...
22
votes
10answers
1k views

Compressing the Atomic Ionization Energies

This is a different type of compression challenge. In a normal kolmogorov-complexity challenge, you are required to recreate a list exactly. Here, you are allowed to round the values in any way you ...
30
votes
126answers
8k views

The Programming Language Quiz, Mark II - Robbers

Cops challenge The Robbers' Challenge Find a vulnerable answer. That is, an answer which hasn't been cracked yet and which isn't safe yet either. Crack it by figuring out its language. That is, find ...
10
votes
14answers
667 views

Cops and Robbers: Redacted Primality (Robbers' Thread)

This is the robbers' thread. The cops' thread is here. Your challenge is to take an uncracked submission from the cops' thread and try to find the original unredacted program. Please comment on the ...
19
votes
29answers
1k views

Cops and Robbers: Redacted Primality (Cops' Thread)

This challenge was originally sandboxed by Magic Octopus Urn; I adopted and posted it with his permission. This is the cops' thread. The robbers' thread is here. The challenge Step One: Write a ...
10
votes
5answers
382 views

Get Two from One

As we saw in this question complex logical statements can be expressed in terms of the simple connectives of generalized Minesweeper. However Generalized minesweeper still has redundancies. In order ...
15
votes
4answers
577 views

Palindrome Compression

Challenge Write a program that compresses and decompresses ASCII text losslessly. It should be specialized to work well with palindromes, including case-insensitive and punctuation-insensitive ...
9
votes
2answers
458 views

How many draws are there in Quarto?

Introduction This challenge is similar to Project Euler problems. I came up with it because I was playing a deceivingly simple board game and couldn't come up with an efficient solution to answer a ...
33
votes
21answers
3k views

Longest Non-Repeating Substring

Given a string as input find the longest contiguous substring that does not have any character twice or more. If there are multiple such substrings you may output either. You may assume that the ...
23
votes
6answers
884 views

Radiation Detector!

A radiation-hardened program is a program where, if any character of the code is removed, the program will still function the same. For this question, we'll be writing a program that detects when it ...
25
votes
6answers
758 views

Mutually Exclusive Quines

Your challenge is simple. Write two programs that share no characters which output each other. Example Two programs P and Q are mutually exclusive quines if: P outputs Q Q outputs P There is no ...
10
votes
1answer
229 views

Cyclic Weak Levenquine

This question asking us to make a "Cyclic Levenquine" has gone unanswered. So today we will ask a slightly simpler version. In this challenge we will define a K-Levenquine to be a program whose ...
32
votes
20answers
12k views

Wait, what language is this?

Recently I had the pleasure of writing a Haskell program that could detect if the NegativeLiterals extension was engaged. I came up with the following: ...
275
votes
20answers
33k views

Write Moby Dick, approximately

Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this ...
15
votes
1answer
286 views

Strategic Vanishers

This post is loosely inspired by this mathoverflow post. A Vanisher is any pattern in Conway's Game of life that completely disappears after one step. For example the following pattern is a size 9 ...
36
votes
34answers
3k views

A Programming Puzzle of Mode Golf

Your task is to print the text Good morning, Green orb!, with every character repeated in place as many times as the most frequent byte in your source (the mode). ...
0
votes
0answers
78 views

Techniques for making code smaller [duplicate]

I came across dwitter which is a twitter for coding javascript ni 140 chars. I saw some cool things people do there for reducing the size of the code, for instance: ...
15
votes
1answer
473 views

Google's Hopping Bunny

On December 4, 2017, the Google Doodle was a graphical programming game featuring a bunny. The later levels were nicely non-trivial and they seemed like a great candidate for an atomic-golf challenge. ...
4
votes
7answers
625 views

Make a Plain PIE!

(2 Jan 2018) Because of the winning criteria I am going to accept the Jelly answer, but I am also giving upvotes to all other answers which all use astounding methods as well Introduction There are ...