text
stringlengths
180
608k
[Question] [ Given a string as input find the longest *contiguous* substring that does not have any character twice or more. If there are multiple such substrings you may output either. You may assume that the input is on the printable ASCII range if you wish. ## Scoring Answers will first be ranked by the length o...
[Question] [ Write a program or a function that will output a given string in a staircase fashion, writing each part of a word that starts with a vowel one line below the previous part. For example: ``` Input: Programming Puzzles and Code Golf Output: Pr P C G ogr uzzl and ...
[Question] [ > > **This contest is over.** > > > Due to the nature of [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenges, the cops challenge becomes a lot easier when the interest in the associated robbers challenge has diminished. Therefore, while you ca...
[Question] [ Now that everyone has developed their (often amazing) low level coding expertise for [How slow is Python really? (Or how fast is your language?)](https://codegolf.stackexchange.com/questions/26323/how-slow-is-python-really-or-how-fast-is-your-language) and [How Slow Is Python Really (Part II)?](https:/...
[Question] [ It's Christmas everybody, and here's a code-golf challenge to celebrate. You need to make a program to print out a present. Specifically, the words "Merry Christmas". BUT, there is a catch: this program must only work if it is the 25th of December. If the code is run on any other day, then the program ...
[Question] [ Help, I've been diagnosed with prosopagnosia! This means I'm no longer able to recognise faces.... :( Can you help me? # The challenge You will be given an image as a matrix of regular ASCII characters separated by new line characters, and your task is to determine if it contains a face. Faces will loo...
[Question] [ **Introduction** Clarence is a data entry clerk who works at an internet service provider. His job is to manually enter the IP addresses of all of the ISP's customers into the database. He does this using a keypad which has the following layout: ``1````2````3`` ``4````5````6`` ``7````8````9`` ``....
[Question] [ Your goal is to check whether a completed [Minesweeper](http://en.wikipedia.org/wiki/Minesweeper_%28video_game%29) board is valid. This means that each number is a correct count of mines in cells adjacent to it, including diagonals. The board does not wrap around. [As usual](http://meta.codegolf.stacke...
[Question] [ [John Horton Conway](https://en.wikipedia.org/wiki/John_Horton_Conway) was a brilliant mathematician. Among his contributions were three Turing-complete esolangs: [Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) ([esolangs wiki](https://esolangs.org/wiki/Game_of_Life)), [FRACTRAN](...
[Question] [ You have a stack of [pancakes](http://en.wikipedia.org/wiki/Pancake) on a plate with a glob of syrup on top so thick it can't run down the sides. You won't be happy to eat until both faces of each pancake have at least touched the syrup, but right now only one face of the top pancake has. You know that...
[Question] [ # Background The computer game NetHack dates from 1987, before the use of graphics in computer games was widely established. There are lots of monsters in the game, and potentially a lot need to fit on screen at once, so monsters are drawn in a very minimal way: a monster is simply drawn as an ASCII ch...
[Question] [ The so-called [Will Rogers phenomenon](https://en.wikipedia.org/wiki/Will_Rogers_phenomenon) describes a way to tweak statistics by raising the average in two (multi)sets when one element is moved between the two sets. As a simple example, consider the two sets ``` A = {1, 2, 3} B = {4, 5, 6} ``` Their...
[Question] [ # Goal [Morse code](https://en.wikipedia.org/wiki/Morse_code) is often represented as sound. Given a stream of bits that represent whether sound is on or off, translate the stream into letters and numbers and spaces. [![International Morse Code](https://i.stack.imgur.com/UFJqy.png)](https://i.stack.img...
[Question] [ This question is inspired by the cover of the book "Godel, Escher, Bach": [![](https://i.stack.imgur.com/yg9UJ.jpg)](https://i.stack.imgur.com/yg9UJ.jpg) The challenge here is to write a function that tells if three given letters can produce a 3D sculpture that can be read from three sides. For this ex...
[Question] [ A snakified string looks like this: ``` T AnE eOf ifi ing h s x l A k e r isI amp Sna dSt ``` ## Your Task Take a string `s` and a size `n`, then output the snakified string. The inputs `ThisIsAnExampleOfaSnakifiedString` and `3` would produce the example above. ## Specifications * `s` will only contai...
[Question] [ You are given a string composed with the characters `0123456789+*()`. You can assume that string is always a valid mathematical expression. Your task is to remove the unnecessary parentheses, assuming multiplication has higher priority than addition. The parentheses should be removed only when they are...
[Question] [ Successful code golf submissions are, by nature, filled with crazy symbols all over the place. To make their submission easier to understand, many code-golfers choose to include an explanation of their code. In their explanation, the line of code is turned into a vertically exploded diagram. For examp...
[Question] [ # Background You are the apprentice of a powerful wizard, and your master is currently developing a spell for creating an inter-dimensional labyrinth to trap his enemies in. He wants you to program his steam-powered computer to analyze the possible layouts. Programming this diabolical machine is highly...
[Question] [ Over at our friends at [Puzzling.SE](http://puzzling.stackexchange.com), the following puzzle was posted: [Is this chromatic puzzle always solvable?](https://puzzling.stackexchange.com/questions/36479/is-this-chromatic-puzzle-always-solvable) by Edgar G. You can play it [here](http://www.puzzlopia.com/...
[Question] [ Consider a prime number *p*, written in base 10. The **memory** of *p* is defined as the number of distinct primes strictly less than *p* that are contained as substrings of *p*. ## Challenge Given a non-negative integer *n* as input, find the smallest prime *p* such that *p* has memory *n*. That is, f...
[Question] [ ## Problem You're stuck in a cabin in the middle of the woods, with only an old scrabble set to entertain yourselves. Upon inspection you see that the scrabble letters are so worn, that only the points for each letter are visible. Nonetheless you decide to play a game. You pull seven letters from the ...
[Question] [ ## Challenge Write a program P, taking no input, such that the proposition “the execution of P eventually terminates” is [independent](https://en.wikipedia.org/wiki/Independence_(mathematical_logic)) of [Peano arithmetic](https://en.wikipedia.org/wiki/Peano_axioms). ## Formal rules (In case you are a m...
[Question] [ The first *Predecessor-completed Ascii Cube (PAC 1)* is a simple cube with side length 1 and looks like this: ``` /////\ ///// \ \\\\\ / \\\\\/ ``` The *PAC 2* is a geometric shape such that combining it with its predecessor (the *PAC 1*) completes a side length 2 cube: ``` front ...
[Question] [ ## Background ASCII art is the practice of creating images by using ASCII text to form shapes. Aliasing is the effect created by the large "pixels" of ASCII art, which are the size of characters. The image becomes blocky and hard to see. Anti-aliasing removes this effect by creating a gradient and by s...
[Question] [ Inspired by [this xkcd](http://xkcd.com/851_make_it_better/) [![enter image description here](https://i.stack.imgur.com/AWTyS.png)](https://i.stack.imgur.com/AWTyS.png) You work for [Shazam](https://en.wikipedia.org/wiki/Shazam_(service)) and they have a project for you. Some customers are complaining ...
[Question] [ You are an explorer, mapping an unknown world. Your ship is carried on the wind. Where it goes, who knows? Each day, in your spyglass, you see features to the north, south, east and west. You always see four such features, corresponding to the cardinal directions. Your spyglass reports ASCII symbols l...
[Question] [ Let's say I have the following (2D) matrix: ``` [[1, 2, 3, 4 ], [5, 6, 7, 8 ], [9, 10, 11, 12], [13, 14, 15, 16]] ``` Rotate the matrix *counterclockwise* `R` times (not in 90 degree increments, just by 1 number each time), ``` 1 2 3 4 2 3 4 8 3 4 8 12 5 6 7 ...
[Question] [ [We already generated Minesweeper fields](https://codegolf.stackexchange.com/q/10635/3396), but someone really has to sweep those generated mines before PCG blows up! Your task is to write a Minesweeper Solver that is compatible with a slightly modified version of [the accepted solution of “Working Min...
[Question] [ Every programmer knows that brackets `[]{}()<>` are really fun. To exacerbate this fun, groups of interwoven brackets can be transformed into cute and fuzzy diagrams. Let's say that you have a string that contains balanced brackets, like `[{][<(]})>(())`. Step one is to rotate the string 45 degrees clo...
[Question] [ It's 22022 and the Unicode consortium is having a problem. After the writing system of the ⮧⣝Ⅲⴄ⟢⧩⋓⣠ civilization was assigned the last Unicode block, the consortium members have been scrambling to find a new encoding to replace UTF-8. Finally UTF-∞, a proposal by Bob Rike, was adopted. UTF-∞ is backwar...
[Question] [ This was inspired by a function I recently added to my language [Add++](https://github.com/SatansSon/AddPlusPlus). Therefore I will submit an short answer in Add++ but I won't accept it if it wins (it wouldn't be fair) Don't you hate it when you can multiply numbers but not strings? So you should corr...
[Question] [ # Task Given a **non-empty** array of `0` and `1`, halve the lengths of the runs of `0`. # Input An array of `0` and `1`. Acceptable format: * Real array in your language * Linefeed-separated string of `0` and `1` * Contiguous string of `0` and `1` * Any other reasonable format For example, the followi...
[Question] [ Output the device's screen resolution in the **specific** format of `[width]x[height]`(without the brackets). For example, an output could be `1440x900`. [Here's an online tester that you can use to check your own screen resolution.](http://www.whatismyscreenresolution.com/) [Answer] # JavaScript ...
[Question] [ I have a number like this: ``` n = 548915381 ``` The output should be the sum of every second digit of that number. In this case 26: ``` 4+9+5+8 = 26 ``` Rules: * This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so the shortest code in bytes wins. * The input cons...
[Question] [ I've been posting relatively hard challenges recently, so here goes an easy one. ## Task Given an array \$A\$ and a number \$n\$, calculate the sum of all numbers of \$A\$ multiplied by \$n\$, except the last one. All numbers (the elements of \$A\$ and the value of \$n\$) are positive integers, and \$A...
[Question] [ This challenge is inspired by one of my other challenges: [Pointlessly make your way down the alphabet](https://codegolf.stackexchange.com/questions/196192/) That challenge asked you to take a string of text, and for each letter produce a sequence of letters moving down the alphabet to 'a'. For this ch...
[Question] [ ## Introduction The [Prime Counting Function](http://mathworld.wolfram.com/PrimeCountingFunction.html), also known as the Pi function \$\pi(x)\$, returns the amount of primes less than or equal to x. ## Challenge Your program will take an integer x which you can assume to be positive, and output a sing...
[Question] [ [Inspired](https://chat.stackexchange.com/transcript/message/58359892#58359892) by [Wzl](https://codegolf.stackexchange.com/users/90614/wzl) Determine if a given square binary matrix has exactly one row or column consisting of entirely `1`s, and the rest of the matrix is `0`s. For example, these are al...
[Question] [ Your task is to write a program or function. Its output/return value must follow these rules: * The program outputs `1` * The program repeated `n` times outputs `n` * The program backwards outputs `-1` * The program backwards and repeated `n` times outputs `-n` * A mix of forward and backward programs ...
[Question] [ I have come across a [question](https://codereview.stackexchange.com/q/107221) on the Code Review site that seems interesting. I think OP is doing it wrong, but cannot be sure... So let's solve it for him! (write a program, not a function/procedure) ## Input (stdin or similar): An integer `x` in decima...
[Question] [ Given any unsigned 16 bit integer, convert its *decimal form* (i.e., base-10) number into a 4x4 ASCII grid of its bits, with the most-significant bit (MSB) at the top left, least-significant bit (LSB) at bottom right, read across and then down (like English text). ## Examples ### Input: 4242 ``` +---+-...
[Question] [ I call this sequence "the Jesus sequence", because it is the *sum of mod*.</pun> For this sequence, you take all the positive integers *m* less than the input *n*, and take the sum of *n* modulo each *m*. In other words: $$a\_n = \sum\_{m=1}^{n-1}{n\bmod m}$$ For example, take the term *14*: ``` 14 % 1...
[Question] [ Take a matrix of positive integers as input, and **make it explode!** --- The way you explode a matrix is by simply adding zeros around every element, including the outside borders. Input/output formats are optional as always! ### Test cases: ``` 1 ----- 0 0 0 0 1 0 0 0 0 -------------- 1 4 5 2 ----- 0...
[Question] [ Write the shortest program which will take a string of numbers (of up to *at least* 20 length) as input, and display the output using the standard digital clock style numbers. For instance for input 81, a solution with ascii output would give: ``` _ |_| | |_| | ``` Graphical output is also acceptabl...
[Question] [ Given an input integer `n`, draw a number snake, that is, a grid measuring `n x n` consisting of the numbers `1` through `n^2` that are wound around each other in the following fashion: Input `n = 3`: ``` 7 8 9 6 1 2 5 4 3 ``` Input `n = 4`: ``` 7 8 9 10 6 1 2 11 5 4 3 12 16 15 14 13 ``` Input...
[Question] [ # Guidelines ## Task Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array (lists in some languages). --- ## Rules * This is code golf so the shortest answer in bytes wins! * You will always get a valid array * There will always...
[Question] [ **Background** Here is a Halloween related challenge. As you may have seen from my last [challenge](https://codegolf.stackexchange.com/questions/93610/the-house-of-santa-claus) I quite like what I term as ascii art animations, that is not just draw a pattern but draw a pattern that progresses. This ide...
[Question] [ Recamán's sequence ([A005132](http://oeis.org/A005132)) is a mathematical sequence, defined as such: ``` A(0) = 0 A(n) = A(n-1) - n if A(n-1) - n > 0 and is new, else A(n) = A(n-1) + n ``` A pretty LaTex version of the above (might be more readable): $$A(n) = \begin{cases}0 & \textrm{if } n = 0 \\ A(n-...
[Question] [ An Egyptian fraction is a representation of a rational number using the sum of distinct unit fractions (a unit fraction is of the form \$ \frac 1 x \$ where \$ x \$ is a positive integer). For all**[1]** positive integers \$ n \ne 2 \$, there exists at least one Egyptian fraction of \$ n \$ distinct po...
[Question] [ Today while playing with my kids I noticed that an apparently simple toy in the park hid a challenge. [![Clock](https://i.stack.imgur.com/dl1Eu.jpg)](https://i.stack.imgur.com/dl1Eu.jpg) The wheel has a triangle that points to a number, but also has three circles that point to the numbers every 90 deg...
[Question] [ We had a [prime factorization challenge](https://codegolf.stackexchange.com/q/1979/42545) a while ago, but that challenge is nearly six years old and barely meets our current requirements, so I believe it's time for a new one. ## Challenge Write a program or function that takes as input an integer grea...
[Question] [ # Task Your task is to produce string that contains average characters of string. First character of result would be average character of first character (which is first character) and second character average of two first characters and so on. # What is average character? Strings are arrays of bytes. ...
[Question] [ Write a function which, given the first 12 digits of an [ISBN-13](https://en.wikipedia.org/wiki/International_Standard_Book_Number#ISBN-13_check_digit_calculation) code, will calculate the entire ISBN via calculating and appending an appropriate check digit. Your function's input is a string containing...
[Question] [ ## Goal Given a non-negative integer, create a function that returns the starting position of number of largest consecutive 1's in that integer's binary value. When given an input `0`, return `0`. If the number has multiple streaks of equal length, you must return the position of the last streak. ## In...
[Question] [ Given a nonempty list of nonempty rows of numbers, compute the *column wise sum*, which is another list that has the length of the longest input row. The first entry of the output list is the sum of all the first entires of the input rows, the second one is the sum of all the second elements (if availa...
[Question] [ ## Disarium Dilemma A Disarium is defined as a number whose: > > sum of its digits powered with their respective position is equal to the original number > > > --- **Your Task**: You have a strange obsession with numbers classified as being a disarium. The need to follow the ways of disarium is so ...
[Question] [ # Code Bots I hate private and protected variables. I just want to access anything and everything! If you are like me, then this challenge is for you! Write a bot that ~~works together in harmony with other bots~~ makes other bots do what you want. You are a programmer, and you know how things are supp...
[Question] [ I absolutely hate the digit `1`. So, I need your help to convert numbers to their "proper forms". Numbers in proper form never have two `1`s in a row. `101` is okay, but `110` is hideous. To convert, simply skip all the improper numbers and count normally. For instance... ``` 1 -> 1 2 -> 2 ... 10 -> 10...
[Question] [ This should be a simple challenge. Given a number \$n \ge 0\$, output the [super-logarithm](https://en.wikipedia.org/wiki/Super-logarithm) (or the \$\log^\*\$, log-star, or [iterated logarithm](https://en.wikipedia.org/wiki/Iterated_logarithm), which are equivalent since \$n\$ is never negative for thi...
[Question] [ You are a space tourist on your way to planet Flooptonia! The flight is going to take another 47,315 years, so to pass the time before you're cryogenically frozen you decide to write a program to help you understand the Flooptonian calendar. Here is the 208-day long Flooptonian calendar: ``` Month ...
[Question] [ # Introduction The game takes place in a small world with different towns. The rulers of the towns hate each other and would like to rule the world. The people are divided into two groups, warriors and lowborns. However, lowborns can raise to warriors. You are the ruler of three of these towns. # Gamep...
[Question] [ Given any string, print it in the form of a triangle where the text runs up and down along each diagonal. For example, an input of `"Hello World"` should output: ``` d l r d o l W r d o l ...
[Question] [ My first code golf post, apologies for any mistakes... # Context In rock climbing ([bouldering specifically](https://en.wikipedia.org/wiki/Grade_(bouldering))), the V/Vermin (USA) climbing grades start at 'VB' (the easiest grade), and then go 'V0', 'V0+', 'V1', 'V2', 'V3', 'V4', 'V5' etc. up to 'V17' (...
[Question] [ What is the shortest way of generating a random string with a given length and with only alphanumeric characters allowed? * example of a random string: with N = 9 output would be `aZua7I0Lk` * the given length N can be assumed to be always greater than 0 * if necessary you can assume 256 as a maximum v...
[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/36515/edit). Closed 8 years ago. [Improve this question](/posts/36515/edit) ...
[Question] [ A [narcissistic number](https://en.wikipedia.org/wiki/Narcissistic_number) is a natural number which is equal to the sum of its digits when each digit is taken to the power of the number digits. For example \$8208 = 8^4 + 2^4 + 0^4 + 8^4\$, so is narcissistic. We'll define a function \$f(x)\$ as the fo...
[Question] [ Given a nonempty list of nonnegative integers, consider rewriting it as an arithmetic problem where: * A plus sign (`+`) is inserted between pairs of numbers that increase from left to right (a.k.a. from the start of the list to the end). * A minus sign (`-`) is inserted between pairs of numbers that d...
[Question] [ ## Introduction A "lobster number", by my own designation, is a number that contains within itself all of its prime factors. The "lobster" description was inspired by the recent question "[Speed of Lobsters](https://codegolf.stackexchange.com/questions/217690/speed-of-lobsters)". The basic idea is that...
[Question] [ Your task is to form an expression equaling \$ 11111111111 \text{ (11 ones)} \$ using only the following characters: `1+()`. Keep in mind that the result is in base 10, and not some other base like binary. Of course, these expressions should follow the [order of operations](https://en.wikipedia.org/wik...
[Question] [ *See also: [Make a move on a Go board](https://codegolf.stackexchange.com/questions/17505/make-a-move-on-a-go-board).* # Task Go is a board game where two players (Black and White) place stones on the intersections of grid lines on a 19×19 board. Black moves first — for example, on D4:        [![go co...
[Question] [ Take a 2-dimensional grid and draw a number of line segments on it to represent mirrors. Now pick a point to place a theoretical laser and an angle to define the direction it's pointing. The question is: if your follow the laser beam path for some specified distance, what coordinate point are you at? E...
[Question] [ This sentence employs two a’s, two c’s, two d’s, twenty-eight e’s, five f’s, three g’s, eight h’s, eleven i’s, three l’s, two m’s, thirteen n’s, nine o’s, two p’s, five r’s, twenty-five s’s, twenty-three t’s, six v’s, ten w’s, two x’s, five y’s, and one z. Such sentences are called [autograms](http://...
[Question] [ In traditional [Tetris](http://en.wikipedia.org/wiki/Tetris), there are 7 distinct [tetromino](http://en.wikipedia.org/wiki/Tetromino) bricks, each denoted by a letter similar to its shape. ``` # # # # # ## # # ### ## ## # ## ## ## # ## ## I O L J T Z ...
[Question] [ Produce this square snowflake. ``` XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX X X X X X X X X X X X X X X XX X XXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXX X XX X X X X X X X X X X X X XX X X XXX XXXX...
[Question] [ Write a formula using only the digits `0-9`, `+`, `*`, `-`, `/`, `%` and `^` to output a 1000 *distinct* primes when given input (which can be used as a variable `n` in the formula) of numbers 1 to 1000. (Note that `/` will give the quotient as all arithmetic is integer arithmetic.) Solutions can use `...
[Question] [ ## Games are fun This Code Golf here was so fun I had to make a version for other classic games similar in complexity: [Shortest Way of creating a basic Space Invaders Game in Python](https://codegolf.stackexchange.com/questions/4410/shortest-way-of-creating-a-basic-space-invaders-game-in-python) This ...
[Question] [ ## Challenge description For every positive integer `n` there exists a number having the form of `111...10...000` that is divisible by `n` i.e. a decimal number that starts with all `1`'s and ends with all `0`'s. This is very easy to prove: if we take a set of `n+1` different numbers in the form of `11...
[Question] [ Given an input of a list of slices of a string, output the original string. Each slice will be given as a list of length 2, containing the start position of the slice (an integer ≥0) and the slice itself. If your language does not support arrays of arbitrary types, you may also take this as a struct or...
[Question] [ In math a [magic square](https://en.wikipedia.org/wiki/Magic_square) is an N×N grid of numbers from 1 to N2 such that every row, column, and diagonal sums to the same total. For example here's a 3×3 magic square: [![Wikipedia magic square example](https://i.stack.imgur.com/b3C10.png)](https://en.wikipe...
[Question] [ In information theory, a "prefix code" is a dictionary where none of the keys are a prefix of another. In other words, this means that none of the strings starts with any of the other. For example, `{"9", "55"}` is a prefix code, but `{"5", "9", "55"}` is not. The biggest advantage of this, is that th...
[Question] [ This is [**Weekly Challenge #1.**](http://meta.codegolf.stackexchange.com/q/3578/8478) Theme: **Audio Processing** Your task is to write a program, which writes an audio file to disc (in a format of your choice), which contains the [Morse code](http://en.wikipedia.org/wiki/Morse_code) for `2015`, i.e. ...
[Question] [ I have one hundred vaults, each one within another. Each vault has a password, consisting of a single number. > > 95 43 81 89 56 89 57 67 7 45 34 34 78 88 14 40 81 23 26 78 46 8 96 11 28 3 74 6 23 89 54 37 6 99 45 1 45 87 80 12 92 20 49 72 9 92 15 76 13 3 5 32 96 87 38 87 31 10 34 8 57 73 59 33 72 95 ...
[Question] [ Given a position with a row of rooks and/or empty spaces, output how many different rook moves are possible. A rook can move left or right to an empty space, but not to one that requires passing over another rook. When a rook moves, the other rooks remain in place. For example, from this position, **6 ...
[Question] [ Given a string `x`, output the characters in `x` sorted according to the order of appearance in your source code. ## Examples ``` Source: ThisIs A Test Input: Is it a Test? Output: TissI etta? Source: Harry - yer a wizard. Input: I'm a what? Output: aa wh'?Imt Source: Mr. H. Potter, The Floor, Hu...
[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/154617/edit). Closed 2 years ago. [Improve this question](/posts/154617/edit)...
[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/9037/edit). Closed 1 year ago. [Improve this question](/posts/9037/edit) Inp...
[Question] [ A cannonball is fired so that in the first eyeblink of its flight it ascends by `N` treetops, during the second eyeblink by `N-1` treetops, etc until it reaches the highest point of its trajectory. Then it starts falling by 1, 2, etc treetops per eyeblink until it hits the ground. At the same time the ...
[Question] [ While doodling around with numbers, I found an interesting permutation you can generate from a list of numbers. If you repeat this same permutation enough times, you will always end up back at the original array. Let's use the following list: ``` [1, 2, 3, 4, 5] ``` as an example 1. **Reverse** the arr...
[Question] [ In the game of Flood Paint, the goal of the game is to get the entire board to be the same colour in as few turns as possible. The game starts with a board that looks something like this: ``` 3 3 5 4 1 3 4 1 5 5 1 3 4 1 1 5 2 1 6 5 2 3 4 3 3 4 3 4 4 4 5 5 5 4 1 4 6 2 5 3[3]1 1 6 6 5 5 1 2 5 2 6 6 3 6 1...
[Question] [ Given an input of a string consisting entirely of `q`s representing quarter notes and `e`s representing eighth notes, output the indices of the quarter notes that are syncopated. [Syncopation](https://en.wikipedia.org/wiki/Syncopation) is complex, but for the purposes of this challenge, our definition ...
[Question] [ # The Challenge I was reading [Google's Java Style Guide](https://google.github.io/styleguide/javaguide.html#s5.3-camel-case) the other day and stumbled over their algorithm to convert any arbitrary string into camelCase notation. In this challenge you have to implement this algorithm since you don't w...
[Question] [ I'm pretty sure there's not a better way to do this but figured it couldn't hurt to ask. I'm tired of typing out `a='abcdefghijklmnopqrstuvwxyz'`. Cool languages have `Range('a'..'z')` or similar What can we come up with with JS that's as short as possible?? ``` for(i=97,a='';i<123;){a+=String.fromChar...
[Question] [ ## Background In most reasonable programming languages, it's very easy to rotate the rows or columns of a 2D array. In this challenge, your task is to rotate the *anti-diagonals* instead. Recall that the anti-diagonals of a 2D array are its 1D slices taken in the northeast direction ↗. ## Input A non-e...
[Question] [ Given a string **s** composed of lowercase letters, such as ``` aabaaababbbbaaba ``` and a positive integer **n**, such as `4`, output a length-**n** string **t** such that when **t** is repeated to the length of **s**, they have as many chars in common as possible. For the given example, the optimal o...
[Question] [ This is kind of inspired by the Intel 8086 challenge that's also on here, but I thought a 6502 challenge would be interesting too. ## The challenge I thought this would be a fun one to see the results for. This one is obviously towards the more advanced side of the spectrum. The challenge is to write y...
[Question] [ Given an input sentence consisting of one or more words `[a-z]+` and zero or more spaces , output an ASCII-art histogram (bar graph) of the letter distribution of the input sentence. The histogram must be laid out horizontally, i.e. with the letter key along the bottom in alphabetical order from left t...
[Question] [ **Objective**: Write a program that generates beautiful (?) ASCII-art landscapes and skylines! Your program has just one input: a string composed of any combination/repetition of the chars `0123456789abc`. For each input character, output a vertical line composed as follows: ``` . .. ...
[Question] [ ## Introduction A quixel is a quantum pixel. Similar to a classical pixel, it is represented with 3 integer values (Red, Green, Blue). However, quixels are in a super position of these 3 states instead of a combination. This super position only lasts until the quixel is observed at which point it colla...
[Question] [ Given a string, return that string's "luck". A string's luck, as I completely just made up for the purpose of this challenge, is an integer, determined as so: * The base luck for a string is 1. * For each consecutive letter it shares with the word "lucky" (case insensitive), multiply the luck by 2. For...
[Question] [ Given an input integer, output the volume corresponding to the value. The value will always be in the range \$[0,100]\$. ## Examples If the input \$=0\$: ``` _/| | |\/ |_ |/\ \| ``` If the input \$>0\$ and \$<33\$: ``` _/| | |\ |_ |/ \| ``` If the input \$\ge33\$ and \$<66\$: ``` _/| \ | |\ ...