text
stringlengths
180
608k
[Question] [ Sylvester's sequence, [OEIS A000058](http://oeis.org/A000058), is an integer sequence defined as follows: Each member is the product of all previous members plus one. The first member of the sequence is 2. ## Task Create a program to calculate the nth term of Sylvester's Sequence. Standard input, outpu...
[Question] [ ### Introduction While studying, I tried to come up with several ways to cheat a multiple choice test. It basically is a compressed version of the multiple choice answers. The method goes as following: The answers to the test: ``` BCAABABA ``` These can be converted to 3 different arrays, which indicat...
[Question] [ Your task is to write a program that will output a readable list of every five letter words with the structure: **consonant - vowel - consonant - vowel - consonant** The output should be sorted alphabetically with one word per line and no words repeated twice. It can be lowercase or uppercase but not m...
[Question] [ While [Rust](https://www.rust-lang.org/) is very, very rarely competitive in code golfing competitions (Java is often shorter), it can still be fun to golf in. What are some tricks for making Rust code shorter? Please post only one tip in each answer. [Answer] ## Use closures instead of functions ...
[Question] [ Given a non-negative integer input, write a program that converts the number to hexadecimal and returns a truthy value if the hexadecimal form of the number contains only the characters `A` through `F` and a falsey value otherwise. --- Test cases ``` 10 ==> True (A in hexadecimal) 100 ==> False (64 in ...
[Question] [ ### Challenge Given a nonempty list of real numbers, compute its median. ### Definitions The median is computed as follows: First sort the list, * if the number of entries is *odd*, the median is the value in the center of the sorted list, * otherwise the median is the arithmetic mean of the two values...
[Question] [ Output terminal dimensions (columns and rows) [in any two-number decimal format](https://codegolf.stackexchange.com/questions/118402/tell-me-my-screen-resolution#comment290065_118402)\*. For example, an output could be `80x25`. --- [Inspiration](https://codegolf.stackexchange.com/q/118402/43319). [Prom...
[Question] [ **The Task** Your task is to create a program or a function that, given an input, outputs the input text with random letters capitalized, while keeping already capitalized letters capitalized. Every combination of capitalizations of the lowercase letters should be possible. For example, if the input wa...
[Question] [ This is the cop's thread. The [robber's thread is here](https://codegolf.stackexchange.com/questions/112300/robbers-crack-the-regex-make-a-snake). --- Write a code that takes an input `n` and creates a n-by-n "snake matrix". A snake matrix is a matrix that follows this pattern: 3-by-3: ``` 1 2 3 6 5...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. Closed 8 years ago. **Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently ...
[Question] [ Write a program with the following properties: * When run as-is, the program produces no output (i.e. 0 bytes of output). * There is a location within the program (of your choice: it could be at the start, end, or somewhere in the middle) with the following property: modifying the program via placing *...
[Question] [ What general tips do you have for golfing in PHP? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PHP (e.g. "remove comments" is not an answer). Please post one tip per answer. [Answer] **Understand how variables and whitespace inte...
[Question] [ # Center The Text! In this challenge you will be centering various lines. ## Examples ``` Foo barbaz Foo barbaz ``` ``` Hello World Hello World ``` ``` Programming Puzzles & Code Golf Programming Puzzles & Code Golf ``` ## Specifications Each input line will always have at least one non-...
[Question] [ Write a script that writes to standard output, or your language's equivalent, 100 lines of (valid) Java code that begins with: ``` class Tuple1 {public Object _0;} class Tuple2 {public Object _0,_1;} class Tuple3 {public Object _0,_1,_2;} class Tuple4 {public Object _0,_1,_2,_3;} class Tuple5 {public O...
[Question] [ This is a 2-dimensional version of [this question](https://codegolf.stackexchange.com/q/71877/9288). Given a non-empty 2-dimensional array/matrix containing only non-negative integers: $$ \begin{bmatrix} {\color{Red}0} & {\color{Red}0} & {\color{Red}0} & {\color{Red}0} & {\color{Red}0} \\ {\color{Red}0...
[Question] [ A lot of languages have built-in ways to get rid of duplicates, or "deduplicate" or "uniquify" a list or string. A less common task is to "detriplicate" a string. That is, for every character that appears, the first *two* occurrences are kept. Here is an example where the characters that should be dele...
[Question] [ **This question already has answers here**: [The Versatile Integer Printer](/questions/65641/the-versatile-integer-printer) (41 answers) Closed 6 years ago. > > **Note:** This challenge has been moved to [Polyglot the (non constant) OEIS!](https://codegolf.stackexchange.com/q/139036/61563) to a...
[Question] [ Consider taking some non-negative integer such as 8675309 and computing the absolute values of the differences between all the pairs of neighboring digits. For \$8675309\$ we get \$|8-6| = 2\$, \$|6-7| = 1\$, \$|7-5| = 2\$, \$|5-3| = 2\$, \$|3-0| = 3\$, \$|0-9| = 9\$. Stringing these results together y...
[Question] [ ## Challenge Given an ASCII representation of a Babylonian number as input, output the number in Western Arabic numerals. ## Babylonian Numeral System How did the Babylonians count? Interestingly, they used a Base 60 system with an element of a Base 10 system. Let's first consider the unit column of th...
[Question] [ *Unlike many C&R challenges, this does not require a separate robbers post; the goal of the robbers is to crack the previous answer and then post a new one as a cop.* As answerers, you will write a series of polyglots that look like this (each column is a language, and each entry is the output of the a...
[Question] [ I was surprised to not find this asked already, though there is a great question on darts checkouts: [Darts meets Codegolf](https://codegolf.stackexchange.com/questions/20076/darts-meets-codegolf) Your challenge is to calculate which scores are not possible with 'n' darts below the maximum score for 'n...
[Question] [ Given an input string, output that string with all vowels `a`, `e`, `i`, `o` and `u` swapped at random between each other. For example, in the string `this is a test`, there are 4 vowels: `[i, i, a, e]`. A valid shuffling of those vowels could be `[a, i, e, i]` therefore yielding the output `thas is e ...
[Question] [ Given a character, output (to the screen) the entire qwerty keyboard layout (with spaces and newlines) that follows the character. The examples make it clear. Input 1 ``` f ``` Output 1 ``` g h j k l z x c v b n m ``` Input 2 ``` q ``` Output 2 ``` w e r t y u i o p a s d f g h j k l z x c v b n m ``` ...
[Question] [ A string can be *shifted* by a number `n` by getting the byte value `c` of each character in the string, calculating `(c + n) mod 256`, and converting the result back to a character. As an example, shifting `"ABC123"` by 1 results in `"BCD234"`, shifting by 10 in `"KLM;<="`, and shifting by 255 in `"@A...
[Question] [ ## Challenge: Given a string only containing upper- and/or lowercase letters (whichever you prefer), put `tape` horizontally to fix it. We do this by checking the difference of two adjacent letters in the alphabet (ignoring wrap-around and only going forward), and filling the space with as much `TAPE`/...
[Question] [ Based on [this Math.SE question](https://math.stackexchange.com/questions/2420488/what-is-trinity-hall-prime-number); number copied from [this answer](https://math.stackexchange.com/a/2420520/452917). Number originally from [a Numberphile video](https://www.youtube.com/watch?v=fQQ8IiTWHhg), of course. ...
[Question] [ If you've ever tried to write palindromic code before, you'd know how much brackets tend to get in your way. `()()` is not a palindrome, even though it kinda looks like it should be, while `())(` and `()(` are both palindromic and both very dumb looking. Wouldn't it be convenient if it was the other wa...
[Question] [ > > The Arecibo message is a 1974 interstellar radio message carrying basic information about humanity and Earth sent to globular star cluster M13 in the hope that extraterrestrial intelligence might receive and decipher it... The message consisted of 1,679 binary digits, approximately 210 bytes... > ...
[Question] [ Inspired by [this SO question](https://stackoverflow.com/q/46019607/1682559). ## Challenge: **Input:** * A string \$s\$ * A character \$c\$ **Output:** Create a diamond-square ASCII art of the string in all four directions, with the first character of the string in the center and going outwards. Which ...
[Question] [ Reading a book is easy, but printing a book can be a bit tricky. When printing a booklet, the printer needs to have the pages arranged in a certain manner in order to be read from left to right. The way this is done is using a pattern like below ``` n, 1, 2, n-1, n-2, 3, 4, n-3, n-4, 5, 6, n-5, n-6, 7...
[Question] [ Some people count sheep to get to sleep. Others count goats. Write a program or function that takes in a positive integer N and outputs N-1 awake goats followed by one sleeping goat, as if someone was counting N goats and at the very last one they fell asleep. Awake goats look like this: ``` \ ...
[Question] [ A Rubik's cube has 6 colors: red, orange, yellow, white, blue, and green. Red and orange, yellow and white, and blue and green faces are on opposite sides. Net of a solved Rubik's cube looks like this: ``` Y BRGO W ``` And the tiles look like this: ``` Y Y Y Y Y Y Y Y Y B B B R R R ...
[Question] [ I was reading [Print your code backwards - reverse quine](https://codegolf.stackexchange.com/questions/16021/print-your-code-backwords-reverse-quine) And I thought, this could be more interesting if your **backwards code is also executable**. So this challenge will have all the rules and requirements o...
[Question] [ **The Challenge** Your task is to create a program that takes any given string input, and outputs the input in a squared format. Empty strings should return an empty string. **Examples** Given the input: ``` golf ``` Your program should output: ``` golf o l l o flog ``` Input: ``` 123 ``` Output: ```...
[Question] [ # Introduction A [Gray Code](https://en.wikipedia.org/wiki/Gray_code) is an alternative to binary representation in which a number is incremented by toggling only one bit, rather than a variable amount of bits. Here are some gray codes along with their decimal and binary equivalents: ``` decimal | bin...
[Question] [ ## The challenge You're given: * a non-empty, unsorted list **h** of positive integers (the haystack) * a positive integer **n** (the needle) Your task is to return the list of all ***unique*** decimal concatenations of permutations of **h** whose binary representation contains the binary representatio...
[Question] [ Vim is a great text editor for unix systems, but it's notorious for being difficult to exit. Write a full program that will output `:q` to exit Vim. It should then read a single line of input, as it will then either be given a bash prompt, in which case the exit was successful, or an error, in which ca...
[Question] [ You have been hired by the American embassy in the UK to act as a translator. Being a programmer, you decide to write a program to do a bit of the work for you. You've found out that often just doing the following things can satisfy Word's spellcheck, which has been set to "English (United States)", so...
[Question] [ One of the interesting aspects of gravity is that, as far as I'm aware, you can't just have stuff floating in midair. However, it seems not everyone at the Association of Random Castle Builders is aware of this fact, leading to castles such as this one: ``` # ...
[Question] [ # Challenge You will be given a table as input, drawn with ASCII `|` and `_`. Your task is to set the chairs around it. # Example Input: ``` ____ | | | | | | | | |____| ``` Output: ``` _^_^_ < > | | < > | | <_ _ _> v v ``` Those chairs are made of `<>` and `v^`. Another ...
[Question] [ ## The challenge Your program or function will accept a single string input from STDIN or a function parameter. You can assume the input will contain only alphabetic characters (a-zA-Z), spaces, and full stops. Input is case insensitive, so you should treat 'a' exactly the same as you would treat 'A'. ...
[Question] [ You are a talented young chef who has just been offered the position of [sous chef](https://en.wikipedia.org/wiki/Sous_chef) at the world's most prestigious Indian restaurant. You have little experience with preparing Indian cuisine, but you're determined, so you set out to prove yourself. You decide t...
[Question] [ # Home improvement for the Minotaur The cretan labyrinth is quite easy to draw. Just start with a symmetric shape (here in red). Let us call all the endpoints of those lines 'nodes'. Then you begin drawing the arches (black): The first one alway begins in the top middle node and connects to the node ne...
[Question] [ I was asked by OEIS contributor Andrew Howroyd to post a Code Golf Challenge to extend [OEIS sequence A049021](https://oeis.org/A049021). > > Would be super great to get a couple more terms for [...] A049021. Kind of thing [...] team golf would excel at. > > > As I found out the hard way with the h...
[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 7 years ago. [Improve this quest...
[Question] [ Write a program or function that takes in a positive integer. You can assume the input is valid and may take it as a string. If the number is any of ``` 123 234 345 456 567 678 789 ``` then output a [truthy](http://meta.codegolf.stackexchange.com/a/2194/26997) value. Otherwise, output a [falsy](http://...
[Question] [ Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with. Specifics: * Your language needs to support variadic argument functions: something callable that takes an arbitrary number of arguments and returns a value. ...
[Question] [ Related to: [Make a ;# interpreter](https://codegolf.stackexchange.com/q/121921/68910) In the above linked challenge the task was to create an interpreter for the esoteric language `;#`. ## The `;#` language The language has exactly two commands: `;` and `#` (all other characters are ignored by the int...
[Question] [ **Problem:** Your goal is to add two input numbers without using any of the following math operators: `+,-,*,/`. Additionally, you can't use any built-in functions that are designed to replace those math operators. **Scoring:** Smallest code (in number of bytes) wins. **Update** > > Most of the progra...
[Question] [ [![enter image description here](https://i.stack.imgur.com/cfNEC.png)](https://i.stack.imgur.com/cfNEC.png) Given one of the following inputs: ``` Sweet Onion Chicken Teriyaki Oven Roasted Chicken Turkey Breast Italian BMT Tuna Black Forest Ham Meatball Marinara ``` output a number from 1-7 (or 0-6) ...
[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/20823/edit). Closed 1 year ago. [Improve this question](/posts/20823/edit) #...
[Question] [ Nice verb there, in the title. Write a program that given an input string, will "elasticize" this string and output the result. Elasticizing a string is done as follows: The first character is shown once. The second character is shown twice. The third character is shown thrice, and so on. As you can s...
[Question] [ An Indian legend tells the story of the alleged inventor of the chess game, who impressed the emperor of India with his game so much that he would get rewarded with anything asked. The man said he wanted to be paid in rice. He wanted a grain of rice for the first square of the chessboard, two for the s...
[Question] [ # Task Write a function/program that, given three positive integers `a`, `b` and `c`, prints a Truthy value if a triangle (any triangle) could have side lengths `a`, `b` and `c` and outputs a Falsy value otherwise. # Input Three positive integers in any sensible format, for example: * three distinct fu...
[Question] [ For this challenge, a linked list looks like this: ``` [1, 2, 4, 0, 6, 1, 3, 1] ``` You'll notice there's no data; each item in the list is just a reference to the index of the next one. Your task is to write a program or function which will follow a linked list like this forever, outputting each item ...
[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/20209/edit). Closed 7 years ago. [Improve this question](/p...
[Question] [ A [Proth number](https://en.wikipedia.org/wiki/Proth_number), named after François Proth, is a number that can be expressed as $$N = k \times 2^n + 1$$ Where \$k\$ is an odd positive integer and \$n\$ is a positive integer such that \$2^n > k\$. Let's use a more concrete example. Take 3. 3 is a Proth n...
[Question] [ Your task is to write a program which, given a number and a string, splits the string into chunks of that size and reverses them. ## Rules Your program will receive a positive integer `n`, as well as a string `s` with length at least one consisting of only printable ASCII (not including whitespace). Th...
[Question] [ Surprisingly we haven't had a simple "find the highest digit" challenge yet, but I think that's a *little* too trivial. Given input of a non-negative integer, return the highest **unique** (ie not repeated) digit found in the integer. If there are no unique digits, your program can do anything (undefin...
[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/25967/edit). Closed 7 years ago. [Improve this question](/p...
[Question] [ Based on [this](https://codegolf.stackexchange.com/questions/132558/i-double-the-source-you-double-the-output) challenge. In the rhythm game [osu!](https://osu.ppy.sh/home), the difficulty modifier "Double-time" actually only increases the speed by 50%. Your task, is to write a program that outputs a p...
[Question] [ Write shortest possible code that will return true if the two given integer values are equal or their sum or absolute difference is 5. Example test cases: ``` 4 1 => True 10 10 => True 1 3 => False 6 2 => False 1 6 => True -256 -251 => True 6 1 => True -5 5 => False ``` The shortest I could come up wit...
[Question] [ *This challenge is [NinjaBearMonkey](https://codegolf.stackexchange.com/users/29750/ninjabearmonkey)'s prize for winning my [Block Building Bot Flocks!](https://codegolf.stackexchange.com/questions/50690/block-building-bot-flocks) challenge with the [Black Knight](https://codegolf.stackexchange.com/a/5...
[Question] [ Take a positive integer **n** as input, and output (some of the) decimal numbers that can be created using **n** bits, ordered in the following way: First list all the numbers that can be created with only one `1`, and the rest `0` in the binary representation (sorted), then all the numbers that can be...
[Question] [ # Introduction As is known, in 2017, [Finland](https://en.wikipedia.org/wiki/Finland) celebrates its 100 years of independence. To mark the occasion, it is your job to produce a [Finnish flag](https://en.wikipedia.org/wiki/Flag_of_Finland) for everyone's enjoyment. # Challenge Create a program or a fun...
[Question] [ Using *two* languages of your choice, write the smallest “mutual [quine](http://en.wikipedia.org/wiki/Quine_%28computing%29)” you can. That is, write a program P in language A that outputs the source code for a program Q in language B, such that the output of program Q is identical to the source code f...
[Question] [ Based on [this question](https://codereview.stackexchange.com/q/236520) from Code Review. Given precisely three positive integers, return the product of all of the distinct inputs. If none of the inputs are distinct, return 1. That is, implement the function: \$ f(a,b,c) = \cases{1 & $a = b = c $ \\ a ...
[Question] [ Write the shortest program that prints this ASCII art section of a [hexagonal tiling](http://en.wikipedia.org/wiki/Hexagonal_tiling) or [honeycomb](http://en.wikipedia.org/wiki/Honeycomb): ``` __ __/ \__ __/ \__/ \__ / \__/ \__/ \ \__/ \__/ \__/ / \__/ \__/ \ \__/ \__/ \__/ / ...
[Question] [ | [Ken Iverson, 1920–2020](https://www.youtube.com/watch?v=3wSSCYUd4z4 "A distinguished panel of contributors remember Ken Iverson and discuss the future of his revolutionary notation.") | | --- | | [(0,x)-(x,0)](https://www.youtube.com/watch?v=3wSSCYUd4z4 "A distinguished panel of contributors remembe...
[Question] [ Given a letter of the English alphabet, your task is to build a semi-diagonal alphabet to the input. ## How to build a Semi-Diagonal alphabet? **Brief Description**: First, you take the position of the letter in the alphabet, `P` (`P` is 1-indexed here). Then, you print each letter until the input (i...
[Question] [ The domain server requires that all employees have a strong, random password conforming to the following rules: * Exactly 15 characters long. * Keyboard-typeable characters only (as shown in code-type below). Teaching the sales to use ALT+NUMPAD codes is not permitted. * At least 1 lower case letter: `...
[Question] [ This challenge is about printing the abacaba sequence of a specific depth. Here is a diagram of the first 5 sequences (`a(N)` is the abacaba sequence of depth N, upper/lowercase is just to show the pattern, this is not needed in the output of your program): ``` a(0) = A a(1) = aBa a(2) = abaCaba a(3) =...
[Question] [ # Twisting Words! Given a string and a positive integer. You must twist the string, back and forth. ### Example Input / Output Input ``` Programming Puzzles & Code Golf 4 ``` Output ``` Prog mmar ing zzuP les oC & de G flo ``` ## Input The input can be taken in through STDIN, or function argument. T...
[Question] [ Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor. Your program should output one of two consi...
[Question] [ Your goal is to determine whether a given 2D point X lies within the area of the triangle with given vertices A,B,C. Write a function that takes in the coordinates of the test point X and the three triangle vertices (so that's 8 coordinates total) and returns True if the point lies inside that triangle...
[Question] [ Randall Munroe (author of XKCD) held [a survey to give names to colors](https://blog.xkcd.com/2010/05/03/color-survey-results/). The main outcome is [a list of names for the 954 most common RGB monitor colors](https://xkcd.com/color/rgb/). For ease of programming, here is the list in plain text: <http:...
[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 7 years ago. [Improve this quest...
[Question] [ **This is part of a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge. [Go here](https://codegolf.stackexchange.com/q/144601/8478) for the robbers' part.** ## The Cops' Challenge You should write a program or function in a language of your choic...
[Question] [ **Task description:** Write a program as short as possible to draw a radial gradient in ASCII art. The size of the output grid is predefined. The center point and the characters to be used for the gradient are provided as input to the program. The gradient will be 70×25 character cells in size with the...
[Question] [ Rectangles have this nice property - an \$n \times m\$ rectangle consists of exactly \$n \times m\$ characters! A.. more interesting property is that the rectangles can be aligned nicely in a multiplication table - for example, a \$3 \times 3\$ table: ``` # ## ### # ## ### # ## ### # ## ### # ## ### # ...
[Question] [ Your task is to output a Magical 8 Trapezium: ``` 1 × 8 + 1 = 9 12 × 8 + 2 = 98 123 × 8 + 3 = 987 1234 × 8 + 4 = 9876 12345 × 8 + 5 = 98765 123456 × 8 + 6 = 987654 1234567 × 8 + 7 = 9876543 12345678 × 8 + 8 = 98765432 123456789 × 8 + 9 = 987654321 ``` * Output in you...
[Question] [ Your company lately hired a new bunch of *extremely dedicated* sysadmins. They feel that just watching computer screens is quite limiting (I mean, 60Hz refresh rate is just NOT enough), so they hooked up the CPU data bus to an DAC and play that on a speaker through the server room so that they can hear...
[Question] [ Each day you put up a new word on a [marquee sign with movable letters](https://i0.wp.com/thecachevenue.com/wp-content/uploads/2017/10/marquee_sign_1.jpg?fit=800%2C800&ssl=1), buying just the letters you need to write it. You re-use letters you've bought for earlier words whenever possible. Given the w...
[Question] [ ## Introduction In this challenge, you are given as input the ASCII representation of the [net](https://en.wikipedia.org/wiki/Net_%28polyhedron%29) (unfolded surface) of a [rectangular cuboid](https://en.wikipedia.org/wiki/Cuboid) (3D box). The format is this: ``` ....+--+....... ....|##|....... ....|#...
[Question] [ When I was a lad, kids would wander into computer stores and play Hunt the Wumpus until the staff kicked us out. It was a simple game, programmable on the home computers of the mid-1970s, machines so rudimentary that instead of chicklet-sized microprocessors, I think some of them probably had real chic...
[Question] [ Your job is to draw a Bézier curve given it's control points. The only criteria is that you actually have to show how to draw the curve from the initial control point to the last one. # Criterias * The result has to be animated, e.g. it has to **show** the drawing process somehow. The way you do the an...
[Question] [ Given a string that is one of the directions on a 16-point compass rose [![16-point compass rose](https://i.stack.imgur.com/hPCWAm.png)](https://en.wikipedia.org/wiki/Points_of_the_compass#/media/File:Compass_Rose_English_North.svg) output the two directions that are immediately adjacent to the input d...
[Question] [ # Background The `echo` program is so neat. You can say anything to it, and it repeats your words perfectly, every time! How cool is that! Disappointingly, it repeats the input all at once, regardless of your typing speed, which is not very realistic. We'll have to fix that. # The Task Your program sha...
[Question] [ An activity I sometimes do when I'm bored is to write a couple of characters in matching pairs. I then draw lines (over the tops never below) to connect these characters. For example I might write \$abcbac\$ and then I would draw the lines as: [![First Link](https://i.stack.imgur.com/7y5Q7.png)](https:...
[Question] [ Starting an the origin on an infinite grid, you follow a predetermined path going up (`U`), down (`D`), left (`L`), or right (`R`). You paint every square you visit, including the square you started at and the square you finish at. Using this method, we can paint the number six using the instructions `...
[Question] [ # Overview Consider the following task: > > Given a positive integer **n > 0**, output its integer square root. The integer square root of a number **n** is the largest value of **x** where **x2 ≤ n**, usually expressed with the formula `floor(sqrt(n))`. > > > Examples: `25 -> 5`, `24 -> 4`, `40 -> ...
[Question] [ Today is [Bacon Day](http://www.nationaldaycalendar.com/bacon-day-december-30/) which is probably why the name of the hat for participating today is "Mmmm Bacon". What better way to celebrate bacon day with fun filled 2d matrices made out of bacon! A 1 by 1 bacon strip is represented by this: ``` -----...
[Question] [ It's simple: Make a [proper](https://codegolf.meta.stackexchange.com/q/4877/8478) quine where if you remove any character, it's still a quine. The difference between this and a radiation hardened quine is that if your program is `AB`, in a radiation hardened quine `A` would output `AB`, but here, `A` w...
[Question] [ You are fighting an extensive network of enemy **spies**. You know that each spy has at least one (sometimes multiple) **fake identities** they like to use. You'd really like to know how many spies you're actually dealing with. Luckily, your counter-intelligence **agents** are doing their job and can *...
[Question] [ Write a program, given an input *n*, will generate all possible n-tuples using natural numbers. ``` n=1 (1),(2),(3),(4),(5),(6)... n=2 (1,1),(1,2),(2,1),(2,2),(1,3),(3,1),(2,3),(3,2),(3,3)... n=6 (1,1,1,1,1,1) (1,1,1,1,2,1) (1,1,1,2,1,1)... ``` * The output may be in any order that does not break any ...
[Question] [ # Task Given a non-empty string of lowercase ASCII letters `a`-`z`, take its first character, and: * Surround it with a square of copies of the **second** character, * Surround that with a diamond of copies of the **third** character, * Surround that with a square of copies of the **fourth** character…...
[Question] [ *Note: This is #2 in a series of [array](/questions/tagged/array "show questions tagged 'array'") challenges. For the previous challenge, [click here](https://codegolf.stackexchange.com/questions/103571/an-array-of-challenges-1-alternating-arrays).* # Separating Nested Lists > > To separate values in ...
[Question] [ ## Introduction Consider a nonempty list **L** of integers. A *zero-sum slice* of **L** is a contiguous subsequence of **L** whose sum equals 0. For example, **[1, -3, 2]** is a zero-sum slice of **[-2, 4, 1, -3, 2, 2, -1, -1]**, but **[2, 2]** is not (because it doesn't sum to 0), and neither is **[4,...
[Question] [ Everyone knows that cats go meow, but what many don't realise is that caaaats go meeeeoooow. In fact, the length of the vowel sounds that the cat makes are dependant on the length of the vowel with which you address it. In the same way, cows go moo, but coooows go moooooooo ## Challenge You are to writ...
[Question] [ [Quipus](https://en.wikipedia.org/wiki/Quipu) are an ancient device used by the Inca in the Precolumbian era to record numbers in a base ten positional system of knots on a cord, which works as follows: > > Each cluster of knots is a digit, and there are three main types of knots: simple overhand knot...