text
stringlengths
180
608k
[Question] [ The goal is, having taken a string as input, duplicate each latin letter and "toggle" its case (i.e. uppercase becomes lowercase and vice-versa). Example inputs & outputs: ``` Input Output bad bBaAdD Nice NniIcCeE T e S t Tt eE Ss tT s E t sS Ee tT 1!1!1st! 1!1!1sStT! n00b ...
[Question] [ **This is the cops' thread. The robbers' thread goes [here](https://codegolf.stackexchange.com/questions/77420/find-the-program-that-prints-this-integer-sequence-robber-thread).** The last [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") thread was alrea...
[Question] [ As a kid my sister showed me this little love calculation to see how much chance you have of getting in a successful relationship with your crush. All you need is 2 names and a piece of paper. * John * Jane Then, you separate these names with the word **Loves**. You can either write this on one line o...
[Question] [ Each term in the squaring sequence, \$x\_n\$, is created by taking \$x\_{n-1}\$, squaring it, and removing all but the first four digits. The sequence always begins with \$x\_1 = 1111\$. Squaring this yields \$1234321\$, so \$x\_2 = 1234\$ The first few terms are: ``` 1111 1234 1522 2316 5363 ... ``` -...
[Question] [ Write a short program for [196-algorithm](http://mathworld.wolfram.com/196-Algorithm.html). The algorithm starts from an integer, then adds its reverse to it until a palindrome is reached. e.g. ``` input = 5280 5280 + 0825 = 6105 6105 + 5016 = 11121 11121 + 12111 = 23232 output = 23232 ``` **Input** an...
[Question] [ Print or return the following string: ``` zottffssentettffssenttttttttttttttttttttffffffffffffffffffffsssssssssssssssssssseeeeeeeeeennnnnnnnnno ``` This is the first letter of each of the numbers **z**ero, **o**ne, **t**wo, all the way up to **o**ne hundred. Standard I/O rules apply, but the output mus...
[Question] [ Inspired by [this Stack Overflow post](https://stackoverflow.com/q/70550089/17242583). Given an ascending-sorted array of possibly duplicated integers, your goal is to increment each number by a counter, starting at 0, that resets for each group. Spec: * Any numbers may be negative (but if so, they'll ...
[Question] [ Your input will be a integer between 1970 and 2090 (inclusive), representing a year. Your program should output the next year on which New Years Day falls on the same day of the week as the input year. **Test Cases:** Below are the sample inputs and outputs ``` 2001 => 2007 2047 => 2058 2014 => 2020 19...
[Question] [ The goal of this challenge is to print the following tongue twister: ``` She sells seashells by the seashore, The shells she sells are seashells, I'm sure. So if she sells seashells on the seashore, Then I'm sure she sells seashore shells. ``` This is more complicated than just calling your language's ...
[Question] [ The program must print the alphabet four times: first in the normal alphabetical order, second in the order of a qwerty keyboard, third in the order of a dvorak keyboard, and lastly in reverse alphabetical order. The output should resemble this: ``` abcdefghijklmnopqrstuvwxyz qwertyuiopasdfghjklzxcvbnm...
[Question] [ # Task: **Given an integer number in decimal number system, reduce it to a single decimal digit as follows:** 1. Convert the number to a list of decimal digits. 2. Find the largest digit, D 3. Remove D from the list. If there is more than one occurrence of D, choose the first from the left (at the most...
[Question] [ *[Rip-off](https://codegolf.stackexchange.com/q/193315/43319) of a [rip-off](https://codegolf.stackexchange.com/questions/193021/i-reverse-the-source-code-you-negate-the-input) of a [rip-off](https://codegolf.stackexchange.com/q/192979/43319) of a [rip-off](https://codegolf.stackexchange.com/q/132558/4...
[Question] [ Using the following length-separated lists of words: [https://github.com/Magic Octopus Urn/wordListsByLength](https://github.com/carusocomputing/wordListsByLength) Print 1 word from each list of length `n` from 1 all the way up to 20, here's a valid example: ``` a an and hand hands handle handles aband...
[Question] [ (Challenge taken from a multiplayer game (clash of code) at [codingame.com](https://www.codingame.com/home)) ## The challenge Find the **n**-th term of the following sequence: `1, 1, 2, 1, 2, 3, 1, 2, 3, 4...` or, to make it more obvious, `{1}, {1,2}, {1,2,3}, {1,2,3,4}...` The sequence is made up from...
[Question] [ A common visual explanation of the Pythagorean theorem is as such: [![3 boxes](https://i.stack.imgur.com/PJFZl.gif)](https://i.stack.imgur.com/PJFZl.gif) The squares are meant to represent the side length's squared, and the areas of `a + b = c`, just like the Pythagorean theorem says. This part is what...
[Question] [ Given an integer `n > 9`, for each possible insertion between digits in that integer, insert an addition `+` and evaluate. Then, take the original number modulo those results. Output the sum total of these operations. An example with `n = 47852`: ``` 47852 % (4785+2) = 4769 47852 % (478+52) = 152 4785...
[Question] [ ## Goal Create a program/function that takes an input `N`, check if `N` random pairs of integers are relatively prime, and returns `sqrt(6 * N / #coprime)`. ## TL;DR These challenges are simulations of algorithms that only require nature and your brain (and maybe some re-usable resources) to approximat...
[Question] [ You have a coin that produces `0` or `1`. But you suspect the coin may be *biased*, meaning that the probability of `0` (or `1`) is not necessarily 1/2. A [well known](https://en.wikipedia.org/wiki/Fair_coin#Fair_results_from_a_biased_coin) procedure to "transform" a biased coin into a *fair coin* (i.e...
[Question] [ ## Input A integer *n* ( ≥ 1) and a digit *d* (an integer such that 0 ≤ *d* ≤ 9). In either order; from stdin or parameters or whatever; to a program or function; etc. ## Output The integers from 1 to *n* inclusive (in order) whose decimal representations contain an **even** number of *d*s. (That is, t...
[Question] [ A [self number](https://en.wikipedia.org/wiki/Self_number) (also called a Colombian or Devlali number) is a natural number, `x`, where the equation `n + <digit sum of n> = x` has no solutions for any natural number `n`. For example, **21** is not a self number, as `n = 15` results in `15 + 1 + 5 = 21`....
[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] [ # Aligning Lines! Given a character and a multiline string, your job is to pad each line of the string so they line up among the given delimiter. ## Examples **Input:** ``` , Programming, Puzzles And, Code golf ``` **Output:** ``` Programming, Puzzles And, Code golf ``` # Input The input will b...
[Question] [ You are given three parameters: start(int), end(int) and list(of int); Make a function that returns the amount of times all the numbers between **start** and **end** are multiples of the elements in the **list**. example: ``` start = 15; end = 18; list = [2, 4, 3]; 15 => 1 (is multiple of 3) 16 => 2 (i...
[Question] [ This is a byte sized challenge where you have to convert an input temperature in one of the three units (Celsius, Kelvin and Fahrenheit) to the other two. # Input You would be provided with a temperature as a number followed by a unit (separated by space). The temperature can be an integer or a floatin...
[Question] [ Your task is to translate a [103-smooth number](https://en.wikipedia.org/wiki/Smooth_number) into an English word, using the method described below. ## How? 1. Generate the list of prime factors (with repetition) of the input number. 2. Sort the list: * If **2** is not one of the prime factors, sort t...
[Question] [ ### Backstory Disclaimer: May contain made up information about kangaroos. Kangaroos traverse several stages of development. As they grow older and stronger, they can jump higher and longer, and they can jump more times before they get hungry. In stage **1**, the kangaroo is very little and cannot jump...
[Question] [ # Stock Time Machine You've gained access to a dataset, `tomorrowStocks`, which contains the stock prices from your favorite business on the NASDAQ. This dataset is a container indexed by minutes past opening. Each index contains the price of the stock at that time. ``` // Assume the stock market opens...
[Question] [ Your challenge is to write a code-golf HTTP server that accepts GET requests. It obviously doesn't have to be fully featured, but it must serve files from a directory. Rules: * The HTTP server must listen on TCP port 36895 (0x901F) * It must serve files from `/var/www` on \*NIX systems (e.g. Linux), or...
[Question] [ I hope this picture looks familiar to you. [![enter image description here](https://i.stack.imgur.com/Egmke.png)](https://i.stack.imgur.com/Egmke.png) It's one of [Pacman](https://www.google.com/logos/2010/pacman10-i.html)'s ghosts in his ["vulnerable" state](http://pacman.wikia.com/wiki/Vulnerable_Gho...
[Question] [ Sometimes I make bad jokes... And a bad joke I like to make involves interpreting exclamation marks in sentences as the factorial sign. # Task Your task is to write a program that receives a sentence and applies the factorial joke to the sentence. The "factorial joke" consists of looking for exclamatio...
[Question] [ Challenge inspiration was this that I saw somewhere: > > The word "nun" is just the letter **n** doing a cartwheel > > > Your challenge is to take a string and determine if it is the first letter doing a cartwheel. # Rules A string is a letter doing a cartwheel if: * The first letter is the same as...
[Question] [ I have a challenge for you: * Print "Hello World" using any language. * Each character must be printed from its own, unique thread That's it. Obviously, as there's no guarantee that the threads will operate in the order you start them, you have to make your program thread safe to ensure the output is p...
[Question] [ # Introduction Humans are a remarkable species, but we can be very awkward to understand sometimes—especially for computers. In particular, we seem to like writing polynomials in a very convoluted fashion with seemingly arbitrary rules. What is the shortest program you can write to format a polynomia...
[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/471/edit). Closed 4 years ago. [Improve this question](/posts/471/edit) This...
[Question] [ I know, the title cracks you up --- Given an amount of money, output the fewest number of **coins** that make up that amount. ## Examples ``` 0.1 1 dime 0.01 1 penny 0.28 1 quarter 3 penny 0.56 2 quarter 1 nickel 1 penny 1.43 5 quarter 1 dime 1 nickel 3 penny ``` ## Spec * 100 cents in a dollar. * The ...
[Question] [ According to me, a tornado looks like this: ``` ######## ####### ###### ##### #### ### ## # ``` This tornado starts out with width `n`, and on each next line, a character is removed from either the left or the right, depending on the input. # Input The input will be a list of some sor...
[Question] [ Imagine a very simple language. It has just 2 syntax features: `()` indicates a block scope, and any word consisting only of 1 or more lower case ASCII letters, which indicates a identifier. There are no keywords. In this language, the value of identifiers is not important except when they appear multi...
[Question] [ We can read `13576870234289` digit-by-digit in English, and it makes a haiku: > > *one three five seven* > > *six eight seven zero two* > > *three four two eight nine* > > > We say it's a "digit haiku", because when read out like this, it's 5+7+5 syllables long, **and** no word is broken acro...
[Question] [ Write a program or function that takes an array of non-negative integers as input and outputs a set of vectors/arrays with the elements of the input array in order, split so that each vector sums up to 15. If the sum of the first N elements doesn't "hit 15", then the number that made it pass 15 must be...
[Question] [ This is a challenge in which two people, 1 and 2, are running for office. People deterministically vote in certain ways in the world of 1 and 2, which can allow for the candidates to figure out the results before the election. NOTE: this is not meant to refer to any outside elections or other political...
[Question] [ Write a program or function that takes in a rectangular grid of text where every cell is either an `A` or a `B`. All the `A` cells will form a [simply-connected](https://en.wikipedia.org/wiki/Simply_connected_space) shape, i.e. they will all be orthogonally [connected](https://en.wikipedia.org/wiki/Con...
[Question] [ Your goal is to determine whether a given number `n` is prime in the fewest bytes. But, your code must be a single [Python 2](https://docs.python.org/2/) expression on numbers consisting of only * operators * the input variable `n` * integer constants * parentheses No loops, no assignments, no built-i...
[Question] [ xkcd is everyone's favorite webcomic, and you will be writing a program that will bring a little bit more humor to us all. Your objective in this challenge is to write a program which will take a number as input and display that xkcd and its title-text (mousover text). ## Input Your program will tak...
[Question] [ Because of this, you need a better way of working out if a phrase is an acronym of a word. You also think it would be worthwhile to see if the phrase and word in question are recursive acronyms. ## Your task: Given a word and then a phrase separated by a line, output if the phrase is an acronym and the...
[Question] [ ### Introduction [![code golf explanation](https://i.stack.imgur.com/5kSwA.png)](https://i.stack.imgur.com/5kSwA.png) Imagine that line of chars is in fact two rows. **Upper row - dots - represents hours** (24 hour system), while **lower - commas - represents minutes**. One character can represent hour...
[Question] [ Write a program or function which receives as input a string representing a Welsh word (UTF-8 unless otherwise specified by you). The following are all *single letters* in Welsh: > > a, b, c, ch, d, dd, e, f, ff, g, ng, h, i, j, l, ll, m, n, o, p, ph, r, rh, s, t, th, u, w, y > > > To quote [Wikipe...
[Question] [ ![cantor normal form](https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Omega-exp-omega-labeled.svg/500px-Omega-exp-omega-labeled.svg.png "Round and round it goes, and this is only the beginning") The [ordinal number system](http://en.wikipedia.org/wiki/Ordinal_number) is a system with infinite...
[Question] [ Nichomachus's Theorem relates the square of a sum to the sum of cubes: ![Nichomachus's Theorem](https://i.stack.imgur.com/58XhI.png) and has a beautiful geometric visualization: ![Visualization](https://i.stack.imgur.com/r0HLx.png) ## Challenge: Create the 2d part of this visualization in ascii. You wi...
[Question] [ Because we can't get enough of esoteric language golfs, can we? ///—pronounced *slashes*—is a fun little language based on the `s///` regex-replacement function of Perl fame. It contains only two special characters, slash `/` and backslash `\`. You can find a full article on it at the [esolangs wiki](h...
[Question] [ ### Statement You are given a still of a series of balls falling in a 2D grid. This grid is surrounded by immutable and unbreakable walls so all the action is contained within them. Your task is to determine what the state of the scenario will be after gravity does all it's work. ### Elements inside gr...
[Question] [ You are given as input a greyscale image. Your task is to find a static or looping pattern in Conway's [Game of Life](http://en.wikipedia.org/wiki/Conway's_Game_of_Life) that resembles the input image as closely as possible. Your output can be *either* a still image or a looping animation in some forma...
[Question] [ # Challenge Given a list of integers, show how gravity sort would be done. # Gravity Sort In gravity sort, imagine the numbers as rows of asterisks. Then, everything falls, and the new rows will be obviously sorted. Let's look at an example: `[2, 7, 4, 6]`: ``` ** ******* **** ****** ------- ** **** **...
[Question] [ # Description We consider a slightly simplified version of Tetris where each move consists of: * rotating the piece clockwise, 0 to 3 times * positioning the piece at a given column * fast drop The goal is to determine the number of completed lines, given a list of such Tetris moves. Completed rows are...
[Question] [ In the 1990s, COBOL computer engineers worked out a way to extend six-digit date fields by converting them to `YYYDDD` where `YYY` is the `year - 1900` and `DDD` is the day of the year `[001 to 366]`. This scheme could extend the maximum date to `2899-12-31`. In the year 2898, the engineers started pa...
[Question] [ Given an input of an ASCII art picture, output the ASCII art italicized. To italicize the ASCII art: 1. Insert zero spaces before the last line, one space before the second-last line, two spaces before the third-last line, etc. 2. Remove any extra leading whitespace that may have been created. That is,...
[Question] [ A lot of PPCG users helped with the creation of this challenge, both in chat and the Sandbox, specifically [Martin Ender](https://chat.stackexchange.com/transcript/240?m=43488434#43488434), [AdmBorkBork](https://chat.stackexchange.com/transcript/240?m=43717719#43717719), [Emigna](https://chat.stackexch...
[Question] [ ## Background In France, and probably in the rest of the European Union, any food available for sale [must](https://www.legifrance.gouv.fr/affichCodeArticle.do?idArticle=LEGIARTI000006292795&cidTexte=LEGITEXT000006069565&dateTexte=20110531) list the ingredients that compose it on its packaging, in **we...
[Question] [ **The Challenge** Given an integer input `x` where `1 <= x <= 255`, return the results of powers of two that when summed give `x`. **Examples** Given the input: ``` 86 ``` Your program should output: ``` 64 16 4 2 ``` Input: ``` 240 ``` Output: ``` 128 64 32 16 ``` Input: ``` 1 ``` Output: ``` 1 ``` In...
[Question] [ ## Introduction and Credit Today without a fancy prelude: Please implement `takewhile`. A variation of this (on a non-trivial data structure) was an assignment at my university functional programming course. This assignment is now closed and has been discussed in class and I have my professor's permiss...
[Question] [ **The Challenge** Your task is to create a program or function that outputs the following with no input: ``` a bb ccc dddd eeeee ffffff ggggggg hhhhhhhh iiiiiiiii jjjjjjjjjj kkkkkkkkkkk llllllllllll mmmmmmmmmmmmm nnnnnnnnnnnnnn ooooooooooooooo pppppppppppppppp qqqqqqqqqqqqqqqqq rrrrrrrrrrrrrrrrrr sssss...
[Question] [ Input a non-empty array with \$n\$ positive integers. Test if the input array contains every integer in \$1\cdots n\$. In case you prefer 0-indexed numbers, you may choose to input an array of non-negative integers, and test if the input array contains every integer in \$0\cdots (n-1)\$ instead. All te...
[Question] [ A set is sum-free if no two (not necessarily distinct) elements when added together are part of the set itself. For example, `{1, 5, 7}` is sum-free, because all members are odd, and two odd numbers when added together are always even. On the other hand, `{2, 4, 9, 13}` is not sum-free, as either `2 + ...
[Question] [ The sequence of Fibonacci numbers is defined as follows: \$ F\_0 = 0 \\ F\_1 = 1 \\ F\_n = F\_{n-1} + F\_{n-2} \$ Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not need to handle the inputs \$ 0 \$ or \$ 1 \$, nor any non-Fibonacci numbers. Errors as a result of...
[Question] [ The task is simple: print `The quick brown fox jumps over the lazy dog` using as few *distinct* characters in your source code as possible. `print "The quick brown fox jumps over the lazy dog"` has a score of 29 characters, as all 26 lowercase letters appear at least once, as well as an uppercase T, sp...
[Question] [ Given two integers, output the two integers, and then the range between them (excluding both). The order of the range must be the same as the input. ### Examples: ``` Input Output 0, 5 -> [0, 5, 1, 2, 3, 4] -3, 8 -> [-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7] 4, 4 -> [4, 4] 4, 5 ...
[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/22975/edit). Closed 3 years ago. [Improve this question](/posts/22975/edit) ...
[Question] [ Over is a higher-order function in multiple languages such as [APL](https://aplwiki.com/) (`⍥`). It takes 2 functions and 2 values as arguments, applies the first function to both values, then applies the second to their result. For example, using `⍥` to represent Over: ``` 1 ²⍥+ 2 ``` We would first c...
[Question] [ *Note: This is the **cops'** thread, where one should post the scrambled code. Here is the **[robbers' thread](https://codegolf.stackexchange.com/questions/115034/robbers-square-times-square-root)*** where the cracked source should be posted and linked to the cop's answer. --- **Task:** Write the short...
[Question] [ Your task is to output the exact string ``` The Jabberwocky ``` without taking input. Normal rules for input and output apply, so both functions and programs are allowed. Of course there is a catch, it wouldn't be fun without a catch. Your program, when stripped of non-alphabetic characters, must start...
[Question] [ (heavily inspired by [Element of string at specified index](https://codegolf.stackexchange.com/q/120375/42545)) Given a string `s` and an integer `n` representing an index in `s`, output `s` with the character at the `n`-th position removed. 0-indexing and 1-indexing are allowed. * For 0-indexing, `n` ...
[Question] [ Again inspired by a task for Programming 101 here's another challenge. **Input:** * A positive integer `n >= 3`. (has to be odd) **Output:** * `n` lines of asterisks, where the first line has `n` asterisks and every new line has two asterisks less than the line before. Until hitting 1 asterisk. From th...
[Question] [ ## Challenge Write a function which takes one parameter: an integer `t`. Your function has to stop your program for `t` seconds before continuing, similar to `time.sleep(t)` in Python and `WAIT t` in BBC BASIC. You must not use any built in waiting functions or any built in functions for executing code...
[Question] [ # Problem Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, ...
[Question] [ In the game [Yahtzee](https://en.wikipedia.org/wiki/Yahtzee), players roll five six-sided dice, and attempt to create certain hands to score points. One such hand is a *small straight*: four consecutive numbers, not necessarily in order. The three possible small straights are `1, 2, 3, 4`, `2, 3, 4, 5`...
[Question] [ Given a square integer matrix as input, output the determinant of the matrix. ## Rules * You may assume that all elements in the matrix, the determinant of the matrix, and the total number of elements in the matrix are within the representable range of integers for your language. * Outputting a decimal...
[Question] [ ## Introduction How much of the English alphabet does a given string use? The previous sentence uses 77%. It has 20 unique letters (howmucftenglisapbdvr), and 20/26 ≃ 0.77. ## Challenge For an input string, return the percentage of letters of the English alphabet present in the string. * The answer can...
[Question] [ # Problem Given no input write a program or a function that outputs or returns the following string: `(<(<>(<>.(<>.<(<>.<>(<>.<>)<>.<>)>.<>).<>)<>)>)` # Rules * Shortest program wins. * Trailing whitespace allowed. * Trailing newlines allowed. * Unused parameters for functions allowed. [Answer] # ...
[Question] [ ## Defintion A [centrosymmetric matrix](https://en.wikipedia.org/wiki/Centrosymmetric_matrix) is a square [matrix](https://en.wikipedia.org/wiki/Matrix_(mathematics)) that is symmetric about its center. More rigorously, a matrix \$A\$ of size \$n \times n\$ is centrosymmetric if, for any \$i,\: j \in (...
[Question] [ So you are given a **POSITIVE** base 10 (decimal) number. Your job is to reverse the binary digits and return that base 10 number. ### Examples: ``` 1 => 1 (1 => 1) 2 => 1 (10 => 01) 3 => 3 (11 => 11) 4 => 1 (100 => 001) 5 => 5 (101 => 101) 6 => 3 (110 => 011) 7 => 7 (111 => 111) 8 => 1 (1000 => 0001)...
[Question] [ ## The Challenge Given a list of integers, the "bittiest" number among them is the one with the most bits on - that is, the largest amount of bits set to 1 in its 32-bit [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement) representation. Write a function (or a program) that takes as in...
[Question] [ The goal here is to simply reverse a string, with one twist: Keep the capitalization in the same places. Example Input 1: `Hello, Midnightas` Example Output 1: `SathginDim ,olleh` Example Input 2: `.Q` Exmaple Output 2: `q.` **Rules**: * Output to STDOUT, input from STDIN * The winner will be p...
[Question] [ The challenge is to make any [Roman numerals](http://en.wikipedia.org/wiki/Roman_numerals) valid code in your chosen language. They should **not** appear inside of strings or anything similar, but work just like any other tokens, [literals](http://en.wikipedia.org/wiki/Literal_%28computer_programming%2...
[Question] [ It's become somewhat of a tradition in PPCG that some users temporarily change their names by an anagram (a new name formed by reordering the letters of the old). Sometimes it gets difficult to find out who is who. I could use a program or function to tell if two phrases are anagrams of each other. ###...
[Question] [ Given N, output the Nth term of this infinite sequence: ``` -1 2 -2 1 -3 4 -4 3 -5 6 -6 5 -7 8 -8 7 -9 10 -10 9 -11 12 -12 11 ... etc. ``` N may be 0-indexed or 1-indexed as you desire. For example, if 0-indexed then inputs `0`, `1`, `2`, `3`, `4` should produce respective outputs `-1`, `2`, `-2`, `1`,...
[Question] [ ### ...but hey, no need to be strict. Given a non-empty array of strictly positive integers, determine if it is: 1. *Monotone strictly decreasing*. This means that each entry is strictly less than the previous one. 2. *Monotone non-increasing, but not strictly decreasing*. This means that each entry is...
[Question] [ [Inspiration.](https://twitter.com/dyalogapl/status/806443935811993600)\* I cannot believe we have not had this challenge before: **Task** Given one or more printable ASCII strings, interleave them by taking one character from each string, cyclically until out of characters. If a string runs out of cha...
[Question] [ Given an integer, output a [truthy](http://meta.codegolf.stackexchange.com/questions/2190/interpretation-of-truthy-falsey) value if it is the same upside-down (rotated 180°) or a [falsy](http://meta.codegolf.stackexchange.com/questions/2190/interpretation-of-truthy-falsey) value otherwise. `0`, `1`, a...
[Question] [ The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! ## The Challenge When people use the term "average," they generally mean the arithmetic mean, which is the sum of the numbers divided by the number of numbers. There ...
[Question] [ Inspired by [Is it double speak?](https://codegolf.stackexchange.com/questions/189358/is-it-double-speak/), I devised a harder challenge. Given a string, determine if the string is *n-speak*, for any \$n\geq 2\$. N-speak is defined by repeating each letter \$n\$ times. With \$n = 4\$, the string `Hello...
[Question] [ In chat, we are often fast-typers and don't really look at the [order](https://chat.stackexchange.com/transcript/message/41967809#41967809) of [letters](https://chat.stackexchange.com/transcript/message/41967812#41967812) before posting a message. Since we are lazy, we need a program that automatically...
[Question] [ Given a positive number `n`, rotate its base-10 digits `m` positions rightward. That is, output the result of `m` steps of moving the last digit to the start. The rotation count `m` will be a non-negative integer. You should remove leading zeroes in the final result, but not in any of the intermediate ...
[Question] [ Do you know the optical effect of a tridimensional hand painted whit horizontal lines? [Examples](https://www.google.com/search?q=mano%20tridimensional%20pintada%20con%20lineas%20horizontales&rlz=1C1CHBF_esES920ES920&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjP8e-v99DwAhVDUhoKHW1tARkQ_AUoAXoECAEQAw&biw=1920...
[Question] [ My stovetop has 10 (0 through 9) different settings of heat and a very odd way of cycling through them. * It always starts at 0 * When I hit plus it increments the number, *unless* the number is 9 in which case it becomes 0, or the number is 0 in which case it becomes 9. * When I hit minus it decrement...
[Question] [ Given a number determine if it is a folding number. A folding number is a number such that if you take it binary representation and "fold" it in half, That is take the result of XNOR multiplication of the first half of the number and the second half with it digits in reverse, you will get zero. If the ...
[Question] [ As you may know it, the factorial of a positive integer `n` is the product of all the positive integers which are equal or smaller to `n`. For instance : ``` 6! = 6*5*4*3*2*1 = 720 0! = 1 ``` We will now define a special operation with an irrelevant name like `sumFac`: Given a positive integer `n`, `su...
[Question] [ # `cat` goes "Meow" We are all familiar with the concept of a `cat` program. The user types something in, it is echoed back to the user. Easy. But all `cat` programs I've seen so far have missed one fact: a `cat` goes "Meow". So your task is to write a program that copies all `STDIN` to `STDOUT` **UNLE...
[Question] [ ## Introduction: A 3x3x3 Rubik's Cube has \$43,252,003,274,489,856,000\$ possible permutations, which is approximately 43 [quintillion](https://en.wikipedia.org/wiki/Names_of_large_numbers). You may have heard about this number before, but how is it actually calculated? A 3x3x3 Rubik's Cube has six sid...
[Question] [ I've recently realized how vim works great for golfing, especially for [kolmogorov-complexity](/questions/tagged/kolmogorov-complexity "show questions tagged 'kolmogorov-complexity'"). Also, according to [meta](https://codegolf.meta.stackexchange.com/a/4817/31716) vim is a perfectly acceptable 'program...
[Question] [ Write the shortest program to transform the standard input into [Morse code](http://en.wikipedia.org/wiki/Morse_code). Characters not in the table should be printed as they are. ![International Morse Code](https://i.stack.imgur.com/oD2up.png) [Answer] **C# (213 characters)** I'm sure this wont sta...
[Question] [ Given two strings of letters, transfer the capitalization pattern of each string onto the other one. Fewest bytes wins. ``` Input: CodeGolf xxPPCGxx Output: coDEGOlf XxppCgxx ``` * Both strings will be equal-length and nonempty, with only letters `a..z` and `A..Z`. * You may output the two resulti...