text
stringlengths
180
608k
[Question] [ Note: this challenge has been posted [on the sandbox](https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges/14028#14028). # Introduction This challenge is inspired by [2009 Putnam B1](https://artofproblemsolving.com/community/c7h316672p1703568), a problem in an undergr...
[Question] [ The card game [War](https://en.wikipedia.org/wiki/War_(card_game)) is interesting in that the final outcome is entirely determined by the initial arrangement of the deck, so long as certain rules are followed for the order in which cards are picked up from the playing field and moved to decks. In this ...
[Question] [ The challenge is to identify the missing number in a string of undelimited integers. You are given a string of digits (valid input will match the regular expression `^[1-9][0-9]+$`). The string represents a sequence of integers. For example, `1234567891011`. All numbers in the sequence are in the range...
[Question] [ In [this challenge](https://codegolf.stackexchange.com/q/50240/32700) posed by xnor, we were asked to implement XOR multiplication. In this challenge the goal is to find the first `n` XOR primes. XOR primes are very similar to regular primes as you can see by the following definitions: **Definition of ...
[Question] [ A grid-filling meander is a closed path that visits every cell of a square \$N \times N\$ grid at least once, never crossing any edge between adjacent cells more than once and never crossing itself. For example: ![](https://i.stack.imgur.com/WTQSE.png) Once filled, each cell of the grid can be represen...
[Question] [ Steganography hides a given message inside a given carrier, producing a package that does not look suspicious. For this challenge, you will write a program that takes an ASCII message and an ASCII carrier as input, and return or print a package that is identical to the carrier except characters corresp...
[Question] [ # Background This challenge is inspired by [this](http://datagenetics.com/blog/april22013/index.html) website, which published the following diagram: [![enter image description here](https://i.stack.imgur.com/Xl3tg.png)](https://i.stack.imgur.com/Xl3tg.png) This diagram shows us that the longest Roman ...
[Question] [ Sometimes when you're playing Wordle, you get to your fifth guess and you can't figure out the word any more, so you start mentally running through the list of remaining iterations, both sensical and nonsensical trying to figure out what those last few letters are. The task here is to create all permut...
[Question] [ [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak) is a stack-based esoteric language with eight commands: ``` () Evaluates to 1 <> Switch active stack; evaluates to 0 [] Evaluates to height of current stack {} Pop current stack; evaluates to the popped number (...) Execute block a...
[Question] [ The sound of the [theremin](http://en.wikipedia.org/wiki/Theremin) has been immortalized in [The Beach Boys song *Good Vibrations*](https://www.youtube.com/watch?v=QSLMWasU0rM&feature=kp). Many also associate its sound with the theme for the original series of *Star Trek*, though [apparently it was a s...
[Question] [ ## Background I wanted to make a pretty word cloud, like this: ``` these are words floating ``` I computed the `(x,y)`-coordinates of the first letter of each word, plugged them into my word cloud generator, and let it do its job. However, I accidentally used `(y,x)`-coordinates, so the r...
[Question] [ > > **Edit:** Bounty puzzle at the end of the question. > > > Given a set of 1-digit numbers, you should determine how tall a tower they can construct. The digits live on a horizontal plane with a ground level where they can stand. No digit wants to be confused with a multi-digit number, so they al...
[Question] [ A [magic square](https://en.wikipedia.org/wiki/Magic_square) is an **n-by-n** square grid, filled with distinct positive integers in the range **1,2,...n^2**, such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. Your task is to take an ...
[Question] [ ## Task Given a matrix, your program/function should output a [row-equivalent](https://en.wikipedia.org/wiki/Row_equivalence) matrix in checkerboard form ( \$A\_{ij}=0\$ if and only if \$i+j\$ is odd). Two matrices are defined to be row-equivalent if and only if one can be obtained from the other by a ...
[Question] [ In a desolate, war-torn world, where cities have been overrun by thugs and thieves, civilization has reinvented itself in the form of small, isolated, industrial cooperatives, scattered throughout the previously uninhabited landscape. The existence of these communities is reliant on teams of mercenary ...
[Question] [ Ice mazes have been one of my favorite staples of [Pokémon](https://en.wikipedia.org/wiki/Pok%C3%A9mon) games since their debut in Pokémon Gold and Silver. Your task will be to make a program that solves these types of problems. Ice mazes primarily consist of, as the name suggests, ice. Once the player...
[Question] [ A [stem and leaf plot](https://en.wikipedia.org/wiki/Stem-and-leaf_display) displays a bunch of numerical values in groups, which are determined by all but the last digit. For example, suppose we have this set of data: ``` 0, 2, 12, 13, 13, 15, 16, 20, 29, 43, 49, 101 ``` We could produce this stem and...
[Question] [ ## Introduction In this challenge, your task is to write a program that decides whether two given trees are isomorphic. A tree means a directed acyclic graph where every node has exactly one outgoing edge, except the root, which has none. Two trees are isomorphic if one can be transformed into the othe...
[Question] [ Modern mathematics has been formalised using set theory by various systems of axioms. [Zermelo Frankel set theory with the axiom of choice](https://en.wikipedia.org/wiki/Zermelo%E2%80%93Fraenkel_set_theory) (ZFC) forms an intuitive set of axioms and is hence most popular, though stronger choices exist....
[Question] [ In the decimal representation of every rational number `p/q`, you have a periodic tail, a non-periodic head, and a section before the decimal point in the following format: ``` (before decimal point).(non-periodic)(periodic) ``` Some examples include: ``` 1/70 = 0.0142857... = (0).(0)(142857) 10/7 = 1...
[Question] [ > > This is an [*Irregular Webcomic!*](http://www.irregularwebcomic.net/) themed task.\* > > > [**Death**](http://www.irregularwebcomic.net/cast/death.html) is a rather extensive orginization, and, although Head Death has had no trouble telling his employees apart, certain other entities connected ...
[Question] [ Imagine a ***W*** by ***H*** grid of squares that wraps toroidally. Items are placed onto the grid as follows. The first item can be placed on any square, but subsequent items must not be within a [Manhattan distance](http://en.wikipedia.org/wiki/Taxicab_geometry "Wikipedia article") ***R*** of any pre...
[Question] [ The goal of this challenge is to check and extend the OEIS sequence [A334248](http://oeis.org/A334248): Number of distinct acyclic orientations of the edges of an n-dimensional cube. Take an n-dimensional cube (if n=1, this is a line; if n=2, a square; if n=3, a cube; if n=4, a hypercube/tesseract; etc...
[Question] [ Related: [Program my microwave oven](https://codegolf.stackexchange.com/q/8791/43319) and [Generate lazy values](https://codegolf.stackexchange.com/q/73916/43319). My colleague is so lazy that he doesn't even bother to move his finger when programming the microwave oven. (This is actually true!) Help h...
[Question] [ ## Background Imagine for a moment that you have a mind-numbingly boring job. Every morning, you are given a collection of tasks that you should work on that day. Each task has a certain duration, and once started, it must be completed in one go. Your boss will not tolerate idling, so if there are task...
[Question] [ Your challenge is extremely simple. Given a year as input, print all the months in that year that will contain a [Friday the 13th](https://en.wikipedia.org/wiki/Friday_the_13th) according to the Gregorian calendar. Note that even though the Gregorian Calendar wasn't introduced until 1582, for simplicit...
[Question] [ I was intrigued by the design of this graphic from the New York Times, in which each US state is represented by a square in a grid. I wondered whether they placed the squares by hand or actually found an optimal placement of squares (under some definition) to represent the positions of the contiguous s...
[Question] [ # Introduction You are a biologist studying the movement patterns of bacteria. Your research team has a bunch of them in a petri dish, and you are recording their activity. Unfortunately, you are seriously underfunded, and can't afford a video camera, so you just take a picture of the dish at regular i...
[Question] [ # Background In a 2d game that I play, each screen is a 2d grid of tiles with walls and walkable tiles, with the player only able to travel on walkable tiles, and being stopped by walls. When the player walks past the edge of the screen, he will travel to the adjacent screen on the map, with the player...
[Question] [ First puzzle from me, suggestions for improvement gladly received! The scenario is; You work as a manager for a whitewater rafting company. Every morning, you are given a list of bookings, and you have to sort them into raft loads. Write a program or function in your chosen language that does this for ...
[Question] [ We've had a lot of alphabet challenges. For this challenge, **you are passed the *output* of an alphabet challenge, and you need to output the pattern scaled to size `N`**. For example, if `N=5` and you were passed the [L-phabet](https://codegolf.stackexchange.com/questions/87064/print-output-the-l-ph...
[Question] [ Take a look at this image. Specifically, at how the holes on the ends are arranged. [![enter image description here](https://i.stack.imgur.com/nmEO8m.jpg)](https://i.stack.imgur.com/nmEO8.jpg) ([Image source](http://www.hed-inc.com/hairpin.html)) Notice how the pipes in this image are packed in a hexag...
[Question] [ In this challenge, you are passed two things: 1. A string length, `N` 2. A list of strings, `L`, each with an assigned point value. Any string that is not passed in has a point value of 0 You need to construct a string of length `N` such that the sum of all substring points is as large as possible. For...
[Question] [ This challenge is based off of Flow Free. An online version can be found here: <http://www.moh97.us/> You will be given a puzzle, and you must return `1` if the puzzle is solvable, or `0` if it is not. To solve a puzzle, the player must create a path to connect each pair of numbers using every empty sq...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 7 years ago....
[Question] [ If you have a small child in your house, you may have come across foam bath letters. These can be moistened and stuck to flat surfaces such as tiles and the side of the bath to make words and messages. The range of words and messages is somewhat limited if you only have one set though, since you only g...
[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/87444/edit). Closed 7 years ago. [Improve this question](/posts/87444/edit) ...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/187692/edit). Closed 4 years ago. [Improve this question](/posts/187692/edit)...
[Question] [ # Challenge Given a positive-length string \$S\$, a divisor of \$S\$ is another (not necessarily distinct) string for which there exists a number \$a\$ such that when we repeat the divisor \$a\$ times, we get the string \$S\$. For example, the string `abcd` is a divisor of the string `abcdabcd` with \$...
[Question] [ **Problem:** Find the number of leading zeroes in a 64-bit signed integer **Rules:** * The input cannot be treated as string; it can be anything where math and bitwise operations drive the algorithm * The output should be validated against the 64-bit signed integer representation of the number, regardl...
[Question] [ Write a program to print or return one of these strings verbatim: ``` abcdefghijkmnopqrstuvwxyz ABCDEFGHIJKMNOPQRSTUVWXYZ ``` Notice that there is [no L](https://en.wikipedia.org/wiki/The_First_Noel). [Answer] # [brainfuck](https://github.com/TryItOnline/brainfuck), 49 bytes ``` +++++++++++++[->+>...
[Question] [ In particular, use each of these symbols at least once in your source code: ``` ! " # $ % & ' () * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~ ``` Symbols inside comments, string literals, regexps (or any other kinds of literals etc.) don't count (but their delimiters such as `/**/` or `""` do count)....
[Question] [ # Task As input you have: * a positive integer `N` And you should output: * The number of integers in \$[1,N]\$ (an inclusive range) which end with the digit \$2\$ in base ten. # Test cases ``` 1 -> 0 2 -> 1 5 -> 1 10 -> 1 12 -> 2 20 -> 2 30 -> 3 54 -> 6 97 -> 10 100 -> 10 ``` # Rules It is a code-golf...
[Question] [ In C++, there exists a [`a <=> b` three-way](https://stackoverflow.com/questions/47466358/what-is-the-spaceship-three-way-comparison-operator-in-c) [comparison operator](https://en.cppreference.com/w/cpp/language/operator_comparison) that, for numerical types, does the following: * If `a < b`, then ret...
[Question] [ The task is simple: given a 32 bit integer, convert it to its floating point value as defined by the IEEE 754 (32-bit) standard. To put it another way, interpret the integer as the bit-pattern of an IEEE binary32 single-precision float and output the numeric value it represents. ## IEEE 754 single pr...
[Question] [ **This question already has answers here**: [Spell out the Revu'a](/questions/68901/spell-out-the-revua) (34 answers) Closed 7 years ago. The challenge is relatively simple, but will hopefully lead to some wonderfully creative answers. The task is to take a string as an input (via command line, ...
[Question] [ Potentially very difficult, but I've seen some amazing things come out of this site. The goal is to write a program, in any language, that does whatever you want. The catch is that the program must be valid after **any** circular shift of the characters. A circular character shift is very similar to a ...
[Question] [ Your task is it to output a number as a unary string. You get the number of a non-negative integer input in the range of 0 - 2'000'000'000. Rules * You can choose any character for the digit you like. But it has to be the same everywhere and for every input. * Output a unary string by outputting this c...
[Question] [ Create all arrays of non-negative integers of length N where the array sum is equal to T. The output order of arrays does not matter. Possible solutions are e.g. ``` N = 5, T = 2: 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 1 0 0 0 1 0 1 0 0 0 1 1 2 0 0 0 0 0 2 0...
[Question] [ ### Task The task is very simple. Given a non-empty string containing **numbers**, **uppercase** and **lowercase letters**, output the sum of the remaining numbers. For example: ``` a1wAD5qw45REs5Fw4eRQR33wqe4WE ``` Filtering out all the letters would result into: ``` 1 5 45 5 4 33 4 ``` Th...
[Question] [ *Also known as the [analog root]* ([Opposite of the digital root!](https://codegolf.stackexchange.com/questions/123258/opposite-of-the-digital-root?answertab=active#comment302444_123258)) ;) The digital root of a number is the continuous summation of its digits until it is a single digit, for example, ...
[Question] [ Given two strings: a string `s` and an alphabet `a`, implement [string projection](https://en.wikipedia.org/wiki/String_operations#String_projection) in the **shortest code** possible. String projection returns a string `o` that contains the characters in `s` that are in `a`. The order of the character...
[Question] [ Given a string and a substring and a positive integer `n`. Remove the `n` occurences of a substring from the *end* of the **originally given string**. If the substring is not present in the string or the number of times the substring appears is less than `n`, then the output is the original string. No ...
[Question] [ This is a simple challenge: given `n` in any way practical (Function arg, stdin, file, constant in code) output the **internal angles** (NOT the sum of the internal angles, just one) of a regular polygon with `n` sides. The output can be in degrees, gradians or radians, and can be displayed in any way...
[Question] [ Each element on the [periodic table](https://en.wikipedia.org/wiki/Periodic_table) of the [elements](https://en.wikipedia.org/wiki/Chemical_element) has an [atomic weight](https://en.wikipedia.org/wiki/Relative_atomic_mass). For example, [boron](https://en.wikipedia.org/wiki/Boron) (element 5) has an [...
[Question] [ Your task is to generate boxes using any one ASCII character with respect to the inputs given. # Test Cases ``` 1 1 --> ===== = = ===== 1 2 --> ========= = = = ========= 2 1 --> ===== = = ===== = = ===== 2 2...
[Question] [ Take an array of nonnegative integers, such as `[1, 0, 0, 1, 2, 4, 2, 0]`. Then, draw that as a mountain where the integers represent altitude: ``` x x x x x xx x ``` You may use any printable non-whitespace character in place of `x`, and adding padding or whitespace after...
[Question] [ The partition number of a positive integer is defined as the number of ways it can be expressed as a sum of positive integers. In other words, the number of integer partitions it has. For example, the number `4` has the following partitons: ``` [[1, 1, 1, 1], [1, 1, 2], [1, 3], [2, 2], [4]] ``` Hence, ...
[Question] [ The challenge is simple: ## generate a word. Specifications: * Word must be pronounceable. + This is defined as "alternating between a consonant and a vowel." + A consonant is one of the following letters: `bcdfghjklmnpqrstvwxz` + A vowel is one of the following letters: `aeiouy` * Word must be rand...
[Question] [ ### Definition Define the **n**th array of the CURR sequence as follows. 1. Begin with the singleton array **A = [n]**. 2. For each integer **k** in **A**, replace the entry **k** with **k** natural numbers, counting up from **1** to **k**. 3. Repeat the previous step **n - 1** more times. For example,...
[Question] [ ## The Narrative You are a frog who is at the edge of a pond with waterlilies. You would like to cross the pond without getting wet, so you plan to jump from lily to lily. There is, however, one problem: you are a rare species of frog which can only jump one specific distance, and so you might not be a...
[Question] [ ## Or *Fix American Kennel Club's database* As covered by the recent [video by Matt Parker](https://www.youtube.com/watch?v=jMxoGqsmk5Y), the American Kennel Club *permits thirty-seven (37) dogs of each breed to be assigned the same name* ([source](https://www.akc.org/register/information/naming-of-dog...
[Question] [ In Russia we have something like a tradition: we like to look for lucky tickets. Here's what a regular ticket looks like: [![bus ticket](https://i.stack.imgur.com/0bqM1m.jpg)](https://i.stack.imgur.com/0bqM1m.jpg) As you can see, the ticket has a six-digit number. A six-digit number is considered **lu...
[Question] [ [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak) (a cross between Brainf\*\*k and Flak-Overstow) is a stack-based esoteric language. Since this challenge was posted, the language has evolved and updated, but this first revision of the language is known as "brain-flak classic". You must write a pr...
[Question] [ Given a string, if it is even, break the string into 2 even parts, then reverse the parts to get the "reversencoded" string. Example: onomatopoeia -> tamonoaieopo If the string is not of even length, then do not change the position of the middle character, and reverse the letters before and after the m...
[Question] [ Make me a [s'more](https://en.wikipedia.org/wiki/S%27more)! I tell you the width, the amount of graham cracker, the amount of chocolate, and the amount of marshmallow. An example: Input: Width: `10` Graham: `3` Chocolate: `2` Marshmallow: `1`. Output: ``` GGGGGGGGGG GGGGGGGGGG GGGGGGGGGG CCCCCCCCCC CCC...
[Question] [ When using Markup, like on the SE network, an indentation of four spaces before a line of text denotes it as part of a code block, as I hope you know. If you don't, here's an example (with `.` representing a space): ....Code ....More code results in ``` Code More code ``` The problem is, when you cop...
[Question] [ ## The Challenge Display the alphabet from a given letter read from console input. If the letter is uppercase, you have to display the alphabet uppercased. The alphabet printed must end in the precedent letter of the one inserted. If an additiontal parameter is added to the input (a simple dot `.`) the...
[Question] [ In this challenge you will compute numbers from a curious sequence. Your input is a single decimal nonnegative integer. Reverse the bits in this integer and then square the number to get the required output. When reversing the bits you must not use any leading zeroes in the input. For example: ``` 26 (...
[Question] [ > > Tetration, represented as \${}^ba\$, is repeated exponentiation. For example, \${}^32\$ is \$2^{2^2}\$, which is \$16\$. > > > Given two numbers \$a\$ and \$b\$, print \${}^ba\$. ## Test cases ``` 1 2 -> 1 2 2 -> 4 5 2 -> 3125 3 3 -> 7625597484987 etc. ``` Scientific notation is acceptable. Rem...
[Question] [ **This is the robbers' thread. The cops' thread goes [here](https://codegolf.stackexchange.com/questions/77419/find-the-program-that-prints-this-integer-sequence-cops-and-robbers).** In the cops thread, the task was to write a program/function that takes a positive (or non-negative) integer and outputs...
[Question] [ Let's define **fn(k)** as the sum of the first **k** terms of the natural numbers **[1, ∞)** where each number is repeated **n** times. ``` **k** | **0 1 2 3 4 5 6 7 8 9** --------+------------------------------------------------- **f\_1(k)** | 0 1 3 6 10 15 21 28 36 45 **d...
[Question] [ Write a [program or function](http://meta.codegolf.stackexchange.com/questions/2419) to **[output](http://meta.codegolf.stackexchange.com/questions/2447) the sum of [the odd square numbers (OEIS #A016754)](http://oeis.org/A016754) less than an [input](http://meta.codegolf.stackexchange.com/questions/24...
[Question] [ ## Definition (from Wikipedia) **A Pythagorean triple consists of three positive integers a, b, and c, such that a² + b² = c².** The typical example of a Pythagorean triple is (3,4,5): 3² + 4² = 9 + 16 = 25 which is 5² ## Task: Given an integer number `c`, write a program or function that returns the l...
[Question] [ Similar to [this](https://codegolf.stackexchange.com/q/5105/3862), [this](https://codegolf.stackexchange.com/q/132/3862), and [this](https://codegolf.stackexchange.com/q/173/3862) question... What general tips do you have for golfing in `VBA`? I'm looking for ideas that can be applied to code golf pro...
[Question] [ Write a function or program that outputs the number of each type of element (vertex, edge, face, etc.) of an N-dimensional hypercube. As an example, the 3 dimensional cube has 1 cell (i.e. 1 3-dimensional cube), 6 faces (i.e. 6 2-dimensional cubes), 12 edges (i.e. 12 2-dimensional cubes) and 8 vertices...
[Question] [ Create the shortest program/function/whatever that splits an inputted string along un-nested commas. A comma is considered nested if it is either within parentheses, brackets, or braces. ## Input and output Output should be a list or a string joined with linebreaks. The input may contain any characters...
[Question] [ **Story:** The π was recently computed with accuracy to [100 trillions digits](https://cloud.google.com/blog/products/compute/calculating-100-trillion-digits-of-pi-on-google-cloud), but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know t...
[Question] [ # Definition > > In Mathematics, **Harmonic Sequence** refers to a sequence where > > > $$a\_n = \frac 1 n$$ > > > i.e. the \$n\_{th}\$ term of the sequence equals the reciprocal of \$n\$. > > > --- ## Introduction In this challenge, given a positive integer \$n\$ as input, output the Partial S...
[Question] [ Write a program that takes an input such as: ``` n,k ``` which then computes: $$\binom n k = \frac {n!} {k!(n-k)!}$$ and then prints the result. --- A numerical example: Input: ``` 5,2 ``` Internal computation: $$\frac {5!} {3!\times2!}$$ Printed Output: ``` 10 ``` --- I'd like to see an answer that be...
[Question] [ ## Intro A friend posed this question today in a slightly different way - "Can a single [Python] command determine the largest of some integers AND that they aren't equal?". While we didn't find a way to do this within *reasonable* definitions of "a single command", I thought it might be a fun problem ...
[Question] [ Your challenge, should you choose to accept it, is to write a program in a language of your choice that, when given a string (limited to printable ASCII) as input, outputs a new program in the same language that outputs that string *without using any characters from that string in the code.* But this t...
[Question] [ Computers like binary. Humans like base 10. Assuming users are humans, why not find the best of both worlds? Your task is to find the first `n` terms in the sequence [A008559](https://oeis.org/A008559) where each term is the binary representation of the previous number interpreted as a base 10 number. ...
[Question] [ *This is a [rip-off](https://codegolf.stackexchange.com/questions/196864/i-shift-the-source-code-you-shift-the-input) of a [rip-off](https://codegolf.stackexchange.com/questions/193315/i-reverse-the-source-code-you-reverse-the-input/193317#193317) of a [rip-off](https://codegolf.stackexchange.com/quest...
[Question] [ You will be given 3 integers as input. The inputs may or may not be different from each other. You have to output 1 if all three inputs are different from each other, and 0 if any input is repeated more than once. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'")...
[Question] [ (Inspired by [last week's Riddler](https://fivethirtyeight.com/features/when-will-the-arithmetic-anarchists-attack/) on FiveThirtyEight.com. [Sandbox post](https://codegolf.meta.stackexchange.com/a/16158/70172).) Given a year between 2001 and 2099, calculate and return the number of days during that ca...
[Question] [ I'm sure you know about the $9.99 price scheme, instead of using $10. Well, in your new job as a sys admin at a large retail store, they want prices to adhere to a similar scheme: * All prices are in whole dollars, no cents. * All prices should end with 5 or 9, rounding to the closest but up if the las...
[Question] [ In this challenge, you implement an interpreter for a simple stack-based programming language. Your language must provide the following instructions: * push a positive number * pop two numbers and push their sum * pop two numbers and push their difference (second number - first number) * pop a number a...
[Question] [ Given a list of two or more spelled-out serial numbers of equal length greater than two, e.g. ``` [[ "three" , "one" , "four" ], [ "one" , "five" , "nine" ], [ "two" , "six" , "five" ], [ "three" , "five" , "eight" ]] ``` sort the list by the numbers that the words represent: ``` [[ "one" ...
[Question] [ Here is a quick Monday morning challenge... Write a function or program in the least number of bytes that: * Takes as input a list of `[x,y]` coordinates * Takes as input a list of the `[x,y]` coordinates' respective masses * Outputs the calculated center of mass in the form of `[xBar,yBar]`. Note: * I...
[Question] [ Your task is simple. The program reads in a line of text from the standard input, and it prints out the same text in a character-reversed form. It is not allowed to print anything else. For example: input: "Hello!", output: "!olleH" **The catch is**, your program has to be able to do the exact same th...
[Question] [ Given a ragged list, we can define an element's depth as the number of arrays above it, or the amount that it is nested. For example, with the list `[[1, 2], [3, [4, 5]]]` the depth of the `2` is 2, as it is nested within two lists: The base list, and the list `[1, 2]`. The depth of the `4` is 3 as it ...
[Question] [ This is similar to [Making an acronym](https://codegolf.stackexchange.com/questions/75448/making-an-acronym), but there are several key differences, including the method of fetching the acronym, and this challenge including flexible output. ## Task Given a string (list of chars/length 1 strings is allo...
[Question] [ Heavily based on [this closed challenge.](https://codegolf.stackexchange.com/q/148911/80214) [Codidact post](https://codegolf.codidact.com/posts/279253), [Sandbox](https://codegolf.meta.stackexchange.com/a/20435/80214) # Description A Sumac sequence starts with two non-zero integers \$t\_1\$ and \$t\_2...
[Question] [ This construction is a way of representing the Natural Numbers. In this representation, 0 is defined as the empty set and for all other numbers, n is the union of {0} and {n-1}. For example to construct 3 we can follow the algorithm: ``` 3 = {ø, 2} = {ø, {ø, 1}} = {ø, {ø, {ø}}} ``` # Task As you may h...
[Question] [ Some numbers like `64` can be expressed as a whole-number power in multiple ways: ``` 64 ^ 1 8 ^ 2 4 ^ 3 2 ^ 6 ``` Output a sorted array of all possible such powers (here, `[1,2,3,6]`) in as few bytes as possible. --- # Input A positive whole number that's greater than 1 and less than 10000. --- # ...
[Question] [ ### Background *The deltas* of an array of integers is the array formed by getting the differences of consecutive elements. For example, `[1, 2, 4, 7, 3, 9, 6]` has the following deltas: `[1, 2, 3, -4, 6, -3]`. We will now define the deltas of a matrix of integers as the deltas of each row and each col...
[Question] [ We define the *hyper-average* of an array / list (of numbers) the arithmetic mean of the sums of its prefixes. For example, the hyper-average of the list `[1, 4, -3, 10]` is computed in the following manner: * We get the prefixes: `[1], [1, 4], [1, 4, -3], [1, 4, -3, 10]`. * Sum each: `[1, 5, 2, 12]`. ...
[Question] [ Based on [this](https://codereview.stackexchange.com/q/133518) question from Code Review Given a non-empty string of printable ASCII characters, output the *second* non-repeating character. For example, for input `DEFD`, output `F`. ### Input * A single string, in [any suitable format](http://meta.code...
[Question] [ ## What I want: Quite simply, I want a text based display, that asks for an input, `n`, then shows that value on the display! But there's a catch. Each of the 'true' 'pixels' (the ones filled in) has to be represented by that number `n`.. ## Example : You are given an input `n`. You can assume `n` wil...