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

8 answers  ·  posted 18d ago by trichoplax‭  ·  last activity 3h ago by jhnc‭

code-golf string html
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 22h 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 1mo ago by trichoplax‭  ·  last activity 3d 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 4d 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 5d ago by ojdo‭

code-golf kolmogorov-complexity
60%
+1 −0
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 13d ago by trichoplax‭  ·  last activity 6d 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 7d 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 8d 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 8d ago by trichoplax‭

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

17 answers  ·  posted 5y ago by AndrewTheCodegolfer‭  ·  last activity 8d ago by jhnc‭

code-golf math decision-problem
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 4y ago by user‭  ·  last activity 8d 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 4y ago by AndrewTheCodegolfer‭  ·  last activity 8d 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 8d 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 9d 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 9d ago by jhnc‭

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

4 answers  ·  posted 4y ago by General Sebast1an‭  ·  last activity 9d ago by jhnc‭

code-golf string
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 10d 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 12d 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 18d ago by trichoplax‭  ·  last activity 15d 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 15d ago by jhnc‭

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

8 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 18d ago by jhnc‭

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

11 answers  ·  posted 2y ago by trichoplax‭  ·  last activity 19d ago by jhnc‭

code-golf math number 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 19d 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 1y ago by trichoplax‭  ·  last activity 20d 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 12mo ago by trichoplax‭  ·  last activity 20d 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 20d ago by ojdo‭

code-golf number
88%
+13 −0
Cumulative Counts

Challenge Given an array of numbers return the cumulative count of each item. This is the number of times an item has occurred so far. Examples [1,1,2,2,2,1,1,1,3,3] -> [1,2,1,2,3,3,4,5,1,2]...

23 answers  ·  posted 5y ago by rak1507‭  ·  last activity 21d ago by jhnc‭

code-golf
71%
+3 −0
Expand a greyscale/colour hex code

Consider a type of hexadecimal colour code that supports shorthand for both greyscale and colour: A 6 digit code is interpreted as 2 digits for red, followed by 2 for green, then 2 for blue. A ...

6 answers  ·  posted 1y ago by trichoplax‭  ·  last activity 21d ago by ojdo‭

code-golf string
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 25d ago by trichoplax‭  ·  last activity 23d ago by jhnc‭

code-golf binary
25%
+0 −4
[Challenge] Audit my Binary-Search SAT Solver — Find a counterexample or prove it correct

Background I've been experimenting with a novel approach to SAT solving: treat variable assignments as integers and binary-search over the solution space. I call it Binary-SAT Collapse. The key i...

0 answers  ·  posted 1mo ago by KaoruAK‭

Codegolf P=NP
62%
+3 −1
Convert to Hexadecimal

Challenge Write a program that takes in a number greater than or equal to 0 and outputs its representation in hexadecimal (base 16). Examples 0 => 0 1 => 1 10 => A 15 ...

7 answers  ·  posted 12mo ago by CrSb0001‭  ·  last activity 2mo ago by Glory2Ukraine‭

code-golf math base hexadecimal
57%
+2 −1
Fast sampling of special binary strings

We are going to define a simple little language. A word in this language is a binary string where the longest run of consecutive $0$s, is shorter than every run of $1$s which is not contained withi...

0 answers  ·  posted 4mo ago by WheatWizard‭  ·  edited 4mo ago by WheatWizard‭

code-golf random restricted-complexity
33%
+0 −2
Partition Algorithm Trap

Challenge Find a valid input (multiset of positive integers) for this deterministic $O(n^2)$ Partition algorithm such that: The algorithm fails to find a solution even though one exists, or The...

0 answers  ·  posted 6mo ago by KaoruAK‭  ·  edited 4mo ago by WheatWizard‭

code-challenge
66%
+2 −0
Is it part of the mandelbrot set?

Input is a number, you have to decide if it is part of the mandelbrot set or not, after at least 16 iterations. This is done by applying this formula: $z_n = z_{n-1}^2 + c$ repeatedly. $c$ is the ...

2 answers  ·  posted 2y ago by H_H‭  ·  last activity 7mo ago by Arpad Horvath‭

code-golf
84%
+9 −0
Bytes to Segfault

Challenge Cause the currently running program to receive the SIGSEGV signal (on Linux or other *nix systems) as fast as possible. What it does with the signal doesn't matter as long as it receives...

12 answers  ·  posted 5y ago by moony‭  ·  last activity 9mo ago by mvirts‭

code-golf *nix
66%
+2 −0
Net​​ or​​ not?

Given a hexomino, indicate whether it is a net of a cube. Input A 6 by 6 grid containing exactly 6 filled squares. The 6 filled squares will be in a single edge connected set (a hexomino). Th...

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

code-golf math decision-problem
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...

4 answers  ·  posted 5y ago by rak1507‭  ·  last activity 10mo ago by CrSb0001‭

code-golf sequence
66%
+4 −1
Print the modular multiplicative inverse / virtual fractions

Goal Print the modular multiplicative inverse with a modulus of 65536 (or a higher exponent of 2) for odd numbers 1-97. Example output Print these values (or an extension of them): 1 43691 52...

3 answers  ·  posted 2y ago by H_H‭  ·  edited 10mo ago by deleted user

code-golf math
83%
+8 −0
Integer to Roman numeral

The task is to take a decimal integer as input and print the corresponding Roman numeral with capital letters. The program must handle all positive integer numbers between 1 and 1000. Input can be...

5 answers  ·  posted 5y ago by Lundin‭  ·  last activity 10mo ago by CrSb0001‭

code-golf
93%
+25 −0
"Hello, World!"

Introduction The classic "Hello, World" challenge. What more can I say? Rules Program takes no input. Program outputs Hello, World! with an optional trailing newline. No other output is accep...

64 answers  ·  posted 5y ago by anna328p‭  ·  last activity 10mo ago by lyxal‭

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

0 answers  ·  posted 5y ago by Razetime‭  ·  edited 11mo ago by deleted user

code-golf date
57%
+2 −1
Show order equivalence between the rationals and the binary fractions

Write a function $f$ which takes rational numbers and gives binary fractions (rational numbers whose denominator is a power of two) which is bijective and preserves order. That means: Different...

0 answers  ·  posted 11mo ago by WheatWizard‭  ·  edited 11mo ago by WheatWizard‭

code-golf math open-ended-function
83%
+8 −0
Compute the determinant

Challenge A simple challenge: Given a two-dimensional matrix (an array of arrays) of real numbers, compute the determinant. The determinant of a matrix is a mathematical construct used in many ap...

10 answers  ·  posted 4y ago by Moshi‭  ·  last activity 11mo ago by CrSb0001‭

code-golf math
50%
+0 −0
Awkward Ordinals

Write code that takes a positive integer and outputs the awkward ordinal name from the test cases. Notice that these are not the conventional ordinal names. Input A positive integer from the te...

0 answers  ·  posted 12mo ago by trichoplax‭  ·  edited 11mo ago by trichoplax‭

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

9 answers  ·  posted 4y ago by General Sebast1an‭  ·  last activity 11mo ago by CrSb0001‭

code-golf string sequence encryption decryption
57%
+2 −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,...

2 answers  ·  posted 2y ago by WheatWizard‭  ·  last activity 12mo ago by CrSb0001‭

code-golf sequence open-ended-function fibonacci
71%
+3 −0
Prove commutativity on this monoid presentation.

Given two binary strings $A$ and $B$ such that $A$ is an anagram of $B$, output a third binary string $S$ such that both $A$ and $B$ can be created by iterated removals of the substring $10101$ fro...

2 answers  ·  posted 3y ago by WheatWizard‭  ·  last activity 12mo ago by m90‭

code-golf abstract-algebra
60%
+4 −2
"Hello, {name}!"

Background While we do have a "Hello, World!" challenge, we still don't have one regarding input. So let's do one! Challenge Create a program that takes an input (not as a function argument) the...

17 answers  ·  posted 4y ago by General Sebast1an‭  ·  last activity 12mo ago by CrSb0001‭

code-golf string
75%
+4 −0
Expand a polynomial

Challenge Given the roots of a polynomial (that is, the $x$ values where the polynomial evaluates to zero), as an array of real numbers, return the polynomial's coefficients. That is, given real ...

5 answers  ·  posted 4y ago by Moshi‭  ·  last activity 1y ago by panadestein‭

code-golf math
60%
+1 −0
Find all unique quintuplets in an array that sum to a given target

Inspiration: Leetcode's [3Sum] linkLink on CG&CC Problem Given an array nums of n (not necessarily distinct) integers, and given a target number target, return an array of all of the unique...

2 answers  ·  posted 1y ago by CrSb0001‭  ·  last activity 1y ago by panadestein‭

code-golf array arithmetic