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

27
votes
1answer
655 views

Unrestricted Languages

One of my favorite types of challenges on this site are restricted-source challenges. These challenges impose a computer tractable restriction that the sources of potential answers must pass. I like ...
28
votes
2answers
2k views

Zero an arbitrarily large cell in Brainf***

Your task is to write a piece of code that zeros the current cell in the Brainfuck variant that, each cell can contain a signed integer of arbitrarily large magnitude, instead of the normal 0 to 255. ...
42
votes
28answers
2k views

Surprise Party for Brain-Flak

This question is part of a series Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday. You can find more information about Brain-Flak's Birthday here. Today is Brain-Flak'...
1
vote
0answers
79 views

Build a date shift cipher, which skips punctuation and whitespace and uses a modular lowercase then uppercase alphabet [closed]

Your program must: - Take a date as input, in 8 figure format (day or month, month or day, year) - Take input of a string of any length. - Shift the first letter by the first figure of the date, the ...
6
votes
3answers
560 views

The Big Bang Polyglot [duplicate]

Everyone loves The Big Bang Theory, right? And everyone loves polyglots, right? So let's combine them! Task Your task in each language is quite basic. You must output the name of the one of the 5 ...
26
votes
5answers
2k views

Same code different characters

Note: This challenge only allows answers in compiled languages Task Your task is pretty simple, make two different programs that when compiled result in the same output. Scoring Here is where the ...
7
votes
1answer
470 views

Large Numbers in BF

Background The language BrainF*** (or simply BF), is an extremely minimal programming language. We're going to strip it back even further by eliminating IO operations; only the sub-langage defined by ...
23
votes
14answers
3k views

Reuse your code!

In this challenge we try to solve two important problems at once. They are: Given integers a and b, tell if ab-1 is a prime number. Given integers a and b, return nCr(a, b). Specifically, you must ...
2
votes
5answers
217 views

Match this random string [duplicate]

To-Do: Come up with a Better Title Specification: This challenge is similar to kolmogorov-complexity, but with a twist. You goal is to output a finite string that resembles the following string of ...
13
votes
3answers
458 views

Let's Play Hide and Seek!

The user will hide, and the computer will try to find them. First, the program will take an input, for the size of the grid. Like 5x5, 10x10, 15x15, etc. The grid won't always be a perfect square. ...
8
votes
5answers
275 views

2016 Time Capsule String: Coverage

Consider the 74 characters from the 2016 time capsule string (note the leading space): ...
8
votes
10answers
1k views

Permutation? Permutatino!

Specifications Your program must can take in an integer n, then take in n more strings (containing only alphanumeric characters)...
20
votes
5answers
781 views

Chess Analysis with Limited Information

In this challenge, you are given a limited amount of information about a particular game of chess, and you need to predict who won the game. You are given two sets of data: Piece counts (What ...
32
votes
16answers
3k views

This is the sort of challenge that bytes

I need to stop thinking of punny names Your task is to create as many snippets (programs that have input and output built-in), functions or full programs as possible that sorts whatever your language'...
28
votes
18answers
3k views

Disconnect 4 bits

Your task: given an input string, determine whether the binary representation of that string does not have 4 1s or 0s in a row, ...
19
votes
3answers
672 views

Meta radiation hardener

Background On this site, we occasionally have questions requiring programs to be "radiation hardened"; this means that the program has to be able to survive the deletion of one or more bytes, no ...
105
votes
49answers
13k views

Fewest (distinct) characters for Turing Completeness

Summary: For any given language, what is the smallest amount of unique characters for your language to be Turing-Complete? Challenge: For any language of your choice, find the smallest subset of ...
1
vote
0answers
251 views

Generalization of Eight Queen Puzzle [closed]

Here's one generalized version of the famous Eight Queen's Puzzle: Given an n × n chess board, and an integer ...
32
votes
3answers
3k views

OOP: Overlapping Oriented Programming

One of the lesser known programming paradigms which seems rather fitting for code golfing is Overlapping Oriented Programming (OOP) *. When writing partly identical code, many bytes can be saved by ...
15
votes
3answers
707 views

Find the shortest Golomb rulers

Golomb rulers are sets of non-negative integers such that no two pairs of integers in the set are the same distance apart. For example, [0, 1, 4, 6] is a Golomb ...
18
votes
11answers
1k views

Output a program that outputs a program … that outputs PPCG

Challenge: Write a code that, when executed will output the source code of a second program that can be executed in another language. The second program should output the source code of a third ...
28
votes
1answer
404 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 ...
29
votes
9answers
2k 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 ...
55
votes
20answers
8k 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 ...
11
votes
1answer
250 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-...
38
votes
7answers
2k views

Sharing (characters) is Caring!

Overview 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 ...
28
votes
11answers
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 ...
71
votes
27answers
6k 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
264 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
606 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 ...
102
votes
32answers
11k 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 ...
23
votes
7answers
700 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, ...
1
vote
0answers
92 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? ...
19
votes
1answer
517 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 ...
20
votes
3answers
2k 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 ...
7
votes
2answers
190 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 ...
12
votes
9answers
757 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 ...
11
votes
4answers
413 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” ...
1
vote
0answers
192 views

The Almost-Eternity Code [closed]

Write a program that outputs as many characters as possible, with two conditions: The program must be 256 bytes or shorter The program must almost surely eventually halt. In other words, the only ...
8
votes
1answer
384 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 ...
40
votes
15answers
3k 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 ...
23
votes
2answers
574 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" ...
12
votes
4answers
648 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. ...
5
votes
0answers
141 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 ...
9
votes
2answers
431 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
237 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 ...
1
vote
0answers
191 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 ...
21
votes
3answers
1k 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 <...
12
votes
3answers
492 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 ...
28
votes
2answers
717 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-...