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
Generalized Sort

Challenge We all know and love the generic sort function, right? However, it only sorts based off one criterion - what if we want more? That's where you come in. Your task is to sort an array bas...

6 answers  ·  posted 2y ago by Moshi‭  ·  last activity 2y ago by radarek‭

71%
+3 −0
Towering Cistercian Representation

SE Sandbox Link, Codidact Sandbox Link Inspired by this video. Given a positive integer, draw its Cistercian representation as ascii art. The Challenge Cistercian numerals are a decimal-based...

1 answer  ·  posted 3y ago by Razetime‭  ·  edited 2y ago by General Sebast1an‭

71%
+3 −0
Convert integer to English

Given a non-negative integer up to $999\,999\,999$, write it in English. The input number can be in any form other than English (though you'll typically want to use the native integer type of your...

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

71%
+3 −0
My house is destroyed! Can you make me one?

Background A House of I I went on an adventure Grabbed resources and making deeds Like start to work on the materials To build the shelter I need It was a marvelous one At least in the eyes ...

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

71%
+3 −0
Multiply two strings

Given two strings, I define their product as follows: If any of the two strings is empty, the product is the empty string. If the second string consists of a single character, the result ...

6 answers  ·  posted 2y ago by celtschk‭  ·  last activity 2y ago by Hakerh400‭

71%
+3 −0
Three Number Monte

The Rules In this game, each round, every player faces off against every other player in a round robin format. In each match, players pick 3 positive integers that sum to 360. Let's say player 1 p...

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

71%
+3 −0
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...

3 answers  ·  posted 3y ago by Quintec‭  ·  last activity 3y ago by user‭

71%
+3 −0
Guess the language! (Robbers' Thread)

COPS THREAD A famous cops-and-robbers challenge whose source shall remain unnamed is brought to Codidact. You are a robber. Your goal is to find answers on this link which haven't been cracked an...

12 answers  ·  posted 2y ago by AndrewTheCodegolfer‭  ·  last activity 2y ago by m90‭

66%
+6 −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 ...

7 answers  ·  posted 3y ago by heav‭  ·  last activity 1y ago by __blackjack__‭

66%
+2 −0
Make my value binary

Challenge What do computers understand? That's right, binary. All files are turned into binary digits when you run them, but what if I suggest giving you an int then turn it into it's binary value...

14 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2y ago by Olin Lathrop‭

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

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

66%
+2 −0
Golf me a polygonal loader

CGCC Sandbox, Codidact Sandbox Given three positive integers as input, animate an ascii-art polygonal loading symbol on the screen. Intro Using the first input $n$, Take one the following regul...

1 answer  ·  posted 3y ago by Razetime‭  ·  edited 2y ago by General Sebast1an‭

66%
+2 −0
Define a mathematical expression in English

Background Inspired by this challenge that is also a mathematical English translator. Challenge Write a program that translates a mathematical expression using English with the following specifi...

1 answer  ·  posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

66%
+2 −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 ...

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

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

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

66%
+2 −0
Construct the Irish possessive

In this challenge you will take an Irish word and a personal pronoun and create the possessive pronoun construction combining the two. For example sé, madra becomes a mhadra. Translated to English...

1 answer  ·  posted 23d ago by WheatWizard‭  ·  last activity 7d ago by Arpad Horvath‭

66%
+2 −0
12-hour time is weird

Your mission for today, should you choose to accept it, is to write a simple 12-hour clock calculator. Your input will always be in the form of arg op arg, where op is either + or -, and arg is eit...

0 answers  ·  posted 2mo ago by honnza‭

66%
+2 −0
Can I follow this recipe?

You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient. So you can add pasta, oil, salt then pesto, but not pasta, pesto...

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

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

1 answer  ·  posted 6mo ago by WheatWizard‭  ·  last activity 6mo ago by Razetime‭

66%
+2 −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...

5 answers  ·  posted 7mo ago by trichoplax‭  ·  last activity 6mo ago by H_H‭

66%
+2 −0
Borromean coprimes

Given 3 positive integers, indicate whether they are Borromean coprimes. Definition 3 positive integers are called Borromean coprimes if both of the following are true: Their greatest common d...

2 answers  ·  posted 7mo ago by trichoplax‭  ·  last activity 5mo ago by NikNakk‭

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

1 answer  ·  posted 8mo ago by H_H‭  ·  last activity 5mo ago by Arpad Horvath‭

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

6 answers  ·  posted 8mo ago by H_H‭  ·  last activity 8mo ago by lovebuny‭

66%
+2 −0
Find near miss prime multiples.

Given a number $n \geq 3$ as input output the smallest number $k$ such that the modular residues of $k$ by the first $n$ primes is exactly $\{-1,0,1\}$. That is there is a prime in the first $n$ p...

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

66%
+2 −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...

0 answers  ·  posted 10mo ago by WheatWizard‭

66%
+2 −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...

0 answers  ·  posted 1y ago by trichoplax‭

66%
+2 −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 ...

1 answer  ·  posted 1y ago by trichoplax‭  ·  last activity 10mo ago by WheatWizard‭

66%
+2 −0
Mark my beacons

Given a grid of numbers, mark the concentric areas around nonzero elements (beacons) decreasing from the value of the beacon till 1. For example, here are some grids with a single beacon: Size 1:...

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

66%
+2 −0
Digit antitranspose

Convert a matrix or grid of digits to its antitranspose. For a square matrix , this is its reflection in its antidiagonal. More generally, for a rectangular matrix, this is its reflection in its sk...

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

66%
+2 −0
Determine if a polyomino is "prime"

An $n$-polyomino is a connected subset of the square tiling consisting of $n$ squares. We will not require that polyominos be simply connected, that is they can have holes. We will say a $n$-polyo...

1 answer  ·  posted 11mo ago by WheatWizard‭  ·  edited 10mo ago by WheatWizard‭

66%
+2 −0
Count polyomino bisections

An polyomino is a non-empty connected subset of the square tiling consisting of squares joined along their edges. We will not require that polyominos be simply connected, that is they can have hole...

0 answers  ·  posted 10mo ago by WheatWizard‭

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 withing $n$ character substitutions of $X$. Sp...

3 answers  ·  posted 10mo ago by WheatWizard‭  ·  last activity 10mo ago by WheatWizard‭

66%
+2 −0
Are these reduced forms of the same thing?

Task You are going to take three strings as input $A$, $B$ and $X$. And your goal is to determine if there exists a third string $S$ such that both $A$ and $B$ can be formed by iteratively removin...

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

62%
+3 −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...

1 answer  ·  posted 3mo ago by H_H‭  ·  last activity 2mo ago by isaacg‭

61%
+6 −3
Make $2 + 2 = 5$

In this challenge, add 2 integers, but if both the integers are 2, output 5. Shortest code in each language wins! Example ungolfed program in Python 3.x def add(x, y): if x == 2 and y == 2: ...

20 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 2mo ago by isaacg‭

60%
+1 −0
A chunk of symbols is a calculation

Challenge Create a program that takes input of a string and outputs an integer using the following calculation system: The string can only contain +, -, *, /, ^, ! (or a different character; ! ...

1 answer  ·  posted 2y ago by General Sebast1an‭  ·  edited 2y ago by General Sebast1an‭

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

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

60%
+1 −0
Stairs? Stairs! Stairs.

Challenge Make a program that takes input of an integer that's $n > 1$ and print out a staircase using a specific character for stair basing (hashes (#) for demonstration; you can use spaces,...

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

60%
+1 −0
Recreate the Server Fault logo

Make the Server Fault logo using the following criteria: The boxes' measurements: There are 3 columns of 5 boxes, with long ones at the left where the rest are regular. The following measure...

0 answers  ·  posted 3y ago by General Sebast1an‭

60%
+1 −0
I irradiate your source code, you irradiate your output

Your task is to write a program $p$ which outputs a string $s$ with the same length as $p$, where $s \neq p$. If I remove the $n$th byte from your program to get program $q$, then either $q$ outpu...

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

60%
+1 −0
Shortest representation in generalised Roman numerals

Find the shortest representation of an integer in generalised Roman numerals. Since there is more than one way to generalise, only the following definition applies to this challenge. Definition T...

1 answer  ·  posted 7mo ago by trichoplax‭  ·  last activity 5mo ago by NikNakk‭

60%
+1 −0
Word suggesting

Suggest a word from a word list, given a string. Motivation Imagine typing a word one letter at a time, and seeing a suggested word after each letter is typed. At first the suggested word is simp...

1 answer  ·  posted 8mo ago by trichoplax‭  ·  edited 1mo ago by trichoplax‭

60%
+1 −0
Reverse engineer the colors for a layout.

At my job we have to sometimes lay out materials. Materials come in large long rolls and are cut into smaller pieces when being laid out. When we order the rolls we draw up a layout document which...

0 answers  ·  posted 9mo ago by WheatWizard‭

60%
+1 −0
Round trip stones

$N$ vessels initially contain $3$ stones each. What is the probability of having at least $3$ stones in the first vessel after moving a uniformly random selection from the first vessel to the secon...

0 answers  ·  posted 13d ago by trichoplax‭

60%
+1 −0
Chequer checker

A chequer board (also spelt "checker board" in some places) is an 8 by 8 grid of squares alternating between 2 colours. Check whether a provided pattern could be a region of a chequer board. The c...

1 answer  ·  posted 1y ago by trichoplax‭  ·  edited 1y ago by trichoplax‭

60%
+1 −0
Balanced quinary quasiquine

Given an integer $N$ in balanced quinary, output the first $N$ characters of your source code if $N$ is positive, or the last $-N$ characters of your source code if $N$ is negative. Terminology ...

1 answer  ·  posted 1y ago by trichoplax‭  ·  edited 1y ago by trichoplax‭

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

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

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. Output The Nth number in the list of Fibonacci numbers whose base 10 ...

2 answers  ·  posted 2mo ago by trichoplax‭  ·  last activity 2mo ago by ok12d‭

55%
+3 −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...

16 answers  ·  posted 2y ago by General Sebast1an‭  ·  last activity 1y ago by south‭

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

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