text
stringlengths
180
608k
[Question] [ Draw the parabolic trajectory of a thrown ball. The input is the ball's initial upward velocity, a positive integer `v`. Every second, the ball moves `1` space right and `v` spaces vertically, and then `v` decreases by `1` to due to gravity. So, the upward velocity eventually steps down from `v` to `0...
[Question] [ Create a program that prints all whole numbers inclusively between an interval `(a, b)`, and replaces multiples of 8 in the sequence with random (uniformly distributed, independent of other characters), non-numeric, non-whitespace, printable ASCII characters. Assume 0 < a < b in all cases. If the numb...
[Question] [ ## Objective Create a function to reverse string concatenation ## Input Two strings (alphanumeric + spaces), where one should be subtracted for the other. * You can assume that the string to be subtracted will never be larger than the other one. ## Output The result from the subtraction ## Subtraction...
[Question] [ In your grandparents' day, dialing a phone number was done with a [rotary dial](https://en.wikipedia.org/wiki/Rotary_dial) like this: ![](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7b/Rotarydial.JPG/220px-Rotarydial.JPG) To dial each digit, put your finger in the corresponding hole, pull it...
[Question] [ This [impossible object](https://en.wikipedia.org/wiki/Impossible_object) is [Reutersvärd's triangle](https://commons.wikimedia.org/wiki/File:Reutersv%C3%A4rd%E2%80%99s_triangle.svg): [![enter image description here](https://i.stack.imgur.com/Ec4du.png)](https://i.stack.imgur.com/Ec4du.png) Draw your o...
[Question] [ [Inspiration](https://puzzling.stackexchange.com/q/31247/74193) [Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves...
[Question] [ One of the most common voting systems for single-winner elections is the plurality voting method. Simply put, the candidate with the most votes wins. Plurality voting, however, is mathematically unsound and is liable to create situations in which voters are driven to vote for the "lesser of two evils" ...
[Question] [ The number `113` is the first prime whose length `3` is prime, digital sum `5 = 1 + 1 + 3` is prime, and digital product `3 = 1 * 1 * 3` is prime. A prime that has these 3 properties will be called *supremely prime*. The primes `11117` and `1111151` are other examples. # Goal Write a program that can f...
[Question] [ Your goal is to generate a [Fibonacci spiral](https://en.wikipedia.org/wiki/Fibonacci_number) with numbers. ![Sample](https://i.stack.imgur.com/eHWK9.png) ### Example Input / Output ``` 1 -> 1 2 -> 1 1 3 -> 1 1 2 2 2 2 6 -> 8 8 8 8 8 8 8 8 5 5 5 5 5 8 8 8 8 8 8 8 8 5 5 5 5 5 8 8 8 8...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/8629/edit). Closed 3 years ago. [Improve this question](/posts/8629/edit) Wr...
[Question] [ Consider a regular grid, where each cell has integer coordinates. We can group the cells into (square-shaped) "rings" where the cells in each ring have the same [Chebyshev distance](https://en.wikipedia.org/wiki/Chebyshev_distance) (or chessboard distance) from the origin. Your task is to take such a c...
[Question] [ # Alternate Title: [Tally Your Prison Sentence on the Wall](https://s3.amazonaws.com/lowres.cartoonstock.com/law-order-jail-jail_cell-prisoner-prison_cell-prison-jcen999_low.jpg) Given a number `n`, output tallies grouped into the traditional 5-per-group and 50 per row. --- # Examples 1 ``` | | | | ```...
[Question] [ A *1-up quine* is a program which is very similar to a quine. The one major difference is that instead of printing itself once, when **n** copies of the program are concatenated, the result prints the original program **n+1** times. ## Example If your program is `Abc123`: ``` Abc123 -> Abc123Abc123 A...
[Question] [ There is a boy named Peter. Peter is a picky eater and doesn't like to eat the same kind of cookie again on the same day. Peter gets a present, The present is a box of cookies! The box contains \$K\$ types of cookies. Also, it contains different amount of each type of cookie. Peter, being the picky eat...
[Question] [ ### Introduction In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: `0.1234567891011121314151617...` and so on. You can see that the first appearence of `15` starts at the `20th` decimal: ``` Position 0000000001111111111222222222233...
[Question] [ Inspired by [Golf me an ASCII Alphabet](https://codegolf.stackexchange.com/questions/80940/golf-me-an-ascii-alphabet), of which this challenge is (almost) a direct inverse. --- ### Task: Take a string of ASCII-art text and output the content of the text as regular ASCII text. --- ### Input: String of A...
[Question] [ # Guidelines ## Scenario John has an important number, and he doesn't want others to see it. He decided to encrypt the number, using the following steps: His number is always a non-decreasing sequence (ie. `"1123"`) He converted each digit into English words. (ie. `"123" -> "ONETWOTHREE"`) And then, re...
[Question] [ This is the inverse of [Let's do some "deciph4r4ng"](https://codegolf.stackexchange.com/q/115709/38183) --- In this challenge, your task is to encipher a string. Luckily, the algorithm is pretty simple: reading from left to right, each typical writing character (ASCII range 32-126) must be replaced by ...
[Question] [ > > **Notice:** This [king-of-the-hill](/questions/tagged/king-of-the-hill "show questions tagged 'king-of-the-hill'") challenge has completed. This means that the green checkmark, which has been awarded to C5H8NNaO4 for their entry The Observer will not be moved to any new answer. > > > You may sti...
[Question] [ It frustrates me that when you say "base 16", the 16 is in base 10. We need a base neutral way of writing down numbers when favoring a specific base would be inappropriate. ## How it works We define `<n>` to be the nth prime. So `<1>=2`, `<2>=3`, `<3>=5`. Note that every positive integer can be uniquel...
[Question] [ Today you need to solve a very practical problem: How many loops do you need to have a certain number of sheets on your toilet paper roll? Let's look at some facts: * The diameter of a bare toilet paper cylinder is 3.8cm * The length of one sheet of toilet paper is 10cm. * The thickness of one sheet of...
[Question] [ ## The task *Today's special offer: consonants and punctuation for FREE!* Your program or function will be given as input the first 6 paragraphs of Lewis Carroll's famous novel *Alice's Adventures in Wonderland*, with all vowels `[aeiouAEIOU]` removed and all other characters left intact. It must outpu...
[Question] [ ## Introduction [A229037](https://oeis.org/A229037) has a quite intriguing plot (at least for the first few terms): ![](https://i.stack.imgur.com/JQY1V.png) There is the conjecture, that it might indeed have some kind of fractal property. ### How is this sequence constructed? Define `a(1) = 1, a(2) = 1...
[Question] [ You are transported in a parallel universe where people write mathematical equations on computers as ASCII art by hand. As a LaTeX addict, this is totally unacceptable, and you ought to automate this process somewhat. Your goal is to write a program that outputs an ASCII version of an equation inputed...
[Question] [ Sometimes when I'm typing out an IPv4 address, I get all the numbers right, but I forget to type one or more periods. I'd like to have a program (or function) that takes my broken IPv4 address and outputs all possible valid placements of the missing periods. ## Input The input will always be a string t...
[Question] [ *Prindeal* (pronounced [prin-dee-al](http://www.pronunciationgenerator.com/v/1mJVa/prindeal.mp4)) is a new [esoteric](http://esolangs.org/wiki/esoteric_programming_language) programming language that only has four commands: ***pr***int, ***in***crement, ***de***crement, and ***al***ias. Despite its min...
[Question] [ *Inspired by [this](https://codegolf.stackexchange.com/questions/138068/kill-it-with-fire "Kill it With Fire").* ## Background The [evil farmer](https://codegolf.stackexchange.com/questions/138068/kill-it-with-fire "Kill it With Fire") has decided to burn your wheat field down in order to drive up the ...
[Question] [ To interpret a positive integer very literally, write it in English words (without "and"), replace hyphens with spaces, replace each resulting word with its number value, and concatenate the results into a single number. To write a positive integer more than 99 but less than 1000 in English words, pref...
[Question] [ Given an ordered list of same-case letter strings (a-z XOR A-Z) where each string is preceded by 0 or more space ( ) characters, output the same list but with the strings sorted at each level of indentation. Indentation depths under different parents count as distinct lists for sorting purposes. ## Exa...
[Question] [ Help! I seem to have an annoying echo in some of my arrays, and I'd like to get rid of it. When this occurs, the original array repeats itself somewhere in the middle causing the values to be added to each other. For example, the array `[ 422, 375, 527, 375, 859, 451, 754, 451 ]` contains an echo of it...
[Question] [ Python is the fastest-growing major programming language today. It is the most wanted language for the third year in a row, meaning that developers who do not yet use it say they want to learn it.[[1]](https://insights.stackoverflow.com/survey/2019#key-results) The reason for Python's popularity is its...
[Question] [ Given the Dowker notation of a knot and its crossing signs, calculate its bracket polynomial. Although there are more technical definitions, for this challenge it is enough to think of a **knot** as something made physically by attaching the two ends of a string together. Since knots exist in three dim...
[Question] [ Olympic vine-swingers perform their routines in standard trees. In particular, Standard Tree `n` has vertices for `0` up through `n-1` and edges linking each nonzero vertex `a` to the vertex `n % a` below it. So, for example, Standard Tree 5 looks like this: ``` 3 | 2 4 \ / 1 | 0 ``` because t...
[Question] [ [Martin Ender](https://codegolf.stackexchange.com/users/8478/martin-ender) recently hit 100K, and has come up with some [pretty awesome languages](https://github.com/m-ender?tab=repositories). We're going to have a bit of fun with one of them, [Hexagony](https://github.com/m-ender/hexagony) (and a bit ...
[Question] [ Given a snippet of ***fizz buzz*** output with all numbers removed, fill in the correct numbers with the lowest possible values such that the ***fizz buzz*** snippet is correct. For the purposes of this challenge, `fizz` and `buzz` have their usual values of 3 and 5, respectively. If the input is an in...
[Question] [ ## Introduction In this challenge, we will be dealing with a certain ordering of the positive integers. The ordering goes like this: ``` 3, 5, 7, 9, 11, ... 2*3, 2*5, 2*7, 2*9, 2*11, ... 4*3, 4*5, 4*7, 4*9, 4*11, ... 8*3, 8*5, 8*7, 8*9, 8*11, ... 16*3, 16*5, 16*7, 16*9, 16...
[Question] [ You have locked your bike with a combination lock of 3 digits. Now you want to go for a ride and need to unlock it with the help of following program. ## Input ### 1st parameter The digit combination of your lock in *locked* state. It must be different from the 2nd parameter (=the combination of *unloc...
[Question] [ The bank has been broken into, and all the local mafia thugs have an unusual alibi: they were at home playing Connect 4! In order to assist with the investigation, you are asked to write a program to validate all the Connect 4 boards that have been seized in order to check that the positions are indeed...
[Question] [ ## Problem Description Imagine you're a turtle on a grid. You're given two numbers ***f*** and ***b***, and you're facing east. You perform a march across the grid, counting each of the cells you encounter, according to the following rules: * By default, you write the count to the cell you're in, then ...
[Question] [ # Introduction Unlike English, German is considered to have quite a [phonemic writing system](https://en.wikipedia.org/wiki/Phonemic_orthography). That means that the correspondence between spelling and pronunciation is close. Given any word you aren't familiar with, you would still know how to pronoun...
[Question] [ This is inspired by [Monday Mini-Golf #6: Meeesesessess upp teeexexextext](https://codegolf.stackexchange.com/q/61885/8478) ## Background [ETHproductions](https://codegolf.stackexchange.com/users/42545/ethproductions) have difficulty entering text on his usual webpage. Whenever he use digits or letters...
[Question] [ The word `BANANA` appears exactly once in this [word search](https://en.wikipedia.org/wiki/Word_search): ``` B A N A A N B B A B A N A B A N A N A B N N A A N N B A A A N N N A A N N N B A A N N N B A N A N A A B A N A N B A N A N B B A ``` The word search above contains only one occurrence of the word...
[Question] [ **You are an enterprising dot** who wants to increase the land under its control. This is quite simple - travel outside your current land and loop back into your land and everything in that loop is now owned by you. But there is a catch. If some other dot somehow finds your loop and crosses it, you die...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/80493/edit). Closed 7 years ago. [Improve this question](/p...
[Question] [ Your job is to open a browser window **of the default browser** to <http://codegolf.stackexchange.com>. Your code must open the browser itself, and cannot rely on an open one. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest answer in bytes wins. ---...
[Question] [ Note that this is not the same as [Print the alphabet four times](https://codegolf.stackexchange.com/questions/2167/print-the-alphabet-four-times). This task is to write a program to generate four copies of each letter of the English alphabet, one letter per line, on standard output: ``` A A A A B B B ...
[Question] [ Here's an array representing a standard deck of cards, including two Jokers. ``` [ "AS", "2S", "3S", "4S", "5S", "6S", "7S", "8S", "9S", "10S", "JS", "QS", "KS", "AD", "2D", "3D", "4D", "5D", "6D", "7D", "8D", "9D", "10D", "JD", "QD", "KD", "AH", "2H", "3H", "4H", "5H", "6H", "7H", "8H", "9H", ...
[Question] [ At runtime, keep prompting for *a line of input* until the user inputs something (other than an empty newline), i.e. does not just press `Enter` or `OK`. Output or result is neither required nor prohibited. ### Pseudo-code 1 ``` myform = new form("GUI") myform.mytxt = new editfield("") myform.ok = new ...
[Question] [ Given three sidelengths of a triangle, evaluate its aspect ratio *AR* given the following formula: [![enter image description here](https://i.stack.imgur.com/NUubd.png)](https://i.stack.imgur.com/NUubd.png) where [![enter image description here](https://i.stack.imgur.com/ZkGvs.png)](https://i.stack.img...
[Question] [ My friend made a lisp translator the other day, that is to say it took a string and converted s=>th and S=>Th. It was quite long and I thought that it could be golfed. So the task is to make a program/function that takes an input string, translates it in to lisp and outputs the string **Test case** ```...
[Question] [ **This question already has answers here**: [Make a list flat](/questions/248245/make-a-list-flat) (22 answers) Closed 1 year ago. In this challenge, your task is to create a program which takes in a nested array and returns a single-dimensional flattened array. For Example `[10,20,[30,[40]],50]...
[Question] [ **Challenge** *[Sandbox post](https://codegolf.meta.stackexchange.com/a/16598/78039)* Given a positive integer `(K)` Output a uniformly-random integer `(Y)` between `[0, K)`. If `Y > 0` Assume `K = Y` and repeat the process until `Y = 0`. **Rules** * Input must be printed at first * Output format as y...
[Question] [ The sequence contains the decimal representation of the binary numbers of the form: `10101...`, where the n-th term has n bits. The sequence is probably easiest to explain by just showing the relationships between the binary and decimal representations of the numbers: ``` 0 -> 0 1 -> 1 10...
[Question] [ > > Note: This challenge is finished. Submissions are still welcome but can not win. > > > This is the cops' thread. The robbers' thread [goes here](https://codegolf.stackexchange.com/questions/99547/code-ladder-robbers). Write a code that outputs the integer `1`. If you add, remove or substitute a...
[Question] [ Your task is to make a program that takes in an integer `n > 1`, and outputs the roll of a single `n`-sided die. However, this dice follows the rules for [exploding dice](https://anydice.com/articles/exploding-dice/). When you roll the die, check what value you rolled. If you got the maximum for that k...
[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 7 years ago....
[Question] [ As a child, my friend had a [magic 8 ball](https://en.wikipedia.org/wiki/Magic_8-Ball) that we would ask questions to and see what the fate of that question was. # Challenge Your challenge is to write a program (or function) that when run (or called), outputs (or returns) a random answer from the possi...
[Question] [ # Definitions * A **perfect square** is an integer which can be expressed as the square of another integer. For example, `36` is a perfect square because `6^2 = 36`. * A **squarefree number** is an integer which is not divisible by any perfect square, except by `1`. For example, `10` is a squarefree nu...
[Question] [ # Background A **[triangular grid](http://mathworld.wolfram.com/TriangularGrid.html)** is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid. ![](https://i.stack.imgur.com/pmooq.gif) A **triangular lattice point*...
[Question] [ ## Challenge Given an input of an integer, \$n\$ (where \$0<n<50\$), output the graph of \$y=\mathrm{Re}((-n)^x)\$ from \$x = -3\$ to \$x = 3\$ inclusive. Where \$\mathrm{Re}(p)\$ is the real part of the complex number \$p\$. Note that \$\mathrm{Re}((-n)^x) = n^x \cos{(\pi x)}\$ ## Output The output ma...
[Question] [ ## Task description In number theory, the [Carmichael function](https://en.wikipedia.org/wiki/Carmichael_function) ***λ*** takes a positive integer **n** and returns the least positive integer **k** so that the **k**-th power of each integer [coprime](https://en.wikipedia.org/wiki/Coprime_integers) to ...
[Question] [ **Monday numbers**, as defined by [Gamow](https://puzzling.stackexchange.com/users/8874/gamow) in [this question](https://puzzling.stackexchange.com/questions/22666/the-largest-monday-number) over on Puzzling, are positive integers *N* with the following three properties: * The decimal representation o...
[Question] [ A lexicographically increasing number is an integer whose digits are in strictly increasing order. Print all lexicographically increasing numbers under 10000. Here are lines of the expected output: ``` 0 1 2 3 4 5 6 7 8 9 12 13 14 15 16 17 18 19 23 24 25 26 27 28 29 34 35 36 37 38 39 45 46 47 48 49 56...
[Question] [ ### Challenge Write a program that reorders the ASCII characters! It should output a single string containing all of the printable ASCII characters exactly once. The first character of this string is assigned the value 1, the second character the value 2, and so on. If two characters are normally next ...
[Question] [ ## Description Count how many occurrences there are of the digit **1** between two given numbers \$[a, b]\$, inclusive. For example, from 1 to 100 it should be 21: **1**, **1**0, **11**, **1**2, **1**3, **1**4, **1**5, **1**6, **1**7, **1**8, **1**9, 2**1**, 3**1**, 4**1**, 5**1**, 6**1**, 7**1**, 8**1...
[Question] [ # Challenge This is a simple one: Given a positive integer up to 1,000,000, return the closest prime number. If the number itself is prime, then you should return that number; if there are two primes equally close to the provided number, return the lower of the two. Input is in the form of a single int...
[Question] [ Your task is to create a program that will display the following text, wait for the user to press a key (it is okay to ignore keys like `ctrl`, `alt`, `caps lock`, etc., as long as keys like `letters`, `numbers`, `symbols`, and `enter` are not ignored), and then terminate the program: ``` Press any key...
[Question] [ An 'Even string' is any string where the [parity](https://en.wikipedia.org/wiki/Parity_(mathematics)) of the ASCII values of the characters is always alternating. For example, the string `EvenSt-ring$!` is an even-string because the ASCII values of the characters are: ``` 69 118 101 110 83 116 45 114 1...
[Question] [ There has been a question about [yes](https://codegolf.stackexchange.com/questions/42428/yes-is-91-lines-long) in the past, but this one is slightly different. You see, despite `yes` having a rather long size, it is incredibly fast. Running the following command: ``` timeout 1s yes > out ``` yields a f...
[Question] [ *Note:* There are some rude words in this question. There's an implicit puzzle posed in this [classic Monty Python sketch](https://www.youtube.com/watch?v=-gwXJsWHupg) (you can also ready the [script](http://www.montypython.net/scripts/wood.php) online). Various phrases are described as being 'woody' ...
[Question] [ In this challenge, submissions will be programs or function which, when given an emoticon such as `:-)`, `:(`, or `:D`, will rate their happiness from 0 to 3. An emoticon will be one of the following: * `:(`: 0 * `:|`: 1 * `:)`: 2 * `:D`: 3 Emoticons may also have noses (a `-` after the `:`). Test case...
[Question] [ An [EAN-8](https://en.wikipedia.org/wiki/EAN-8) barcode includes 7 digits of information and an 8th checksum digit. The checksum is calculated by multiplying the digits by 3 and 1 alternately, adding the results, and subtracting from the next multiple of 10. For example, given the digits `2103498`: ```...
[Question] [ The least common multiple of a set of positive integers `A` is the smallest postive integer `B` such that, for each `k` in `A`, there exists a positive integer `n` such that `k*n = B`. Given at least two positive integers as input, output their least common multiple. ## Rules * Builtins are allowed, bu...
[Question] [ In this challenge, you will play the noisy iterated prisoner's dilemma. The [Prisoner's dilemma](https://en.wikipedia.org/wiki/Prisoner's_dilemma) is a scenario in game theory where there are two players, each with two options: cooperate, or defect. Each player does better for themself if they defect t...
[Question] [ ## Definition An [arrowhead matrix](https://en.wikipedia.org/wiki/Arrowhead_matrix) is a [matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics)) that has all entries equal to **0**, except the ones on the main diagonal, top row and leftmost column. In other words, the matrix should look like this:...
[Question] [ Pretty simple challenge today: Write a program or function that takes in a positive integer N and prints or returns a ***sorted*** list of the ***unique*** numbers that appear in the [multiplication table](https://en.wikipedia.org/wiki/Multiplication_table) whose row and column multiplicands both range...
[Question] [ # CodeGolf Challenge PWSSHHHH! You wake up in a cryogenics lab in the year 3000. Upon being escorted to the assignment office to receive your career chip, presumably that of a delivery boy, a probe detects that you are from the year 2000. Because of this, and a few stereotypes, you are assumed stupid c...
[Question] [ Given an array of positive integers in base 10, where `n > 0`, output their representation of a binary wall. **How does this work?** 1. Convert each number to it's binary representation. 2. Pad the representation with leading zeroes to the length of the longest one i.e. `1, 2` -> `1, 10` -> `01, 10`. 3...
[Question] [ It's my 17th birthday and you're invited to my party! And as always at parties, there will be cake. One cake... And you need as much of it as possible. As this is a fair party, each of us will say how much of my cake we want and the person who said the smallest amount will get it. Then everyone else g...
[Question] [ According to [RollingStone](http://www.rollingstone.com/music/lists/100-greatest-singers-of-all-time-19691231), below are the 26 greatest singers of all time: ``` Aretha Franklin Al Green Ray Charles Robert Plant Elvis Presley Mick Jagger Sam Cooke Tina Turne...
[Question] [ Your challenge is to passwordify the string! What is passwordifying, you ask? Take a string as input. This string will only contain uppercase letters, lowercase letters, digits, and spaces. You must replace all spaces with underscores and move all numbers to the end of the string in the order that the...
[Question] [ Write the shortest code for finding the sum of primes between \$a\$ and \$b\$ (inclusive). **Input** 1. \$a\$ and \$b\$ can be taken from command line or stdin (space seperated) 2. Assume \$1 \le a \le b \le 10^8\$ **Output** Just print the sum with a newline character. **Bonus Points** 1. If the progr...
[Question] [ ## Introduction In this challenge you should split an integer into two pieces. Since nobody likes getting the smaller piece of cake, your goal is to be as fair as possible. For example if you wanted to split the integer `7129` into two pieces, there are 3 possible ways of doing so. `7,129`, `71,29` and...
[Question] [ Without taking any input, output this exact text: ``` A B A C B A D C B A E D C B A F E D C B A G F E D C B A H G F E D C B A ...
[Question] [ # Round away from zero Inspired by [Round towards zero](https://codegolf.stackexchange.com/q/190670/52194). Given a number input via any reasonable method, round the number "away from zero" - positive numbers round up, and negative numbers round down. If you intend to take the input as a string (via ST...
[Question] [ A polyquine is both quine and polyglot.1 You are to write a quine which is valid in at least two different languages. This is code golf, so the shortest answer (in bytes) wins. 1 I made that up. Or rather, [Geobits did](http://chat.stackexchange.com/transcript/240?m=17522730#17522730). Apparently, [he ...
[Question] [ My Precalc teacher has one of his favorite problems that he made up (or more likely ~~stole~~ inspired by [xkcd](https://blog.xkcd.com/2009/09/02/urinal-protocol-vulnerability/)) that involves a row of `n` urinals. "Checkmate" is a situation in which every urinal is already occupied OR has an occupied ...
[Question] [ ## Challenge: **Input:** A list of distinct positive integers within the range \$[1, \text{list-size}]\$. **Output:** An integer: the amount of times the list is [riffle-shuffled](https://upload.wikimedia.org/wikipedia/commons/7/7c/Riffle_shuffle.jpg). For a list, this means the list is split in two ha...
[Question] [ There are already [30 challenges dedicated to pi](https://codegolf.stackexchange.com/questions/tagged/pi) but not a single one asks you to find the nth decimal, so... # Challenge For any integer in the range of `0 <= n <= 10000` display the nth decimal of pi. # Rules * Decimals are every number after `...
[Question] [ Given the name of an HTTP status code, such as `OK` or `Continue`, output or return the corresponding number. Your code is limited to **200 bytes**, and the winner is the answer that correctly finds the number for the most status codes. For this challenge, the status codes your program should handle ar...
[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 7 years ago....
[Question] [ # It's all in the title... Take as input a positive integer `n>=12` and... do what the title says. Yes, this is on OEIS [A187924](https://oeis.org/A187924). **Some test cases** ``` 12 -> 912 13 -> 11713 14 -> 6314 15 -> 915 16 -> 3616 17 -> 15317 18 -> 918 19 -> 17119 20 -> 9920 40 -> ...
[Question] [ # Church booleans A [Church boolean](https://en.wikipedia.org/wiki/Church_encoding#Church_Booleans) is a function that returns `x` for true and `y` for false where `x` is the first argument to the function and `y` is the second argument to the function. Further functions can be composed from these func...
[Question] [ My wife is very, let's say, particular when it comes to putting ornaments on our Christmas tree. Let's get her some code to help her in this trying time. ### Input Given an input `2 < n < 10` the height of the tree and `0 < k < n` the distinct number of ornaments. ### Task Decorate the tree starting wi...
[Question] [ Your task is to create a program that will, given an input image, create an output image of the same size, where all pixels are ordered by hex value. Your program may: * Sort the pixels from left to right and then down or first sort down in columns and then right. In any case, the top left pixel is the...
[Question] [ # Results (May 22 2017 21:40:37 UTC) [`Master`](https://codegolf.stackexchange.com/a/121038/42649) won 18 rounds, lost 2 rounds, and tied 0 rounds [`Save One`](https://codegolf.stackexchange.com/a/120848/42649) won 15 rounds, lost 3 rounds, and tied 2 rounds [`Machine Gun`](https://codegolf.stackex...
[Question] [ I have an ASCII-art box and I need a program to open it. ## Examples Input: ``` ------- | | |_____| ``` Output: ``` / / / / / / / | | |_____| ``` # Specification * The first line will only consist of `-`, at least 3 of them * The middle rows will start with `|` have spaces,...
[Question] [ As input you will receive * An integer \$a\$ * A list of integers that is *infinite* and *strictly-monotonic*1. Your program should check **in finite time** if \$a\$ appears the list. You should output one of two distinct values. One if \$a\$ appears in the list and the other if \$a\$ does not. This is...
[Question] [ Your job is to write a program (or two separate programs) in any language that: 1. Can take a completed Sudoku board as input (in any logical format) and compress it into a string of characters 2. Can take the compressed string as input and decompress it to get the *exact* same completed Sudoku board (...
[Question] [ You work at a bakery and every day you make exactly 100 bagels. However your customers are not as reliable and every day a random number of bagels will be ordered. So sometimes you will run out of bagels and sometimes you will have leftovers. Now leftover bagels will still be good for 1 more day. After...