text
stringlengths
180
608k
[Question] [ Given a string containing only letters, output the length of the longest run of consecutive alphabetical letters the word contains, where order does not matter. An example algorithm may sort the word, remove duplicates, and then output the length of the longest run. ## Test Cases ``` watch -> 1 stars -...
[Question] [ In as few bytes as possible, sort the input, *a delimited string OR list/vector/array of words, words contain printable ASCII except space (ASCII values 33-126)* into a numbered list, table, or something resembling a table, by length. Table rules are as follows: * Order is mandatory, direction is optio...
[Question] [ # Input A string that contains at most one of each of the letters `A`, `B`, and `C`. They may be in any order. The empty string is valid input. **Note:** A previous version of this challenge used the letters `LEJ` instead of `ABC` and they may still be used if desired. # Output A string of the `A`, `B`...
[Question] [ Your task is pretty simple, calculate the n-th element of [A190810](https://oeis.org/A190810). Elements of A190810 are calculated according to these rules: 1. The first element is 1 2. The sequence is increasing 3. If `x` occurs in the sequence, then `2x+1` and `3x-1` also do You can use 1-based or 0-b...
[Question] [ # Introduction Every number can be represented as ASCII. For example, \$0\$ comes in ASCII is \$48\$, \$1\$ is \$49\$, and so on. Using this method of translating numbers to other numbers, it is possible to infinitely expand a number, by replacing all its digits with their ASCII values and doing the sa...
[Question] [ Given a non-negative integer \$n ,\$ output the \$n^{\text{th}}\$ [Euler number](https://en.wikipedia.org/wiki/Euler_number) ([OEIS A122045](https://oeis.org/A122045)). All odd-indexed Euler numbers are \$0 .\$ The even-indexed Euler numbers can be computed with the following formula (\$i \equiv \sqrt{...
[Question] [ Oh no! I'm trapped in a big forest (Okay, not really, but just assume it) and I don't know where I am! Thankfully, I brought my laptop. But when I searched 'Maps', It said 'No results', and I'm asking this as a last resort. Please make a program which outputs my location's longitude and latitude in any...
[Question] [ Amazingly, this simple task doesn't seem to exist already, so... Your task is to write a program that takes as input a 12 hour time, and converts it into "military time", or 24-hour time format. Input will be in the form: ``` HH:MM am/pm ``` Although slight variations are allowed: * The space separatin...
[Question] [ You should write a program or function which takes a non-negative integer `N` as input and outputs or returns two integers (negative, zero or positive) `X` and `Y`. Integers are meant in the mathematical sense as there are infinitely many of them. The implemented function has to be [bijective](http://e...
[Question] [ Your program must find all the words in [this wordlist](http://www.mieliestronk.com/wordlist.html) that contain all the vowels (`a e i o u y`). There are easy ways to do this, but I am looking for the shortest answer. I will take any language, but I'd like to see Bash. Here is an example (could be much...
[Question] [ The [Reuleaux triangle](http://mathworld.wolfram.com/ReuleauxTriangle.html) is the shape formed by the intersection of three circles, with each circle passing through the others' centers. Regardless of rotation, a Reuleaux triangle's width will always equal the radius of the circles: [![From Wolfram Ma...
[Question] [ ## **21, 21, 23, 20, 5, 25, 31, 24, ?** Inspired by [this Puzzle](https://puzzling.stackexchange.com/questions/89656/what-is-the-next-number-in-the-series-21-21-23-20-5-25-31-24), given an integer \$n>0\$ , print out the following sequence until you reach a non-Integer (spoilered, in case you want to s...
[Question] [ ## Final results # 1st place goes to *Follow*! Honourable mentions to **The diff predictor** (2nd), and **Simple Killer**, **Low Blow** and **High to Low** (joint 3rd). Other winners: ### (score competition) 1st - Simple Killer Honourable mentions: **The diff predictor** and **Naiive**. ### (wins compe...
[Question] [ March 13 is recognized as [National Jewel Day](http://www.nationaldaycalendar.com/2017/03/12/362971/), which is the theme of this challenge. So, given an integer `n` where `n` is greater than 0, create an ASCII jewel. For example: ``` n = 1 n = 2 n = 3 ...
[Question] [ In this [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge, robbers must crack cop answers by finding out which languages the cops used. This is the **Cops** thread. For the Robbers' challenge, see [here](https://codegolf.stackexchange.com/q/2120...
[Question] [ ## Overview The *sharpness* of a word is the sum of the sharpness of each of its letters, using the following rules: **Sharp letters** * `A`, and `V` each have a sharpness of **1** * `N` and `Z` each have a sharpness of **2** * `M` and `W` each have a sharpness of **3** **Dull letters** * `C` and `U` e...
[Question] [ ## Background Consider a sequence defined as follows: * The first element is 0; * The second element is 4; * From the third element onwards, its value can be calculated by: + Taking the set of integers from 0 up to the previous element of the sequence (inclusive or exclusive, it doesn't matter); + Re...
[Question] [ Write a quine... from which every other character can be removed it still be a valid quine. You can specify whether to start removing characters at the first or second character. Scoring criteria (add bonuses/penatly percentages together for total percentage): * Answers must be at least 4 characters lo...
[Question] [ The goal of this challenge is the write the shortest function/program to take input text, encrypt it using the method below, and return the result. As an example, I will use the string `hello world`. **First**, get the input text. ``` hello world ``` **Second**, convert the string into ternary (base 3)...
[Question] [ Your challenge is to make a program or function that outputs the [GCD](https://en.wikipedia.org/wiki/Greatest_common_divisor) of its inputs in one language and the [LCM](https://en.wikipedia.org/wiki/Least_common_multiple) of its inputs in another. Builtins for GCD or LCM (I'm looking at you, Mathemati...
[Question] [ [Chebyshev Polynomials](https://en.wikipedia.org/wiki/Chebyshev_polynomials) are a family of orthogonal polynomials that pop up in all kinds of places in math, and they have a lot of quite interesting properties. One characterization of them is that they are the unique polynomials that satisfy \$T\_n(\...
[Question] [ **Introduction** The rain finally subsided. Most of humanity drowned [due to a bug in @user12345's code](https://codegolf.stackexchange.com/q/23406/18487). Survivors are scattered across a worldwide archipelago. Radio communication is up, and humanity is poised to thrive once more. For no reason whatso...
[Question] [ ## Problem definition Print out the powerset of a given set. For example: ``` [1, 2, 3] => [[], [1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]] ``` Each element is to be printed on a separate line, so the above example would be printed as: ``` [] [1] [2] ... [1, 2, 3] ``` ## Example code (in D, pytho...
[Question] [ [Legendre's Conjecture](https://en.wikipedia.org/wiki/Legendre%27s_conjecture) is an unproven statement regarding the distribution of prime numbers; it asserts there is at least one prime number in the interval \$(n^2,(n+1)^2)\$ for all natural \$n\$. # The Challenge Make a program which only halts if ...
[Question] [ # Background The game of [Morra](http://en.wikipedia.org/wiki/Morra_(game)) is a simple game. In the "original" version, several players simultaneously throw out a number 0-5 with their hands while guessing the total sum of everyone's hands. The version I'll use here has been modified to increase the p...
[Question] [ ## Challenge Given a size s, print a cube net of that size made of hash symbols (`#`) and spaces (). Examples: ``` 1: # # # # # # 2: # # # # # # # # # # # # # # # # # # # # # # # # 3: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #...
[Question] [ An old test for programmers, taken from [here](https://www.facebook.com/notes/dario-dariol/il-pifferaio-magico/10157974434244334/) (Note: in italian). Along a road (denoted by '`_`'), there is a Magical Piper (denoted by '`P`') and several mice (represented by the two characters 'o' and '`~`', that den...
[Question] [ Write a program or function that, given an integer `n`, construct an array with `n` dimensions of `n` length, where each element is an identifier of its own coordinates. That is, starting with one array, populate it with `n` arrays, where each of those contain `n` more arrays, up to a depth of `n-1`. T...
[Question] [ Take a positive integer `X`. This number is part of the sequence we are interested in if the sum of all digits of `X` is a divisor of `X`, and if the product of all digits of `X` is a divisor of `X`. For example, `135` is such a number because `1 + 3 + 5 = 9` which divides `135 = 9 * 15` and `1 * 3 * 5...
[Question] [ What general tips do you have for golfing in TI-BASIC for the TI-83/84+ series calculators? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to TI-BASIC (e.g. "remove comments" is not an answer). Please post one tip per answer. [Answer]...
[Question] [ It is very hard to remember my password, so I came up with a way to generate a password. The way I generate my password is from a word or a sentence, following these steps: 1. Start from left to right 2. Find the count of each letter 3. Put letter with its count in an order * Letters with higher repe...
[Question] [ Having a function *f* that takes arguments *x1*, *x2*, …, *xn*                                                – ie.  *f : X1 × X2 × … × Xn → Y* – [currying](https://en.wikipedia.org/wiki/Currying) redefines *f* as a function taking a single argument *a1* which maps to yet another function. This techniq...
[Question] [ An Integer is *prime* if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: `p` and `p±2`, that are both prime. You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given int...
[Question] [ ## Background Information: What is a [Fenwick Tree](https://en.wikipedia.org/wiki/Fenwick_tree)? With a normal array, it costs \$O(1)\$ to access and modify an element, but \$O(n)\$ to sum \$n\$ elements. Working with a prefix sum array (an array where the \$i\$th value represents the sum of the first ...
[Question] [ # Context (Feel free to skip, doesn't really matter for the algorithmic explanation of the task) European Portuguese is a fairly complicated language to learn, mostly because of its grammar. One particular annoying thing is conjugating the verbs correctly: We have this mechanism that, when we have a ve...
[Question] [ According to <http://en.cppreference.com/w/cpp/language/integer_literal>, integer literals consist of a decimal/hex/octal/binary literal and a optional integer suffix, that is obviously completely unnecessary, wastes precious bytes and is not used in this challenge. A decimal literal is `a non-zero dec...
[Question] [ *(Essentially the inverse of [Find the needle in the haystack](https://codegolf.stackexchange.com/q/179351/42963))* Given two tuples, `(w, h)` and `(x, y)`, generate a haystack composed of a single random [printable ASCII character](https://codegolf.meta.stackexchange.com/a/5869/42963) of `w` width and...
[Question] [ Given a list of unique strings that are anagrams of each other, output an anagram of those words that is different from each word in the list. The strings will be alphanumeric, and there is guaranteed to be a valid anagram. The program or function can, but doesn't have to be non-deterministic, meaning ...
[Question] [ Write the shortest program that prints, in order, a complete list of iPhone iterations, according to [this site](https://www.theiphonewiki.com/wiki/List_of_iPhones): ``` iPhone iPhone 3G iPhone 3GS iPhone 4 iPhone 4S iPhone 5 iPhone 5c iPhone 5s iPhone 6 iPhone 6 Plus iPhone 6s iPhone 6s Plus iPhone SE...
[Question] [ **This is a simple one:** Take a matrix of integers as input, and output the index of the row with the most non-zero elements. You may assume that there will only be one row with the most non-zero elements. ### Test cases: These are 1-indexed, you may choose if you want 0 or 1-indexed. ``` 1 0 row = 1 ...
[Question] [ Consider the infinite string of all nonnegative decimal integers concatenated together in order (akin to [Champernowne's constant](https://en.m.wikipedia.org/wiki/Champernowne_constant)): ``` 0123456789101112131415161718192021222324252627282930...979899100101102103... ``` Write a program or function th...
[Question] [ Two prime numbers are defined as twin primes if they differ by two. For example, 3 and 5 are twin primes as are 29 and 31. Write a program that finds the nth pair of twin primes (where n comes from STDIN) and prints them on STDOUT, separated by a comma and a space. This is code-golf, so the shortest co...
[Question] [ A compound word is a word that contains 2 or more words in it. We can do better than that, though. We need you to **create 1 (nonsensical) word that contains *every* word**. However, we want this word to be as short as possible. We can use overlapping letters to achieve this. For example, if your word ...
[Question] [ Today, November 11th, is known as [Remembrance Day](https://en.wikipedia.org/wiki/Remembrance_Day), [Armistice Day](https://en.wikipedia.org/wiki/Armistice_Day), or [Veterans Day](https://en.wikipedia.org/wiki/Veterans_Day) (depending upon the country), and is a day of reflection and gratitude for memb...
[Question] [ Time for another maze challenge, but not as you know it. The rules for this challenge are a little different than most maze challenges. The tile types are defined as follows: * `S`: The location on the maze you start at * `E`: The location you are trying to get to * `0`: Wall that you can't cross * `+`...
[Question] [ Given (by any means) two different natural numbers (of any reasonable size), output (by any means) the square of their sum as in the examples below: Given 4 and 3, output: ``` 12 12 12 12 9 9 9 12 12 12 12 9 9 9 12 12 12 12 9 9 9 16 16 16 16 12 12 12 16 16 16 16 12 12 12 16 16 16 16 12 12 12 1...
[Question] [ When this question was posted, it was [caird coinheringaahing](https://codegolf.stackexchange.com/users/66833/caird-coinheringaahing)'s birthday! (source: [1](https://chat.stackexchange.com/transcript/message/58633501), [2](https://chat.stackexchange.com/transcript/message/58633511), [3](https://chat.s...
[Question] [ Bibi-binary is a numeric system invented by [Boby Lapointe](https://en.wikipedia.org/wiki/Boby_Lapointe) in order to represent numbers in letters which pronunciation seems funny. Your task is to convert decimal numbers into Bibi-binary! ## Conversion A number is converted to base 16 (hexadecimal) and e...
[Question] [ Two strings are "Caesar equivalent" if the distance (counting up) between the corresponding characters are the same. Yes, I made this term up. Here's an example: "Abc" and "Cde" are equivalent because ``` distance from a-c == 2 distance from b-d == 2 distance from c-e == 2 ``` The capitalization doesn'...
[Question] [ ## Task Given two positive integers `a`, `b` and a Unicode mathematical inequality symbol `c`, determine if `a c b` is true. You many take the character or its Unicode codepoint for the input `c`. You may output your language's truthy/falsy values, or two distinct values for true and false respectively...
[Question] [ ["First they came..."](https://en.wikipedia.org/wiki/First_they_came_...) is a poem by [Martin Niemöller](https://en.wikipedia.org/wiki/Martin_Niem%C3%B6ller): ``` First they came for the Socialists, and I did not speak out- Because I was not a Socialist. Then they came for the Trade Unionists, and I d...
[Question] [ The [pigeonhole principle](https://en.wikipedia.org/wiki/Pigeonhole_principle) states that > > If *N* items are put into *M* boxes, with *N* > *M*, then at least one box must contain more than one item. > > > For many, this principle has a special status compared to other mathematical enouncements....
[Question] [ A string is *pairable* if it can be split into subtrings, each of which is a string repeated twice consecutively. For example, `aabaaababbbaba` is pairable as: ``` aaba aaba b b ba ba ``` Given a non-empty string of `a`'s and `b`'s, output a Truthy value if it's pairable and a Falsey value if it isn't....
[Question] [ # Challenge Given an input of an all-lowercase string `[a-z]`, output the total distance between the letters. ## Example ``` Input: golf Distance from g to o : 8 Distance from o to l : 3 Distance from l to f : 6 Output: 17 ``` ## Rules * Standard loopholes forbidden * This is [code-golf](/questions/tag...
[Question] [ ## Goal The goal of this challenge is: given a string as input, remove duplicate pairs of letters, if the second item in the pair is of opposite capitalization. (i.e. uppercase becomes lowercase and vice-versa). Pairs should be replaced from left to right. For example, `aAa` should become `aa` and not ...
[Question] [ **Monday Mini-Golf:** A series of short [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") challenges, posted (hopefully!) every Monday. A **Fibonacci-like sequence** is obtained using the same method as the famous [Fibonacci sequence](https://en.wikipedia.org/wiki/Fibonacci_n...
[Question] [ A number is a Chen prime if it satisfies two conditions: * It is prime itself * Itself plus two is either a prime or a semi-prime. A prime is a number where it has exactly two divisors and those divisors consist of itself and one. A semi-prime is a number which is the product of two primes. (Note that ...
[Question] [ In this challenge, given a list of ghosts from Pac-Man, you must output which ghosts are missing. You must do it in as few bytes as you can ## Input Input will consist of a string or list, which will include a number ghosts, which could include: * Blinky * Inky * Pinky * Clyde However, input may also i...
[Question] [ Here's a simple one to stretch your compression muscles. Your code (a complete program) must output the spelled-out English representation of all the cardinal numbers from 1 to 100, and then all the ordinal numbers from 1 to 100. The numerals in each list should be delimited by commas and spaces and pr...
[Question] [ > > For nandgame fans: Please try out [DPD to decimal in logic gates](https://codegolf.stackexchange.com/q/176557/78410) too! > > > ## Background [Densely packed decimal (DPD)](https://en.wikipedia.org/wiki/Densely_packed_decimal) is a way to efficiently store decimal digits in binary. It stores th...
[Question] [ People on this site really love to embellish their post titles... ``` Stewie's sequence: + * - / + * - / ``` However, when this title needs to be included in the page URL, it is simplified: ``` stewies-sequence ``` --- # The Challenge Your task is to create a program or function which, given a string r...
[Question] [ A sequel to [this question](https://codegolf.stackexchange.com/questions/94028/find-the-largest-number-thats-beside-a-zero). # Task Given an array of positive integers, find the **largest element k** for which: > > There exists *some* positive integer distance **n**, so that the element in the array l...
[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/32081/edit). Closed 3 years ago. [Improve this question](/posts/32081/edit) ...
[Question] [ [This was fun!](https://codegolf.stackexchange.com/questions/25670/output-pi-without-math) However with only three digits, the fun was over way too soon. This challenge is similar, but we'll keep the fun going. ## The Challenge > > Print as many digits of the [Golden Ratio](https://en.wikipedia.org/wi...
[Question] [ The challenge is simple, find the matching parentheses for every one of the parentheses in a given string input E.g. ``` ()()() -> [1, 0, 3, 2, 5, 4] ``` Always start with the ending parentheses index before the starting parentheses, which is why `()` becomes `[1,0]`, not `[0,1]`, unless the parenthese...
[Question] [ A radiation-hardened program is a program where, if any character of the code is removed, the program will still function the same. For this question, we'll be writing a program that detects when it is irradiated. Write a program or function that, when *any* single byte is removed, the resulting progra...
[Question] [ # Introduction Try to convert words to two different unicode fonts. # Challenge Your task is to transform your input string into the 𝖬𝖺𝗍𝗁 𝖲𝖺𝗇𝗌 and 𝗠𝗮𝘁𝗵 𝗦𝗮𝗻𝘀 𝗕𝗼𝗹𝗱 unicode characters. All uppercase words should become lowercase 𝗠𝗮𝘁𝗵 𝗦𝗮𝗻𝘀 𝗕𝗼𝗹𝗱 words. * For Example: `WORD` -...
[Question] [ A [prime gap](https://en.wikipedia.org/wiki/Prime_gap) is the difference between two consecutive primes. More specifically, if *p* and *q* are primes with *p* <*q* and *p*+1, *p*+2, ..., \_q\_−1 are not primes, the primes *p* and *q* define a gap of *n* = *q\_−\_p*. The gap is said to be **started** by...
[Question] [ Inspired by [this challenge](https://codegolf.stackexchange.com/questions/109117/unscramble-those-case-very-sensitive-strings?atw=1) (or, more specifically, by misreading it), I've come up with the following challenge: Given an input string S, reverse the order of all uppercase characters, and all lowe...
[Question] [ # Background LISP programmers have taken over the world! Parentheses have been declared as sacred characters, and from now on, they can only be used in LISP programs. It has been decided that parentheses in literary works shall be replaced by footnotes, and it's your job to automate this for simplified...
[Question] [ This [ascii-art](/questions/tagged/ascii-art "show questions tagged 'ascii-art'") challenge is about walking around a string like a snake. ``` s-n-a-k .---. e d <-' a n-u-o-r ``` You will be given a string \$ S \$ of length \$ l \$ and a positive integer \$ n \$ where \$ n ^ 2 \ge l + 1 \$. The string ...
[Question] [ Given a sorted array of unique positive integers \$A\$ \$(A\_0<A\_1<\cdots<A\_{n-1})\$, and an integer \$t\$, where \$A\_0\le t\le A\_{n-1}\$. Output the value \$i\$ such that: * If \$t \in A\$, \$A\_i=t\$. * If \$t \notin A\$, \$ \left(i-\left\lfloor i\right\rfloor\right)\cdot A\_{\left\lceil i\right\...
[Question] [ # Fermat's Last Theorem, mod n It is a well known fact that for all integers \$p>2\$, there exist no integers \$x, y, z>0\$ such that \$x^p+y^p=z^p\$. However, this statement is not true in general if we consider the integers modulo \$n\$. You will be given \$n\$ and \$p\$, which are two positive integ...
[Question] [ Similar to other quine puzzles (more specifically, [this one](https://codegolf.stackexchange.com/q/2582/3862)), write a program that produces the source for itself. **Here's the new twist:** The code produced should *NOT* be identical to the source. Rather, it should output a different program that wi...
[Question] [ Your job is to take a string input and a number and align the string to the right, making the width of the text the number. When a line is too long, break it and put the rest on the next line, repeating until it's not necessary. If a line is shorter than the width, then pad it with spaces. Multiple new...
[Question] [ The following is inspired by [a question that came up on Stack Overflow today](https://stackoverflow.com/questions/31251377). Given a number of microseconds, `0 <= n <= 86400000000` (e.g. `12345678900`), output a formatted string `hh:mm:ss:000:000`, e.g. `03:25:45:678:900`. ``` 0 -> '00:00:00...
[Question] [ # Objective Given an ASCII character, toggle its "shift-ness" on the standard US keyboard (ANSI-INCITS 154-1988 (R1999)), then output it. # Mapping ``` ) ↔️ 0 ! ↔️ 1 @ ↔️ 2 # ↔️ 3 $ ↔️ 4 % ↔️ 5 ^ ↔️ 6 & ↔️ 7 * ↔️ 8 ( ↔️ 9 " ↔️ ' + ↔️ = , ↔️ < - ↔️ _ . ↔️ > / ↔️ ? : ↔️ ; (Capital Latin letters) ↔️ (Smal...
[Question] [ The year 2013 had an interesting property: the digits are consecutive when sorted (0123). Let's call this type of number a *sortable number:* a non-negative integer whose base-10 digits are consecutive after sorting. Unfortunately, this won't happen again until 2031, and after that, not until 2103. You...
[Question] [ I have a serious problem. I have some text files where I keep my very important numbers -- all of the important ones! And twos, and threes.. These numbers were so important that I couldn't entrust them to those newfangled decimal or binary number systems. I kept each number encoded in unary, as so: ```...
[Question] [ What general tips do you have for golfing in Lua? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Lua (e.g. "remove comments" is not an answer). Please post one tip per answer. [Answer] In addition to the ones already posted, here a...
[Question] [ Your task is to write a short program that represents a large (infinite) ordinal, using a well-ordering of the set of positive integers. Your program will take two different positive integers and indicate which one is greater in your chosen well-ordering. The order type of the well-order is the represe...
[Question] [ No, not [this](https://codegolf.stackexchange.com/q/115715/64159). And not [this](https://codegolf.stackexchange.com/q/116616/64159) either. This question is nothing like those Write the shortest code to print/return the following output: ``` /\ /\ /\ / \ / \ / \ / /\ \ / /\ \...
[Question] [ First of all ... I would like to wish everyone a Merry Christmas (sorry if I am a day late for your timezone). To celebrate the occasion, we are going to draw a snowflake. Because the year is 201**5** and Christmas is on the 2**5**th (for a large portion of persons), we will draw a **Penta**flake. The ...
[Question] [ Consider a binary tree built the following way: * The root node is \$1\$ * For a given node \$n\$: + If \$n\$ is odd, its only child is \$2n\$ + If \$n\$ is even, one of its children is \$2n\$. If \$\frac {n-1} 3\$ is an integer and not already part of the tree, its right child is \$\frac {n-1} 3\$ *...
[Question] [ Write code that takes a string as input, and outputs a [truthy or falsey value](http://meta.codegolf.stackexchange.com/a/2194/31516) depending on whether or not the string follows these rules: If you stack each character on top of each other, convert to binary and sums each column, then all the sums sh...
[Question] [ # How many atoms in the hydrocarbon? A hydrocarbon is a chemical compound which consists of only hydrogen and carbon atoms. For this challenge, we will only consider the three simplest kinds of hydrocarbons: **alkanes**, **alkenes**, and **alkynes** with no branches. An **alkane** with \$n\$ carbon ato...
[Question] [ *Inspired by [this video by Matt Parker](https://www.youtube.com/watch?v=Mf2H9WZSIyw)* The distances between the letter keys of a QWERTY keyboard are somewhat standardised. The keys are square and both the horizontal and vertical spacing are 19.05mm (so if there were no gaps between the keys, their sid...
[Question] [ # Introduction In Tennis, the server alternates serving on the left side or the right side of the court every point, starting on the right. It is possible to figure out which side to serve on for that point just based on the score; if there have been an even number of points you serve on the right, and...
[Question] [ The New York Times has a daily online game called [Letter Boxed](https://www.nytimes.com/puzzles/letter-boxed) (the link is behind a paywall; the game is also described [here](https://www.polygon.com/2019/2/1/18205854/new-york-times-crossword-letter-boxed-puzzle-game)), presented on a square as follows...
[Question] [ *([Related](https://codegolf.stackexchange.com/q/1775/42963))* Given an integer `n > 1`, 1) Construct the range of numbers `n, n-1, n-2, ... 3, 2, 1` and calculate the sum 2) Take the individual digits of that number and calculate the product 3) Take the individual digits of *that* number and cal...
[Question] [ # Introduction Your goal is to find the least number of ones you need to add or multiply together to get the input value, this is [A005245](//oeis.org/A005245). ## Input One positive integer ***N***. ## Output The smallest number of ones that must be added/multiplied to get ***N***. ### Sample Input > ...
[Question] [ What are some tips for code-golfing in Swift? Its focus on safety seems to make it difficult to golf in, but that makes little tips and even more useful. Are there any features in Swift that may help it excel in code-golf in certain applications? Please post one tip per answer. [Answer] # Ranges O...
[Question] [ Space indentation users, *unite*! We must fight against all the [lowly tab users](https://codegolf.stackexchange.com/questions/56001/my-god-its-full-of-spaces)! Your mission (should you choose to accept it) is to write a program or function that takes in two arguments: * A string: This is the input. * ...
[Question] [ The boardgame [Terra Mystica](https://boardgamegeek.com/boardgame/120677/terra-mystica) has some very interesting mechanics for one of the primary resources, power. Instead of gaining and spending units of power from a bank, each player starts the game with exactly 12 units of power which are distribut...
[Question] [ When we publish some software, we assign a version number to it. And users may want to update to the latest version of some software. So, it is the time to find out which version should be newer. ### Input Input two version numbers as strings. In the context of this challenge, we only support version n...
[Question] [ *This is a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge the Robbers' Thread can be found [here](https://codegolf.stackexchange.com/questions/111191/anagram-quines-robbers-thread)* Your challenge is to write a program that outputs an anagram...
[Question] [ Consider an eight bit number in which an even position bit will never be 1 if one of its neighbors is 0 (considering MSB and LSB as neighbors). There are fewer than 64 such numbers, so there is at least some reversible mapping of them to 6 bit numbers. Your task is to write a pair of functions (or code...
[Question] [ Each natural number (including 0) can be written as a sum of distinct powers of integers (with a minimum exponent of 2). Your task is to output the smallest power required to represent \$n\$. For example: ``` 2 = 1^2 + 1^3 // Output 3 9 = 1^2 + 2^3 = 3^2 // Output 2 15 = 2^2 + 2^3 + 1^4 + 1^5 + 1^6 // ...
[Question] [ ## Background The greatest common divisor (*gcd* for short) is a convenient mathematical function, since it has many useful properties. One of them is [Bézout's identity](https://en.wikipedia.org/wiki/B%C3%A9zout's_identity): if `d = gcd(a, b)`, then there exist integers `x` and `y` such that `d = x*a...
[Question] [ # My Alarm Clock I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button moves it up one minute. Hitting both buttons at the same time resets it to midnight (12:00 am), and c...