text
stringlengths
180
608k
[Question] [ Colonies of bacteria labelled `1` through `9` live on a segment of equally-spaced cells, with empty cells indicated by `0` ``` 0 0 2 0 0 0 1 2 0 0 3 3 0 0 ``` Every second, each colony spreads to adjacent empty cells. If two colonies reach an empty cell at the same time, the larger-labeled colony takes...
[Question] [ Given an N-dimensional orthogonal (non-ragged) array of non-negative integers, and an indication of which dimensions to reverse, return the array but reversed along those dimensions. The indication may be given as a Boolean list of length N or a list of a subset of the first N dimensions indexed from 0...
[Question] [ ### Definition The Alternating Power Fibonacci Sequence is formed as follows. 1. Start with the empty sequence and set **n** to **1**. 2. Compute **f**n, the **n**th non-negative [Fibonacci number](https://en.wikipedia.org/wiki/Fibonacci_number), with repetitions. **0** is the first, **1** is the sec...
[Question] [ Your task is to, given an unsigned integer `n`, find the largest number which can be created by removing a single byte (8 consecutive bits) of data. --- ## Example Given the number `7831`, we first convert it to binary (removing any leading zeroes): ``` 1111010010111 ``` We then find the consecutive gr...
[Question] [ The Recursively Prime Primes is are sequence of primes such that ``` p(1) = 2 p(n) = the p(n-1)th prime ``` Here is an example of how one might calculate the 4th Recursively Prime Prime. ``` p(4) = the p(3)th prime p(3) = the p(2)th prime p(2) = the p(1)th prime p(1) = 2 p(2) = the 2nd prime p(2) = 3 p...
[Question] [ Your challenge is to, given a matrix of nonnegative integers, remove all rows and columns that contain a 0. For example, with this matrix: ``` [[5, 3, **2**, 4, **1**], [**3**, **2**, **0**, **4**, **7**], [7, 1, **9**, 8, **2**], [3, 2, **1**, 5, **7**], [6, 4, **6**, 1, **2**], [**9**, **3**, **...
[Question] [ [Gimbap](https://en.wikipedia.org/wiki/Gimbap)(김밥) is Korean food, somewhat looks like sushi roll. Here is Korean emoticon represent Gimbap : `@))))))))))` Your quest is make ASCII Gimbap cutter. # Rule Input is string made with only `@` and `)`. Output *cuts* every valid Gimbap with `)`, and then add ...
[Question] [ # The challenge The [plastic number](https://en.wikipedia.org/wiki/Plastic_number) is a number related to the golden ratio, with many interesting mathematical properties. As such, there are many approaches that can be used to calculate the number. In order to precisely specify the number for the purpos...
[Question] [ Given \$A = (a\_1,\dots,a\_k)\ k\ge2 \$ a sequence of positive integers, in which all elements are different. Starting from \$i=2\$, while \$a\_i\in A:\$ *(until the last element)* * If \$d=|a\_i-a\_{i-1}|\$ is not already in \$A\$, append \$d\$ to \$A\$ * Increase \$i\$ **Output** the completed sequen...
[Question] [ First, let's talk about [Beatty sequences](https://en.wikipedia.org/wiki/Beatty_sequence). Given a positive irrational number ***r***, we can construct an infinite sequence by multiplying the positive integers to ***r*** in order and taking the floor of each resulting calculation. For example, [![Bea...
[Question] [ # Problem Starting from `n=2` dice: * Roll `n` dice, with each number 1 to 6 equally likely on each die. * Check if their sum equals the most probable sum for `n` dice, that is `3.5*n`. + If they're equal, terminate. + Otherwise, print `n`, and repeat from the start with `n+2` dice Your code doesn't ...
[Question] [ Given \$ i = \sqrt{-1} \$, a base-\$ (i - 1) \$ binary number \$ N \$ with \$ n \$ binary digits from \$ d\_{0} \$ to \$ d\_{n - 1} \$ satisfies the following equation. $$ N = d\_{n - 1} (i - 1) ^ {n - 1} + d\_{n - 2} (i - 1) ^ {n - 2} + \cdots + d\_{1} (i - 1) + d\_{0} $$ For example, a decimal number...
[Question] [ ## Input A string of printable ASCII characters, for example: ``` This is an example string. ``` ## Output For every consonant (`BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz`) that is not followed by a vowel (`AEIOUaeiou`) add the last vowel before it, in lowercase. **Consonants before the first vowel ...
[Question] [ You are to write a very small program within 100 characters. Your program must distinguish between masculine and feminine french nouns. The output should be `un` if it is masculine and `une` if it is feminine. Often, there are certain statistical rules you can follow (e.g. if it ends in an "e" it is mo...
[Question] [ *Inspired by a [question](https://stackoverflow.com/q/69682156/2586922) (now closed) at Stack Overflow.* Given a square matrix, let its *double trace* be defined as the sum of the entries from its main diagonal and its anti-diagonal. These are marked with `X` in the following examples: ``` X · · X · X ...
[Question] [ *Disclaimer: This is heavily inspired by ["Polyglot the OEIS!"](https://codegolf.stackexchange.com/questions/137846/polyglot-the-oeis) but fixes the problem that lead to closure (see the output section) and was re-posted as to not invalidate answers.* ## Introduction We all know and love the *on-line e...
[Question] [ Inspired by [this example](http://bl.ocks.org/mbostock/3231298) of using [d3js](http://d3js.org/), I challenge you to create a canvas (or your language-of-choice equivalent) in which the [mouse pointer trails](http://en.wikipedia.org/wiki/Pointer_(graphical_user_interfaces)#Pointer_trails_and_animation...
[Question] [ Let's play some code golf! Given a tic-tac-toe board state (Example:) ``` |x|x|o| |x|o|x| |o|o|x| ``` Determine whether a game is a `win` a `lose` or `cat`. Your code should output any of these options given a state. The above game should output `lose` Just to be clear: a win is defined as any 3 `x`s i...
[Question] [ Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1. To determine the perfectness of a string, you see how many sections you can split it into where each section is a palindrome. If there are ambiguitie...
[Question] [ Draw the path of [Langton's ant](http://en.wikipedia.org/wiki/Langton%27s_ant). ### Description > > Squares on a plane are colored variously either black or white. We arbitrarily identify one square as the "ant". The ant can travel in any of the four cardinal directions at each step it takes. The ant ...
[Question] [ # Challenge Bar Dice is a simple game played in a Bar with Dice (hence the name). You roll 5 six-sided dice and attempt to make the best hand. > > Scoring is based on amassing the largest number of dice with the same digits. Each hand must include at least a single "Ace", or one, in order to be a val...
[Question] [ [Inspired by this SciFi.SE question.](https://scifi.stackexchange.com/questions/107675/why-does-mark-use-hexadecimal-to-communicate) --- ### Background (with minor spoiler): > > In the movie [*The Martian*](http://www.imdb.com/title/tt3659388/), protagonist Mark Watney uses an ASCII table to look up ...
[Question] [ Implement the shortest Sudoku solver using guessing. Since I have received a few request I have added this as an alternative [question](https://codegolf.stackexchange.com/questions/355/implement-a-non-guessing-sudoku-solver) for those wishing to implement a brute force sudoku solver. **Sudoku Puzzle:**...
[Question] [ Originally from [caird coinheringaahing's idea](https://codegolf.meta.stackexchange.com/questions/24021/advent-of-code-golf), I (Bubbler) am hosting [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/questions/24068/announcing-advent-of-code-golf-2021-event-challenge-sandbox). On ea...
[Question] [ My userid is 100664. In binary this is `11000100100111000`. An interesting property of this number is that it can be created entirely by concatenating strings which are repeated at least twice: ``` 11 000 100100 111 000 ``` The first few such numbers are \$3,7,10,12,15,24,28,31,36,40,42, 43, 45,48,...
[Question] [ ### Input: * An integer `n` * Two equal-sized square matrices (with their width/height being a multiple of `n`) ### Output: One of two distinct values of your own choice, one being for truthy results and one for falsey results (so yes, `1/0` instead of `true/false` are valid outputs for languages like ...
[Question] [ The challenge is to write codegolf for the [Hafnian of a matrix](https://en.wikipedia.org/wiki/Hafnian). The Hafnian of an \$2n \times 2n\$ symmetric matrix \$A\$ is defined as: $$\operatorname{haf}(A) = \frac 1 {n!2^n} \sum\_{\sigma \in S\_{2n}} \prod^n\_{j=1} A\_{\sigma(2j-1),\sigma(2j)}$$ Here \$S\_...
[Question] [ Given a non-empty string consisting of only lower and upper case alphabetical characters and spaces (`[a-zA-Z ]`), reduce it to a snippet of the alphabet, starting with the first character. To reduce a string, begin with the first alphabetical character, then remove every character after it that is not...
[Question] [ ## Background An **L-shape** is defined as a polyomino which can be made by extending two rectangular legs in orthogonal directions from a full square (called a pivot). The size of the square should be at least 1, and the lengths of the two legs should also be at least 1. These are some examples of L-s...
[Question] [ The [Xerox Alto](https://history-computer.com/ModernComputer/Personal/Alto.html), originally released in 1973, was the [first](https://arstechnica.com/features/2005/05/gui/3/) computer to feature the now-familiar angled mouse pointer. The Alto's bitmapped pointer looked like this (redrawn from Fig. 2 [...
[Question] [ We've all seen those online "maths hax" that look like this: ``` Think of a number, divide by 2, multiply by 0, add 8. ``` And, by magic, everyone ends up with the number 8! --- ## Language Let's define a programming language which uses the syntax of the text above, called "WordMath". WordMath scripts ...
[Question] [ Write a function or a full program that applies an ASCII texture to a 2d shape. **Inputs:** shape, texture, dimensions(optionally). * Both Shape and Texture can be given by any convenient method (2d matrix, array of strings or string with newlines) * Shape data have a rectangular shape and contains 2 p...
[Question] [ Put simply, you are to print out the following number: ``` 0202020100110020122120012121100120121020202100012110002002010110211221012021112010200012112021220120022222102211121110110201220020202001111212210010100222100112101201122100222120201002002020200011110002211002202100022210212020112002020000120222...
[Question] [ # Mountain range number A number is a mountain range number if the inequalities satisfied by their consecutive digits alternate. In a way, looking at the number's digits should exhibit a `/\/\/\...` or a `\/\/\/...` pattern. More formally, if our number `n` has \$k\$ digits $$n = d\_1d\_2d\_3\cdots d\_...
[Question] [ Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first `5` rows (borrowed from [Generate Pascal's triangle](https://codegolf.stackexchange.com/q/3815/42963)): ``` 1 1...
[Question] [ Help! I just logged into Stack Exchange, but I forgot what my password is! I need a way to work it out before I log off. Luckily, I'm an excellent hacker. Not only was I able to find my password's hash, but I also found Stack Exchange's hashing algorithm! It takes the ASCII value of each digit multipl...
[Question] [ Sometimes it happens that while typing a sentence, I am distracted and I end up typing the same couple of words twice *couple of words twice* in succession. To make sure *make sure* other people are not bothered by this, your task is to write a program that resolves this problem! # Task Given an input ...
[Question] [ ## Background [**Complex floor**](https://aplwiki.com/wiki/Complex_floor) is a domain extension of the mathematical floor function for complex numbers. This is used in some APL languages to implement floor `⌊`, ceiling `⌈`, residue `|`, GCD `∨`, and LCM `∧` on complex numbers. For the rest of this chal...
[Question] [ *Inspired by [a question](https://stackoverflow.com/q/45788547/2586922) at Stack Overflow*. Given a non-empty array of integers `x` and a positive integer `n`, compute the **sum** of each **sliding block** of length `n` along the array `x`, **circularly** filling the missing values at the left with val...
[Question] [ The challenge this time is to find the *n*th *Fibohexaprime*. The definition of a *Fibohexaprime* is as following: We first observe a list with Fibonacci numbers: ``` N | Fibonacci number 1 | 1 2 | 1 3 | 2 4 | 3 5 | 5 6 | 8 7 | 13 8 | 21 9 | 34 10 | 55 11 | 89 12 | 144 13 | 233 1...
[Question] [ If you visit Code Golf often, you may have heard of [Kolmogorov complexity](https://en.wikipedia.org/wiki/Kolmogorov_complexity). It's usually defined as the amount of bytes required to express some string in a programming language. Here the Kolmogorov-complexity of a natural number is defined similarl...
[Question] [ ## Background Given a triangle \$ABC\$, extend its three sides by the opposite side length, as shown in the figure below. Then the six points surprisingly lie on a circle called the [**Conway circle**](https://mathworld.wolfram.com/ConwayCircle.html), whose center coincides with the incenter (the cente...
[Question] [ Let's define the a function on natural numbers \$n\$, written as base 10 digits \$d\_k\; d\_{k-1}\; \dotsc\; d\_1\; d\_0\$, as follows: As long as there are equal adjacent digits \$d\_i\;d\_{i-1}\$, replace them by their sum \$d\_i+d\_{i-1}\$ from left to right. If there were any such digits, repeat th...
[Question] [ > > Version 2 [here](https://codegolf.stackexchange.com/q/131845/70347). > > > Simple challenge: given an integer, draw a house of cards with the given number of stories. If the number is negative, draw the house upside-down. Examples: ``` Input: 2 Output: /\ -- /\/\ Input: 5 Output: /\ -...
[Question] [ Your task is simple: write a program (or function) that takes no input and outputs (or returns) its source code. The catch is that when the program is wrapped in `"quotes"` (Unicode character 34), it should again output its (now quoted) source code. Standard rules for quines apply. This is [code-golf](...
[Question] [ ### Golf Challenge Given the below ASCII "Green". ``` | | | |> | | | | | O | | | | | | | | | | | | | ``` Let `|` Denote a wall Let `|` Denote half the flag pole Let `>` Denote the flag on the pole Let `O` Denote t...
[Question] [ I have a simple task that should be relatively easy to implement by means of code. **Your goal** is to write a program that will output the time written in Spanish, given the time in HH:MM format. Many people likely don't know *how* to do this, so I will elaborate. Time in Spanish is fairly logical. It...
[Question] [ # Task A date can be compactly represented in a 6-character string in the format `ddmmyy` where the first two characters (`dd`) represent a day, the 3rd and 4th characters (`mm`) represent a month and the last two characters (`yy`) represent a `20XX` year. Given a string with 6 characters in `[0-9]` de...
[Question] [ Take a string, `s` containing printable ASCII-characters as input, and output its "binary split sum". Need an explanation? **How do you get the binary split sum?** We'll use the string `A4` as an example in the following explanation. * Convert the characters to binary, treating each letters as a 7-bit ...
[Question] [ # Challenge Description You have to show a simulation of rain in terminal. In the example given below its adding 100 raindrops at random (use the default random function which your language offers) coordinates, waiting for 0.2 seconds and then redrawing again until the given time expires. Any characte...
[Question] [ The presents have been opened. The mince-pies have been eaten. The Star Wars have been watched. The Christmas Season is beginning to wind down. By now you may well have pulled a few [Christmas Crackers](https://en.wikipedia.org/wiki/Christmas_cracker). If you're lucky, instead of the usual useless plas...
[Question] [ A ragged array is an array where each element is an array of unknown number of positive integers. For example, the following are ragged arrays: ``` [[1,2,3],[4],[9,10]] Shape: 3,1,2 [[1],[2],[3]] Shape: 1,1,1 [[1,2,3,4,5,6,8]] Shape: 7 ``` The foll...
[Question] [ # Introduction Everyone's heard of [sine (sin)](https://en.wikipedia.org/wiki/Sine), [cosine (cos)](https://en.wikipedia.org/wiki/Trigonometric_functions#Sine.2C_cosine_and_tangent), [tangent (tan)](https://en.wikipedia.org/wiki/Trigonometric_functions#Sine.2C_cosine_and_tangent), [cotangent (cot)](htt...
[Question] [ I came across an interesting tiling of the plane using squashed hexagons in a popular math book. All the six edges of the squashed hexagon are the same length. Two opposite corners are right angles and the rest four corners are 135 degrees each. This shape allows four squashed hexagons be arranged so t...
[Question] [ Write a function or program which takes as input a set of distinct, non-negative integers \$\{x\_1, \ldots, x\_n\}\$ and outputs the smallest gap between any two values in the set, i.e. \$\min\_{i\neq j}|x\_i-x\_j|\$. ### Scoring **This is not code golf.** Your score is the smallest gap of the set of c...
[Question] [ Some numbers, such as \$14241\$, are palindromes in base 10: if you write the digits in reverse order, you get the same number. Some numbers are the sum of 2 palindromes; for example, \$110=88+22\$, or \$2380=939+1441\$. For other numbers, 2 palindromes are not enough; for example, 21 cannot be written...
[Question] [ In this challenge we try to solve two important problems at once. They are: 1. Given integers \$a\$ and \$b\$, tell if \$a^b-1\$ is a prime number. 2. Given integers \$a\$ and \$b\$, return [\$a\choose b\$](https://en.wikipedia.org/wiki/Binomial_coefficient). Specifically, you must write two programs, ...
[Question] [ ## Background [Link-a-Pix](https://www.conceptispuzzles.com/index.aspx?uri=puzzle/link-a-pix) is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules: * Connect two cells with number N with a line spanning N cells, so that the two cells are at the...
[Question] [ I've been playing around with a robot on the coordinate plane. This robot is able to tell me if it goes left, right, up, or down by reporting back a string consisting of the letters `L`, `R`, `U`, and `D`, such as `DLURRDLURDLLLRRLRLDURRU`. Each character represents a movement of one unit. However, it ...
[Question] [ In the burial place of King Silo of Asturias there is an inscription that reads **SILO PRINCEPS FECIT** (*King Silo made this*). ![SILO PRINCEPS FECIT](https://upload.wikimedia.org/wikipedia/commons/3/32/Silo_princeps_fecit.JPG) The first letter is found in the very middle, and from there one reads by ...
[Question] [ The famous constructed language [Esperanto](http://en.wikipedia.org/wiki/Esperanto) uses the Latin alphabet (mostly, see the linked wikipedia page for details). However, there are some characters with accents: **ĉ, ĝ, ĥ, ĵ, ŝ, and ŭ**. (C-circumflex, g-circumflex, h-circumflex, j-circumflex, s-circumfl...
[Question] [ In the game of sudoku, many players like to "pencil in" possible numbers that can go in each square: [![Sudoku row](https://i.stack.imgur.com/6RQ7U.png)](https://i.stack.imgur.com/6RQ7U.png) The above row can be represented as an array: ``` [[1,2,9], [6], [5], [7], [1,2,9], [1,2,9], [3], [1,2,4], [8]] ...
[Question] [ Related: [Program my microwave oven](https://codegolf.stackexchange.com/q/8791/43319). Inspired by [Generate lazy microwave input](https://codegolf.stackexchange.com/q/73914/43319). The lazy value of the non-negative integer *N* is the smallest of the integers that are closest to *N* while all their di...
[Question] [ Whilst trying to golf several of my answers, I've needed to write large integers in as few characters as possible. Now I know the best way to do that: I'll be getting *you* to be writing this program. # The challenge * Write a program that when given a positive integer, outputs a program that prints it...
[Question] [ Given (in any *structure*; flat list, two lists of lists, a tuple of matrices, a 3D array, complex numbers,…) the coordinates for two non-degenerate triangles `ABC=[[Ax,Ay],[Bx,By],[Cx,Cy]]` and `PQR=[[Px,Py],[Qx,Qy],[Rx,Ry]]`, determine if they are similar, that is, > > they both have the same shape,...
[Question] [ The below pattern will form the basis of this challenge. ``` /\ \/ /\ / \ / \ /\/ \/\ \/\ /\/ \ / \ / \/ /\ \/ ``` Given an input width and height, each `>=1`, output the above ASCII art pattern repeated that many times, joining (and overlap...
[Question] [ # Challenge You must write a program that takes a positive integer `n` as input, and outputs the `n`th Fibonacci number (shortened as Fib# throughout) that contains the `n`th Fib# as a subtring. For the purposes of this challenge, the Fibonacci sequence begins with a `1`. Here are some examples that yo...
[Question] [ ***See also: [Rotatagons](https://codegolf.stackexchange.com/questions/92431/hexagolf-rotatagons)*** ## Challenge Given a string as input, output its wordagon. ## Wordagons A wordagon is a way of representing a string in a hexagon. Now, let's create a wordagon from the string `hexa`: Firstly, you start...
[Question] [ Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the m...
[Question] [ In this challenge, you'll create some programs which behave similarly to genes. When you run one, it will return one of its two "alleles" (a half of its source code), and concatenating any two alleles from your programs will result in a new, functioning program (which returns its own alleles). As an ex...
[Question] [ # Objective Given an ASCII string, decide whether it is a valid C integer literal. # C integer literal A C integer literal consists of: * One of: + `0` followed by **zero or more** octal digits (`0`–`7`) + A nonzero decimal digit followed by **zero or more** decimal digits (`0`–`9`) + `0X` or `0x`, ...
[Question] [ ## PROBLEM Given two words, find the winner in a **digital root** battle. Define the **digital root** of a word this way: 1. Each letter of the alphabet is assigned a number: *A = 1, B = 2, C = 3, ..., Z = 26* 2. Add the values for each letter to total the word. Take "CAT", for example. *C+A+T = 3+1+20...
[Question] [ I like golfing in [tinylisp](https://github.com/dloscutoff/Esolangs/tree/master/tinylisp): ``` (d M(q((x)(i x(i(disp x)0(M x))0 ``` But I also like posting explanations with nicely formatted code: ``` (d M (q ((x) (i x (i (disp x) 0 (M x)) 0)))) ``` Can you help me generate the ungolfed c...
[Question] [ # Challenge ## Premise Bob lost1 Alice's precious grand piano. Big mistake. Alice has now stolen Bob's low-orbit ion cannon. Alice refuses to just make up with Bob, so let's help her give him a *light tap* on the roof. Suppose that from the top Bob's house looks like a lattice polygon, where all points...
[Question] [ # Overview Given an image in plain PPM (P3) format as input, for each pixel `p` in the image, replace each of the following 4 pixels' red, green, and blue with the floored average value of the respective channels of all 4 pixels: 1. `p` itself 2. The pixel located at `p`'s location when the image is fl...
[Question] [ # Task Given input N, generate and output an NxN grid where each row, column and the two diagonals contain the numbers 1 to `N` (or 0 to `N`−1 if that's easier). ## Input The input is a positive integer `N`. It represents the number of columns and rows in the grid. For this problem, you can assume `N` ...
[Question] [ As any *amateur* photographer can tell you, extreme post-processing is **always good.** One such technique is called "[miniature-faking](http://en.wikipedia.org/wiki/Miniature_faking)". The object is to make an image look like a photograph of a miniaturized, toy version of itself. This works best for ...
[Question] [ You are to approximate the value of: $$\int^I\_0 \frac {e^x} {x^x} dx$$ Where your input is \$I\$. # Rules * You may not use any built-in integral functions. * You may not use any built-in infinite summation functions. * Your code must execute in a reasonable amount of time ( < 20 seconds on my machine...
[Question] [ Sometimes when writing brainfuck code, you feel the need to make it longer than needed to *encourage* debugging. You could do it by just plopping a `><` in there, but what fun is that? You'll need something longer and less NOPey to confuse anybody reading your code. ## Quick introduction to Brainfuck >...
[Question] [ Your company is just getting started on a project, and for the first time you decided to go use a functional programming code-style. However your boss is really diffident and doesn't want to use built-in functions, and requires you to implement yourself the main functions. In particular you need to wri...
[Question] [ Inspired by [one of Vi Hart's videos](https://www.youtube.com/watch?v=Gx5D09s5X6U) (which are a treasure trove full of potential challenge ideas) A snake is made up of segments of same length and the connection between each segment can be straight or make a 90° turn. We can encode such a snake (up to...
[Question] [ Let's define a **grouping** as a flat list, which is either: * just `0` * 2 groupings followed by the literal integer `2` * 3 groupings followed by `3` * 4 groupings followed by `4` * etc. (for all integers \$ \ge 2 \$) Note that `1` is not included in this definition, because otherwise groupings could...
[Question] [ ## **Concept** In what ways can you scramble the English alphabet so that it can still be sung to the tune Twinkle Twinkle Little Star without ruining the tune? ## **Rules** **Swapping** Let's just assume the letters contained in each of the following sets can be swapped freely by default without ruin...
[Question] [ If you've ever tried adding labels to a really dense plot, then you'll realise that sometimes labels will overlap one another, making them hard to read. We're going to do something similar but in 1D. Input will be a sequence of `(label, x-coordinate)` pairs, and output will be the result of drawing eac...
[Question] [ [Pyth](https://pyth.herokuapp.com/) is a golfing language based on Python. It uses prefix notation, with each command having a different arity (number of arguments it accepts). Your task is to write a syntax checker for a (non-existent) Pyth-like language, Pith. ## Pith's syntax Pith only has 8 single-...
[Question] [ [sandbox (deleted)](https://codegolf.meta.stackexchange.com/a/17288/78039) Lets define a matrix of 9s as: $$ N = \begin{bmatrix} 9&9&9\\9&9&9\\9&9&9 \end{bmatrix} $$ Lets define an exploding number as a number at position \$(x,y)\$ that can be decomposed into equal integers between all its adjacent ne...
[Question] [ ## A celebration of the many faces of APL Given a string among those in column 1 or column 2 of the below table, return the string's neighbor to its right. In other words, if given a string in column 1 then return column 2's string on that row, and if given a string in column 2 then return column 3's s...
[Question] [ This is a window: ``` --- | | --- ``` Let's add some walls `|`. Put two spaces on either side of it so that the window has plenty of room. ``` | --- | | | | | | --- | ``` Now let's add a roof and a ceiling. To keep the window in the middle of the room, let's add one more row above it and below it...
[Question] [ # Introduction A palindromic closure of an input string is the shortest palindrome that can be constructed out of the input string where the final palindrome starts with the input string. For this challenge, we will consider a two-way palindromic closure such that * **Left Palindromic Closure** of an i...
[Question] [ Using only [printable ASCII](http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters) (hex codes 20 to 7E), write a square N×N *core* program **without comments** that is surrounded by 4 more *[layers](https://www.youtube.com/watch?v=_bMcXVe8zIs)*, creating a (N+8)×(N+8) square program (N > 0). F...
[Question] [ [Hole #1](https://codegolf.stackexchange.com/questions/39748/9-holes-of-code-golf-kickoff?lq=1) Joe the snake is hungry. He eats pictures, one pixel at a time. He really likes bright pixels. ## The Challenge Program Joe to eat the most bright pixels he can find, given that he can only move up, down, le...
[Question] [ [ISO 3166-1](http://en.wikipedia.org/wiki/ISO_3166-1) is the standard that defines all the country codes. The well-known two-letter codes (US, GB, JP, etc.) are called Alpha-2 codes. With two letters, there are only 262 = 676 possible codes, which can be nicely arranged in a grid. [This table](http://e...
[Question] [ Submit a well-formed program or function with **usual I/O rules** which satisfy the input, output, and algorithm conditions below. **Shortest submission (in bytes) wins.** As always, standard loopholes are forbidden. *In short:* Two distinct 8-bit integer inputs must produce two 8-bit integer outputs s...
[Question] [ # Name the poker hand Given five cards, output the name of the poker hand, which will be one of: ``` High card One pair Two pair Three of a kind Straight Flush Full house Four of a kind Straight flush Royal Flush ``` If in doubt, refer to the rules at <http://en.wikipedia.org/wiki/List_of_poker_hands>....
[Question] [ There are quite a few accumulator-based programming languages featured in challenges across the site, but it's a little tiring to have to write almost identical code for each one. So in this challenge you will write a program which can generate interpreters from an input. How does this work? Let us tak...
[Question] [ ## Challenge: Given a square input matrix \$A\$, pad the matrix with one row and one column on all four sides. * The value of each element in the top and bottom row should be the sum of the elements in each corresponding column. * The value of each element in the left and right column should be the sum...
[Question] [ Given Google's recent announcement of official [Kotlin](https://kotlinlang.org/) support for Android development, I thought it might be timely to poll the community for some awesome golfing tips for this relatively new JVM language. Kotlin includes a unique combination of features among it's JVM siblin...
[Question] [ You and some buddies are going bowling. There are a total of *N* bowlers. However, there are only *N*-1 chairs to sit in. The solution is simple: whoever's turn it currently is doesn't get a chair. Then when their turn is over, they sit in the chair of the person that goes next. Lets take an example. ...
[Question] [ **The board game** In the board game "[Carcassonne](http://en.wikipedia.org/wiki/Carcassonne_%28board_game%29)" players place tiles by matching their edges and earn the highest scores through creating large contiguous areas of terrain. The following are (roughly) the types and quantities of tiles inclu...
[Question] [ # Challenge: Write a program that produces the following output: ``` . E .. I ... S .... H ...- V ..- U ..-. F ..-- .- A .-. R .-.. L .-.- .-- W .--. P .--- J - T -. N...