text
stringlengths
180
608k
[Question] [ Your challenge today is to output a given term of a sequence enumerating all of the integers. The sequence is as follows: If we have a 0-indexed function generating the sequence `f(n)` and `ceil(x)` is the ceiling function, then `f(0) = 0`; `abs(f(n)) = ceil(n/2)`; `sign(f(n))` is positive when `n` and...
[Question] [ Given a 2-dimensional [jagged array](https://en.wikipedia.org/wiki/Jagged_array) and a fill value, pad the array in both dimensions with the fill value to ensure that it is square and not jagged (i.e., all rows are the same length, and that length is the same as the number of rows). The fill values sho...
[Question] [ [Robbers' Thread](https://codegolf.stackexchange.com/questions/231322) Your challenge is to find an existing challenge, and implement it in a way such that certain inputs fail. At least one input must not produce the correct output (use the other submissions on the challenge as a reference for this, bu...
[Question] [ Every now and again, I'll encounter a large string of alphabetical text encoded as numbers from 1-26. Before I knew that I could just google a translator online, I had to personally, painstakingly copy and paste the entirety of the encoded text into a text document and translate it myself. Thankfully, ...
[Question] [ ## Flavortext The [Bystander Effect](https://en.wikipedia.org/wiki/Bystander_effect) is a phenomenon where individuals are less likely to help a victim if other people are present. The idea is that as there are more people around, the individual burden is less, and each individual thinks "someone else ...
[Question] [ Write a software that prints on stdout the number of answers and the number of comments(visible and collapsed of question and answers) of this question/page. Your script must run with this page closed when it starts. Expected example output: ``` A12C40 ``` Where A stands for Answers and C for Comments....
[Question] [ Your task is to build a program that identifies the shape of the input. The shapes to be identified can be any of the following: ### Square To be identified as a square, the source must have lines of all equal length, and the same number of lines as characters per line (newline characters excluded). An...
[Question] [ Given a string, find the first word starting with each letter (case insensitive). ### Sample Using `Ferulas flourish in gorgeous gardens.` as input: ``` "Ferulas flourish in gorgeous gardens." ^^^^^^^ ^^ ^^^^^^^^ | | | | | --> is the first word starting with ...
[Question] [ Infix notation is a method of printing mathematical expressions where each operator sits between its two arguments, such as \$ \left(5 \cdot 4\right) + 3 \$. Prefix notation is a method of printing expressions where operators sit before their arguments. The equivalent of the above is `+*543`. It's a bi...
[Question] [ Let's start with the natural numbers ``` [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,...
[Question] [ [Halley's Comet](https://en.wikipedia.org/wiki/Halley%27s_Comet) is the only comet that may appear (i.e. become visible to the naked eye on Earth) twice in a human lifetime. The orbital period of Halley's Comet is not constant: it has varied between 75 to 79 Earth years since the first definite apparit...
[Question] [ Given a list of positive integers, find the number of triangles we can form such that their side lengths are represented by three distinct entries of the input list. (Inspiration comes from [CR](https://codereview.stackexchange.com/questions/226885/counting-the-triangles-that-can-be-formed-from-segment...
[Question] [ ## Challenge Given a three digit octal permissions number, output the permissions that it grants. ## chmod On UNIX OSes file permissions are changed using the `chmod` command. There are few different ways of using chmod, but the one we will focus on today is using octal permissions. The three digits in...
[Question] [ Following the fine tradition of questions such as [Find the largest prime whose length, sum and product is prime](https://codegolf.stackexchange.com/questions/35441/find-the-largest-prime-whose-length-sum-and-product-is-prime?rq=1) , this is a variant on a largest prime challenge. **Input** Your code s...
[Question] [ What general tips do you have for golfing in Go? I'm new to Code Golfing and looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Go. Please keep to one tip per answer. [Answer] Inspired by @EMBLEM's answer [here](https://codegolf.stackexcha...
[Question] [ In this challenge, you will be given a text block, and you need to perform reflection on the text. # Input: 1. A string to be reflected. The text may *not* be supplied as an array whose elements are the lines of text. For example, `"ab\ncd"` and `['a','b','\n','c','d']` are allowed, but `['ab','cd']` o...
[Question] [ If you are unfamiliar with hacker typer, see [hackertyper.net](http://hackertyper.net). In short, it is a program that outputs one chunk of a code base per keystroke for comedic effect. BUT, the hackertyper.net version is far too easy to implement. It simply outputs three characters at a time from an *...
[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/19196/edit). Closed 3 years ago. The community reviewed whether to reopen thi...
[Question] [ In this question I will talk about programs as strings, this is strings of bytes, not characters. How your resultant program is rendered or displayed is not important to this challenge, only how it appears in memory matters. A [pristine program](https://codegolf.stackexchange.com/questions/63433/progra...
[Question] [ Your input is a list/sequence/vector/array of 5-255 positive integers, not necessarily unique. You may assume whatever input format is most suitable, and that each integer (as well as the quantity of integers) is chosen uniformly at random from the range 5-255. The goal is to output the same list, in t...
[Question] [ Everyone is likely familiar with the following [song](https://en.wikipedia.org/wiki/Row,_Row,_Row_Your_Boat), which is [a musical round](https://en.wikipedia.org/wiki/Round_(music)): [![The song.](https://i.stack.imgur.com/q5hML.png)](https://i.stack.imgur.com/q5hML.png) # Background Fewer people might...
[Question] [ (First challenge, please let me know if there are any problems with it.) A ***heterogram*** is a word where no letter of the alphabet occurs more than once, and a ***palindrome*** is a phrase that is the same backwards and forwards. The challenge here is to write a piece of code that takes in a word (...
[Question] [ The shortest code that finds all *unique* "sub-palindromes" of a string, that is: any substring with length > 1 that is a palindrome. eg.1 ``` input: "12131331" output: "33", "121", "131", "313", "1331" ``` eg.2 ``` input: "3333" output: "33", "333", "3333" ``` [Answer] ## J, 24 ~~31~~ ~~40~~ ``` ...
[Question] [ Given an input of two integers *n* and *m*, output an ASCII ladder of length *n* and size *m*. This is an ASCII ladder of length 3 and size 3: ``` o---o | | | | | | +---+ | | | | | | +---+ | | | | | | o---o ``` This is an ASCII ladder of length 5 and size 1: ``` o-o | | +-+ | | +-+ | ...
[Question] [ # Introduction Let's start by arranging all fractions from 0 to 1 in order of lowest denominator, then lowest numerator: 1/2, 1/3, 2/3, 1/4, 3/4, 1/5, 2/5, 3/5, 4/5, 1/6, 5/6, 1/7... Note that duplicates aren't counted, so I haven't listed 2/4, 2/6, 3/6, or 4/6, since they already appeared in their sim...
[Question] [ A *radioactive quine* is a [quine](http://en.wikipedia.org/wiki/Quine_(computing))-like program that has an even number of characters and, when run, outputs itself with exactly half of its characters removed. The output itself may be a radioactive quine, so the program can "[decay](http://en.wikipedia....
[Question] [ # The Collatz sequence Given a positive integer \$a\_1\$, the [Collatz sequence](https://en.wikipedia.org/wiki/Collatz_conjecture) with starting value \$a\_1\$ is defined as \begin{equation} a\_{n+1} = \begin{cases} a\_n/2 & \mathrm{if}\ a\_n\ \mathrm{is}\ \mathrm{even} \\ 3a\_n+1 & \mathrm{if}\ a\_n\ ...
[Question] [ # Reverse and Invert a String ## Challenge In this challenge. You'll be writing a program which will output or return the input, reversed and inverted. First, each character should be converted to its character code. Then, that should be converted to base-2. Following, that string should be reversed. A...
[Question] [ # Background In the online graphing calculator [Desmos](https://www.desmos.com/calculator), there is a certain shape that appears in the lower left portion of the graph in many high detail graphs, which the Desmos community has dubbed "Bernard". You can see an example of it in this [graph](https://www....
[Question] [ **This challenge was posted as part of the [April 2018 LotM challenge](https://codegolf.meta.stackexchange.com/q/16116/31716), as well as for Brain-flak's 2nd birthday** --- I was thinking about what the most efficient way to encode brain-flak programs would be. The obvious thing to do, since there are...
[Question] [ ### Introduction A [**queue**](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) is an abstract data type where elements are **added to the front** (enqueue) and **removed from the back** (dequeue). This is also known as the [FIFO (First In First Out)](https://en.wikipedia.org/wiki/FIFO_(comput...
[Question] [ Your task: given an input string, determine whether the binary representation of that string does not have 4 `1`s or `0`s in a row, anywhere. Furthermore, your code itself should not contain any such runs of four in a row. ## Test Cases ``` String Binary Result U3 01010101 00...
[Question] [ Output one random character for each character of source code (as illustrated below). The probability of each character is its frequency in the original source code. Thus the output will be fake source code resembling a quine. # Specification * **Restrictions** + Standard [quine](/questions/tagged/qui...
[Question] [ The age-old question - is it better to walk or run? There are two trains of thought. If you run, you cause the rain to effectively hit you from the front, which increases your surface area and basically causes you to run into the raindrops, getting hit with more water. However, if you walk, you spend l...
[Question] [ When you edit a post on SE, any further edits within a 5-minute grace period are merged into it. Given a list of times you edit a post, count the edits not in a grace period. Say you edit at minutes `[0,3,4,7,9,10,11,12]`. This results in 3 edits at times `[0,7,12]`, with the rest happening in their gr...
[Question] [ The title of Numberphile's newest video, [13532385396179](https://www.youtube.com/watch?v=3IMAUm2WY70), is a fixed point of the following function \$f\$ on the positive integers: > > Let \$n\$ be a positive integer. Write the prime factorization in the usual way, e.g. \$60 = 2^2 \cdot 3 \cdot 5\$, in ...
[Question] [ Write a program that takes as its input a string that outputs a string with the following properties. * If a character in the string is an uppercase letter (ASCII 41-5A), then the character is replaced by a string containing every letter up to and including the original letter in upper case. For exampl...
[Question] [ A [**Walsh matrix**](https://en.wikipedia.org/wiki/Walsh_matrix) is a special kind of square matrix with [applications in quantum computing](https://en.wikipedia.org/wiki/Quantum_logic_gate#Hadamard_gate) (and probably elsewhere, but I only care about quantum computing). ### Properties of Walsh matrice...
[Question] [ ## Introduction Yesterday I saw a [birthday puzzle](https://codegolf.stackexchange.com/questions/57277/its-my-birthday-d). Congrats!! Also this week I watched an episode of the TV show *Bones* where a dead body was found buried under a tree. To calculate the time of death, they counted the tree rings. ...
[Question] [ Here's a pixelated 5 by 7 font for the digits 0 through 9: ``` .███. █...█ █...█ █...█ █...█ █...█ .███. ..█.. ███.. ..█.. ..█.. ..█.. ..█.. █████ .███. █...█ ....█ ...█. ..█.. .█... █████ .███. █...█ ....█ ..██. ....█ █...█ .███. █..█. █..█. █..█. █████ ...█. ...█. ...█. █████ █.... █.... .███. ....█ ...
[Question] [ Given an integer, output an upside-down tent. The input determines both the size of the tent (absolute value) and whether the entrance is on the left side (negative numbers) or the right side (positive numbers). ``` If input = -1: ____ \/_/ If input = -2: ________ \ / / \/___/ If input = -3: ______...
[Question] [ Find the longest run of true in a list of booleans. Return the same list, with all other trues falsified. ## Input, output A list; any usual format (e.g., a delimited list as a string). ## Details True and false can be anything your language typically uses for those values, or the integers 1 and 0. If ...
[Question] [ A newspaper is made of several sheets; for the purposes of this question, each sheet of newsprint holds four pages of the final newspaper. Here is an example of three sheets of newsprint making up a newspaper with twelve pages: ``` ___________ |2 | 11| | ___|_____|_ | |4 | 9| |_| ___|____...
[Question] [ ## Challenge Given a list of **unique** colour names as input, sort them in the order that they first appear in [Joseph's Amazing Technicolour Dreamcoat](https://youtu.be/snYP49EAIWg?t=2m51s). --- ## Example ``` Input: green, blue, red, brown Output: red, green, brown, blue ``` The full list of colour...
[Question] [ Write three different programs such that when any one program is provided as input to one of the other two, you get the source of the remaining program as output. More explicitly, given programs \$A\$, \$B\$, and \$C\$, where \$f(g)\$ denotes the output obtained from inputting the text of program \$g\$...
[Question] [ ## Challenge: There's a silly puzzle circulating on social networks that reads: ``` 8 + 2 = 16106 5 + 4 = 2091 9 + 6 = ? ``` Implement a function or operator that, when given two positive integer numbers `x` and `y` such that `x > y > 0`, yields the correct answer as an **integer**, where the answer's ...
[Question] [ Mini-Flak is a subset of the [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak) language, where the `<>`, `<...>` and `[]` operations are disallowed. Strictly speaking it must *not match* the following regex: ``` .*(<|>|\[]) ``` Mini-Flak is the smallest known Turing complete subset of Brain-Flak. ...
[Question] [ I came up with a series of numbers the other day and decided to check what the OEIS number for it was. Much to my surprise, the sequence did not appear to be in the OEIS database, so I decided to name the sequence after myself (note that someone else who's a lot smarter than me has probably already com...
[Question] [ In English, nouns can take on two different forms depending on whether they are singular (one) or plural (anything else). For example, we would say "1 dog" but "2 dogs", "0 dogs", "57 dogs" and so forth. In Russian, there are three categories. Instead of "1 dog, 2 dogs, 5 dogs", in Russian it would be ...
[Question] [ Write a complete program that takes a boolean or non-negative integer input. It must: * Output its own source code if the input value is falsy * Output its own source code in reverse if the input value is truthy Your program cannot be palindromic, nor can it read its own source code by any means. This ...
[Question] [ Keeping this challenge short. You are given 4 numbers: p1, p2, p3 and p4. The magic sum of the numbers are defined as follows: ``` magic_sum = |p1 - p2| + |p2 - p3| + |p3 - p4| + |p4 - p1| ``` You are only allowed to change one of the above integer values (p1, p2, p3 or p4). You need to change the valu...
[Question] [ You will need to generate the smallest prime with `n` digits, and it will only contain digits specified in the list `k`. ### Examples: Input: ``` 4 1 2 ``` For this, you must generate the smallest prime with `4` digits, and that prime must only contain the digits `1` and `2`. Output: ``` 2111 ``` Input...
[Question] [ What general tips do you have for golfing in brainfuck? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to brainfuck (e.g. "remove comments" is not an answer). Please post one tip per answer. [Answer] Putting one tip per answer would b...
[Question] [ Ruby has a strange operator, `..`, called [flip-flop](https://ruby-doc.org/core-3.1.2/doc/syntax/control_expressions_rdoc.html#label-Flip-Flop) (not to be confused with the range operator, which looks the same). Used in a loop, flip-flop takes two conditions as operands and will return `false` until th...
[Question] [ Given a non-empty rectangular array of integers from `0` to `9`, output the amount of cells that are `8` and do not have a neighbour that is `8`. Neighbouring is here understood in the [Moore sense](https://en.wikipedia.org/wiki/Moore_neighborhood), that is, including diagonals. So each cell has `8` ne...
[Question] [ This is sequence [A054261](https://oeis.org/A054261) The \$n\$th prime containment number is the lowest number which contains the first \$n\$ prime numbers as substrings. For example, the number \$235\$ is the lowest number which contains the first 3 primes as substrings, making it the 3rd prime contai...
[Question] [ Let's start by defining a **reflection** of a character in a string: > > Given a string with distinct lowercase alphabetical letters with no spaces such > as `abcdefg`, define a reflection of a letter in the string `c` as > moving it (without changing the order of any other letter) to a new > place...
[Question] [ Your task is to given two integer numbers, `a` and `b` calculate the modular multiplicative inverse of a modulo b, if it exists. The modular inverse of `a` modulo `b` is a number `c` such that `ac ≡ 1 (mod b)`. This number is unique modulo `b` for any pair of `a` and `b`. It exists only if the greate...
[Question] [ A straight-chain alk\*ne is defined as a sequence of carbon atoms connected by single (alkane), double (alkene), or triple bonds (alkyne), (implicit hydrogens are used.) Carbon atoms can only form 4 bonds, so no carbon atom may be forced to have more than four bonds. A straight-chain alk\*ne can be rep...
[Question] [ Your challenge, should you choose to accept it, is, given an integer `K >= 1`, find non-negative integers `A` and `B` such that at least one of the two conditions following hold: 1. `K = 2^A + 2^B` 2. `K = 2^A - 2^B` If there does not exist such `A` and `B`, your program may behave in any fashion. (To ...
[Question] [ Create a function or program that takes a number as input, and outputs a string where ASCII-code points for the lower and upper case alphabet are substituted by their character equivalents. * The upper case alphabet use the code points: `65-90` * The lower case alphabet use the code points: `97-122` If...
[Question] [ Time for another easy challenge in which all can participate! The multinomial theorem states: $$(x\_1 + x\_2 + \cdots + x\_m)^n = \sum\_{k\_1 + k\_2 + \cdots + k\_m = n} \binom n {k\_1, k\_2, \dots, k\_m} \prod\_{1 \le t \le m} x\_t^{k\_t}.$$ The expression in parentheses is the multinomial coefficient...
[Question] [ In this challenge you will take a an ascii art image of a highway like so ``` | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` And you need to put rain across its lanes like so ``` |\\\|\\\| |\\|\\| |\\\\\...
[Question] [ # Introduction The [**\$n\$-ellipse**](https://en.wikipedia.org/wiki/N-ellipse) is a generalization of the ellipse with possibly more than two foci. Specifically, given \$n\$ points on the plane, called foci, the \$n\$-ellipse is the set of points of the plane whose sum of distances to the \$n\$ foci i...
[Question] [ **This question already has answers here**: [Find two integers from an unordered list to sum to the input](/questions/113365/find-two-integers-from-an-unordered-list-to-sum-to-the-input) (26 answers) Closed 6 years ago. # The Task This is my first challenge so apologies if it is very simple! In ...
[Question] [ I thought of a new way to generate my passwords, and even though it's probably not very clever in the long run, it could still make for a fun code-golf. Taking a string of words, the password is generated thus: * Pick the *nth* character in the *nth* word * If *n* is larger than the word, continue coun...
[Question] [ ## Task Given two positive integers, output the number of carries needed to add them together in long addition in base 10. ## Examples ``` ¬π¬π¬π <-- carries 999 + 1 ---- 1000 ``` Three carries are needed. ``` ¬π 348 + 91 ---- 439 ``` One carry is needed. ## Testcases ``` 999, 1 -> 3 398, 91 ...
[Question] [ A list of positive integers can be visualized as a quantized mountain range where each list entry represents the height of one vertical section of the mountains. For example, the list ``` 1, 2, 2, 3, 4, 3, 5, 3, 2, 1, 2, 3, 3, 3, 2, 2, 1, 3 ``` can become the range ``` x x x xxxxx ...
[Question] [ The objective of this challenge is to write a program to convert an inputed string of what can be assumed as containing *only* letters and numbers from as many bases between 2 and 36 as possible, and find the base 10 sum of the results. The input string will be converted to all the bases in which the n...
[Question] [ In Python, one can save bytes by aliasing functions that are used repeatedly. For example: ``` r=range a=r(100) b=r(200) c=r(300) ``` However, when the functions are member functions together, I don't know how to alias them in a way that allows chaining. For example: ``` s='Hello' // Plain code s=s.rep...
[Question] [ Being a big fan of the Rubik's cube and of cool art, I've been working on combining the two together to do some really cool stuff. Basically solving miniature Rubik's cubes to form rudimentary pixels in the formation of Rubik's cube art. Examples of such art can be seen via this link: <http://google.co...
[Question] [ Let's consider the sequence of the binary representation of positive integers (without any leading zero): ``` 1 2 3 4 5 6 7 8 9 10 11 12 ... 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 ... ``` If we join them together, we get: ``` 1101110010111011110001001101010111100 ... ```...
[Question] [ This challenge is a simple ASCII-art challenge inspired by the [solar eclipse](https://www.timeanddate.com/eclipse/globe/2017-august-21) that happened on August 21, 2017. Given an input `0 <= n <= 4`, output the corresponding stage of the eclipse described below: ``` n=0: ***** ** ** * ...
[Question] [ 2013 has the prime factorization `3*11*61`. 2014 has the prime factorization `2*19*53`. An interesting property regarding these factorizations is that there exist distinct primes in the factorizations of 2013 and 2014 that sum to the same number: `11+61=19+53=72`. Write a program or function that takes...
[Question] [ I recently decided to download some dictation software, in order to help with my writing. However, it doesn't work very well when I'm coding, since I have to change from saying words to symbols and back again. It's even worse when I'm coding in an esoteric language which is *all* symbols. In order to m...
[Question] [ A number spiral is an infinite grid whose upper-left square has number 1. Here are the first five layers of the spiral: [![enter image description here](https://i.stack.imgur.com/m4ei9.png)](https://i.stack.imgur.com/m4ei9.png) **Your task is to find out the number in row y and column x.** --- Example:...
[Question] [ The [London Underground A.K.A. The Tube](https://simple.wikipedia.org/wiki/London_Underground) is the oldest underground railway in the world, it currently consists of eleven lines\* servicing 267 named stations (strictly 269\*\* stations since "Edgware Road" and "Hammersmith" each occupy two locations...
[Question] [ Write a program or function (hereafter "function") that returns or prints the source code of four new functions: Increment, decrement, undo, and peek. The initial function contains an internal integer value of `0`. Each of the returned functions contains a value based on that value, and each behaves di...
[Question] [ Given a word (or any sequence of letters) as input, you must interpolate between each letter such that each adjacent pair of letters in the result is also adjacent on a QWERTY keyboard, as if you typed the input by walking on a giant keyboard. For example, '**yes**' might become '**y**tr**es**', '**cat...
[Question] [ Write the shortest code measured by byte count to generate an ASCII grid composed of rhombi, given the following parameters: * m - number of complete rhombi in one row * n - number of rows * s - side of the smallest rhombus * r - level of nesting - how many rhombi are there inside the "base ones" (whic...
[Question] [ This challenge is similar to [this old one](https://codegolf.stackexchange.com/q/3783/3808), but with some unclear parts of the spec hammered out and less strict I/O requirements. --- Given an input of a string consisting of only printable ASCII and newlines, output its various metrics (byte, word, lin...
[Question] [ Related: [Calculate \$f^n(x)\$](https://codegolf.stackexchange.com/q/137527/78410), [Polynomialception](https://codegolf.stackexchange.com/q/78334/78410) ## Challenge Given a polynomial \$f(x) = a\_0 + a\_1 x + a\_2 x^2 + \cdots + a\_k x^k\$ of order \$k\$, we can compute its composition with itself \$...
[Question] [ Everyone's been freaking out about that stupid "Flappy Bird" game being removed. So, your task is to crate a Flappy Bird Clone game. Its really simple. Here are the guide lines: * It can use either ascii art or real images * You can make your "bird" flap with either a click or a key press * It should t...
[Question] [ The [Hadamard transform](https://www.mathworks.com/help/signal/examples/discrete-walsh-hadamard-transform.html) works similarly to the Fourier transform: it takes a vector and maps it to its frequency components, which are the [Walsh functions.](http://mathworld.wolfram.com/WalshFunction.html) Instead ...
[Question] [ When babies open their mouths, they're not just spewing gibberish. They're actually talking in a highly advanced, adult-proof cipher... # The Baby-talk Cipher When a baby talks, it could look something like `gogooa gagooook aagaaoooy` Each single-space separated section represents a character (so the e...
[Question] [ Given an integer **1 ≤ N ≤ 1,000,000** as input, output the last non-zero digit of **N!**, where **!** is the factorial (the product of all numbers from **1** to **N**, inclusive). This is OEIS sequence [A008904](//oeis.org/A008904). Your program needs finish within 10 seconds on a reasonable machine f...
[Question] [ Well... there are 59 (now 60) questions tagged [sorting](/questions/tagged/sorting "show questions tagged 'sorting'"), but no simple quicksorts. That must be fixed. For those unfamiliar with [quicksort](https://en.wikipedia.org/wiki/Quicksort), here is a breakdown, courtesy of Wikipedia- 1. Pick an el...
[Question] [ Tomorrow, November 23rd, is [Thanksgiving Day](https://en.wikipedia.org/wiki/Thanksgiving) in the United States. To prepare, you need to cook up some ASCII turkeys. However, since you're late in planning, you need a program (or function) to help you with how many birds you need to prepare. ``` .-...
[Question] [ It is the year 87,539,319 and solitary space-walking is now commonplace, many people travel into space by themselves, propelled by nothing but a jetpack on their backs, programming their course with a personal computer and keyboard as they go. You are one such person; you were out on a lovely, peaceful...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 6 years ago. [Improve this quest...
[Question] [ This is my first challenge! ### Background [Perfect number](https://en.wikipedia.org/wiki/Perfect_number) is a positive integer, that is equal to the sum of all its divisors, except itself. So `6` is perfect number, since `1 + 2 + 3 = 6`. On the other hand `12` is not, because `1 + 2 + 3 + 4 + 6 = ...
[Question] [ The next revolution in typing on laptops was released on the [first of April, 2014 by SwiftKey](http://www.youtube.com/watch?v=-QfhTWJIDCM). However, I want to be the first person to write a swiping nano clone, but, as I can't find a good swipe-text to real-text library, and I can't wait for them, I'm ...
[Question] [ ## Introduction: I saw there was only [one other badminton related challenge right now](https://codegolf.stackexchange.com/questions/44900/confused-badminton-players). Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the first one: ## ...
[Question] [ In set theory, the natural numbers \$\mathbb{N} = \{0, 1, 2, 3, ...\}\$ are usually encoded as [pure sets](https://en.wikipedia.org/wiki/Hereditary_set), that is sets which only contain the empty set or other sets that are pure. However, not all pure sets represent natural numbers. This challenge is ab...
[Question] [ The gambler's fallacy is a cognitive bias where we mistakenly expect things that have occurred often to be less likely to occur in the future and things that have not occurred in a while to be more likely to happen soon. Your task is to implement a specific version of this. ## Challenge Explanation Wri...
[Question] [ # It was a warm summer evening... when my stupid car decided to break down in the middle of the road on my way back from the supermarket. I pushed it to the sideline and decided to walk home. I opened the trunk to take out the grocery and remaining stuff. It was then that I noticed the items were not e...
[Question] [ I can have a large `if/else` condition for each 30 minutes but I'm looking for more math and Unicode based solution. Here are clock emojis: 🕐🕑🕒🕓🕔🕕🕖🕗🕘🕙🕚🕛🕜🕝🕞🕟🕠🕡🕢🕣🕤🕥🕦🕧. If you lack proper rendering support, you can see them below (the...
[Question] [ Code a program or function to construct an interactive canvas on the screen of at least 400 pixels x 400 pixels in size. The canvas can be any color you wish, bordered or borderless, with or without a title bar, etc., just some form of obvious canvas. The user will click on two distinct areas of the ca...
[Question] [ Take a flag, like this one: ``` ----------------------------- | | | | | | |=============+=============| | | | | | | ----------------------------- ``` And a number input: the "wave length" Say the wave length...
[Question] [ ## Background An \$n\$-bit [Gray code](https://en.wikipedia.org/wiki/Gray_code) is an ordering of \$2^n\$ binary sequences so that adjacent sequences always differ by exactly one bit. A **[Beckett-Gray code](https://en.wikipedia.org/wiki/Gray_code#Beckett%E2%80%93Gray_code)** is a special kind of Gray ...