Posts tagged code-golf
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...
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...
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]...
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...
You are a low-level censor working for the Ministry of Media Accuracy. Part of your job is to make sure that certain words don't appear in publications. Every morning you get a fresh stack of next...
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 ...
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...
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...
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...
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 ...
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...
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...
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...
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 ...