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)
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...
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...
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...
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 ...
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 ...
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...
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...
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...
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 ...
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...
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...
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...
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...
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 ...
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 ...
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...
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...
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...
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...
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...
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...
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 ...
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...
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...
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...
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...
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 ...
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:...
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...
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...
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...
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...
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...
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...
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: ...
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; ! ...
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...
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,...
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...
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...
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...
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...
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...
$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...
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...
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 ...
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,...
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...
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 ...
- ← Previous
- 1
- 2
- 3
- 4
- Next →