Stack Exchange Network

Stack Exchange network consists of 175 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

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

20
votes
5answers
377 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. ("...
7
votes
0answers
245 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 ...
22
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
420 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
554 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
612 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
426 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
813 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
369 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
860 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
802 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
360 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
437 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
684 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
2k 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
392 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
646 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
488 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 ...
26
votes
6answers
985 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 ...
27
votes
6answers
908 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
263 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 ...
33
votes
21answers
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: ...
285
votes
21answers
35k 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
294 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 ...
41
votes
39answers
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). ...
16
votes
1answer
557 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
637 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 ...
18
votes
1answer
601 views

Advent Challenge 1: Help Santa unlock his present vault!

Next >> Descriptive Keywords (for searching): Make Two Matrices Equivalent, Overlap, Array, Find Challenge Santa has had a history of elves stealing presents from his vault in the past, so this ...
25
votes
32answers
5k views

Circular Keyboard Spiral

This is a QWERTY keyboard. Q W E R T Y U I O P A S D F G H J K L Z X C V B N M We can "spiral out" on this keyboard, starting from G. The spiral will start at ...
11
votes
9answers
1k views

BigNum Bakeoff Reboot

Some of you may be familiar with the BigNum Bakeoff, which ended up quite interestingly. The goal can more or less be summarized as writing a C program who's output would be the largest, under some ...
12
votes
4answers
808 views

Find the password

An ordinary N-digit combination lock consists of N rotating discs. Each disc has digits 0-9 inscribed in order, and you need to turn them to the correct password to open it. Obviously, if you don't ...
29
votes
27answers
2k views

Concatenative counting

Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any ...
72
votes
14answers
8k views

Hello World in Multiple Languages

Task Create a program or a function that is valid in multiple programming languages, and when compiled/interpreted as a different language outputs "Hello, World!" in a different natural language. ...
6
votes
2answers
254 views

Fuzzy distances to coordinates

This challenge is similar to my previous one, but has a twist that makes it significantly more difficult. There are n people on a 2D plane. Using distances between them we're going to find their ...
0
votes
4answers
362 views

The greedy regex (robbers)

This is the robbers' post. The cops' is here. Your challenge is to take a cop's post and find an input that the regex matches but the program returns a falsey value. Once you have cracked a cop's ...
7
votes
15answers
2k views

I'm thinking of a number (Robber's thread)

Cop's thread here In this cops-and-robbers challenge cops will think of a positive integer. They will then write a program or function that outputs one value when provided the number as input and ...
32
votes
26answers
4k views

I'm thinking of a number (Cop's Thread)

Robber's Thread here In this cops-and-robbers challenge cops will think of a positive integer. They will then write a program or function that outputs one value when provided the number as input and ...
15
votes
2answers
918 views

Mathematical Expression Showdown!

You are given 6 numbers: 5 digits [0-9] and a target number. Your goal is to intersperse operators between the digits to get as close as you can to the target. You have to use each digit exactly once, ...
44
votes
43answers
8k views

Determine your language's version

Your challenge is to write a polyglot that works in different versions of your language. When run, it will always output the language version. Rules Your program should work in at least two versions ...