text
stringlengths
180
608k
[Question] [ Your task is to write a function or program that takes two non-negative integers `i` and `k` (`i` ≤ `k`), and figure out how many zeroes you'd write if you wrote all whole numbers from `i` to `k` (inclusive) in your base of choice on a piece of paper. Output this integer, the number of zeroes, to stdou...
[Question] [ # Generate a Koch Snowflake A Koch snowflake is a triangle that for each `n`, another equilateral point is added in the middle of each side: <http://en.wikipedia.org/wiki/Koch_snowflake#Properties> We already had a [kolmogrov-complexity](/questions/tagged/kolmogrov-complexity "show questions tagged 'ko...
[Question] [ Make a program that simulates the basic logic gates. **Input:** An all-caps word followed by 2 1 digit binary numbers, separated by spaces, such as `OR 1 0`. The gates `OR`, `AND`, `NOR`, `NAND`, `XOR`, and `XNOR` are needed. **Output:** What the output of the entered logic gate would be given the two ...
[Question] [ Your task is to print the following ASCII Art: ``` _ _ _______ _ | | | | (_______) _ | | | |__ | | ____ ____ ____ _ _ _____ ____ ___| |_ ____ ____| | | __)| |/ _ | _ \| _ \| | | |...
[Question] [ Make a code that takes a list and a number as input, and generates all possible combinations with the length of the number. For example, with the list **{0,1}** and the number **2**: ``` 00 01 10 11 ``` **Your program doesn't have to expect characters twice or more often in the list, such as** *{0,0,0,...
[Question] [ The [Prime Signature](https://en.wikipedia.org/wiki/Prime_signature) of a number is the list of the exponents of the prime factors of a number, sorted in descending order (exponents of `0` are ignored). Inspired by [Combo Class](https://www.youtube.com/@ComboClass)'s "[The Magnificent Patterns of Prime...
[Question] [ Given a string of parentheses `(` and `)`, find the length of the longest substring that forms a valid pair of parentheses. Valid pairs of parentheses are defined as the following: An empty string is a valid pair of parentheses. If `s` is a valid pair of parentheses, then `(s)` is also a valid pair of ...
[Question] [ Related: [Iterated phi(n) function](https://math.stackexchange.com/q/2550437). Your challenge is to compute the iterated phi function: ``` f(n) = number of iterations of φ for n to reach 1. ``` Where `φ` is [Euler's totient function](https://en.wikipedia.org/wiki/Euler%27s_totient_function). Related [O...
[Question] [ You might know Alan Walker from his ever popular song Faded. Now his "followers" are called Walkers and they have a logo, here is a simplified version: ``` \\ \\ //\\ \\ // \\ // \\ // \\ // \\ // \\ // \\ ...
[Question] [ I've designed a new font which I call PrettyFont. I've put much much time into perfecting it, but since I'm a working man I don't have time to finish it. Therefore it only contains 4 characters right now. One day when I've become rich it will become my life-long goal to finish it, but for now... This i...
[Question] [ Your task is to write the shortest algorithm in a language of your choosing that accomplishes the following: Given two matrices it must return the euclidean distance matrix. The euclidean distance between two points in the same coordinate system can be described by the following equation: \$D = \sqrt{ ...
[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/100578/edit). Closed 6 months ago. This post was edited and submitted for rev...
[Question] [ The goal of this code golf is to create a program or function that calculates and outputs the cube root of a number that's given as input. The rules: * No external resources * No use of built-in cube root functions. * No use of methods/operators that can raise a number to a power (that includes squar...
[Question] [ True color (24-bit) at [Wikipedia](https://en.wikipedia.org/wiki/Color_depth#True_color_(24-bit)) is described in pertinent part as > > 24 bits almost always uses 8 bits of each of R, G, B. As of 2018 > 24-bit color depth is used by virtually every computer and phone > display and the vast majority ...
[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/68666/edit). Closed 2 years ago. [Improve this question](/posts/68666/edit) ...
[Question] [ Let \$n\$ be some positive integer. We say that \$n\$ is of *even kind* if the prime factorisation of \$n\$ (counting duplicates) has an even number of integers. For example, \$6 = 2 \times 3\$ is of even kind. Likewise, we say \$n\$ is of *odd kind* of the prime factorisation of \$n\$ has an odd numbe...
[Question] [ Given two integers, compute the two numbers that come from the blending the bits of the binary numbers of equal length(same number of digits, a number with less digits has zeros added), one after the other, like such: ``` 2 1 10 01 1 0 1001 0 1 0110 ``` some examples: | Input | Bi...
[Question] [ Produce a text file that prints "Hello World!" in as many programming languages as possible when compiled/interpreted, while also being as short as possible. The score for your submission is calculated as `C / 2 ^ ((L - 1) / 4)`, where "C" is the length of the text file in characters and "L" is the num...
[Question] [ ## Challenge Assume two vectors \$\mathbf{a} = (a\_1,a\_2,\cdots,a\_n)\$ and \$\mathbf{b} = (b\_1,b\_2,\cdots,b\_n)\$ are given in an \$n\$-dimensional space, where at least one of \$b\_1,\cdots,b\_n\$ is nonzero. Then \$\mathbf{a}\$ can be uniquely decomposed into two vectors, one being a scalar multi...
[Question] [ Let's consider a list \$L\$ (initially empty) and a pointer \$p\$ into this list (initialized to \$0\$). Given a pair of integers \$(m,n)\$, with \$m\ge 0\$ and \$n>0\$: 1. We set all uninitialized values in \$L\$ up to \$p+m+n\$ (excluded) to \$0\$. 2. We advance the pointer by adding \$m\$ to \$p\$. ...
[Question] [ Given latitude/longitude of two points on the Moon `(lat1, lon1)` and `(lat2, lon2)`, compute the distance between the two points in kilometers, by using **any formula** that gives the same result as the haversine formula. ## Input * Four integer values `lat1, lon1, lat2, lon2` in degree (angle) or * f...
[Question] [ ## Introduction This challenge requires you to set the trailing zeros of an integers binary representation to `010101…`, this is best explained with an example: Given the integer `400`, the first step is to convert it to binary: ``` 110010000 ``` As we can see the fifth bit is the least significant `1`...
[Question] [ Slightly more than an inverse of [this](https://codegolf.stackexchange.com/q/74557/43319). **In:** Multi-line [DSV](https://en.wikipedia.org/wiki/Delimiter-separated_values) data and a single delimiter character. The DSV may be taken as a file, a filename, line-break separated string, list of strings, ...
[Question] [ Inspired by [this](https://codegolf.stackexchange.com/questions/56006/calculate-an-bn-with-cn-digits) question Given a positive integer \$n\$, your code must output the first \$n\$ composite numbers. **Input / Output** You may write a program or a function. Input is through STDIN or function argument a...
[Question] [ Your task is to write a program that calculates the amount of different ways to display any given whole positive number using the following rules: Meet the 'advanced binary system': Any whole positive number can be displayed in binary form, but each bit can have every number from 0 to 9. This means, a ...
[Question] [ # Challenge For any two non-empty strings A and B, we define the following sequence : ``` F(0) = A F(1) = B F(n) = F(n-1) + F(n-2) ``` Where `+` denotates the standard string concatenation. The sequence for strings "A" and "B" starts with the following terms: A, B, BA, BAB, BABBA, ... Create a function...
[Question] [ [Square numbers](https://en.wikipedia.org/wiki/Square_number) are those that take the form of \$n^2\$ where \$n\$ is an integer. These are also called perfect squares, because when you take their square root you get an integer. The first 10 square numbers are: ([OEIS](https://oeis.org/A000290)) `0, 1, ...
[Question] [ ### Goal The program's goal is to draw an ASCII art rectangle repeatedly doubled in size, alternating horizontally and vertically. Each time the rectangle doubles in size, the extra area is represented by a different character and the previous areas remain unchanged. The two smallest sections contain o...
[Question] [ The ubiquitous [Catalan numbers](https://codegolf.stackexchange.com/q/66127/110698) \$C\_n\$ count the number of *Dyck paths*, sequences of up-steps and down-steps of length \$2n\$ that start and end on a horizontal line and never go below said line. [Many other interesting sequences](http://dx.doi.org...
[Question] [ Write the shortest program or function that takes some text as input, and outputs either it or an empty line in a repeating pattern: ``` some text some text some text some text some text some text ... ``` This must continue indefinitely, or until some unpreventable limitation occurs (stack size, memory...
[Question] [ Your goal is to write a program that takes no input and outputs the following text: ``` ca e na ŋa va o sa; þa ša ra la ła. ma a pa fa ga ta ča; în ja i da ða. ar ħo ên ôn ân uħo; carþ taŋ neŋ es nem. elo cenvos. ``` But there's a catch: for each letter (any character whose general category in Unicode ...
[Question] [ Situation: You are a high school teacher, teaching your computing class how to write C programs. However, since it is just the beginning of the term, you haven't taught them about the importance of indentation and spacing. As you are marking their work, your eyes hurt so much you scream in agony, and r...
[Question] [ # Background [IEEE 754 Double-precision floating-point format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format) is a way to represent real numbers with 64 bits. It looks like the following: ![](https://upload.wikimedia.org/wikipedia/commons/thumb/a/a9/IEEE_754_Double_Floating_Point...
[Question] [ It is Friday and I am tired, so let's do a quick one! Take no input, however you should output all thirteen different numbered cards in a standard deck of cards. You should output 2 through Ace (Suit agnostic). Each card has a top that is denoted with a space and ten `_` and another space. The sec...
[Question] [ Let `f` be the function that maps a bitfield (`{0 1}`) of size `n+1` to bitfield of size `n` by applying `XOR` to the `i`th and `i+1`th bit and writing the result in the new bitfield. Example: `f("0101") = "111"` Informal calculation: ``` 0 XOR 1 = 1 1 XOR 0 = 1 0 XOR 1 = 1 ``` Let `f_inverse` be the i...
[Question] [ This question involves taking input in Morse code as . (period) and - (minus symbol), with spaces to separate the input. Your task is to convert the code to standard output. You can assume that the only input contains character symbols found in the International Morse Code alphabet, found here: <http:/...
[Question] [ Your challenge is to print any 100 consecutive digits of π. You must give the index at which that subsequence appears. The 3 is not included. For example, you could print any of the following: * `1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679` (ind...
[Question] [ You are given a string \$s\$ of characters from a to z. Your task is to count how many unique strings of length \$n\$ you can make by concatenating multiple prefixes of the string \$s\$ together. Since the result can be superlative you can either choose to output the whole result, the result mod \$2^{3...
[Question] [ Given an 8086 segmented ("*logical*") memory address, output its actual linear physical address. A segmented memory address has format `xxxx:xxxx`, where each of `x` is one of `0-9A-F`, and the two parts are parsed as hexadecimal integers. Both parts are exactly 4 digits. To get its actual linear addre...
[Question] [ > > You are *James* and **four** of your friends (*Bjarne*, *Eich*, *Rossum*, *Ada*) are called for an interview. There are **n** interviewers, and they can *each serve one* person at a time, **alphabetically**. Each round of interview takes **20** min. > > > Let's take **n = 2**, > > So, the firs...
[Question] [ **NOTE**: The winner of this competition is [Jack](https://codegolf.stackexchange.com/a/172123/82007)!!!. No more submissions will be accepted. [Here](https://chat.stackexchange.com/rooms/83075/reaper) is the chat room for this [king-of-the-hill](/questions/tagged/king-of-the-hill "show questions tagge...
[Question] [ This challenge is pretty simple. As input, you take in a regular expression. Then, you output a truthy/falsey of whether or not your source code matches the regular expression. It's that simple! Just two more things: * No quine builtins; you may, however, access the code's source code by file IO, etc. ...
[Question] [ # Bingo Bingo is a numbers game where players match randomly drawn numbers to the numbers on their cards. Each bingo card is a square grid with 25 spaces, and the columns of the grid are labeled with letters such as "B", "I", "N", "G", "O". The letters help to identify the number range in each column, ...
[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/185208/edit). Closed 4 years ago. [Improve this question](/posts/185208/edit)...
[Question] [ ## Challenge: **Inputs:** * A string containing printable ASCII (excluding spaces, tabs and new-lines) * A boolean *†* **Output:** The parts of the String are divided into four groups: * Lowercase letters * Uppercase letters * Digits * Other Based on the boolean, we either output the highest occurrence...
[Question] [ ## Background You are planning your trip away from the Diamond City, and must travel through Diamond Road. However, Diamond Road branches away from Diamond City to different locations. Out of curiosity, you'd like to measure the total distance of unique roads used for all paths. We define a path as a s...
[Question] [ Your function must accept one [string](https://codegolf.meta.stackexchange.com/questions/2214/whats-a-string/8964#8964) and return the opposite The opposite string is a string where all characters go in reverse order, all letters are replaced with the opposite mirror letter from the English alphabet an...
[Question] [ ## Input A single hex 6-digit colour code, capital letter, without `#`. Can also be a 24-bit integer if you prefer. ## Output The closest HTML color *name* (e.g `red`, or `dark-salmon`, as defined as <https://www.w3schools.com/colors/colors_names.asp> or see below). Distance is defined by summing the d...
[Question] [ I am new to the sport of code golf. I am trying to generate a ladder of integers using the least number of unique characters in C++. Let's say we are given an integer 4. We will generate the following ladder: 1 1 2 1 2 3 1 2 3 4 In short, my program will read a positive integer from stdin and pri...
[Question] [ [This is a Google interview question, see here for a youtube link.](https://www.youtube.com/watch?v=XKu_SEDAykw) ### The task: Find 2 integers from an unordered list that sum to a given integer. 1. Given an unordered list of integers, find 2 integers that sum to a given value, print these 2 integers, a...
[Question] [ Write a program which parses the output of `uptime` and generates an anatomically suggestive progress bar (as shown) with a length equal to the current uptime in days: ``` $ uptime 23:01 up 34 days, 7:30, 5 users, load averages: 0.23 0.27 0.24 $ uptime|<command> 8==================================D `...
[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. --- Santa likes to sort his presents in a special way. He keeps "uninterleaving" the pile ...
[Question] [ Your objective is to write a program that takes an input, and, when chained together `N` times, performs "sequential multiplication". What is sequential multiplication, you may ask? It's a sequence with a seed `a` defined as thus: ``` f(0) = a f(n+1) = f(n)*(f(n)-1) ``` So, let `a = 5`. Thus, `f(0) = 5...
[Question] [ You just invited a liberal arts major to your house and you're telling him/her > > "You know, I am a great programmer and I can do x and y and z..." > > > S/he quickly gets bored and asks you: > > "If you really are a great programmer, can you make a programme to let me draw, I just need to draw l...
[Question] [ Today's problem is easy. You're given two strings A and B of equal length consisting of only the characters `(` and `)`. Check whether after any number of operations you can make both strings balanced or not. The only operation allowed is swapping A[i] and B[i], where i is an arbitrary index. Here is t...
[Question] [ [UTF-9](https://datatracker.ietf.org/doc/html/rfc4042) was an April Fool's Day RFC joke specifications for encoding Unicode suitable for 9-bit nonet platforms. # Challenge Your task is to implement a program or a function or a subroutine that takes one integer, who represents the codepoint of a charact...
[Question] [ Tom is going to implement a new programming language of his invention. But before actually starting working on it, he wants to know whether his language should be case sensitive or not. On one hand, case insensitivity seems more easy to implement to him, but he worries that it could cause a lack in the...
[Question] [ **Objective** Given an input of text that does not contain characters `[` or `]`, perform the following actions: 1. For every instance of `Amen` with at least one capital letter (so all instances of `Amen` excluding `amen`), output that same `Amen` (retain capitalization). 2. For every instance of `/al...
[Question] [ 'exaggerated' is an example of a word which can be typed on the left hand, on a normal qwerty keyboard map. 'monopoly' is an example for the right hand. Searching the unix `words` file for words that can be typed on one hand. Output should be two lines: space separated list of such words for the left ...
[Question] [ Given a list, `L`, of sets of numbers like this: ``` [[1], [0,2,3], [3,1], [1,2,3]] ``` Output a single list of numbers such that 2 numbers A and B appear next to each other at least once if and only if `B in L[A]`. That is all such pairs *must* exist in the output, and *only* such pairs *may* exist in...
[Question] [ Given a list of positive integers, write code that finds the length of longest contiguous sub-list that is increasing (not strictly). That is the longest sublist such that each element is greater than or equal to the last. For example if the input was: \$[1,1,2,1,1,4,5,3,2,1,1]\$ The longest increasing...
[Question] [ After all the fun we've had with polyglot challenges in the ([recent](https://codegolf.stackexchange.com/questions/97472/trick-or-treat-polyglot)) past, how about a challenge where the output can be in two languages? Your answer needs to accept boolean input `b` and output the text `"true"` or `"false"...
[Question] [ Can you write a program that renders to screen a group of pixels exploding apart (as in a simple particle engine) and can you do this in any remarkably small number of characters (key strokes)? (Recall the game lemmings, when those little guys would explode and their little pixel pieces fly apart.) Som...
[Question] [ ## Introduction In [this TED-Ed video](https://www.youtube.com/watch?v=SXXrQlJoNsw) (which I'd recommend watching first), a puzzle is presented. 27 unit cubes must be painted with one of red, green, or purple on each face, so that they can be reassembled into a large 3x3x3 cube that shows only red on t...
[Question] [ Write the shortest code you can solving the following problem: **Input:** An integer X with `2 <= X` and `X <= 100` **Output:** Total combinations of 2, 3, and 5 (repetition is allowed, order matters) whose sum is equal to X. **Examples:** Input: `8` Output: `6`, because the valid combinations are: ``...
[Question] [ **This question already has answers here**: [Appending String Lengths](/questions/103377/appending-string-lengths) (48 answers) Closed 1 year ago. The task is simple. You're given an arbitrary string message. Return that message prefixed with a number, such that the length of that number plus th...
[Question] [ Imagine throwing a rock into a pond. You get to see perfect circles of ripples spreading out over the pond, bouncing off of each other. Of course, nothing can be as serene as that in coding, but, we can try! Given a point on a 2D array `(x, y)` and the dimensions of a 2D array/pond `(w, h)`, and a "fra...
[Question] [ A truck fleet dispatcher is trying to determine which routes are still accessible after heavy rains flood certain highways. During their trips, trucks must follow linear, ordered paths between `26` waypoints labeled `A` through `Z`; in other words, they must traverse waypoints in either standard or rev...
[Question] [ \$P\_k(n)\$ means the number of partitions of \$n\$ into exactly \$k\$ positive parts. Given \$n\$ and \$k\$, calculate \$P\_k(n)\$. > > Tip: \$P\_k(n) = P\_k(n‚àík) + P\_{k‚àí1}(n‚àí1)\$, with initial values \$P\_0(0) = 1\$ and \$P\_k(n) = 0\$ if \$n \leq 0\$ or \$k \leq 0\$. [[Wiki]](https://en.wiki...
[Question] [ Write a square block of code that is N characters wide and N characters tall, for some positive integer N. For instance, your N may be 5 and the block look like this: ``` ThisI sMy5B y5Cod eBloc kOkay ``` This block needs to behave as follows: 1. When the top row is extracted and run as a program, the ...
[Question] [ The goal is to write a program that encodes an other program (input) with the fewest character possible. ### Scoring * The score is equal to the different number of characters needed for the output. * Lower score is better. ### Rules * No target languages with a limited set of commands. (No Brainf\*\*k...
[Question] [ Your task is to generate an emoticon of three characters, the first character being one eye, the second the mouth, and the third another eye. Each eye is a random one of these characters: `$'*+-;O^`ox~`, and the mouth is a random one of these: `,-._coux`. Each eye and the mouth must be on the same gene...
[Question] [ Consider the following probability puzzle. We start with a string of bits all set to 0. At each step we choose a bit uniformly and independently at random and flip it. The value your code has to compute is the probability of getting to the all 1s bit string before you get back to the all 0s bit string....
[Question] [ ### Input: Integer `n` which is `>=0` or `>=1` (`f(0)` is optional) ### Output: The `n`'th number in the sequence below, OR the sequence up to and including the `n`'th number. ### Sequence: ``` (0),1,-1,-3,0,5,-1,-7,0,9,-1,-11,0,13,-1,-15,0,17,-1,-19,0,21,-1,-23,0,25,-1,-27,0,29,-1,-31,0,33,-1,-35,0,37...
[Question] [ You have been collecting data from a *Advanced Collecting Device Controller™* for a long time. You check the logs, and to your horror you discover that something has gone terribly wrong: the data only contains the last bits of the numbers! Luckily, you know the starting value and that the value never ...
[Question] [ This is a code-golf question. You need to take the contents of two separate files (i.txt and o.txt) and swap them. You can create a third file to help you with the process, but have your program delete it after the file contents are swapped. Renaming the files is now allowed again. Programs must work f...
[Question] [ ## Background Consider the following sequence ([A051935](https://oeis.org/A051935) in OEIS): * Start with the term \$2\$. * Find the lowest integer \$n\$ greater than \$2\$ such that \$2+n\$ is prime. * Find the lowest integer \$n'\$ greater than \$n\$ such that \$2 + n + n'\$ is prime etc. A more form...
[Question] [ The **optimal matrix** (for the rather narrow scope of this challenge) is obtained by "zipping" the elements from the corresponding rows and columns of a square matrix and getting the maximum of each pair. For instance, given the following matrix: ``` 4 5 6 1 7 2 7 3 0 ``` You can combine it with its t...
[Question] [ It's time for [another](https://codegolf.stackexchange.com/questions/197764/whats-the-mayan-date) Mesoamerican calendar! The [Xiuhnelpilli](https://en.wikipedia.org/wiki/Aztec_calendar#Xiuhmolpilli) was used by the Aztecs (more properly, the Mexica) to name their years. Each year has a number and a sig...
[Question] [ # Introduction The EKG sequence begins with 1 and 2, then the rule is that the next term is the smallest positive integer not already in the sequence and whose common factor with the last term is greater than 1 (they are not coprimes). The first terms are: > > 1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, ... >...
[Question] [ ASCII art is fun. Modern text editors are very good at manipulating text. Are modern programming languages up to the task? One common task in ASCII art manipulation is to crop text to a rectangle between two characters. This is the task you must implement in this challenge. ## Details Your program wil...
[Question] [ Consider the array of positive integers: ``` 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, ... ``` Then, concatenate them: ``` 1234567891011121314151617181920212223242526... ``` And then split them into chunks of variable length, each length being equal to the **N**th positive integer: ``` [1][23][456][78...
[Question] [ The world of art is full of colour, but the world of the network is even fuller than the world of art of diferent colours and it's renderings. That's why we need to know how to convert one type of colour format to another. ### The challenge is self-evident: Write a program / function than converts an g...
[Question] [ **Challenge** Your goal is to write a program that prints another program. That printed program should print another program, and the new program should print another program, until the end. **Rules** 1. Each program must less than 256 bytes. (If this needs to be changed, leave a comment) 2. The last p...
[Question] [ You have a box with a single digit number in each corner: ``` 1|2 --- 3|4 ``` If we concatenate the digits along rows left to right, we get 12 and 34. If we concatenate the digits along columns top to bottom, we get 13 and 24. If we add all of these numbers, we get 12+34+13+24 = 83. ### Challenge Write...
[Question] [ Consider 30 by 30 [Toeplitz](https://en.wikipedia.org/wiki/Toeplitz_matrix) matrices all of whose entries are 0 or 1. This challenge is a simple optimization challenge to find the matrix with the largest determinant possible. **Input** None **Output** A 30 by 30 Toeplitz matrix all of whose entries are...
[Question] [ Given an atomic number in the inclusive range `[1,118]`, write the shortest program/function that outputs one of `{2,8,18}` if the element with that atomic number follows the duplet, octet, or 18-electron rule, respectively. ### Notes * The [Octet/Duplet/18-electron](https://en.wikipedia.org/wiki/Octet...
[Question] [ You are the electoral strategist for a sudden late entrant in the 2020 US presidental election. **Your task**: print out the names of states\* your candidate will win, totalling at least 270 electoral college votes. ## Background Each state (and Washington DC) in the US system has an arbitrary number ...
[Question] [ Inspired by [this glove-themed 538 Riddler Express Puzzle](https://fivethirtyeight.com/features/can-you-get-the-gloves-out-of-the-box/). ## Task You are given a positive integer `n`, and a list `A = [a_1, a_2, ..., a_k]` of `k` distinct positive integers. Then a restricted composition is an ordered lis...
[Question] [ Another sequence, another challenge.\* ### Definition A prime `p` is in this sequence, let's call it `A`, iff for every digit `d` in `p`'s decimal expansion, you replace `d` with `d` copies of `d` and the resulting integer is still prime; zeros are not permitted. For example, `11` is trivially in this ...
[Question] [ ## Goal Your task is to create a program taking no input that returns the link to your answer. You can find a link to your answer by clicking at the share button on your answer. ## Rules 1. Standard loopholes apply except for searching for the answer online. In fact, you are expected to find the answer...
[Question] [ *Huge omega thanks to @wasif for emailing me this challenge idea in its basic form* Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them...
[Question] [ This is the **Robbers** thread. For the Cops challenge, see [here](https://codegolf.stackexchange.com/q/212068/66833) As the robbers, your job is to crack the cops' answers. Choose an uncracked, unsafe cop answer and attempt to figure out which languages, in which order, the cop used. Note that a crack...
[Question] [ **This is Hole-1 from [*The Autumn Tournament* of APL CodeGolf](https://apl.codegolf.co.uk/problems#1). I am the original author of the problem there, and thus allowed to re-post it here.** --- Given a list of numbers, produce a horizontal bar chart of `#` characters for how many numbers fit into each ...
[Question] [ Weather conditions at airports are reported to pilots in [METAR](https://en.wikipedia.org/wiki/METAR) (METeorological Aerodrome Report) format. This format could be described as being "golfed." Here are some examples: ``` METAR KPDX 241653Z 16003KT 1/4SM R10R/4500VP6000FT FG SCT000 01/M01 A3040 RMK AO2...
[Question] [ We all know run-length decoding: A list of character-length pairs expands to a string of that many characters, so `A1B4C2` expands to `ABBBBCC`. But what if we stretch this concept to 2 dimensions? Instead of character-length pairs, in this challenge you will be given character-length-direction triples...
[Question] [ Isn't it annoying when you're taking a picture, but the background detracts from the actual substance of the image? I'd say it is. I need to know how much I should crop so that I get rid of this problem! But - as usual - I am quite lazy, so I need someone to do this for me... ## Task & Rules Given a b...
[Question] [ Your challenge is to turn input text to brain-flak code that will output the text. # Tutorial taken from [here](https://github.com/DJMcMayhem/Brain-Flak/blob/master/README.md) with permission [here](https://chat.stackexchange.com/transcript/message/42965636#42965636) Brain-Flak has two stacks, known as...
[Question] [ Your program / function, etc. will take 2 inputs. The first will be a list of who came to my party and when. Example: ``` Kevin 13:02 Ruby 5 Sam 3 Lisa 6 Bob 12 ``` What does that mean? It means that Kevin got to my party first (at 13:02, 24-hour time), then Ruby 5 minutes later, then Sam 3 m...
[Question] [ The challenge is to filter a large file quickly. * Input: Each line has three space separated positive integers. * Output: All input lines `A` `B`, `T`that satisfy either of the following criterion. 1. There exists another input line `C`, `D`, `U` where `D = A` and `0 <= T - U < 100`. 2. There exist...