text
stringlengths
180
608k
[Question] [ > > This question is based on [a question I asked](https://spanish.stackexchange.com/q/20685/12637) in [Spanish language](https://spanish.stackexchange.com/). Yes, I asked for an algorithm in Spanish Language. :) > > > In Spain, current license plates have this pattern: > > 1234 XYZ > > > where...
[Question] [ **Challenge:** Get the JavaScript string value containing only the "`-`" character using code only containing the following three symbols: `+[]`. *Note: I'm not sure if this is possible*. **Scoring criterion**: The number of bytes of code used. **Why?** I've set myself a challenge to be able to write c...
[Question] [ In Chess, a Knight on grid \$(x, y)\$ may move to \$(x-2, y-1)\$, \$(x-2, y+1)\$, \$(x-1, y-2)\$, \$(x-1, y+2)\$, \$(x+1, y-2)\$, \$(x+1, y+2)\$, \$(x+2, y-1)\$ or \$(x+2, y+1)\$ in one step. Imagine an infinite chessboard with only a Knight on \$(0, 0)\$: > > How many steps is required for moving a K...
[Question] [ Recently, I made a made a typo and I wrote [unicorn](https://codegolf.stackexchange.com/revisions/8f3e2c92-ba67-4354-a538-1609ca225307/view-source) instead of unicode, I did what any normal person would do and I made an [esolang](https://github.com/vihanb/Unicorn) out of it. In this challenge you will ...
[Question] [ Here are the letters of the English alphabet in order by frequency: ``` e t a o i n s h r d l c u m w f g y p b v k j x q z ``` That is, `e` is the most frequently used letter, and `z` is the least common. (Data from [Wikipedia](http://en.wikipedia.org/wiki/Letter_frequency).) Your challenge is to take...
[Question] [ Your task is to output all possible ways to end a game with a tie (all rows, columns, and diagonals are completely filled and do not have 3 X's or 3 O's, and there are exactly 5 X's and 4 O's in total) in [Tic-Tac-Toe](https://en.wikipedia.org/wiki/Tic-tac-toe) (assuming X goes first): ``` OXO XXO XO...
[Question] [ My stovetop has 10 different settings of heat (0 through 9) and a very odd way of cycling through them. * When I hit plus (`+`) it increments the number, *unless* the number is 9 in which case it becomes 0, or the number is 0 in which case it becomes 9. * When I hit minus (`-`) it decrements the number...
[Question] [ *(inspired by [this post](https://puzzling.stackexchange.com/q/53927) over on Puzzling. CAUTION: SPOILERS FOR THAT PUZZLE ARE BELOW.)* The standard telephone keypad correlates letters to numbers as follows: ``` 1 -> 2 -> ABC 3 -> DEF 4 -> GHI 5 -> JKL 6 -> MNO 7 -> PQRS 8 -> TUV 9 -> WXYZ 0 -> ``` A gi...
[Question] [ # Problem Given a positive integer `n` where `n < 100` Output a diamond pattern as follows: Input `n=1` ``` /\/\ \/\/ ``` Input `n=2`: ``` /\ /\ //\\/\/\//\\ \\//\/\/\\// \/ \/ ``` Input `n=3`: ``` /\ /\ //\\ /\ /\ //\\ ///\\\//\\/\/\//\\///\\\ \\\///\\//\/\/\\//\\\...
[Question] [ Everyone knows [log scales are for quitters](https://xkcd.com/1162/). Therefore, you must write a program or function that *de-quitifies* a bar graph with a log scale given a base. The bar graph input is taken as a single string which is a list of bars, where each bar of the log scale bar graph is sepa...
[Question] [ In that Coding Golf, you should convert one coding convention with TitleCase to lower\_case\_with\_underscores. And... vice versa! # Specification Change the casing in a following way: * If underscore character is a delimiter, change the casing to Title Case without any of delimiter. * If there are mul...
[Question] [ This is the second in a series, the third is [Two roads diverged in a yellow wood (part 3)](https://codegolf.stackexchange.com/questions/114420/two-roads-diverged-in-a-yellow-wood-part-3) This is based on [Two roads diverged in a yellow wood (part 1)](https://codegolf.stackexchange.com/questions/114253...
[Question] [ A sturdy square (akin to a [magic square](https://en.wikipedia.org/wiki/Magic_square)) is an arrangement of the integers 1 to \$N^2\$ on an \$N\$ by \$N\$ grid such that every 2 by 2 subgrid has the same sum. For example, for \$N = 3\$ one sturdy square is ``` 1 5 3 9 8 7 4 2 6 ``` because the four 2 b...
[Question] [ For example, let's look at the following ASCII art: ``` /\ - encloses a total of 2 cells - half a cell per slash \/ /\ - encloses 4 cells fully and half of 8 cells, for a total of 8 / \ \ / \/ ``` Your challenge is to write a program that determines (and outputs) the total area enclosed by AS...
[Question] [ In sporting competitions, it often happens that winners are presented on podiums, with the first-place person on the highest in the middle, the second-place person on the middle height to the left, and the third-place person on the lowest and to the right. We're going to recreate that here with some sp...
[Question] [ In **[pancake sorting](http://en.wikipedia.org/wiki/Pancake_sorting)** the only allowed operation is to reverse the elements of some prefix of the sequence. Or, think of a stack of pancakes: We insert a spatula somewhere in the stack and flip all the pancakes above the spatula. For example, the sequen...
[Question] [ The totient function \$\phi(n)\$, also called Euler's totient function, is defined as the number of positive integers \$\le n\$ that are relatively prime to (i.e., do not contain any factor in common with) \$n\$, where \$1\$ is counted as being relatively prime to all numbers. (from [WolframMathworld](...
[Question] [ I've been scrolling around this site for a while, but just recently got really interested in actually trying out some of the challenges. I was intending to try my hand at some of the existing code-golf topics, but I didn't have Internet access for a while yesterday, and in the meantime, I thought up my...
[Question] [ In chess, the Fool's Mate is the fastest possible way to reach checkmate. It is reached with Black's second move. In chess notation, one possible sequence of moves that achieves Fool's Mate is `1.f3 e6 2.g4 Qh4#`. [![Position after 1.f3 e6 2.g4 Qh4#](https://i.stack.imgur.com/PVtzc.png)](https://i.stac...
[Question] [ You're a chef and you love cooking with your spices, but recently you've taken a liking to organizing your spices based on how often you use them. But you have no time to be writing down when you used your spice last. Simply, you swap and move spices around, and this seems to do the trick. But of cours...
[Question] [ **This question already has answers here**: [Operation Unz̖̬̜̺̬a͇͖̯͔͉l̟̭g͕̝̼͇͓̪͍o̬̝͍̹̻](/questions/188472/operation-unz%cc%96%cc%ac%cc%9c%cc%ba%cc%aca%cd%87%cd%96%cc%af%cd%94%cd%89l%cc%9f%cc%adg%cd%95%cc%9d%cc%bc%cd%87%cd%93%cc%aa%cd%8do%cc%ac%cc%9d%cd%8d%cc%b9%cc%bb) (12 a...
[Question] [ *Note: This challenge only allows answers in compiled languages* ## Task Your task is pretty simple, make two different programs that when compiled result in the same output. ## Scoring Here is where the fun comes in. Your score will be the number of unique **bytes** present in exactly one program. For...
[Question] [ This is sequel to [this](https://codegolf.stackexchange.com/questions/69770/cheating-a-multiple-choice-test) challenge by [Adnan](https://codegolf.stackexchange.com/users/34388/adnan). If you like this challenge, chances are you'll like the other one too. Check it out! --- A multiple choice test with 8...
[Question] [ In a fictional 2D world, a set of 2D printing instructions for an object can be represented by a list of integers as follows: ``` 1 4 2 1 1 2 5 3 4 ``` Each number represents the height of the object at that particular point. The above list translates to the following object when printed: ``` # ...
[Question] [ 5 Years ago, [this](https://www.youtube.com/watch?v=aOT_bG-vWyg) happened, and then it became sort of a meme. # Challenge The Challenge today is, to check if a "[magic square](https://en.wikipedia.org/wiki/Magic_square)" is a valid parker square. What is a **Real Magic square**? * All the numbers mus...
[Question] [ # Task 1. Take a single Unicode character as input. 2. Output a program in the same language that also obeys this specification, but which does not contain the input character. 3. If your program is run with input *a*, and then the output program is then run with input *b*, then the program *it* output...
[Question] [ Given a properly-parenthesized string as input, output a list of all nonempty substrings within matching parentheses (or outside of all parentheses), with nested parentheses removed. Each substring should be the sequence of characters in exactly the same matching parentheses. Substrings should be liste...
[Question] [ You may be aware of the famous old rhyme, *["I before E, except after C"](https://en.wikipedia.org/wiki/I_before_E_except_after_C)*. It is a rule taught to aid in the spelling of certain English words. Quoting Wikipedia: > > If one is not sure whether a word is spelled with the digraph *ei* or *ie*, t...
[Question] [ ## Background Binary Sudoku, also known as [Takuzu](https://en.wikipedia.org/wiki/Takuzu), Binario, and Tic-Tac-Logic, is a puzzle where the objective is to fill a rectangular grid with two symbols (0s and 1s for this challenge) under the following constraints: 1. **Each row/column cannot have a substr...
[Question] [ This was inspired by a Minecraft mini-game. The rules are pretty simple: you run and jump around, and every block you step on disappears once you've stepped on it. The goal is to be the last one left. Your bot should be a complete program. It should accept input as a command line argument. The input wi...
[Question] [ *Redivosite is a portmanteau word invented for the sole purpose of this challenge. It's a mix of Reduction, Division and Composite.* ## Definition Given an integer **N > 6**: * If **N** is prime, **N** is not a Redivosite Number. * If **N** is composite: + repeatedly compute **N' = N / d + d + 1** unt...
[Question] [ # Background At the time of writing this, the P vs NP problem is still unsolved, but you might have heard of [Norbert Blum's new paper](https://arxiv.org/abs/1708.03486) claiming proof that P != NP, which is already [suspected to be erroneous](https://cstheory.stackexchange.com/a/38832) (but we will se...
[Question] [ This: [![enter image description here](https://i.stack.imgur.com/x5VNu.png)](https://i.stack.imgur.com/x5VNu.png) is a *Glider*. In Conway's Game of Life, the [glider](https://en.wikipedia.org/wiki/Glider_(Conway%27s_Life)) is a famous pattern that rapidly traverses across the board. For today's challe...
[Question] [ Using our familiar mathematical symbols: +, x, parenthesis, and any rational number, it's easy to create expressions that evaluates to some desired number. For example: `1+(2x3)=7`, `(1+2)+(3x6.5)=22.5` and so on. Boring enough. In this challenge, we'll use a new operator: `±`. The use of `±` in an exp...
[Question] [ ## Introduction A hypercube/tesseract is the 4 dimensional equivalent of a normal cube. It's made by taking a cube net, extending it to the 3rd dimension, then – using the 4th dimension – folding it into a hypercube. It's basically a cube, where each side is a cube. To create a hypercube, you need 16 4...
[Question] [ You are a web developer, and your boss has decided to update the company's website. He has decided that less color is better, but he wants the site to look the same. You justly decide that he has no idea what he's talking about, but you're going to try anyway, because you're bored. Since the company ha...
[Question] [ Quite a few people here are probably avid XKCD readers. So, I figure I'd challenge you guys to do something that Megan can do easily: make a script that generates thousands of reassuring parables about what computers can never do. [![XKCD #1263](https://i.stack.imgur.com/NtDma.png "'At least humans ar...
[Question] [ In this challenge, you need to simulate a frog jumping back and forth on lily pads. The pond is infinitely big, has a line of an infinite number of lily pads, and the frog can jump across as many lily pads as he likes. This frog likes to jump back and forth: **after jumping forward, he always jumps bac...
[Question] [ [Fermat's polygonal number theorem](https://en.wikipedia.org/wiki/Fermat_polygonal_number_theorem) states that every positive integer can be expressed as the sum of at most \$n\$ \$n\$-gonal numbers. This means that every positive integer can be expressed as the sum of up to three triangle numbers, fou...
[Question] [ I drew this map of the regions of an imaginary word in a few minutes in MS Paint: ![my map](https://i.stack.imgur.com/weDlq.png) I think that being able to generate maps like this programmatically would be really cool. # Challenge Write a program that takes in positive integers `W` and `H`, and a non-e...
[Question] [ A "rhyme scheme" is a string of letters `a` to `z`, such that the first occurrences of the characters are in ascending order (without gaps), starting from `a`. For example (with first occurrences marked): ``` abccdbebdcfa ^^^ ^ ^ ^ ``` The number of rhyme schemes of length `N` is given by the *Bell n...
[Question] [ Given an integer n ≥ 0 , output it in a non-positional base-3 notation, using digits `139ABCDE…` and a 1-character separator. Every digit is a consecutive power of 3 and the digits on the left side of the separator are negated, e.g. **A931|B** → 81−(1+3+9+27) → **41**. A digit may appear only once. Rig...
[Question] [ For each row and then column of a matrix, we can add an extra entry with the sum of the last two entries in that row or column. For example with the following input matrix: ``` [ 1 1 1 ] [ 2 3 4 ] ``` The resulting matrix would be: ``` [ 1 1 1 2 ] [ 2 3 4 7 ] [ 3 4 5 9 ] ``` Given an input of an intege...
[Question] [ You have been chosen to make a program that creates some pretty ASCII [bar charts](https://en.wikipedia.org/wiki/Bar_chart). Here is the input format: ``` [List of words (they can have spaces)] [an integer >= 0] Bar 3 This is so cool 4 IDK-Why 6 ``` The input will have multiple lines in this format, ea...
[Question] [ # Input The board: A 2D container (matrix, list of lists, etc.) of letters like: ``` ["B", "C", "C", "C", "C", "B", "B", "C", "A", "A"], ["B", "A", "C", "B", "B", "A", "B", "B", "A", "A"], ["B", "C", "B", "C", "A", "A", "A", "B", "C", "B"], ["B", "B", "B", "A", "C", "B", "A", "C", "B", "A"], ...
[Question] [ Here is an ASCII-art of a 4-way intersection: ``` | | | | | | | | | | | | | -----+-----+----- | | - - -| |- - - | | -----+-----+----- | | | | | | | | | | | | | ``` (Note how the horizontal road...
[Question] [ A [nonogram](http://en.wikipedia.org/wiki/Nonogram) is a two-dimensional logic puzzle that looks something like this (screenshots from the game [Pixelo](http://www.64levels.com/game/pixelo), my favourite nonogram game): ![An empty nonogram board](https://i.stack.imgur.com/JBBC5.png) The goal of the gam...
[Question] [ This challenge takes place on a grid. ``` +----------+ | | | | | | | | | | | | | | | | | | +----------+ ``` This one's 10 x 10, but it can be any rectangular shape. There are four directions on this grid. Up, down, left an...
[Question] [ Imagine an arsonist walking around the town and picking its victims according to a very specific pattern (Or, alternatively, *Imagine a bee flying around the garden and picking its flowers to pollenize according to a very specific pattern*). Let's say the town is an **N × N** matrix, where **N** is an ...
[Question] [ A [Lyndon word](https://en.wikipedia.org/wiki/Lyndon_word) is a string that is strictly [lexicographically smaller](https://en.wikipedia.org/wiki/Lexicographical_order) than any of its cyclic rotations. Given a binary string, determine if it's a Lyndon word in as few bytes as possible. For example, `00...
[Question] [ This problem is an extension of what happens to me on a regular basis: I have to have $1.00 in coins and have to be able to give change to somebody. I discovered rather quickly that the ideal coins to have were 3 quarters, 1 dime, 2 nickels, and 5 pennies. This is the smallest number of coins (11 total...
[Question] [ Let's play some code-golf! The challenge is to find the winner of a game of Tic-Tac-Toe. This has been done many times by giving a board that has one clear winner but here is the twist: The cells are numbered like this: ``` 1|2|3 -+-+- 4|5|6 -+-+- 7|8|9 ``` You get an array of exactly 9 moves like that...
[Question] [ The other day, my son asked me to build him a staircase using Lego-ish blocks. And I came up with something like this: [![Staircase](https://i.stack.imgur.com/EzQUOm.jpg)](https://i.stack.imgur.com/EzQUOm.jpg) Then my kid asked me for a program using the least number of bytes that generated a similar s...
[Question] [ [![xkcd: Scheduling Conflict](https://imgs.xkcd.com/comics/scheduling_conflict.png "Neither a spokesperson for the organization nor the current world champion could be reached for comment.")](http://xkcd.com/1542) (I meant to post this while [1542: Scheduling Conflict](http://xkcd.com/1542) was still t...
[Question] [ FizzBuzz is where a range of positive integers is taken, and numbers divisible by 3 are replaced with "Fizz", divisible by 5 with "Buzz" and divisible by 15 with "FizzBuzz". I've got some FizzBuzz output here. Unfortunately, it's been shuffled: ``` 4 Fizz Fizz Buzz 2 ``` A bit of logic shows us that th...
[Question] [ ### Challenge Given a set `T` of subsets of a finite set `S={1,2,3,...,n}`, determine whether `T` is a *topology* or not. ### Explanation The *powerset* `P(S)` of some set `S` is the set of all subsets of `S`. Some examples: ``` S = {}, P(S) = {{}} S = {1}, P(S) = {{}, {1}} S = {1,2}, P(S) = {{}, {1}, ...
[Question] [ ## Challenge Implement the 1-indexed sequence [A054049](https://oeis.org/A054049), which starts like this: ``` 1, 2, 3, 6, 13, 5, 9, 377, 21, 11, 89, 14, 8, 233, 16, 987, 18, 2584, 20, 6765, 55, 23, 28657, 25, 75025, 27, 196418, 29, 514229, 31, 1346269, 33, 3524578, ... ``` This sequence is the lexicog...
[Question] [ Make a program that takes a length and list of intervals and outputs a ruler of that length with longer ticks for each interval using the line drawing characters `┌ ┬ ┐ │ ╵` * The first row of the output should begin with the tick for 0 with `┌` and end with a tick for the length with `┐`, with a `┬` b...
[Question] [ While doing some research for a different challenge I'm formulating, I came across a [Cayley graph](https://en.wikipedia.org/wiki/Cayley_graph), specifically [this one](https://upload.wikimedia.org/wikipedia/commons/d/d2/Cayley_graph_of_F2.svg). Since I'm [one of the top](https://codegolf.stackexchange...
[Question] [ Today we'll look at a sequence \$a\$, related to the Collatz function \$f\$: $$f = \begin{cases} n/2 & \text{if } n \equiv 0 \text{ (mod }2) \\ 3n+1 & \text{if } n \equiv 1 \text{ (mod }2) \\ \end{cases}$$ We call a sequence of the form \$z, f(z), f(f(z)), …\$ a *Collatz sequence*. The first number in ...
[Question] [ If you don't know already, a quaternion is basically a 4-part number. For the purposes of this challenge, it has a *real* component and three *imaginary* components. The imaginary components are represented by the suffix `i`, `j`, `k`. For example, `1-2i+3j-4k` is a quaternion with `1` being the real c...
[Question] [ [Bytebeat](http://canonical.org/~kragen/bytebeat/) is a style of music one can compose by writing a simple C program that's output is piped to `aplay` or `/dev/dsp`. ``` main(t){for(;;t++)putchar(((t<<1)^((t<<1)+(t>>7)&t>>12))|t>>(4-(1^7&(t>>19)))|t>>7);} ``` There is a good deal of information on the ...
[Question] [ Sometimes, when writing a program, you need to use a prime number for some reason or other (e.g. cryptography). I assume that sometimes, you need to use a composite number, too. Sometimes, at least here on PPCG, your program has to be able to deal with arbitrary changes. And in circumstances convenient...
[Question] [ Recently I read the novel ["The Solitude of Prime Numbers"](https://en.wikipedia.org/wiki/The_Solitude_of_Prime_Numbers_(novel)) where the main characters are somewhat compared to [twin prime numbers](https://en.wikipedia.org/wiki/Twin_prime) ("*always together, but never touching*"). > > A **twin pri...
[Question] [ The world is a five by five array of cells. **It wraps on all sides.** It can be visualized like... ``` XXXXX XXXXX XXOXX XXXXX XXXXX ``` You are an O. You love to travel the world, and you do so according to the following rules (let C be the current day): * On [prime](https://en.wikipedia.org/wiki/Pri...
[Question] [ Given an array of any depth, draw its contents with borders of `+-|` around each subarray. Those are the ASCII characters for plus, minus, and vertical pipe. For example, if the array is `[1, 2, 3]`, draw ``` +-----+ |1 2 3| +-----+ ``` For a nested array such as `[[1, 2, 3], [4, 5], [6, 7, 8]]`, draw ...
[Question] [ In this challenge, you are passed two words: Your job is to determine if they are *adjacent*. Two letters are adjacent if: 1. They are the same letter, or 2. They are lexicographically adjacent. *For example, **J** is adjacent to **I**,**J**, and **K** only. **Z** is not adjacent to **A*** Two words ar...
[Question] [ You are the sonar captain aboard an underwater submarine. The way sonar works is that every submarine sends out a ping at regular intervals. Each interval is a whole number of seconds. Each submarine has an identifying amplitude, that is no two submarines send out pings at the same amplitude. The ampli...
[Question] [ Given a positive integer < 100 (from 1 to 99, including 1 and 99), output that many lockers. A locker is defined as the following: ``` +----+ | | | | | | | nn | +----+ ``` where `nn` is the locker number, in base 10. If there is 1-digit number, it is expressed with a 0 in front of it. For exam...
[Question] [ # Introduction The [Dragon's Curve](https://en.wikipedia.org/wiki/Dragon_curve) is a fractal curve that notably appears on section title pages of the Jurassic Park novel. It can very simply be described as a process of folding a paper strip, as explained in the Wikipedia article about this curve. The f...
[Question] [ If you haven't played the game [Baba is You](https://hempuli.com/baba/), I think you [really](https://www.youtube.com/watch?v=YH0NR1kmMUo) should. Whether you’ve played it or not, have a go at implementing it as a code golf. The idea behind this challenge is to have a bit more complicated, non-standa...
[Question] [ # Background [Nonogram](https://en.wikipedia.org/wiki/Nonogram), also known as Picross or Griddlers, is a puzzle where the objective is to determine if each cell on the 2D grid should be colored or left blank, using the numbers of consecutive colored cells on each line. The following is an example Nono...
[Question] [ Today's challenge is to draw a [binary tree](https://en.wikipedia.org/wiki/Binary_tree) as beautiful [ascii-art](/questions/tagged/ascii-art "show questions tagged 'ascii-art'") like this example: ``` /\ / \ / ...
[Question] [ You can create a list of all rationals 0 < r ≤ 1 by listing them ordered first by denominator and then by numerator: ``` 1 1 1 2 1 3 1 2 3 4 1 5 1 2 3 4 5 - - - - - - - - - - - - - - - - - 1 2 3 3 4 4 5 5 5 5 6 6 7 7 7 7 7 ``` Note that we skip any ration...
[Question] [ **Challenge:** You are given a string containing only digits. Your task is to output the minimum number of primes which must be concatenated to form the string. If this is impossible, output `0`. **Test Cases:** Input -> Output: ``` 252 -> 3 235 -> 2 92 -> 0 31149 -> 2 ``` [Answer] # JavaScript (...
[Question] [ Given an input of four integers *x1*, *y1*, *x2*, and *y2*, output whether a white king in chess (with coordinates (*x1*, *y1*)) could catch a black pawn (with coordinates (*x2*, *y2*)) and capture it if the pawn is moving to promote to a queen as fast as possible. The coordinates of the board are as f...
[Question] [ **Premise** One night, I was just contemplating on numbers. I found out about something unique about numbers like 7, 10, 12, 13, and more. They are squares of squares! Meaning, that when squared, are comprised of squares themselves. The OEIS calls them Squares which are a decimal concatenation of two o...
[Question] [ *This challenge is loosely inspired by the Zachtronics game [Infinifactory](http://www.zachtronics.com/infinifactory/).* You are given a top-down view of a rectangular grid of conveyors, represented by `>v<^`. There may be cells without conveyors, represented by spaces. Here is an example: ``` > <vv ...
[Question] [ ### Background A [bijective base **b** numeration](https://en.wikipedia.org/wiki/Bijective_numeration), where **b** is a positive integer, is a bijective positional notation that makes use of **b** symbols with associated values of **1** to **b**. Unlike its non-bijective counterpart, no symbol has a v...
[Question] [ When I saw the title of [this closed question](https://codegolf.stackexchange.com/questions/5786/converting-infix-expressions-to-postfix-expressions), I thought it looked like an interesting code golf challenge. So let me present it as such: ### Challenge: Write a program, expression or subroutine whic...
[Question] [ ## Haplology Haplology is a linguistic term: > > the omission of one occurrence of a sound or syllable that is repeated within a word, for example probly for probably. > > > For this challenge, it means specifically, replacing any sequences of two or more letters that are repeated two or more times...
[Question] [ Write a "palipolyquine": a program that is a [quine](https://en.wikipedia.org/wiki/Quine_(computing)), a [polyglot](https://en.wikipedia.org/wiki/Polyglot_(computing)), and a [palindrome](https://en.wikipedia.org/wiki/Palindrome). Rules: * The number of polyglot languages is more preferable than code s...
[Question] [ In crossword terminology, the *grid* is the region into which the crossword answers are inserted, consisting of white and black squares. The crossword answers, called *entries*, are inserted into contiguous sequences of white squares in a row or column, separated by black squares. [![Example of a cross...
[Question] [ Today Neil Sloane of the OEIS [sent out an email](http://list.seqfan.eu/pipermail/seqfan/2020-October/020991.html) asking for a confirmation of the current terms, and computation of some larger terms of the latest OEIS sequence [A337663](https://oeis.org/A337663) with the keyword "nice". Here's how thi...
[Question] [ I've become alarmed with the growing [hatred of spaces](https://codegolf.stackexchange.com/questions/35818/i-hate-spaces-in-file-names) and [this answer](https://codegolf.stackexchange.com/a/35801/7464) has inspired me to make sure Morse code is safe from this insidious removal of whitespace. So, your...
[Question] [ # Background The official currency of the imaginary nation of Golfenistan is the *foo*, and there are only three kinds of coins in circulation: 3 foos, 7 foos and 8 foos. One can see that it's not possible to pay certain amounts, like 4 foos, using these coins. Nevertheless, all large enough amounts ca...
[Question] [ A De Bruijn sequence is interesting: It is the shortest, cyclic sequence that contains all possible sequences of a given alphabet of a given length. For example, if we were considering the alphabet A,B,C and a length of 3, a possible output is: ``` AAABBBCCCABCACCBBAACBCBABAC ``` You will notice that e...
[Question] [ This challenge is to write fast code that can perform a computationally difficult infinite sum. **Input** An `n` by `n` matrix `P` with integer entries that are smaller than `100` in absolute value. When testing I am happy to provide input to your code in any sensible format your code wants. The defaul...
[Question] [ # [Pronouncing Hex](http://www.bzarg.com/p/how-to-pronounce-hexadecimal/) For those of you uninitiated with the show Silicon Valley, this challenge is inspired by an exchange that goes like this ([YouTube](https://www.youtube.com/watch?v=_zTpwNR5Bf4)): ``` Kid - Here it is: Bit… soup. It’s like alpha...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 4 years ago....
[Question] [ The 15 Puzzle is a famous puzzle involving sliding 15 tiles around on a 4x4 grid. Starting from a random configuration, the goal is to arrange the tiles in the correct order. Here is an example of a solved 15 Puzzle: ``` 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 ``` Each move on the puzzle is of the...
[Question] [ A classic example to introduce people to the concept of a discrete probability distribution is the [bean machine](https://en.wikipedia.org/wiki/Bean_machine). This machine has a large amount of marbles fall from a narrow passageway at the top, after which they hit rows of interlaced pins, where at each...
[Question] [ A void list is a list that at no level contains any non-list objects. Or if you prefer a recursive definition * The empty list is void * A list containing only other void lists is void All void lists have a finite depth. Here are some examples of void lists (using python syntax): ``` [] [[]] [[],[]] [[...
[Question] [ Right hand brace is a style of code bracketing in which curly braces and semicolons are all aligned to a single point on the right side of a a file. ![Example Image go here](https://pbs.twimg.com/media/CvH9gfFWcAA2knK.jpg) Generally, this is considered bad practice, for several reasons. ## The Challeng...
[Question] [ In his xkcd [about the ISO 8601 standard date format](https://xkcd.com/1179/) Randall snuck in a rather curious alternative notation: [![enter image description here](https://i.stack.imgur.com/b1ZUO.png)](https://i.stack.imgur.com/b1ZUO.png) The large numbers are all the digits that appear in the curre...
[Question] [ It's friday! Which means it's time for beer! Sadly though, today we will be golfing beer instead of drinking it. :( ### Challenge Output a beer and drink it. The amount of sips you take changes your output. ### Sips Your program should take one input string. This string can solely consist out of conc...
[Question] [ Suppose you're given some distinct uppercase letters scattered in a rectangular array of otherwise-blank cells. Each cell in the array *belongs* to the letter *nearest* to it, defined as the letter reachable in the smallest number of horizontal and/or vertical steps -- no diagonal steps. (If a cell is ...
[Question] [ Your input is an array of integers in the range `[-1,4]`. An array element of `-1` means that there might be a bomb in that position. A non-negative element means that there is not a bomb in that position and also the numeric value tells how many bombs there are **within distance 2**. For example, if w...
[Question] [ Your task is to read an image containing a handwritten digit, recognize and print out the digit. **Input:** A 28\*28 grayscale image, given as a sequence of 784 plain-text numbers from 0 to 255, separated by space. 0 means white and 255 means black. **Output:** The recognized digit. **Scoring:** I will...
[Question] [ *You know how many and which kinds of chess pieces were murdered. Can you come up with* any *possibility for who killed whom and how?* ## Background During the course of a game of chess, there are between 2 and 32 pieces on the board. Call the collection of all pieces on the board (both white and black...