Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Challenges

Code challenges of all types. For questions about golfing, bowling, etc, use Q&A. For questions about this community, use Meta. To get feedback on a challenge before posting it, use Sandbox.

Filters (None)
77%
+5 −0
Add two negabinary integers

About Negabinary Negabinary means base negative two (-2). That is, the $n$th place value is determined by $(-2)^n$. Negabinary numbers can be evaluated just like any other base system. For exampl...

3 answers  ·  posted 3y ago by Moshi‭  ·  last activity 3y ago by Shaggy‭

77%
+5 −0
A number adder, not a death adder

Create a program P1 which takes as input a base 10 number N1 (the numbers for the variables are important). Given N1, P1 will print a program P2. P2 will take as input a base 10 number N2 and outpu...

14 answers  ·  posted 3y ago by AndrewTheCodegolfer‭  ·  last activity 2y ago by torres‭

77%
+5 −0
Gamer Meme Creator

Challenge You will be given a string and an ascii art as input. The string must be placed above the ascii art, and centered based on its longest line. The text BOTTOM TEXT must be placed below...

4 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by user‭

77%
+5 −0
Decode periodic decimal fractions

Rational numbers in decimal representation can have an infinite periodic part. One common way to write this down is to repeat the periodic digits and then add three dots. Numbers without those thre...

2 answers  ·  posted 2y ago by celtschk‭  ·  edited 2y ago by General Sebast1an‭

77%
+5 −0
Shuffle a subset of a list

Idea shamelessly stolen from caird and rak1507 Shuffle a subset of a list of unique, positive integers with uniform randomness, given the indices of that subset. For example, given the list $[A, B...

4 answers  ·  posted 3y ago by user‭  ·  edited 2y ago by General Sebast1an‭

77%
+5 −0
Are they abundant, deficient or perfect?

Abundant numbers are numbers which are less than their proper divisor sum. For example $18$ is abundant as $1 + 2 + 3 + 6 + 9 = 21 > 18$ Deficient numbers are numbers which are greater than the...

8 answers  ·  posted 3y ago by caird coinheringaahing‭  ·  last activity 2y ago by General Sebast1an‭

77%
+5 −0
Create a Sudoku

Write the shortest program that takes no input and outputs a Sudoku solution. For reference, a Sudoku solution is a 9x9 grid of digits where each column, each row and each of the nine 3x3 grids th...

4 answers  ·  posted 3y ago by AndrewTheCodegolfer‭  ·  last activity 3y ago by Shaggy‭

77%
+5 −0
Recreate the Stack Overflow logo

Originally from Somewhere Else. I thought I'd continue making more drawing challenges here now that I discovered it. Make the Stack Overflow logo using the following criteria: The tray: ...

2 answers  ·  posted 3y ago by General Sebast1an‭  ·  last activity 2y ago by Anonymous‭

77%
+5 −0
Diagonalized alphabet

Task Print the following: ABDFHJLNPRTVXZ CABDFHJLNPRTVX ECABDFHJLNPRTV GECABDFHJLNPRT IGECABDFHJLNPR KIGECABDFHJLNP MKIGECABDFHJLN OMKIGECABDFHJL QOMKIGECABDFHJ SQOMKIGECABDFH USQOMKIGE...

7 answers  ·  posted 3y ago by Razetime‭  ·  last activity 2y ago by radarek‭

77%
+5 −0
Given the preorder and the inorder of a tree, output the postorder

Definitions A binary tree is either a null (leaf), or an object (node). A node contains a value (non-negative integer) and two pointers (left and right) to two separate binary trees. A binary tre...

2 answers  ·  posted 3y ago by Hakerh400‭  ·  last activity 2y ago by radarek‭

77%
+5 −0
Prime Difference

Given an integer n, output the smallest prime such that the difference between it and the next prime is at least n. For example, if n=5, you would output 23, since the next prime is 29, and 29-23&...

8 answers  ·  posted 3y ago by Quintec‭  ·  last activity 2y ago by radarek‭

77%
+5 −0
Ratio limits of fibonacci-like series

Definition $F_{n}\left(0\right)=0$ $F_{n}\left(1\right)=1$ $F_{n}\left(x\right)=n\cdot F_{n}\left(x-1\right)+F_{n}\left(x-2\right)$ For example: $F_{1}=\left[0,1,1,2,3,5,8,13,21,34,55,89...\ri...

3 answers  ·  posted 3y ago by rak1507‭  ·  edited 2y ago by General Sebast1an‭

77%
+5 −0
Longest parallel lines

Note: This challenge was underspecified and bad, and as such I would not encourage answering it in the future. Challenge You will be given a single 2D boolean array $M$. You may take its dimensi...

1 answer  ·  posted 3y ago by rak1507‭  ·  edited 3y ago by rak1507‭

77%
+5 −0
Create a range grid

This challenge is based on the i. verb from J. A range grid is basically a range of m × n numbers fit into a rectangular grid with m rows and n columns. A 2×3 range grid would be: 0 1 2 3 4 5 ...

8 answers  ·  posted 2y ago by Razetime‭  ·  last activity 1y ago by Shaggy‭

75%
+4 −0
Knight safe squares

Given a chess board with some knights on it, say how many squares are neither attacked by a knight nor containing a knight. Input An 8 by 8 grid where each square is either a knight or empty T...

3 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 8mo ago by Karl Knechtel‭

75%
+4 −0
Implement Rule 110

[Rule 110] is a Turing complete cellular automaton. It is defined as follows: Take as initial value a sequence of symbols that's infinite to both sides, which consists only of two different symbol...

1 answer  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Moshi‭

75%
+4 −0
55 fruit salad: choose your own Kolmogorov complexity

This is a fixed output challenge. It is similar to a standard Kolmogorov complexity challenge, except you get to choose your own fixed output. Given no input, output 55 fruits. You may choose any 5...

5 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 7mo ago by trichoplax‭

75%
+4 −0
Just the vowels please

Given a sequence of letters, output only the vowels. Input A sequence of letters This may be a string or any ordered data structure of characters (provided it is consistent between inputs) Th...

9 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by taoh‭

75%
+4 −0
Encode with ROT13.5

Given a string, convert all of its letters using ROT13, and all of its digits using ROT5. This is sometimes referred to as ROT13.5. Input A sequence of printable ASCII characters (character cod...

4 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by Razetime‭

75%
+4 −0
Decoding a non injective bit matrix encoding

The problem Someone has created an encoding format for square bit matrices, however they have found it isn't perfect! One encoding may not decode to exactly one matrix, or it may not even be possi...

0 answers  ·  posted 1y ago by Aftermost2167‭  ·  edited 1y ago by Aftermost2167‭

75%
+4 −0
Calculate the Z-array

Task Given a list of numbers $X$ produce a second list of numbers $Y$ such that $Y_i$ is the length of the longest common prefix of $X$ and $X$ with the first $i$ elements removed. For example if...

1 answer  ·  posted 10mo ago by WheatWizard‭  ·  last activity 10mo ago by TheCodidacter, or rather ACodidacter‭

75%
+4 −0
Find the IP address class

Task Given an IP address as a string, find its IP address class. For reference, here is a table: Class Leadingbits Numberof networks Addressesper network Total addressesin class Start...

6 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by torres‭

75%
+4 −0
The Pell Numbers

Introduction The Pell(no, not Bell) Numbers are a simple, Fibonacci-like sequence, defined by the following relation: $P_n=\begin{cases}0&\mbox{if }n=0;\\1&\mbox{if }n=1;\\2P_{n-1}+P_{n-2...

9 answers  ·  posted 3y ago by Razetime‭  ·  last activity 2y ago by torres‭

75%
+4 −0
Generate Lewis Caroll's Jabberwocky

The task is to generate the text of Lewis Caroll's Jabberwocky. The text, quoted from Wikipedia, is as follows (I've replaced a non-ASCII character with ASCII, otherwise it's direct copy&paste...

4 answers  ·  posted 3y ago by celtschk‭  ·  last activity 2y ago by General Sebast1an‭

75%
+4 −0
When The Ternary Is Balance

Inspired by this Rosetta Code article. Introduction Balanced Ternary is a method of representing integers using -1, 0 and 1 in base 3. Decimal 11 = (1 * 32) + (1 * 31) + (−1 * 30) = [1,1,-1] or ...

3 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by Moshi‭

75%
+4 −0
Calculate a person's age

Challenge Given a date with day, month and year, calculate how old a person born on that day would be today. Input can be in any reasonable format(params, array, date object). Input will never b...

0 answers  ·  posted 3y ago by Razetime‭

75%
+4 −0
Win a War (or at least a few battles)

You have an army of size $n$ that you need to split up to fight $k$ battles simultaneously against an opposing army $A$. In each battle, the army with the most troops present wins - no one wins a t...

2 answers  ·  posted 3y ago by Quintec‭  ·  edited 2y ago by General Sebast1an‭

75%
+4 −0
Tile pyramids on top of each other!

The task Given a positive integer as input, output tiled pyramids of this height. How? Let's say the inputted integer was n. From there, we output n lines of output, each having: A decreasing...

9 answers  ·  posted 3y ago by Dion‭  ·  last activity 2y ago by A username‭

75%
+4 −0
The Ludic Numbers

The Ludic Numbers are a sequence that pops up when you apply the sieve of eratosthenes to the natural numbers, completely removing the numbers every iteration. Here is how they are generated: The...

3 answers  ·  posted 2y ago by Razetime‭  ·  last activity 2y ago by General Sebast1an‭

75%
+4 −0
Caesar shift cipher

Introduction What is the Caesar shift cipher (ROT$n$)? It's basically a cipher sequence that changes a letter's value from the number chosen. If we use ROT1 on "games", we get "hbnft". The basic i...

7 answers  ·  posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

75%
+4 −0
Probability of rolling all 6 dice faces

The probability of rolling every number from 1 to 6 with $N$ six-sided dice. Input A positive integer $N$. Your code must work for inputs up to and including 10, but may crash, error, or give ...

4 answers  ·  posted 10mo ago by trichoplax‭  ·  last activity 10mo ago by RubenVerg‭

75%
+4 −0
Is it stuck in a counting loop?

Given a list of non-negative integers the function $f$ replaces every integer with the number of identical integers preceding it (not necessarily contiguously). So f [1,1,2,2,1,3,3] = [1,2,1,2,3,1...

1 answer  ·  posted 4mo ago by WheatWizard‭  ·  last activity 2mo ago by isaacg‭

71%
+3 −0
The 50 substrings that validate any string of Roman numerals

Given a string of Roman numerals, decide whether it forms a valid Roman number. If not, output the substring that proves this, from the list of 50 strings described below. Relevant fact This chal...

3 answers  ·  posted 2mo ago by trichoplax‭  ·  last activity 3d ago by Arpad Horvath‭

71%
+3 −0
Plain black webpage

This is a language specific challenge, for HTML only. Your answer is the content of a self contained HTML file, that when opened in a web browser gives a plain black page. Requirements The HTM...

4 answers  ·  posted 3mo ago by trichoplax‭  ·  last activity 3mo ago by Razetime‭

71%
+3 −0
How many umbrellas to cover the beach?

You work at a beach. In the afternoon, the sun gets quite hot and beachgoers want to be shaded. So you put out umbrellas. When you put out umbrellas you want to shade the entire beach, with as few ...

2 answers  ·  posted 6mo ago by WheatWizard‭  ·  last activity 5mo ago by justhalf‭

71%
+3 −0
Find good coalitions

As you might know, there were elections in Germany, and now the parties have to form a government coalition. Let's help them with it! A good coalition has the strict majority of seats (that is, mo...

2 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Moshi‭

71%
+3 −0
Sort letters by height

Given a sequence of lower case letters, sort them into order of height. Heights The heights of letters are dependent on font, so for this challenge the height order to be used is as defined below...

5 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 9mo ago by Taeir‭

71%
+3 −0
Lowercase, but not just the letters

Given a string of printable ASCII characters, convert them all to lowercase, except not just the letters. ASCII characters that are letters have a bit in their binary representation that is 0 for ...

7 answers  ·  posted 1y ago by trichoplax‭  ·  edited 9mo ago by trichoplax‭

71%
+3 −0
Mediocre pop count

Given a sequence of letters, omit those with the highest or lowest pop count. Terminology The pop count or population count of a binary string is the number of 1s in it. For this challenge, the ...

6 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by A username‭

71%
+3 −0
Label a hinged tetromino

Given a hinged tetromino, give it a unique, consistent label independent of location, rotation, and reflection. Tetrominoes A tetromino is a connected subset of the square tiling, composed of 4 s...

2 answers  ·  posted 10mo ago by trichoplax‭  ·  last activity 9mo ago by RubenVerg‭

71%
+3 −0
8 coexisting queens

This is a fixed output challenge. Output a textual representation of a chessboard hosting 8 queens, none of which are attacking each other. There are 92 ways of arranging them, 12 if rotations and...

5 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by m90‭

71%
+3 −0
Encode and decode floating point integers

Imagine you have only one byte (8 bits) to store a value, but need to store values from $0$ to $4032$. Impossible, until you are also told that an error of 1/64 of the exact value does not matter. ...

2 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by General Sebast1an‭

71%
+3 −0
Run-length encode a byte sequence

Run-length encoding is a simple compression technique which compresses sequences of repeating identical bytes. The encoding rules for this task are as follows: Any sequence of $n$ identical bytes...

2 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Moshi‭

71%
+3 −0
From the smallest seed

Challenge It's a bootstrapping challenge this time! Write a full program that, once run, writes the source code of another program that in turn, once run, writes the source code for another progra...

2 answers  ·  posted 2y ago by Moshi‭  ·  last activity 2y ago by orthoplex‭

71%
+3 −0
Make a frequency table (histogram)

Challenge Given an array in any suitable format, create a frequency table for it. i.e: Pair each unique element with the number of times it appears in the array. You can return the frequency tabl...

10 answers  ·  posted 2y ago by Razetime‭  ·  last activity 1y ago by Moshi‭

71%
+3 −0
Presumptuous base conversion

Take an input string representing a number and convert it to decimal (base 10). However, the base of the input is not specified. Assume the input is in the smallest base for which its digits are va...

5 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by Shaggy‭

71%
+3 −0
The holeyest base

Given a positive integer as input, indicate which base from 2 to 16 gives the most holes in the representation of the input in that base. The digits used are 0123456789ABCDEF. Note that these incl...

6 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 1y ago by Razetime‭

71%
+3 −0
The Camelot Wheel

Given a musical key, output its number and letter on the Camelot Wheel (shown below). Input A musical key as a string, as shown on the wheel. The words "Sharp" and "Flat" may be replaced with s...

2 answers  ·  posted 3y ago by Quintec‭  ·  edited 2y ago by General Sebast1an‭

71%
+3 −0
Abbreviate everything

Challenge Make a program that takes input of a string and abbreviate it. All letters of an abbreviation are capitalized, so keep that in mind. Whitespace, numbers and non-English characters ar...

3 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Hakerh400‭

71%
+3 −0
Longest Increasing Subsequence

Given an array of numbers, output the length of the longest increasing (not necessarily contiguous) subsequence. It is guaranteed that there are no duplicates in the array. For example, if the inpu...

4 answers  ·  posted 3y ago by Quintec‭  ·  edited 2y ago by General Sebast1an‭