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

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

11
votes
5answers
885 views

Blind Random Sort

Here's a pretty common pattern for sorting algorithms: ...
-2
votes
3answers
223 views

Send the pairs in smallest output

Write two programs A and B: Program A takes 1024 pairs of integers \$(a,b)\$, where \$0≤a<2^{32}\$ and \$0≤b<1024\$, and all \$a\$ will be different. It will output a single positive integer. ...
1
vote
1answer
165 views

Describe a 2D Bitmap Using Filled Rectangle Mapping

Idea: Consider a 2-bit bitmap of arbitrary side-lengths overlaid on a coordinate grid and imaged with random data (1's represent an element of the image, 0's represent the "blank" canvas background):...
-3
votes
0answers
70 views

Miranda challenge [closed]

How would that short function be converted into Miranda code: ...
0
votes
0answers
129 views

Meeting splitter

Introduction Large meetings waste working time. Our aim is to split a large meeting into a number of smaller meetings, so the average number topics that a person discusses is minimized but every ...
12
votes
21answers
2k views

Longest Increasing Substring

Given a list of positive integers, write code that finds the length of longest contiguous sub-list that is increasing (not strictly). That is the longest sublist such that each element is greater ...
14
votes
2answers
417 views

Rubik-sorting a matrix (a.k.a. the torus puzzle)

The idea for this code-challenge is simple: given a matrix of integers, let's sort it by applying Rubik-style movements. This means that you can select a single row or column and rotate its elements ...
23
votes
23answers
3k views

Encode - Shuffle - Decode

Challenge Your task is to encode an integer as a string of ASCII characters, then successfully decode it after said string has been randomly shuffled. You will write two programs/functions, which ...
8
votes
3answers
378 views

Counting Squares

We've all seen the pictures captioned "How many squares are in this image? 98% will not get this right!" Well, here's your chance to laugh at that 98%. Input A rectangular block made of only 2 ...
11
votes
2answers
256 views

Removing points from a triangular array without losing triangles

I have a combinatorics problem that I'd like to put on the OEIS—the problem is that I don't have enough terms. This code challenge is to help me compute more terms, and the winner will be the user ...
91
votes
11answers
11k views

Build a Markdown bomb [closed]

I'm sure most of us have heard of zip bombs and similar decompression bomb tricks, where a maliciously crafted input creates a massively disproportionate output. We even had a question on here to do ...
8
votes
4answers
284 views

Get the lowest possible pylint score within 128 bytes of python

pylint has no lower bound on the scores it will give your code. It uses the following metric to score code, with the maximum score being 10: ...
11
votes
9answers
1k views

Everyone Ought to Have a Friend

An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not ...
5
votes
0answers
256 views

What is the simplest reversible circuit that computes conjugacy of transpositions?

Reversible computation refers to computation in which little or no information is deleted. Reversible computation a major component of quantum computation, and reversible computation is potentially ...
16
votes
1answer
360 views

Traceless Busy Beaver

All those busy beavers made quite a mess. They wrote all over the tape. At this rate, our neighbour will stop lending us unbounded tapes. We need a new way to play the busy beaver game, one that ...
0
votes
0answers
89 views

C# puzzle - execute impossible code [duplicate]

This is a small challenge which was given in my workplace, ...
196
votes
99answers
29k views

Without using numbers, get the highest salary you can. But don't exaggerate!

As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "...
6
votes
6answers
848 views

Lucas and Fibonacci are in pair

Influenced by Non-discriminating Programming, I made up an idea of a similar challenge. Here, we say a string is a Lucas string if the number of appearances of each character is a Lucas number (2, 1, ...
10
votes
5answers
843 views

The Onion, or Not The Onion?

The Onion (warning: many articles are NSFW) is a satirical news organization that parodies traditional news media. In 2014, The Onion launched ClickHole (warning: also frequently NSFW), a satirical ...
6
votes
0answers
271 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 ...
26
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 ...
2
votes
1answer
197 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
370 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
707 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
311 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
543 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
368 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
184 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
415 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
528 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
561 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
412 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
788 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
332 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
558 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
750 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
280 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 ...