text stringlengths 180 608k |
|---|
[Question]
[
Write a program in the minimum number of bytes that prints a string split into chunks of every length from 1 to the string's length (ascending and then descending), separated by spaces.
## Example
```
Input : abcdef
Output: a b c d e f
ab cd ef
abc def
abcd ef
abcde f
... |
[Question]
[
Given an array of integers A, the task is to output another array B of the same length so that B[i] is the maximum over A for every index that is not i. That is \$B[i] = \max\_{i' \ne i} A[i']\$.
Examples:
```
A = [1, 5, -3, 4, 2]. B = [5, 4, 5, 5, 5]
A = [1, 2, 3]. B = [3, 3, 2]
A = [-1, -2, -3, -1]. ... |
[Question]
[
In 1.13, Minecraft language files were switched from being a simple multi-line key=value format to [JSON](https://en.wikipedia.org/wiki/JSON).
# Challenge
Write a program converting from the original format returning a JSON string. Input can be taken using any standard input method, output must be json... |
[Question]
[
# Expand a number
Your task is to expand an integer greater than 0 in the following manner:
Split the number into decimal digits and for each digit generate a list according to these rules:
* if the digit is odd, the list starts with the digit and goes down to 1;
* if the digit is even, the list starts... |
[Question]
[
In this challenge you'll be using be [distributing](https://en.wikipedia.org/wiki/Distributive_property) a product over sums and differences of numbers, as explained [here](http://www.coolmath.com/prealgebra/06-properties/05-properties-distributive-01).
[, yes, but what about [*highly* powerful numbers](https://en.wikipedia.org/wiki/Highly_powerful_number)?
### Highly powerful numbers
Let \$n\$ be a positive integer in the form
$$n = p\_1^{e\_{p\_1}(n)}p\_2^{e\_{p\_2}(n)}\cd... |
[Question]
[
In this challenge, given a [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) file as a string, you'll return the data contained as a 2d array of strings.
**Spec:**
* The input consists of one or more **records**, delimited with `\r\n` (CRLF), `\n` (line feed), or some other reasonable newline... |
[Question]
[
For this challenge a "binary tree" is a rooted tree where each node has 0 children (leaf) or 2. The children of a node are unordered, meaning that while you might *draw* the tree with left and right children there isn't a distinction between them and mirroring the tree or a sub-tree does not produce a ... |
[Question]
[
You have to write a function/program that takes input via the `stdin`/command-line arguments/function arguments, mixes up characters in a string, and then output the final string via the `stdout`.
Input will first contain a string (not empty or `null`), a space, and then an even number of non-negative ... |
[Question]
[
# Introduction
An [abstract syntax tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree) is a tree of tokens that shows their connection to each other and syntactical meaning. They are commonly used in compilers and static analysis tools, as parsing a language into an AST helps remove any amb... |
[Question]
[
# The task
Given a positive integer `c`, output two **integers** `a` and `b` where `a * b = c` and each `a` and `b` is closest to `sqrt(c)` while still being integers.
# Test cases
```
Input: 136
Output: 17 8
```
```
Input: 144
Output: 12 12
```
```
Input: 72
Output: 9 8
```
```
Input: 41
Output: 41 1
... |
[Question]
[
Maybe some of you already know this game: you have a collection of jelly beans of different colors. For every color, the bean can have different tastes, some are good and some are bad, and you cannot tell them apart. You have to pick a bean of a given color, and pray you have select a good one.
So, wri... |
[Question]
[
I often forget what I wanted to say when the teacher calls on me to speak. Can you make me a tool to solve this?
Requirements:
* The program must loop as follows:
+ First, take in input
+ If the input is empty, print the last stored question.
+ Otherwise, store the input as a question.
Notes:
* The ... |
[Question]
[
*Inspired by [this question](https://stackoverflow.com/q/37462443/670206) and refined by [Luis Mendo](https://codegolf.stackexchange.com/users/36398/luis-mendo).*
## Challenge
Given a 2D matrix of integers, each row has a maximum value. One or more elements of each row will be equal to the maximum valu... |
[Question]
[
# Introduction
[hackertyper.net](http://hackertyper.net/) is a website that simulates "hacking" (as the media portrays it) by outputting complicated code from the crypto section of the Linux kernel onto the screen as you type at a rate of 3 characters per one inputted.
# Challenge
Your program/function... |
[Question]
[
Let's make a little stupid program that simulates the meme "[Mr. incredible becoming uncanny](https://www.google.com/search?q=mr%20incredible%20uncanny&rlz=1C1ONGR_esES970ES970&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjs2e34ka_1AhXa_7sIHaP3BNIQ_AUoAXoECAEQAw&biw=1920&bih=969&dpr=1)", but in this case, our ... |
[Question]
[
## Introduction
>
> In computer science, a literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values, some also have notations for elements of enumerated types and compound values. [Wikipedia](https://en.wikipedia.org/wiki/Li... |
[Question]
[
List all of the combinations with replacement (or combinations with repetition) of size *k* from a set of *n* elements.
A combination with replacement is an unordered multiset that every element in it are also in the set of *n* elements. Note that:
* It is unordered. So a previously printed set with a ... |
[Question]
[
# Introduction
In this challenge you will be solving diagonal Burrows-Wheeler transforms. Here is a general overview of what a diagonal Burrows-Wheeler transform is. To encode a message, you first must guarantee that it is odd in length (i.e. 5, 7, 9, etc.). Then you make a grid, `n` by `n`, where `n` ... |
[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 9 years ago.... |
[Question]
[
Given a 20×20 grid of non-negative integers, find a 3×3 sub-grid where the
product of the sums of the individual lines hits the maximum. Spoken in
formulas:
Given the 3×3 sub-grid
$$\mathfrak{U} = \left(\begin{matrix}
x\_{11} & x\_{12} & x\_{13} \\
x\_{21} & x\_{22} & x\_{23} \\
x\_{31} & x\_{32} & x\_... |
[Question]
[
I wrote a code that separates the numbers from 1 to 9999 by comma
```
void p(n){printf("%d,",n);if(n<9999){p(n+1);}}main(){p(1);}
```
Is there a way to make this short code without using a repeat statement?
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 40 bytes by Sisyphus, exit by stack overflow
``... |
[Question]
[
Given an integer \$N\$ consider a permutation \$p=p\_1,p\_2,p\_3,\ldots\$ of \$1,\ldots,N-1\$. Let \$P = p\_1 , p\_1+p\_2 \bmod N, p\_1+p\_2+p\_3 \bmod N, \ldots\$ be its prefix sums modulo \$N\$. Sometimes \$P\$ will be a permutation of \$1,\ldots,N-1\$ itself.
For example, \$N=4: p=3,2,1 \rightarrow ... |
[Question]
[
# Challenge
Given a left- or right-stochastic matrix where the limit as x approaches infinity of the matrix to the power of x approaches a matrix with all finite values, return the matrix to which the matrix converges. Basically, you want to keep multiplying the matrix by itself until the result no lon... |
[Question]
[
**This question already has answers here**:
[Different Way Forward](/questions/47005/different-way-forward)
(31 answers)
Closed 7 years ago.
*[Related](https://codegolf.stackexchange.com/questions/94519/output-a-strings-cumulative-slope)*
# Explanation
Given a string such as `DCBA`, convert it t... |
[Question]
[
# Problem
Create a program or function that can calculate the result of a matrix raised to the *n*th power. Your code will take an arbitrary square matrix *A* and a non-negative integer *n*, and return a matrix with the value *A**n*.
## Restrictions
Built-in functions that compute the matrix power and ... |
[Question]
[
This is yet another challenge about the Fibonacci numbers.
The goal is to compute the 20'000'000th Fibonacii number as fast as possible. The decimal output is about 4 MiB large; it starts with:
>
> 28543982899108793710435526490684533031144309848579
>
>
>
The MD5 sum of the output is
>
> fa831ff5dd... |
[Question]
[
[Inspiration](https://codegolf.stackexchange.com/q/32451/66833)
Given a positive integer \$1 \le n \le 9\$, output all positive \$n\$-digit integers \$i\$ for which the following is true:
* Each digit from \$1\$ to \$n\$ appears exactly once in \$i\$. Therefore, \$i\$'s digits are a permutation of the ... |
[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/148911/edit).
Closed 6 years ago.
[Improve this question](/posts/148911/edit)... |
[Question]
[
Given a nonzero polynomial with integer coefficients and roots that are on the imaginary and on the real line such that if `a` is a root then so is `-a`, return another polynomial with the roots rotated by 90 degrees.
### Details
The polynomial can be given in any reasonable format, e.g. as a list of c... |
[Question]
[
**This question already has answers here**:
[Polygonal Numbers!](/questions/99688/polygonal-numbers)
(9 answers)
Closed 6 years ago.
# Explanation of the challenge
Given an input, return what shapes it could be. There are only a couple options.
1. Square
2. Triangle
---
**Square**
A square is in... |
[Question]
[
*Inspired by [this](http://chat.stackexchange.com/transcript/240?m=26561376#26561376) conversation in chat.*
Your goal in this challenge is to emulate a ninja and count how many deaths he has left.
## Specs
You ninja starts out with 9 deaths left. He also gets an integral starting health as an input.
T... |
[Question]
[
The challenge is to find the maximum number you can get from a list of integer using basic arithmetic operators (addition, substraction, multiplication, unary negation)
**Input**
A list of integers
**Output**
The maximum result **using every integer** in the intput.
The input order doesn't matter, resu... |
[Question]
[
A [Kaprekar number](http://mathworld.wolfram.com/KaprekarNumber.html) is an n-digit number *k* that, when the first *n* or *n-1* digits of k^2 are added to the second *n* the digits of N^2, the result is N.
Examples:
```
9^2 = 81. 8+1 = 9.
45^2 = 2025. 20+25 = 45.
297^2 = 88,209. 88+209 = 297
```
The... |
[Question]
[
## Background
You have again, again been given the task of calculating the number of landmines in a field. But this time, the field is foggy.
You must calculate the landmine score given a list/string of numbers, the landmine number, and the land distance (all are numbers).
The landmine number tells you... |
[Question]
[
This is the companion question for [Code Crosswords](https://codegolf.stackexchange.com/q/40304/26997). Robber answers go here.
See [Where should we put robbers?](https://codegolf.meta.stackexchange.com/questions/2334/where-should-we-put-robbers) for meta-info.
[Answer]
# Solution to [es1024's C p... |
[Question]
[
In this challenge, you must take two numbers (separated by a space) as input and output an ASCII right triangle, made up of `x`s.
The first number will be the width and height of the triangle you should output. The second number will be which corner the right angle will be in. The corners are numbered ... |
[Question]
[
Write a program that displays a moving ASCII ball `*` inside a rectangle (20 by 10 chars including border). The ball must not cross the rectangle, e.g. bump off when it hits the wall. The scene must be cleared and redrawn every 0.1 seconds and the ball must move 1 char in x and y direction every frame.... |
[Question]
[
# Challenge
Given a Youtube playlist, output the number of videos in it.
# I/O
The playlist will be given as an URL; for example, `https://www.youtube.com/playlist?list=PL_3jnZNPYn7qUatgDYBS5NShkfXoehSRC` (this is a playlist a friend sent me to try to get me to listen to K-Pop because she's obsessed wi... |
[Question]
[
The goal is really simple. Receiving a string as input, parse all the HTML entities that correspond to the following characters (including their uppercase variants):
```
áàãâäéèêëíìîïóòõôöúùûüýÿ
```
Parsing rules:
* Each entity starts with `&` and ends with `;`
* The first character after the `&` will ... |
[Question]
[
## Rocket Bots
The year is 3024. People have become too scarce a resource to risk in war, so combat has shifted to the robots. Your task is to construct a bot like no other, who's rockets will rain destruction down on your foes and shoot down all incoming threats.
## Gameplay
### Bots
Gameplay takes pl... |
[Question]
[
Draw something that looks like this:

In more precise terms, draw a circle of radius r, with n evenly-spaces tangent lines of length l. Connect the ends of these lines to form a new n-sided regular polygon.
## Rules
r = circle radius ... |
[Question]
[
## Goal
Create a program or pair of programs that collectively disrupt and fix files with the intent of preventing LZMA2 from working effectively. The disrupt and fix routines must be reciprocal, so you can recover the original file exactly.
## Targets
* The collected works of Shakespeare in [plain UTF... |
[Question]
[
**This question already has answers here**:
[Find the Squarish Root](/questions/167149/find-the-squarish-root)
(36 answers)
Closed 5 years ago.
Just a simple code golf function for fun, intentionally left open with few rules to see what creativity comes up.
**Input:** An integer representing the... |
[Question]
[
Another problem from our internal golfing...this one around the holidays last year.
## PROBLEM
Andy, Barb, Carl, Didi, Earl, and Fran are buying gifts for each other. Draw names for a gift exchange.
1. Each person buys one gift and receives one gift.
2. Nobody buys their own gift.
3. Running the soluti... |
[Question]
[
Your task is to make a program which interprets the language it is run in, but also works in many languages.
Let's say you make a Brainfuck-Underload self-interpreglot, as it will be called. Run in Brainfuck, this program should be a Brainfuck interpreter; run in Underload, it should be a Underload int... |
[Question]
[
[The robber's thread is here](https://codegolf.stackexchange.com/q/175366/76162)
The cops task is to write a function or program that, when given an input of itself, outputs a finite deterministic string. If the program is given a different input, it should return a different output.
## Rules:
* Submis... |
[Question]
[
An isolated character is a character (other than a newline) that doesn't have an adjacent character of the same type. Adjacent characters can be to the left, the right above or below, but not diagonals. For example in the following text `H` is isolated:
```
Ybb
YH%
%%%%
```
All the other characters are... |
[Question]
[
Given 2 brainfuck code snippets `A` and `B`, output some brainfuck code `C` which has the same behavior as running `B` with the input of `A`s result. Note that `C` must work for any input that match the following assumptions, as if it were given to `A`.
You can assume:
1. Finite input.
2. both A and B ... |
[Question]
[
# Introduction
[Briscola](https://en.wikipedia.org/wiki/Briscola) is one of Italy's most popular card games. It is a trick-taking card game, like Bridge. Briscola is well known for its bizarre point system. In this challenge, given two cards, you will output whether the first one scores more, less, or ... |
[Question]
[
The challenge here is simple, and not at all about byte-count. Your job is to output the first 50 characters of the previous quine's source code, concatenated with the first 50 characters of yours starting with the 50 characters I've placed below:
```
abcdefghijklmnopqrstuvwxyzACDEFGHIJKLMNOPQRSTUVWXY
... |
[Question]
[
## Challenge
Hi, given a string as input, [remove any salutations](https://meta.stackexchange.com/a/93989/267184) found at the start of the string.
The program which performs the most correct substitutions in under 50 bytes wins.
## Salutations
Hey, a salutation is defined as one of the following words... |
[Question]
[
Following on from [Monte Carlo estimator of Pi](https://codegolf.stackexchange.com/questions/47759/monte-carlo-estimator-of-pi) this challenge is to produce the shortest code for the constant Pi. Except here your code must output consecutive digits of pi forever.
This is code golf, so the shortest subm... |
[Question]
[
Given two positive reals \$a\$ and \$b\$, output some positive reals \$r\_i\$, such that \$\sum r\_i=a\$ and \$\prod\left(r\_i+1\right)=b\$. You can assume that it's possible. You can also assume that your float type have infinite precision.
Test cases:
```
2,3 => 2
2,4 => 1,1 or 1/2,(sqrt(57)+9)/12,(9... |
[Question]
[
## Background
The game [Grand Theft Auto: San Andreas](https://en.wikipedia.org/wiki/Grand_Theft_Auto:_San_Andreas) went down in history also thanks to its wide selection of cheats. They're almost 90 and anyone who has ever touched this game, no doubt has tried them all!
One cheat is activated (on PC... |
[Question]
[
Write a program or a function that accepts the list of outputs from a logic function and outputs the LaTeX code for its truth table.
The inputs should be labeled as lowercase letters `a-z`, and the output should be labelled as `F`. The length of list of inputs will always be shorter than `2^25`, which ... |
[Question]
[
**This question already has answers here**:
[Roman numeral converter function](/questions/797/roman-numeral-converter-function)
(4 answers)
Closed 10 years ago.
The usual rules: no external resources, or the like. Input will be a positive integer in valid Roman numeral format less than 10 thousa... |
[Question]
[
Inspired by [Random with your hands tied](https://codegolf.stackexchange.com/questions/6832/random-with-your-hands-tied):
---
## The Goal
The goal of this challenge is to write a program that generates a pseudorandom bit stream, which is a string of 1s and 0s that appears to be purely random, but is ac... |
[Question]
[
Given a sequence of integers find the largest sum of a subsequence (integers on consecutive positions) of the sequence. The subsequence can be empty (in which case the sum is 0).
Input is read from standard input, one integer per line. The largest sum must be written to standard output.
I wrote a small... |
[Question]
[
You task is to write a small program, that counts the points of a Skat hand. A Skat deck has cards 7 to 10, Jack, Queen, King and Ace (called Unter, Ober, König and Daus). We use the German suits, which have Acorns, Leaves, Hearts and Bells instead of Clubs, Spades, Hearts and Diamonds. The points are ... |
[Question]
[
The `period` of a string is the shortest non-zero shift so that the string matches itself, ignoring any parts that overhang. So for example, `abcabcab` has period `3`. By convention we say that if there is no such shift then a string has period equal to its length. So the period of `abcde` is `5` and t... |
[Question]
[
You are to golf a program that will take a filename as input and you must output what color the file is.
The file will have any one of these extensions but your program only needs to support one. Please say which one in your answer.
* `.jpg`
* `.png`
* `.svg`
* `.gif`
* `.bmp`
And now to the classic la... |
[Question]
[
Your task is to write a program that outputs its own source code in reverse. However, when the reversed code is run, it should output the source code, facing the correct direction.
## Example
Say your program is `abc`. When run, it should output `cba`. `cba`, when run, should output `abc`.
## Rules
You... |
[Question]
[
In this challenge, you will remove duplicate words from each **sentence**.
## Examples
```
Hello Hello, World!
Hello, World!
Code Code! Golf Code
Code! Golf Code
Hello hello World
Hello World
Programming Golf Programming!
Programming Golf!
```
## Specification
* Input will be a string of ASCII cha... |
[Question]
[
Your friend is trying to break into a vault that has a peculiar locking system: it requires a certain number of gentle knocks in a particular spot. Your friend discovered the number (which is in the range 1...99999) and possesses a gadget that produces the required knocks. However, the gadget is a Brai... |
[Question]
[
>
> **Related:** [Hello world!!! Fibonacci distribution](https://codegolf.stackexchange.com/questions/18812/hello-world-fibonacci-distribution)
>
>
>
Create a program that returns True if a given input meets the following specifications, and False otherwise:
* The count of numeric characters (0-9) ... |
[Question]
[
Pick a programming language.
In that language, write a function or program that takes as input a string of working code (in the same language).
It should return/output a [minified](http://en.wikipedia.org/wiki/Minification_%28programming%29) version of the input code. The output should be functionally ... |
[Question]
[
You are given a matrix of size m x n where each cell can contain either 1 or 0. You need to find the largest square submatrix that contains only 1's. The output should be the area of the largest square submatrix.
For example, given the following matrix:
```
1 0 1 1 1
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
```
T... |
[Question]
[
[Robbers thread](https://codegolf.stackexchange.com/q/223160/45613)
Your task is to create a method for hiding information in an image. You will post three encoded messages of your choice (keep them classy), each with its associated image. Reveal the messages for the first two images and do not reveal ... |
[Question]
[
[](https://i.stack.imgur.com/sjl00.png)
**Challenge:**
Find the number of ways to climb some stairs with n steps and with some limitations. You should be able to run the tests below on TIO <https://tio.run/> **without timing out.** – 6... |
[Question]
[
The task is a rather simple quine challenge with a twist, you must output your source code in the shape of a pyramid. The shape of a pyramid is defined below:
```
1
234
56789
ABCDEFG
HIJKLMNOP
QRSTUVWXYZa
bcdefghijklmn
......etc......
```
The main limitation of this challeng... |
[Question]
[
I'm attempting to create a function over multiple lines.
# Parameters of the challenge:
1. Function returns 'barbarian'
2. Only 2 characters per line
3. 40 lines maximum.
I keep trying to use a fat arrow to declare my function, but fat arrows don't seem to work if you don't have them connected.
Source ... |
[Question]
[
*This is a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge the Cops' Thread can be found [here](https://codegolf.stackexchange.com/questions/111190/anagram-quines-cops-thread)*
Your challenge, as robbers is to take outputs from the cops' threa... |
[Question]
[
[SmileBASIC](http://smilebasic.com/en) deserves more attention. I've only seen 3 users here (including myself!) providing SB answers, and while that doesn't surprise me, it disappoints me. It being a paid lang as well as being a BASIC dialect certainly turns people off, but [for those who own it](https... |
[Question]
[
# Definition
The infinite spiral used in this question has `0` on the position `(0,0)`, and continues like this:
```
16-15-14-13-12
| |
17 4--3--2 11
| | | |
18 5 0--1 10
| | |
19 6--7--8--9
|
20--21...
```
It is to be interpreted as a Cartesian plane.
For example, `1` i... |
[Question]
[
Given an input of a positive integer, output the number of steps it takes to
find the input via a binary search starting at 1.
We are simulating a binary search for the integer that was given as input, in
which the simulated searcher can repeatedly guess an integer and be told
whether it is too high, t... |
[Question]
[
2015 was the year of the goat! In this challenge, you will figure out which animal represents the year. To avoid making this challenge to complex you won't need to calculate Chinese new year.
Because they are only 12 animals in the Zodiac, your code will need to be as short as possible.
## Examples
**Y... |
[Question]
[
A magic sequence is a sequence of non-negative integers `x[0..n-1]` such that there are exactly `x[i]` instances of `i`
For instance, 6,2,1,0,0,0,1,0,0,0 is a magic sequence since there are 6 0's, 2 1’s, and so on.
Write a function which when given n, outputs all magic sequences of length n
---
The pro... |
[Question]
[
Write a program that defines a function that can check if a string variable called "anything you want or inputted by the user" is or not a piem.
(piem = a story or poem in which the word lengths represent the digits of π ([from Wikipedia](http://en.wikipedia.org/wiki/Piphilology#Examples_in_English)))
... |
[Question]
[
[**Latest update: benchmark program and preliminary resuls available, see below]**
So I want to test the speed/complexity tradeoff with a classic application: sorting.
Write an ANSI C function that sorts an array of floating point numbers in *increasing* order.
You can't use *any* libraries, system cal... |
[Question]
[
Given two natural numbers (less than 100) as input print the sequence of intermediate results obtained when computing the sum of the two numbers using only the following operations1:
* `n <-> (m+1)` for integers `n`and `m` satisfying that equation
* `(a+b)+c <-> a+(b+c)` for integers `a`,`b` and `c` (a... |
[Question]
[
It's [Nowruz](https://en.wikipedia.org/wiki/Nowruz) and you want to set up a [Haft-Sin](https://en.wikipedia.org/wiki/Haft-sin) table by words. This means finding seven words that start with letter *s*.
# The Challenge
Write a program which its input is a list of words separated by space, and output at... |
[Question]
[
Create a function that accepts a list of dates (unsorted with possible duplicates) and returns the days of the week in one of the following formats:
* A format similar to `MTWTFSS` or `SMTWTFS` (i.e. beginning with Monday or Sunday), with non-days replaced by an underscore `_`, illustrated below.
* `WE... |
[Question]
[
The flag of Tennessee is specified by chapter 498 of the Public Acts of 1905.
>
> An oblong flag or banner in length one and two thirds times its width, the large or principal field of same to be of color red, but said flag or banner ending at its free or outer end in a perpendicular bar of blue, of u... |
[Question]
[
Tomorrow is the Mid-Autumn festival, and in the spirit of that holiday, I will introduce a gambling game that we (people from [Xiamen](https://en.wikipedia.org/wiki/Xiamen)) play during the holiday!
# Rules
The game is played with six 6-sided dice. Different combinations of numbers have different ranks... |
[Question]
[
## Challenge
Given an image of the Moon as input, output the phase of the Moon.
## Phases of the Moon
Your program will be supplied one of these images in png format and you must output the phase exactly as given:
```
new moon
```
[hexdump](https://gist.github.com/beta-decay/9b7f749f38dc0c9111915e4ffdd... |
[Question]
[
# Challenge
The task is simple. Given an array and a first and last value: Return the first of the last after the first, and the last of the first before the last.
---
Or simply: Given an array, var1, var2.
Example Array:
[ var2, , var1, , var2, , var2, var1, var2, ]
Return:
* The index of the first va... |
[Question]
[
Given a square matrix, output the matrix's eigenvalues. Each eigenvalue should be repeated a number of times equal to its algebraic multiplicity.
The eigenvalues of a matrix `A` are scalar values `λ` such that, for some column vector `v`, `A*v = λ*v`. They are also the solutions to the characteristic p... |
[Question]
[
>
> Normally, we decompose a number into binary digits by assigning it with powers of 2, with a coefficient of `0` or `1` for each term:
>
>
> `25 = 1*16 + 1*8 + 0*4 + 0*2 + 1*1`
>
>
> The choice of `0` and `1` is... not very binary. We shall perform the *true* binary expansion by expanding with p... |
[Question]
[
**This question already has answers here**:
[Generate combinations that add up to a target value](/questions/153221/generate-combinations-that-add-up-to-a-target-value)
(15 answers)
Closed 6 years ago.
Write a function that gets as an input a sorted array of positive numbers `A`, and an addition... |
[Question]
[
Write a [fixed point combinator](http://en.wikipedia.org/wiki/Fixed_point_combinator) in as few characters as possible, in the language of your choice.
* free form (*i.e.*, whatever's shortest): whole program, actual function, code snippet
* you may not use your standard library's if it has one
* you m... |
[Question]
[
(Similar: [Through the bases](https://codegolf.stackexchange.com/questions/53683/through-the-bases))
Normally, our number system is base ten, with the digits `0123456789`. However, we can increase or decrease the base count (so hexadecimal uses `0123456789abcdef` and octal uses `01234567`.
Your goal is... |
[Question]
[
This question is tricky (and in particular harder than [Which big number is bigger?](https://codegolf.stackexchange.com/questions/184734/which-big-number-is-bigger)), for those who like more challenging puzzles.
**Input**
Integers a1, a2, a3, a4, a5, b1, b2, b3, b4, b5 each in the range 1 to 10.
**Outp... |
[Question]
[
# Goal
Write a program or function that takes a positive integer `n` and randomly generate a legal series of pitches (henceforth called a Pitch string) of length `n`.
# Input
A non-zero, positive integer `n` <= 100
# Output
Return a random string, or list of characters, that represent a possible, valid... |
[Question]
[
Given is any integer x > 0 and any base y > 3.
1. Sum all digits of x (if written in the set base).
2. Multiply this by the highest possible digit (is always `base -1`).
3. Repeat until this value is `(y - 1) ^ 2`
Searched is the count of iterations and the steps.
Example 1:
```
x= 739
y= 7
searched: (... |
[Question]
[
Given an input string containing only letters and numbers, write a program or function that prints the possible printable ASCII characters (Hex 20-7E) that correspond with the string's value in bases 8, 10, and 16 (where possible). The characters must be written in increasing order in terms of the base... |
[Question]
[
Let `z` be a complex number. `z` is an nth **primitive root of unity** if for a certain positive integer `n` [](https://i.stack.imgur.com/KglnS.gif) and for any positive integer `k < n` [](https://i.stack.imgur.com/d7Gic.gi... |
[Question]
[
Here's an interesting challenge...
I want you to golf code that when executed will allow your input to be converted to mimic output as though you were typing on a DVORAK keyboard layout.
The aim is to mimic the US Simplified Dvorak Keyboard (US:SDK)
 to become more popular on the site.
The rules are simple. The cops choose problems from Le... |
[Question]
[
Your task is to write a program that receives a base 10 number from 0 to 99 and outputs the German name of that number with non-ASCII characters replaced with ASCII equivalents.
## German number names
```
0 -> null
1 -> eins
2 -> zwei
3 -> drei
4 -> vier
5 -> fuenf
6 -> sechs
7 -> sieben
8 -> acht
9 ->... |
Subsets and Splits
Python Q&A Count
Counts the number of questions and answers related to Python in the dataset, providing insight into the prevalence of Python content.