text
stringlengths
180
608k
[Question] [ ## The Machine A billiard-ball type machine is composed of only the symbols `\` `_` `/` along with upper- and lower-case letters, spaces, and the number `1`. `\` and `/` are ramps. A ball coming from above will be deflected to either the right or left side, respectively. For both ramps, if a ball comes...
[Question] [ ## Mathemania Specs: Every piece of Mathemania code starts off with the number `2`. From the `2`, you can do the following operations: * `e`: Exponentiation. This command's default is squaring the number. * `f`: Factorial. This command's default is using the single factorial on the number (`using f on ...
[Question] [ The nutty maths professor wants to encode all of their research using a system sure to fox even the wiliest of their competitors! To this end the professor has decided to change the base of not just the number that they're writing but every single digit in that number, according to which place the digi...
[Question] [ I was walking through a pumpkin patch the other day for a birthday party, and noticed the pumpkin vines making a nifty pattern, with whirls, loops, and offshoots. We're going to simulate that here with some ASCII art. ``` (()) \ p--q p-----q / \ / \ (()) b...
[Question] [ If we have a list, say the list `[9, 2, 4, 4, 5, 5, 7]`, we can do a moving average across it. Taking a window of say, 3 elements, each element is replaced by a window like such: `[[9], [9, 2], [9, 2, 4], [2, 4, 4], [4, 4, 5], [4, 5, 5], [5, 5, 7]]`, and then taking averages, we get `[9.0, 5.5, 5.0, 3....
[Question] [ Jason has a big JSON but it's unreadable, so he needs to prettify it. ## Formatting Spec The JSON has 4 different types: * Numbers; Just `0-9` * Strings; Double quoted `"` strings escaped with `\` * Arrays; Delimited by `[]`, with items separated by `,`, items can be any of these types * Objects; Delim...
[Question] [ The [SAS programming language](https://en.wikipedia.org/wiki/SAS_language) is a clunky, archaic language dating back to 1966 that's still in use today. The original compiler was written in [PL/I](https://en.wikipedia.org/wiki/PL/I), and indeed much of the syntax derives from PL/I. SAS also has a prepro...
[Question] [ Easy As ABC, also known as "End View", is a puzzle where you are given an empty grid with letters around it; you must partially fill in the grid so that exactly one of each letter is in every row and column; in addition, letters at the end of a row (or column) must be the first letter visible in that r...
[Question] [ # 🐸🐸 You must make the shortest program to always find the optimal solution to a simplified Frogger game on a 9x9 grid. **Course Elements:** * `L` - Log (Length: 3-4). When you hop on a log, it carries you with it. * `V` - Vehicle (Length: 1-2) * Speed (1-2): On the left hand side of the row wi...
[Question] [ [Mahjong](https://en.wikipedia.org/wiki/Mahjong) is a tile game that is immensely popular in Asia. It is typically played with four players, and the goal of the game is to be the first person to complete a valid hand using the tiles. In mahjong there are three tile suits plus honour tiles — for this ch...
[Question] [ # Background and Rules There is a variant of chess called atomic chess, which follows essentially the same rules as normal chess, except that pieces explodes other pieces around them when captured. In addition to checkmate, you can also win the game by blowing up the king. When a piece captures another...
[Question] [ [Sandbox](https://codegolf.meta.stackexchange.com/a/18563/82007) Finding radicals of arbitrary ideals in rings is hard! However, it's a doable task in polynomial rings, since they are Noetherian (all ideals are finitely generated) **Background** [A quick introduction to radical ideals](http://mathworld...
[Question] [ [Alpha Decay](https://en.wikipedia.org/wiki/Alpha_decay) is a kind of radiation decay where every time the atom "decays", it loses a helium nucleus (an alpha particle). This means that an atom loses 2 protons and 2 neutrons each time. Your task is to simulate this, including the problems that occur dur...
[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/123907/edit). Closed 6 years ago. [Improve this question](/posts/123907/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/28148/edit). Closed 6 years ago. [Improve this question](/posts/28148/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/8986/edit). Closed 3 years ago. [Improve this question](/posts/8986/edit) **...
[Question] [ I'm work on a problem which I set myself for fun, which is to create a python script which prints the even numbers from 0 to 100. The challenge is to make the script as small as possible. This is what I have so far: ``` for x in range(0, 101): if (x % 2 == 0): print x ``` Currently it is 60...
[Question] [ **Challenge:** Print the **entire** printable ASCII charset (not just a range!) in order. ``` !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ``` **Rules:** *read closely* * No other characters allowed in the output. * Program/function does not accept inp...
[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/35182/edit). Closed 5 years ago. [Improve this question](/posts/35182/edit) ...
[Question] [ Write a program or function that takes in a string and outputs a count of each modern English alphabet letter in the string, case-insensitive. Input: A string consisting of printable ASCII characters (code points 32-126). Output: A list of pairs, where each pair consists of a letter and its count in th...
[Question] [ **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 accepting new answers or interactions. The challenge: > > Input text from one file and output it to another. Solution should be a comple...
[Question] [ Given a string consisting of only upper and lower case letters, output `an` if it begins with a vowel, and `a` if not. For the purposes of this challenge, we'll ignore normal grammar rules, and use a very basic rule instead: if the input begins with a vowel (any of `AEIOUaeiou`), then output `an`. Othe...
[Question] [ This challenge is [related](https://codegolf.stackexchange.com/questions/124362/how-high-can-you-count) # Challenge Your task is to write as many programs/snippets as you can, where each one outputs/prints/ returns an alphabet. The first program must output the letter `A` or `a`, the second one `B` or ...
[Question] [ **Closed**. This question is [opinion-based](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it can be answered with facts and citations by [editing this post](/posts/20994/edit). Closed 2 years ago. [Improve this questio...
[Question] [ Consider the [triangular numbers](https://en.wikipedia.org/wiki/Triangular_number) and their forward differences: $$ T = 1, 3, 6, 10, 15, 21, ... \\ \Delta T = 2,3,4,5,6, ... $$ If we alter \$\Delta T\$ so that it begins with a different integer, we get a different, yet similar sequence (assuming that ...
[Question] [ The title says it all; Given a number in the binary (base-2) number system, output the same number expressed in unary (base-1). You should take the binary number as a string (optionally with a separator), list, or equivalent structure of digits, using any number or digit you like for the digits. The un...
[Question] [ Write a program to calculate the first 500 digits of the mathematical constant e, meeting the rules below: * It cannot include "e", "math.e" or similar e constants, nor may it call a library function to calculate e. * It must execute in a reasonable time (under 1 minute) on a modern computer. * The dig...
[Question] [ # Robbers' Challenge Read the [cops' challenge](https://codegolf.stackexchange.com/q/245701/110951) first. In this [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge, you (the robbers) must find the correct string of characters, which, when added...
[Question] [ Behold! The Crystal Maze‚Ñ¢ Time Matrix! ``` 0 1 2 3 4 5 6 7 8 9 10 1 0 5 10 15 20 25 30 35 40 45 50 2 0 10 20 30 40 50 60 70 80 90 100 3 0 15 30 45 60 75 90 105 120 135 150 4 0 20 40 60 80 100 120 140 160 180 200 5 0 25 50 7...
[Question] [ Yeah... it's confusing. Let me explain it a little better: 1. With a string, get the unicode code points of each letter * Let's use `"Hello World!"`. * The code points would be `[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]` 2. Of each digit of the code points, get their binary format * G...
[Question] [ ## Preamble We've already proven we're good at [adding two numbers](https://codegolf.stackexchange.com/questions/84260/add-two-numbers), but many solutions only operate on tiny numbers like 2³²-1, honestly we can do a lot better. ## The Challenge Given two unsigned, non-negative integers, add them to...
[Question] [ Let us define the *"multiplicative deltas"* of values \$[\; a\_0, \cdots a\_N, \;]\$ as: $$ [\; a\_1 / a\_0, \cdots, a\_{i+1} / a\_i, \cdots, a\_N / a\_{N-1} \;] $$ The reverse operation - namely *"multiplicative undelta"* - returns values such that the above operation results in the given values. ### ...
[Question] [ *This is the robbers' thread. The cops' thread is [here](https://codegolf.stackexchange.com/q/137742/61563).* Your challenge is to take an uncracked submission from the cops' thread and find, for what input or inputs, the program will print `Hello, World!` and a newline. Capitalization, spacing, and pu...
[Question] [ Today, my girlfriend and I started with [this year's Advent of Code](https://adventofcode.com/2020) to improve our Python. So far we only did Day 1 and the first part of Day 2. The latter, I found to be very fun, so, to spice it up a little, and with a tip o' the head to Eric Wastl, here's my attempt a...
[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/231794/edit). Closed 2 years ago. [Improve this question](/posts/231794/edit)...
[Question] [ This is the robbers' thread for 'Almost Illegal Strings'. See the [cop's thread](https://codegolf.stackexchange.com/q/214705/48931) for information on participating. A section from the post is included here for convenience. > > ## The Robbers' Challenge > > > Find an uncracked answer. Write a progra...
[Question] [ I have encountered this type of puzzle, that usually involves apples, several times. It goes as follows: > > There is a certain number of apples in a basket. Ava takes a third of the apples. Bob takes a quarter of the apples that are left. Finally, Dennis takes one-sixth of the apples left. In the end...
[Question] [ Given an input string, write a program that outputs the total number of lines and curves it has. ## The Challenge * Take input from `STDIN`, or any other input method. * Output to `STDOUT`, or any other output method, the total number of lines and curves contained in the string, *in that order*, based ...
[Question] [ **The challenge** Create a function which takes an array of numbers and subtract from each element the lowest element in the array that has not yet been subtracted from another. * After using the lowest value, It can not be used again. * Numbers in the array are decimal numbers, and not necessarily int...
[Question] [ When given a a list of values and a positive integer `n`, your code should output the cartesian product of the list with itself `n` times. For example, in pseudocode your function could be similar to: ``` for x1 in list: for x2 in list: for x3 in list: ... for xn in ...
[Question] [ Given a non-empty list of integers, output every possible partitioning of the list where each partition is a non-empty sublist. So for the list `[1, 2, 3, 4]` the result is: ``` [[1, 2, 3, 4]] [[1, 2, 3], [4]] [[1, 2], [3, 4]] [[1, 2], [3], [4]] [[1], [2, 3, 4]] [[1], [2, 3], [4]] [[1], [2], [3, 4]] [[...
[Question] [ ## Background [Quaternion](https://en.wikipedia.org/wiki/Quaternion) is a number system that extends complex numbers. A quaternion has the following form $$ a + bi + cj + dk $$ where \$ a,b,c,d \$ are real numbers and \$ i,j,k \$ are three *fundamental quaternion units*. The units have the following pr...
[Question] [ Let's say that this array is how many press-ups I've achieved each day in the last 28 days: ``` [ 20,20,20,30,30,30,30, 35,35,40,40,40,45,45, 50,50,50,50,50,50,50, 60,70,80,90,100,110,120 ] ``` As you can see, it's taken a steep upward trend in the last week, and that's the part of this data I'...
[Question] [ # Input A bound m <= 4294967295. # Output Consider values sampled uniformly at random from integers in the range 0 to m, inclusive. Your output should be the expected (average) number of trailing zeros in the binary representation of the sampled value. Your answer should be exact, for example given as ...
[Question] [ You have to make something that takes in one input from a default I/O method (as an integer), and prints out the sum of all the permutations of that number (not necessarily unique) For example: `10` would return `11` because `10` can have 2 permutations (`10` and `01`), and the sum of those two numbers...
[Question] [ This is a [code-shuffleboard](/questions/tagged/code-shuffleboard "show questions tagged 'code-shuffleboard'") [answer-chaining](/questions/tagged/answer-chaining "show questions tagged 'answer-chaining'") challenge, where the answers will aim to, together, output the lyrics to [this](https://www.youtu...
[Question] [ ## The Challenge Given a [rational number](https://en.wikipedia.org/wiki/Rational_number), determine the smallest number which is a positive integer multiple of it. Eg. ``` Given: 1.25 x1: 1.25 x2: 2.5 x3: 3.75 x4: 5 Thus: Answer is 5 ``` ## Clarifications Inputs will be a rational number ...
[Question] [ # Introduction I stumbled across this (useless) pattern the other day while I was watching TV. I named it "the 9 pattern" because the first number to use it was 9. The gist of it is, you enter a number (let's say **x**), and then you get back: * **x** * **x** + (**x** / 3) [let's call this **y**] * two...
[Question] [ # Taken from: OEIS-[A071816](http://oeis.org/A071816) Your task, given an upper bound of `n`, is to find the number of solutions that satisfy the equation: ``` a+b+c = x+y+z, where 0 <= a,b,c,x,y,z < n ``` The sequence starts out as described on the OEIS page, and as below (1-indexed): ``` 1, 20, 141, ...
[Question] [ Two numbers are considered [amicable](https://en.m.wikipedia.org/wiki/Amicable_numbers) if the proper divisor sum of the first is the same as the second number, the second number's proper divisor sum is equal to the first number, and the first and second numbers aren't equal. \$s(x)\$ represents the al...
[Question] [ Let `n` be the number of times your program has been executed. If `n` is a power of 2, then print `2^x` where `n = 2^x`; otherwise, simply output the number. Example run: ``` [1st time] 2^0 [2nd time] 2^1 [3rd time] 3 [4th time] 2^2 [5th time] 5 ``` and so on. This is a popularity contest, so the answe...
[Question] [ One way to generalize the concept of a range from the integers to the Gaussian integers (complex numbers with integer real and imaginary part) is taking all numbers contained in the rectangle enclosed by the two ends of the range. So the range between two Gaussian integers `a+bi` and `c+di` would be al...
[Question] [ In this challenge, all bots are wizards. At the beginning of each round, they create a wand which has a certain chance of successfully stunning another wizard. They then fight, by choosing one bot to attack in each turn. The last bot remaining wins. ### Results 500 games, 1000 rounds each ``` Revenge!:...
[Question] [ Assume an simple keyboard with this layout: ``` 1 2 3 4 5 6 7 8 9 0 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z . , ? ! ``` Peter's keyboard pattern can be generated by starting at the top left of the keyboard, and displays the first three characters and a newline. It shifts over one character ...
[Question] [ Write a program which takes an input (which may or may not be prime), and lists the immediate prime following and preceding it. **Example input:** ``` 1259 ``` **Example output:** ``` 1249 1277 ``` Shortest program wins. Must execute within 10 seconds on a modern desktop PC. Inputs will be limited to 1...
[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/219219/edit). Closed 2 years ago. [Improve this question](/posts/219219/edit)...
[Question] [ Write the shortest program or function which generates these 1000 numbers or a sequence (0- or 1-indexed) which begins with them. ``` [0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,...
[Question] [ Given two integers, which may be negative, zero, or positive, \$a\$ and \$b\$ (taken in any reasonable format, **including inputting a plain complex number**), convert it to \$a + bi\$ where \$i\$ is the imaginary number (square root of negative one). Then, raise it to the power of a third (positive in...
[Question] [ Some decimal numbers cannot be precisely represented as binary floats due to the internal representation of the binary floats. For example: rounding 14.225 to two decimal digits does not result in 14.23 as one might expect but in 14.22. **Python**: ``` In: round(14.225, 2) Out: 14.22 ``` Assume, howeve...
[Question] [ Write a program which generates keyboard events which type `Hello, World!`. It doesn't have to be platform-independent. It can't leave any keys pressed. For example, in Java, `Robot.KeyPress('H');` will leave `H` pressed, so you must release it with `Robot.KeyRelease('H');` You may assume that the caps...
[Question] [ # Objective Given a permutation of 4 distinct items, classify the permutation by the normal subgroup(s) it belongs. # Input/Output Format You gotta choose the followings as the hyperparameters for your submission: * The 4 distinct items. * The permutation serving as the identity permutation. The input ...
[Question] [ Given a PPCG User ID, output that user's current username. # Examples ``` Input -> Output 61563 -> MD XF 2 -> Geoff Dalgas 12012 -> Dennis foo -> -3 -> ``` # Rules * Input/output can be taken via any allowed means. * The output must be the full username with proper capitalization and spacing...
[Question] [ Given a positive square number as input. Output the number of values between the input and next highest square. ### Example Input: 1 Output: 2 Reason: The numbers 2 and 3 are between 1 and 4, the next highest square Input: 4 Output: 4 Reason: The numbers 5, 6, 7, 8 are between 4 and 9 [Answer] #...
[Question] [ You will be given a two-dimensional array and a number and you are asked to find whether the given matrix is [Toeplitz](https://en.wikipedia.org/wiki/Toeplitz_matrix) or not. A matrix is a Toeplitz matrix if every descending diagonal, going from left to right, has only one distinct element. That is, it...
[Question] [ A Tiefling is a character race, from Dungeons and Dragons, that has this list of possible traits: * small horns * fangs or sharp teeth * a forked tongue * catlike eyes * six fingers on each hand * goat-like legs * cloven hoofs * a forked tail * leathery or scaly skin * red or dark blue skin * cast no s...
[Question] [ *Inspired by the [Codewars Kata](https://www.codewars.com/kata/replace-with-alphabet-position/train/python).* Your goal is to take an input string such as this one: ``` "'Twas a dark and stormy night..." ``` and return a string containing the position of each character in the alphabet, separated by spa...
[Question] [ # Introduction When playing Mario Kart the other day, an interesting question popped up when a Grand Prix with my 2 roommates, 9 AI drivers and myself seemed to be fairly close and therefore exciting until the very end. We asked ourselves: How close can the point difference between first and last place...
[Question] [ Inspired by [this StackOverflow question](https://stackoverflow.com/questions/52990870/splitting-double-quatation-comma-lines-in-java/). ## Input: We'll take three inputs: * A delimiter-character `D` to split on * A character `I` between two of which we ignore the delimiter character (I know, that soun...
[Question] [ What you need to do is create a function/program that takes a decimal as input, and outputs the result of repeatedly taking the reciprocal of the fractional part of the number, until the number becomes an integer. More specifically, the process is as follows: 1. Let x be the input 2. If x is an integer...
[Question] [ Inspired by [this question](https://codegolf.stackexchange.com/questions/1977/what-is-the-average-of-n-the-closest-prime-to-n-the-square-of-n-and-the-closes). Given a list containing numbers, print: * The sum and product of the numbers in the list * The average and median * The differences between each...
[Question] [ **Input:** A string (or the closest thing to that in your language) **Output:** The same string but converted to sentence case **Rules:** * For this challenge, sentence case can be considered "`The first letter of each sentence is capitalized. The rest are lowercase.`" (i.e. proper nouns do not have to...
[Question] [ Given the output of the cop's program (`o`), the byte-count (`n`) and the number of unique bytes (`c`) used, come up with a corresponding piece of code that is `n` bytes long with `c` unique bytes which matches the cop's output `o`. --- # This is the ***robbers thread***. Post solutions that you cracke...
[Question] [ In this challenge, You have to bring ASCII art (which are usually 2D) to 3D! # How? like this, ``` X X DD X D D X X DD ``` to... ``` X X DD X X DD D X X DDDD X XDDD X X DD ``` # Then How do we do *that*? Given the ascii art and `N`, repeat this `N` times. * for every character (we will call t...
[Question] [ In [special relativity](https://en.wikipedia.org/wiki/Special_relativity), the velocity of a moving object relative to another object that is moving in the opposite direction is given by the formula: \begin{align}s = \frac{v+u}{1+vu/c^2}.\end{align} ``` s = ( v + u ) / ( 1 + v * u / c ^ 2) ``` In this ...
[Question] [ [PARI/GP](http://pari.math.u-bordeaux.fr/) is a free computer algebra system. It is designed for (algebraic) number theory, not golfing, but that's part of the attraction. Unsurprisingly, it fares best at mathematical tasks; its support for string manipulation is primitive. (Having said that, advice fo...
[Question] [ Your goal is to compute the set intersection of two lists of integers. The intersection is defined as the unique un-ordered group of integers found at least once in both input list. # Input The input may be in any format desired (function parameter, stdio, etc.), and consists of two lists of integers. ...
[Question] [ Write the shortest code to create a [deadlock](https://en.wikipedia.org/wiki/Deadlock). Code execution must halt, so this doesn't work: ``` public class DeadlockFail extends Thread{ //Java code public static void main(String[]a){ Thread t = new DeadlockFail(); t.start(); t.j...
[Question] [ Your task today will be to take an existing file and append zeros to it until it reaches a certain size. You must write a program or function which takes the name of a file in the current directory `f` and a number of bytes `b`. While maintaining the original content of `f`, you must write zeroes ***(...
[Question] [ # Introduction The childhood song *Eeny, meeny, miny, moe* was often used to select who was "it" when playing tag. Everyone would stand in a circle and point at one person selected at random. They would sing: > > Eeny, meeny, miny, moe, > > Catch a tiger by the toe. > > If he hollers, let him ...
[Question] [ Given a large number (in base 10), such as 1234567891011121314151617, find prime "subnumbers" in it. A prime "subnumber" is a consecutive sequence of digits (taken from the input), which represents a prime number (in base 10). * **Input**: A number (either a string, a file, or whatever you like). * ...
[Question] [ A [common year](https://simple.wikipedia.org/wiki/Common_year) is a year that is not a leap year and where the first and last day of the year are on the same day. A [special common year](https://en.wikipedia.org/wiki/Common_year_starting_on_Monday) is one that starts on a Monday and so ends on a Monday...
[Question] [ # Objective Given an unlabelled binary tree, decide whether it is contiguous in indices. # Indices This challenge gives one-indexing on binary trees. The exact definition expresses all indices in binary numeral: * The root is indexed `1`. * For every node, to get the index of its left child, replace th...
[Question] [ Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details. --- It's time to prepare an advent calendar, but I've only got a large sheet of rectangula...
[Question] [ Welcome to Code Bots 2! You've learned your lesson since the last Code Bots. You've tried to figure out more ways to fit more actions in less lines, and now you finally have it. You're going to make an event-driven Code Bot. Your bot must consist of 24 lines. Each line follows one of the two formats: `...
[Question] [ Given a set of `n` elements, the challenge is to write a function who lists all the combinations of `k` elements of in this set. ## Example ``` Set: [1, 7, 4] Input: 2 Output: [1,7], [1,4], [7,4] ``` ## Example ``` Set: ["Charlie", "Alice", "Daniel", "Bob"] Input: 2 Output ["Daniel", "Bob"], ["Charlie"...
[Question] [ The task is to to compete for the **shortest regex** (in **bytes**) in your preferred programming language which can distinguish between English and Spanish with minimum ~~**`60%`**~~ **`90%`** accuracy. [Silvio Mayolo](https://codegolf.stackexchange.com/a/207418/95389)'s submission (pinned as `Best An...
[Question] [ The problem over [here](https://codegolf.stackexchange.com/questions/205129/produce-the-string-deno-from-the-string-node) introduces an new type of strings: if you split the string into equal halfs and swap the pairs, it produces the same output as sorting the string. We call that a half-sort. Given a ...
[Question] [ For reference as to what the tower of Hanoi is, either Google it or look on the [Wikipedia](http://en.wikipedia.org/wiki/Tower_of_Hanoi) page. Your code should be able to do 2 things, and they are the following: * Accept user input that specifies the number of discs at the starting point of the Hanoi t...
[Question] [ > > This is a follow-up of > [CodeGolf - Ignore the noise #1](https://codegolf.stackexchange.com/questions/50381/quickgolf-ignore-the-noise-1) > the only problem being that Barry has made things even worse for us. Lets see what happened > > > ### Update I've added code to create random input and ...
[Question] [ I was working on a math question with a friend of mine, and we decided to write a script that finds the answer. The original question is as follows: > > The difference of two natural numbers is 2010 and their greatest common denominator is 2014 times smaller than their lowest common multiply. Find all...
[Question] [ A skyline is an array of positive integers where each integer represents how tall a building is. For example, if we had the array `[1,3,4,2,5,3,3]` this would be the skyline in ascii art: ``` # # # ## ### ###### ####### ``` A maximal rectangle is a rectangle that cannot be extended in any direc...
[Question] [ *Inspired by [this Numberphile video](https://www.youtube.com/watch?v=R4OvBB9KHMA).* --- ## What is planing? In order to 'plane' a sequence of digits, you need to: 1. Identify the lengths of the 'runs' (adjacently repeated digits) in the sequence. Non-repeated digits count as runs of one. 2. Decrease t...
[Question] [ Let's say you have a stack, which at the start contains `a b c` in this order (`a` is on the top). You are given the required output stack, in any reasonable format (a list, a string, etc.), e.g. `[a, c, b]` (here `a` is on the top, below it `c` and below it `b`). You can also take the input reversed i...
[Question] [ You are given an array/list/vector of pairs of integers representing cartesian coordinates \$(x, y)\$ of points on a 2D Euclidean plane; all coordinates are between \$−10^4\$ and \$10^4\$, duplicates are allowed. Find the area of the [convex hull](https://en.wikipedia.org/wiki/Convex_hull) of those poi...
[Question] [ Implement the Discrete Fourier Transform (DFT) for a sequence of any length. This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. The algorithm will compute a result based on standard DFT in the forward direction. The input ...
[Question] [ Given 3 positive integers `a`, `b`, and `n` (whose maximum values are the maximum representable integer value in your language), output a truthy value if `a ≡ b (mod n)`, and falsey otherwise. For those unfamiliar with congruency relations, `a ≡ b (mod n)` is true iff `a mod n = b mod n` (or, equivalen...
[Question] [ ## The challenge The program must return all numbers included into a group (comma and hyphen separated sequence) of numbers. ## Rules * `s` is the sequence string; * all numbers included in `s` are **positive**; * numbers will always **increase**; * numbers will **never repeat** * when you answer, sho...
[Question] [ Given a list of numbers \$[a\_1, a\_2, ... a\_n]\$, compute the sum of all the matrices \$A\_i\$ where \$A\_i\$ is defined as follows (\$m\$ is the maximum of all \$a\_i\$): $$ \begin{array}{c|cc} & 1 & 2 & \cdots & i-1 & i & i+1 & \cdots & n \\ \hline 1 & 0 & 0 & \cdots & 0 & a\_i & a\_i & \cdots & a...
[Question] [ The *prime cluster* of an integer **N** higher than **2** is defined as the pair formed by the highest prime **strictly** lower than **N** and the lowest prime **strictly** higher than **N**. Note that following the definition above, if the integer is a prime itself, then its prime cluster is the pair ...
[Question] [ **Introduction** Today I went fishing alone with my canoe, unfortunately I fell asleep and the stream brought me away, I lost my oars, now it's night and I am lost in the ocean! I can't see the coast so I must be far away! I have my cell phone but is malfunctional because it got wet by the salty wate...