Image

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)
60%
+1 −0
Identifying returning paths.

Let's imagine a point in three dimensional space. We will start it located at $(0,0,0)$. Then we will receive a series of instructions. x, y, and z indicate moving unit distance in the positive $x$...

1 answer  ·  posted 12d ago by WheatWizard‭  ·  last activity 4d ago by jhnc‭

code-golf math decision-problem
85%
+10 −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...

12 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 5d ago by Ray‭

code-golf math number string
66%
+4 −1
Give the fool's fibonacci sequence

Recently I asked for tips on improving some code-golf of mine. The code was supposed to output every third value of the Fibonacci sequence starting with 2: 2,8,34,144,610,2584,10946,46368,196418,...

4 answers  ·  posted 2y ago by WheatWizard‭  ·  last activity 6d ago by Shaggy‭

code-golf sequence open-ended-function fibonacci
71%
+3 −0
Digits from words

Convert a number in words to digits. Input A number in words from one to ninety-nine. Output The corresponding number in digits from 1 to 99. This may be a string of digits or a number o...

5 answers  ·  posted 24d ago by trichoplax‭  ·  last activity 9d ago by jhnc‭

code-golf number string
50%
+0 −0
Number of sides on a polygon

Input The name of a polygon. You are only required to handle inputs listed in the test cases. Output The number of edges the polygon has. Test cases Test cases are in the format input...

1 answer  ·  posted 23d ago by trichoplax‭  ·  last activity 9d ago by jhnc‭

code-golf number string
57%
+2 −1
Fibonacci without consecutive digits

Output the Nth number in the list of Fibonacci numbers that have no consecutive digits. Input A non-negative integer (if you treat the Fibonacci numbers as zero-indexed) or a positive integer (...

4 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 10d ago by Shaggy‭

code-golf math number sequence fibonacci
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...

2 answers  ·  posted 2y ago by WheatWizard‭  ·  last activity 10d ago by Shaggy‭

code-golf decision-problem list
71%
+3 −0
Single digit Roman numeral

Given a single character, which is a valid Roman numeral, output its value. Values There are 7 valid single character Roman numerals, with the following values: Character Value I...

9 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 11d ago by Shaggy‭

code-golf
66%
+2 −0
Reverse the bits in a Byte

Simple challenge: Read a byte, swap bit 7 with 0, 6 with 1, 5 with 2 and 4 with 3 and then output the byte. For example the byte 0b1001'1100 would turn into 0b0011'1001. Rules: Shortest code wi...

7 answers  ·  posted 2y ago by H_H‭  ·  last activity 11d ago by Shaggy‭

code-golf
66%
+2 −0
Expected value of highest dice rolled

You roll $N$ six-sided dice simultaneously. Your score is the highest number rolled. If you play this game many times, what is the expected value (mean) of your score? Input A positive integer ...

3 answers  ·  posted 3y ago by trichoplax‭  ·  last activity 11d ago by Shaggy‭

code-golf math dice
81%
+7 −0
Golf golf challenge

The task is to create a program which displays a golf score as text. It takes 2 numbers as input, separated by space or new line: The first number is the par of the specific hole. The second nu...

6 answers  ·  posted 4y ago by Lundin‭  ·  last activity 11d ago by Shaggy‭

code-golf
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...

3 answers  ·  posted 4y ago by celtschk‭  ·  last activity 11d ago by Shaggy‭

code-golf encoding
66%
+2 −0
Reverse your quine

Challenge Write a program that prints its reversed self. For example, if your code is foo() Then it'll output: )(oof Make sure that the quine is a valid one, as defined here: No cheatin...

5 answers  ·  posted 4y ago by General Sebast1an‭  ·  last activity 12d ago by Shaggy‭

code-golf quine
75%
+4 −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...

5 answers  ·  posted 4y ago by General Sebast1an‭  ·  last activity 12d ago by Shaggy‭

code-golf string
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 ...

4 answers  ·  posted 4y ago by Razetime‭  ·  last activity 12d ago by Shaggy‭

code-golf number base
81%
+7 −0
Roll n fair dice

Challenge This is a simple randomness challenge: Given a non-negative integer $n$, and positive integer $m$, simulate rolling and summing the results of $n$ fair dice, each of which have $m$ sides...

11 answers  ·  posted 4y ago by Moshi‭  ·  last activity 12d ago by Shaggy‭

code-golf random
50%
+0 −0
5 by 5 knight's tour string validator

The squares of a 5 by 5 chessboard are labelled with the letters A to Y in English reading order: A B C D E F G H I J K L M N O P Q R S T U V W X Y Determine whether a string is a knight's ...

0 answers  ·  posted 12d ago by trichoplax‭

code-golf
71%
+3 −0
Single letter HTML

Indicate whether a letter is an HTML element. Input A single lowercase letter. Output An indication of whether the input is a standard HTML element. This could be one of 2 distinct value...

9 answers  ·  posted 2mo ago by trichoplax‭  ·  last activity 12d ago by WheatWizard‭

code-golf string html
62%
+3 −1
Really Cool Numbers

Define a cool number as a number whose proper divisors (all except for the number itself) have an integral mean. Define a really cool number as a number whose divisors (including itself) are all co...

4 answers  ·  posted 5y ago by Quintec‭  ·  last activity 13d ago by Shaggy‭

code-golf math
80%
+6 −0
Juggler sequences

A Juggler sequence is a sequence that begins with a positive integer $a_0$ and each subsequent term is calculated as: $$a_{k+1} = \begin{cases} \left \lfloor a_k ^ \frac 1 2 \right \rfloor, &...

9 answers  ·  posted 5y ago by caird coinheringaahing‭  ·  last activity 13d ago by Shaggy‭

code-golf math number sequence
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...

5 answers  ·  posted 5y ago by rak1507‭  ·  last activity 14d ago by Shaggy‭

code-golf sequence
81%
+7 −0
Is it a near-anagram?

Two words are anagrams of each other if the letters of one can be reordered to spell the other; e.g. ADOBE and ABODE are anagrams. An alternate way of describing it is that both words contain the s...

6 answers  ·  posted 5y ago by snail_‭  ·  last activity 14d ago by Shaggy‭

code-golf string
70%
+5 −1
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...

4 answers  ·  posted 3y ago by WheatWizard‭  ·  last activity 14d ago by Shaggy‭

code-golf list array
84%
+9 −0
Solve Goldbach's Conjecture

Goldbach's Conjecture states that every even whole number greater than 2 is the sum of 2 prime numbers. Your task is to return those 2 prime numbers, given an even whole number as input. There are ...

10 answers  ·  posted 5y ago by Quintec‭  ·  last activity 14d ago by Shaggy‭

code-golf math
66%
+2 −0
Output a Sturmian sequence

A Sturmian sequence is an infinite binary sequence satisfying two properties: It is balanced. This can be stated a number of equivalent ways: There is no pair of equal length subwords whose d...

0 answers  ·  posted 16d ago by WheatWizard‭  ·  edited 14d ago by WheatWizard‭

code-golf sequence open-ended-function
66%
+2 −0
Is it a valid hidden word?

The Universal Crossword has a set of guidelines for crossword puzzle submissions. In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consis...

2 answers  ·  posted 2y ago by WheatWizard‭  ·  last activity 17d ago by jhnc‭

code-golf string decision-problem
66%
+2 −0
Determine if a string is Sturmian

A finite binary string is "Sturmian" if for every two contiguous substrings $x$ and $y$ of the same length, the number of $0$s in $x$ and $y$ differs by at most 1. Your program should take a finit...

0 answers  ·  posted 18d ago by WheatWizard‭  ·  edited 18d ago by WheatWizard‭

code-golf math decision-problem binary
81%
+7 −0
Evens or Odds - you know this one

Get ready for a comparatively dry question - this is intended to be one of the "the"s of the code-golfing dictionary. Create a program which inputs a base 10 non-negative whole number (without lea...

18 answers  ·  posted 5y ago by AndrewTheCodegolfer‭  ·  last activity 23d ago by PlaceReporter99‭

code-golf math decision-problem
66%
+2 −0
Connected ​bits

Indicate whether the 1s and 0s in an 8 by 8 grid are connected. The grid Connectedness is by orthogonal adjacency (up, down, left, right). Diagonal adjacency does not count. If all of the 1s ...

2 answers  ·  posted 2mo ago by trichoplax‭  ·  last activity 27d ago by jhnc‭

code-golf binary
87%
+12 −0
Merge two strings

Challenge Given two strings a and b, return the shortest string s so that s starts with a and ends with b. (Inspired by https://chat.stackexchange.com/transcript/message/57816868#57816868 ) Exam...

10 answers  ·  posted 5y ago by rak1507‭  ·  last activity 29d ago by Shaggy‭

code-golf
81%
+7 −0
Lone ​​​​​​ones

Given an integer, output the number of lone 1s in its binary representation. Input An integer from $0$ to $4294967295$ (that is, $2^{32}-1$). In binary that's from 00000000000000000000000000000...

11 answers  ·  posted 2mo ago by trichoplax‭  ·  last activity 1mo ago by Shaggy‭

code-golf binary
87%
+12 −0
Print the Great Numeric Pyramid

Print or return this exact text: 0 0 0 0 1 0 0 1 1 0 0 1 2 1 0 ...

6 answers  ·  posted 5y ago by Sisyphus‭  ·  last activity 1mo ago by jhnc‭

code-golf kolmogorov-complexity
85%
+10 −0
Create an Alphabet Diamond

Challenge Output the following text: A ABA ABCBA ABCDCBA ABCDEDCBA ...

13 answers  ·  posted 5y ago by dzaima‭  ·  last activity 1mo ago by ojdo‭

code-golf kolmogorov-complexity
50%
+1 −1
Root to digits of π

How many digits of $\pi$ can you fit into a square root? Rules Your answer is a non-negative integer $N$. Highest score wins. Your score is the number of initial digits after the decimal poin...

1 answer  ·  posted 1mo ago by trichoplax‭  ·  last activity 1mo ago by emanresu A‭

math highest-score
83%
+8 −0
Truthify an array

Jelly has an atom called untruth, which when given indices, creates an array with 1s at those places: [2,4] → [0,1,0,1]. You are required to perform the inverse of this. Given a 2D boolean array, ...

11 answers  ·  posted 5y ago by Razetime‭  ·  last activity 1mo ago by jhnc‭

code-golf boolean array-manipulation
81%
+7 −0
Word Count Tool

In Google Docs, the word count tool looks like this: Pages would not make sense, but your goal is to implement every other count. Definitions Words are strings of text separated by any amount ...

10 answers  ·  posted 5y ago by Quintec‭  ·  last activity 1mo ago by jhnc‭

code-golf string
69%
+7 −2
Multiply complex numbers.

Multiply complex numbers. 2 space-seperated ones will be input, as follows: (update: you can replace i with j or some other symbol if needed) a+bi -a+bi a-bi -a-bi where a and b are integers ...

8 answers  ·  posted 5y ago by heav‭  ·  edited 1mo ago by trichoplax‭

code-golf math
80%
+6 −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...

5 answers  ·  posted 5y ago by user‭  ·  last activity 1mo ago by jhnc‭

code-golf array-manipulation random
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...

15 answers  ·  posted 5y ago by AndrewTheCodegolfer‭  ·  last activity 1mo ago by jhnc‭

code-golf code-generation
86%
+11 −0
Are All Elements Equal?

Challenge Given a list of integers >= 0 , check if all of them are equal. Tests [1,1,1,1,1] -> true [0,1,1,6,7] -> false [1] -> true [] -> undefined(you do n...

17 answers  ·  posted 4y ago by Razetime‭  ·  last activity 1mo ago by jhnc‭

code-golf decision-problem list array
85%
+10 −0
Coat of Many Colours

Challenge Given a list of unique colour names as input, sort them in the order that they first appear in Joseph's Amazing Technicolour Dreamcoat. Example Input: green, blue, red, brown Outpu...

8 answers  ·  posted 4y ago by Shaggy‭  ·  last activity 1mo ago by wizzwizz4‭

code-golf array-manipulation
60%
+1 −0
Getting perfect squares, differently

Create a program that gets all perfect squares starting from 0 or 1 without using any methods of multiplication (repetitive addition) and exponentiation (repetitive multiplication). Output them for...

8 answers  ·  posted 4y ago by General Sebast1an‭  ·  last activity 1mo ago by jhnc‭

code-golf math number restricted-source
71%
+3 −0
Connect the corners without 4 in a row

Connect opposite corners of a rectangle of characters without putting 4 characters in a row. Input Two numbers, W and H, representing the width and height of the rectangle Each number will be ...

2 answers  ·  posted 3y ago by trichoplax‭  ·  last activity 1mo ago by jhnc‭

code-golf
66%
+2 −0
Build a replacement ball in regex.

In this challenge you will take a number $n$ and a string $X$ of length $\geq n$, and produce a regular expression which matches all strings that are within $n$ character substitutions of $X$. Spe...

4 answers  ·  posted 3y ago by WheatWizard‭  ·  last activity 1mo ago by jhnc‭

code-golf string regex
77%
+5 −0
Cod golf: condense your shoal

Your answer is a string containing 255 fishes as subsequences, and your score is the length of that string in bytes (lowest score wins). Rules Your string must include at least 255 fishes from ...

3 answers  ·  posted 2mo ago by trichoplax‭  ·  last activity 1mo ago by Moshi‭

string lowest-score
50%
+0 −0
Circle of text characters

Given a radius R, output a text representation of a circle. Input A positive integer R (strictly greater than zero) You do not need to handle values of R greater than 32 Output A square ...

1 answer  ·  posted 3y ago by trichoplax‭  ·  last activity 1mo ago by jhnc‭

code-golf string
71%
+3 −0
Pinwheel ​words

Given a word that can be rotated by 180 degrees (a half turn) about at least one of its 3 axes and continue to be composed of English alphabet letters, output one of its rotated forms. The 3 rotat...

1 answer  ·  posted 3y ago by trichoplax‭  ·  last activity 2mo ago by jhnc‭

code-golf alphabet
60%
+1 −0
Most isolated of 3 points

Given 3 points, output one that is separated from its nearest neighbour by the largest distance. Input 3 distinct points (that is, no 2 points are in the same position). Each point is a pair o...

1 answer  ·  posted 2y ago by trichoplax‭  ·  last activity 2mo ago by jhnc‭

code-golf math number
60%
+1 −0
Digit balanced numbers

Does a number have balanced numbers of distinct digits? That is, do the number's digits appear with equal frequency? Input A positive integer N. N will have no leading zeroes. Output An ...

6 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 2mo ago by ojdo‭

code-golf number
66%
+2 −0
How many odd digits?

Given a positive integer, count its odd digits. Input An integer from 1 to 999,999,999, inclusive, in any of the following formats: A number (such as an integer or floating point number), li...

8 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 2mo ago by ojdo‭

code-golf number