text stringlengths 180 608k |
|---|
[Question]
[
There are [several questions regarding this game](https://codegolf.stackexchange.com/search?q=rock%20paper%20scissors), even a [king-of-the-hill](/questions/tagged/king-of-the-hill "show questions tagged 'king-of-the-hill'") contest [here](https://codegolf.stackexchange.com/q/35079/70347). But I think ... |
[Question]
[
## How strings are twisted
The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps to the top. It works like this:
```
aaaa
bbbb
cccc
```
Becomes:
```
a
ba
cba
----
cba
cb
c
```
With everything under the line... |
[Question]
[
Your challenge is to write a program that is a quine, meaning it prints out its own source code.
For at least one individual character, when it is removed from the program's source, a single different character is removed from the output.
By different, I mean that the character removed from the code is... |
[Question]
[
## Definition
The rank of a word is defined as the position of the word when all the possible permutations (or arrangements) of its letters are arranged alphabetically, like in a dictionary, no matter if the words are meaningful or not.
Let us consider these two words - "blue" and "seen". To begin with... |
[Question]
[
What general tips do you have for golfing in F#? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to F# (e.g. "remove comments" is not an answer). Please post one tip per answer.
[Answer]
Need to provide a type annotation for a variable... |
[Question]
[
I'm a mentor at RubyLearning and one of the exercises we give to our students is the "Deaf Grandma" exercise from Chris Pine's book "[Learn to Program](http://pine.fm/LearnToProgram/)". Here's the description:
>
> Write a Deaf Grandma program. Whatever you say to grandma (whatever
> you type in), she... |
[Question]
[
Given an expression like `4 / 2 + 3`, determine whether the expression has the same value in Python 2 and Python 3. Recall that in Python 2 division rounds down (so that `5 / 2 -> 2`), whereas in Python 3 division returns a float (so that `5 / 2 -> 2.5`).
For simplicity's sake, we will only consider ex... |
[Question]
[
### Challenge
Implement the "greedy queens" sequence (OEIS: [A065188](https://oeis.org/A065188)).
### Details
*Taken from the [OEIS page](https://oeis.org/A065188).*
This permutation [of natural numbers] is produced by a simple greedy algorithm: starting from the top left corner, walk along each succes... |
[Question]
[
Take a matrix **A** consisting positive integers, and a single positive integer **N** as input, and determine if there are at least **N** consecutive occurrences of the same number in any row or column in the matrix.
You need only test horizontally and vertically.
### Test cases
```
N = 1
A =
1
Result... |
[Question]
[
A function (or program) which takes inputs and provides outputs can be said to have a cycle if calling the function on its own output repeatedly eventually reaches the original number. For instance, take the following function:
```
Input: n 1 2 3 4 5 6
Output: f(n) 5 7 1 3 4 9
```
If we start with ... |
[Question]
[
The [Simpson index](https://en.wikipedia.org/wiki/Diversity_index#Simpson_index) is a measure of diversity of a collection of items with duplicates. It is simply the probability of drawing two different items when picking without replacement uniformly at random.
With `n` items in groups of `n_1, ..., n... |
[Question]
[
A follow-up to [this challenge](https://codegolf.stackexchange.com/q/144146/45941)
Given a set of mixed dice, output the frequency distribution of rolling all of them and summing the rolled numbers on each die.
For example, consider `1d12 + 1d8` (rolling 1 12-sided die and 1 8-sided die). The maximum a... |
[Question]
[
# Background
A **binary tree** is a rooted tree whose every node has at most two children.
A **labelled binary tree** is a binary tree whose every node is labelled with a positive integer; moreover, all labels are **distinct**.
A **BST** (binary search tree) is a labelled binary tree in which the label... |
[Question]
[
## Question
`Given the atomic number of an element` in the range [1-118] output the `group and period`, of that element as given by the following Periodic Table Of Elements.
For elements in the Lanthanide and Actinide series, (ranges [57-71] and [89-103]), you should instead return `L` for the Lanthani... |
[Question]
[
**Output** is a shape that encloses 1009 pixels.
* The shape must take the form of a single, closed, non-intersecting loop.
**Input** is a positive non-zero integer.
* Each input must yield output that is unique — that is, each output must be unique from those generated using a lower input.
**Victory**... |
[Question]
[
The goal of this code golf is to convert integers to English words.
The program prompts for input. If this input isn't an integer, print `NaN`. If it is an integer, convert it to English words and print these words. Minimum input: 0 (zero). Maximum input: 9000 (nine thousand).
So, `5` returns `five`... |
[Question]
[
Imagine you have a grid where some squares are walls, some are empty, and some are lights that shine for arbitrary distances in the four cardinal directions until they meet walls:
```
####.####
##..L....
####.##.#
####.##L.
##......L
```
In the above grid, the lights cover all the tiles. But in some ca... |
[Question]
[
>
> This is a overhaul of [this now deleted question](https://codegolf.stackexchange.com/q/152430/56656) by [ar kang](https://codegolf.stackexchange.com/users/77282/ar-kang). If the OP of that question would like to reclaim this question or has a problem with me posting this I'd be happy to accommodat... |
[Question]
[
Given a finite [arithmetic sequence](https://en.wikipedia.org/wiki/Arithmetic_progression) of positive integers with some terms removed from the middle, reconstruct the whole sequence.
## The task
Consider an arithmetic sequence: a list of positive integers in which the difference between any two succe... |
[Question]
[
## The task
In this challenge, your task is to write a program in a programming language **L** that takes a positive integer **n**, and outputs the sum of the proper divisors of **n** ([sequence A001065](http://oeis.org/A001065) on OEIS).
It should return the correct output for any **1 ≤ n ≤ 10 000**.
... |
[Question]
[
FizzBuzz is so simple, bet you can do it backwards. In this challenge, you will be given the length of the FizzBuzz string and must give the positive integer that produced that string.
## Description
To break this down, a FizzBuzz string for `n` is generated by the following algorithm.
Start with an e... |
[Question]
[
Write a program or function that takes in a 4×4 text grid consisting of exactly 4 `A`'s, 4 `B`'s, 4 `C`'s, and 4 `D`'s, such as:
```
ACDC
BBCA
BADD
ABCD
```
The `ABCD`'s may be in any arrangement but there will always be 4 of each. You can assume the input is valid. If desired you can also assume it ha... |
[Question]
[
(This is [A065825](https://oeis.org/A065825).) The [sequence](/questions/tagged/sequence "show questions tagged 'sequence'") defaults apply, so you can pick another format other than this one.
Given an input integer `n`, find the smallest number `k` so that there exists an n-item subset of `{1,...,k}` ... |
[Question]
[
My birthday is in a month, and this is a slice of tasty cake.
```
.-""-.
.-" "-.
|""--.. "-.
| ""--.. "-.
|""--.. ""--..\
| ""--.. |
| ""--..|
""--.. |
""--.. |
""--..|
```
In the fewest number of bytes, construct this... |
[Question]
[
Some numbers such as: 6, 12, 20, 30, 42, 56, 60, 90, 120 and so on as can be expressed as a product of consecutive integer numbers as shown below.
```
6 = 2 * 3
12 = 3 * 4
30 = 5 * 6
60 = 3 * 4 * 5
90 = 9 * 10
120 = 4 * 5 * 6
```
Write a program or function that outputs a list of consec... |
[Question]
[
Given a string whose length is divisible by 4, make a triangle as demonstrate below.
If the string is `abcdefghijkl`, then the triangle would be:
```
a
b l
c k
defghij
```
If the string is `iamastringwithalengthdivisiblebyfour`, then the triangle would be:
```
i
a r
m ... |
[Question]
[
This challenge is a little tricky, but rather simple, given a string `s`:
```
meta.codegolf.stackexchange.com
```
Use the position of the character in the string as an `x` coordinate and the ascii value as a `y` coordinate. For the above string, the resultant set of coordinates would be:
```
0, 109
1, ... |
[Question]
[
In Windows, when you perform double-click in a text, the word around your cursor in the text will be selected.
(This feature has more complicated properties, but they will not be required to be implemented for this challenge.)
For example, let `|` be your cursor in `abc de|f ghi`.
Then, when you double... |
[Question]
[
Task is pretty simple. Your program should take a number `N` from `1` to `20` and draw the following ASCII art.
When `N=1`:
```
_____
| | |
| | |
| | |
| | |
| | |
| | |
| | |
|_|_|
\ /
\-/
v
```
When `N=2`:
```
_______
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| ... |
[Question]
[
This challenge is inspired by [this](https://codegolf.stackexchange.com/a/112832/31516) very nice answer by TidB.
---
In TidB's answer, every eight character is in the correct order: `gnilwoB edoC` (`Code Bowling` backwards). The other strings however ~~are~~ were in a strange, random order.
Your chall... |
[Question]
[
**EDIT**
It appears that there has been some confusion following my typo in the original post which used a lowercase o to define the plane and then an uppercase later. Unfortunately this bug did not get picked up in the Sandbox. Since many members have written answers with both and since the typo was m... |
[Question]
[
Inspired by [this](http://www.bbc.co.uk/news/technology-31028787) recent article telling of a French programmer who wrote a 487 byte 2-player (human vs. human) chess program in Assembly, I wondered how small chess programs could be in other languages.
**Details**
* The program must only accept legal ch... |
[Question]
[
We consider two integers to be *similar* if, when written in decimal, have the same length, and if we compare characters in any two positions for both decimal strings, the comparison results (less, equal or greater) must be the same in both strings.
Formally, for two number that can be written as decim... |
[Question]
[
In CSS, colours can be specified by a "hex triplet" - a three byte (six digit) hexadecimal number where each byte represents the red, green, or blue components of the colour. For instance, `#FF0000` is completely red, and is equivalent to `rgb(255, 0, 0)`.
Colours can also be represented by the shortha... |
[Question]
[
Define that the natural number **p** is a *+1 prime* of the natural number **n** if **p** is a prime number and the standard binary representation (i.e., without leading zeroes) of **p** can be obtained by adding (i.e., prepending, appending or inserting) a single **1** to the standard binary represent... |
[Question]
[
## The Challenge
Build a N-Leveled [Cantor Set](http://en.wikipedia.org/wiki/Cantor_set).
>
> The Cantor ternary set is created by repeatedly deleting the open
> middle thirds of a set of line segments.
>
>
>
The program receives one parameter `N` (a integer number) and then prints (in console or... |
[Question]
[
A simple way to scramble a 2x2x2 Rubik's cube is to make a sequence random moves. This is not how official scrambles are done, but can get pretty close to a uniform distribution of all possible scramble states. Due to the way a 2x2 only has two layers, doing one turn on one face is equivalent (without ... |
[Question]
[
Recently I had a Maths test and noticed that a certain number on the test matched an interesting pattern. The number (`28384`) matched a generic digit sequence that looks like this
```
(n)(x)(n+1)(x)(n+2)(x)(n+3) etc...
```
where `n` and `x` are single digit integers. The sequence can begin with either... |
[Question]
[
The *minimal power iteration* of a number \$n\$ is defined as follows:
$$\text{MPI}(n):=n^{\text{min}(\text{digits}(n))}$$
That is, \$n\$ raised to the lowest digit in \$n\$. For example, \$\text{MPI}(32)=32^2=1024\$ and \$\text{MPI}(1234)=1234^1=1234\$.
The *minimal power root* of a number \$n\$ is de... |
[Question]
[
# Room Number Locator
I have come across an interesting problem solving technique at my job when given the wrong room number from a colleague for a meeting. Every now and then, while on the way to a meeting, a member on my team will send me the wrong room number, typically because they are in a rush at... |
[Question]
[
## Background
The Collatz (or 3x+1) map ([A006370](https://oeis.org/A006370)) is defined as the following:
$$
a(n) =
\begin{cases}
n/2, & \text{if $n$ is even} \\
3n+1, & \text{if $n$ is odd}
\end{cases}
$$
Now, let's define the sequence \$s\_0\$ as the infinite sequence of positive integers \$1, 2, 3... |
[Question]
[
*With the US election going on right now, I noticed that there is one (completely meaningless, but still) thing which Trump can still achieve and which is out of reach for Biden: Having the won states being connected.*
**Task:** Given a list of strings of two-letter abbreviations (see below) for US sta... |
[Question]
[
When making phone calls internationally, phone numbers are prefixed with a code indicating what country the number is located in. These codes are [prefix codes](https://en.wikipedia.org/wiki/Prefix_code), meaning that no code is a prefix of another.
Now, earlier today you missed a call, and you're kind... |
[Question]
[
*This challenge sounds too simple to not already exist, so let me know if it is a duplicate.*
## The task
Print `Hello, world!`
## The rules
Your code has to be in "byte order". This means that every character / byte has a higher or equal byte value than the preceding character / byte.
Exceptions to th... |
[Question]
[
## The task
Write a program or function that given three strings `A, B, C` produces an output string where each instance of `B` in `A` has been recursively substituted with `C`.
Recursively substituting means repeating a substitution where at each step all non-overlapping instances of `B` in `A` (chose... |
[Question]
[
The digital root (also repeated digital sum) of a positive integer is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached.
For exa... |
[Question]
[
*This challenge is related to some of the MATL language's features, as part of the [May 2018 Language of the Month](https://codegolf.meta.stackexchange.com/questions/16337/language-of-the-month-for-may-2018-matl) event.*
---
## Introduction
In MATL, many two-input functions work **element-wise** with *... |
[Question]
[
# Problem
given input `a,b,c`
where `a,b,c` are positive even integers
and `a > b > c`
Make a box of any allowed character with dimensions `a x a`
Center a box of a different allowed character with dimensions `b x b` within the previous
Center a box of another different allowed character with dimension... |
[Question]
[
# Background
A Pythagorean triangle is a right triangle where each side length is an integer (that is, the side lengths form a [Pythagorean triple](http://en.wikipedia.org/wiki/Pythagorean_triple)):

Using the sides of this triangle, we can at... |
[Question]
[
## Challenge
There are many numbers which can be expressed as the difference of two squares, or as the difference of two cubes, or maybe even higher powers. Talking about squares, there are various ways of writing a number, say 75, as the difference of 2 squares. You can write:
```
75 = (10)^2 - (5)^2 ... |
[Question]
[
>
> Thanks to [this](https://codegolf.stackexchange.com/questions/33221/write-a-domino-effect) question for some inspiration
>
>
>
In this challenge we will represent a line of dominoes as a string of `|`, `/` and `\`. You will be given a string of dominoes as input and you must determine what they... |
[Question]
[
The "standard" polyhedral game dice have 4, 6, 8, 10, 12 and 20 sides. (Yes, I know that there are two 10-sided dice which together make a d100, but we're ignoring that right now.)
If I want to generate a random number between 1 and \$n\$ where \$n\$ is not one of those sides, I have a couple of option... |
[Question]
[
Starting with the string `ABC`, consider the result of repeatedly appending the last half of itself to itself (using the larger half if the length is odd).
We get the progression:
```
ABC
ABCBC
ABCBCCBC
ABCBCCBCCCBC
ABCBCCBCCCBCBCCCBC
etc...
```
Let `S` represent the resulting infinite string (or seque... |
[Question]
[
Today, you're going to be writing Polish. No, not Polish notation—*Polish*, the actual language spoken in Poland.
Given a number and a noun, output a Polish sentence telling me that there are that many of that thing, using the appropriate template below.
The input consists of an integer in the range fr... |
[Question]
[
## Challenge:
Your challenge is to write an interpreter for [Whitespace](https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php). Given a string consisting of spaces, tabs, newlines, and potentially other characters, as well as possible inputs for the Whitespace pro... |
[Question]
[
Golf a program or function which gives the \$n^{\text{th}}\$ location of the [wildebeest](https://en.wikipedia.org/wiki/Wildebeest_Chess "Wikipedia") who starts at square \$1\$ on an infinite [chessboard](https://en.wikipedia.org/wiki/Chessboard "Wikipedia") which is numbered in an anti-clockwise squar... |
[Question]
[
Here is an ASCII [saltine cracker](http://en.wikipedia.org/wiki/Saltine_cracker):
```
_________________
| . . . |
| . . |
| . . . |
| . . |
| . . . |
|_________________|
```
Here are two crackers stacked:
```
_________________
| . . . |
... |
[Question]
[
Our classic snake has developed an inbalance of [growth hormones](http://en.wikipedia.org/wiki/Growth_hormone). To make matters worse, his tail is frozen in place! Given directional input as specified in `Figure 1`, write a program to determine where he will grow.
](https://i.stack.imgur.com/JzZCj.png)
## Input / output
The input will be a string that contains only printable ASCII characters. The first or last characters will never be ... |
[Question]
[
You're a mouse. Your mouse friends have all been captured, and are unconscious and trapped in a maze that has only one entrance/exit. You happen to have a perfect map of the maze, so you can plot a solution to rush in and carry them all to safety. However, the maze is guarded with a security system tha... |
[Question]
[
The *Tangram* is a dissection puzzle made from seven shapes: Five differently sized triangles, a parallelogram and a square. Given a shape, the goal is recreating the shape using all the pieces and without overlapping. There are obviously infinitely many ways to arrange this set of pieces in the plane.... |
[Question]
[
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/59997/edit).
Closed 8 years ago.
[Improve this question](/p... |
[Question]
[
## Overview
**Given a number of hexagons, arrange them into a connected shape within the confines of a 50 by 50 ASCII art image. The shape you choose can be arbitrary - whatever you find most amenable to golfing - as long as it is connected. It may have holes provided they are larger than one hexagon (... |
[Question]
[
To check whether a list of non-negative integers is *balanced*, one can imagine putting respective weights on a board and then try to balance the board on a pivot such that the summarized *relative* weights left and right of the pivot are the same. The relative weight is given by multiplying the weight... |
[Question]
[
[Hilbert numbers](https://en.wikipedia.org/wiki/Hilbert_number) are defined as positive integers of the form `4n + 1` for `n >= 0`. The first few Hilbert numbers are:
```
1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 93, 97
```
The Hilbert number sequence is g... |
[Question]
[
If we take the natural numbers and roll them up counter clock-wise into a spiral we end up with the following infinite spiral:
```
....--57--56
|
36--35--34--33--32--31--30 55
| | |
37 16--15--14--13--12 29 54
| | ... |
[Question]
[
The idea of this is mainly from [BIO 2017 q1](http://www.olympiad.org.uk/papers/2017/bio/bio17-exam.pdf). I got the idea for posting this challenge from my [Binary Sequences challenge](https://codegolf.stackexchange.com/questions/150650/binary-sequences), since lots of people seemed to like it.
Also, t... |
[Question]
[
Thanks to your help in the [Mark My Mail](https://codegolf.stackexchange.com/questions/149672/mark-my-mail-ascii-barcodes) challenge, PPCG-Post has successfully stamped all of its parcels with the generated barcodes!
Now, it's time to decode them.
In this challenge your program will, given a barcode ge... |
[Question]
[
Your objective: Given a string of brackets, output the minimum [Damerau-Levenshtein Distance](http://www.wikiwand.com/en/Damerau%E2%80%93Levenshtein_distance) required to turn the input string into a string where the brackets are balanced.
## Input
The input string will only contain brackets and no oth... |
[Question]
[
Given a polynomial \$p(x)\$ with integral coefficients and a constant term of \$p(0) = \pm 1\$, and a non-negative integer \$N\$, return the \$N\$-th coefficient of the power series (sometimes called "Taylor series") of \$f(x) = \frac{1}{p(x)}\$ developed at \$x\_0 = 0\$, i.e., the coefficient of the m... |
[Question]
[
## Challenge
Given a string as input, golf down the [Fourier program](http://esolangs.org/wiki/Fourier) which outputs that string.
In Fourier there is no easy way to output a string: you have to go through each character code and output that as a character.
## Fourier
The language is based upon an accu... |
[Question]
[
You all know the Newton method to approximate the roots of a function, don't you? My goal in this task is to introduce you into an interesting aspect of this algorithm.
Newton's algorithm converges only for certain, but most of all complex input values. If you picture the convergence of the method for ... |
[Question]
[
The problem statement here is pretty simple, take two real numbers on the range [0,1) as input and output their sum, with probability 1.
The catch here is that there are a lot of real numbers. There are in fact so many real numbers that it is impossible to fit all of them into any finite data type. As ... |
[Question]
[
### Background
Bathroom Etiquette, when pertaining to the available urinals, states that the next urinal to be filled in should be the one that minimizes the total discomfort. The total discomfort equation is given by the following set of equations:
```
**dist(x,y)** = linear distance between person x ... |
[Question]
[
Before 1994, Spanish dictionaries used alphabetical order [with a peculiarity](https://en.wikipedia.org/wiki/Spanish_orthography#ref_r): digraphs `ll` and `ch` were considered as if they were single letters. `ch` immediately followed `c` , and `ll` immediately followed `l`. Adding the letter `ñ`, which... |
[Question]
[
Given an n non-negative integers, how many numbers must be changed so that each number x appears x times? You cannot add or remove elements, only replace them with other numbers.
For example:
```
1 6 23 6 9 23 1 1 6
```
can be turned into:
```
1 6 2 6 6 2 6 6 6
```
with 5 changes, which is optimal.
## ... |
[Question]
[
I live in the UK, where it rains. A lot. I also have the unfortunate necessity to need to wear glasses to see, which means that when it rains (as it is now), I can barely see out of them. This challenge is so that you can all experience the same!
## Task
Output ASCII art glasses with a drop of water ad... |
[Question]
[
**This is a good beginner challenge and a good time killer.**
*I only said a -natural- log because the title was too short, this has nothing to do with logarithms.*
Given 2 variables:
* The number of ants `n`.
* The width of the log `w`.
Output a log of width `w` with `n` ants (Example shown `w=3`, `n=... |
[Question]
[
[Brachylog](https://github.com/JCumin/Brachylog) is a language that's beginning to rise in prominence in code-golfing recently (and just received a major update with a terser syntax). Like Prolog, it has the advantage that it can often solve a problem (typically via brute force) merely from a sufficien... |
[Question]
[
A friend of yours has given you directions to the best restaurant in town. It's a series of left and right turns. Unfortunately, they forgot to mention for how long you need to go straight ahead between those turns. Luckily you have a street map with all the restaurants on it. Maybe you can figure out ... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win.
Closed 1 year ago.
[Improve this questi... |
[Question]
[
In chess, the queen piece can move arbitrarily far in each cardinal and intercardinal direction. What does this mean? Well, I'll show you with an ASCII drawing:
```
\..|../
.\.|./.
..\|/..
---Q---
../|\..
./.|.\.
/..|..\
```
It means the queen (notated as `Q`) can move along these lines (notated as `\`... |
[Question]
[
Don't tell anyone, but I've nicked my uncle's time travel machine! My uncle is obsessed with prime numbers, though, and that shows in the machine — he has programmed it so that it can only go to dates that sum up to a prime number.
So it can't go to `1947-08-15` because 1947+8+15 = 1970, which is not ... |
[Question]
[
Inspired by a discussion from the [Esolangs.org unofficial Discord Server.](https://discord.gg/3UXSK5p)
## Instructions
A chess cycle is an arrangement of a chess board where each piece *must* attack one other piece, and *only* one other piece, and each piece is attacked exactly once.
The effective ide... |
[Question]
[
## Introduction
Consider two arrays of the same length, say `A = [0,1,0,2]` and `B = [-1,1,2,2]`.
Suppose we know that their contents are equivalent in some sense, item by item:
* `0` is equivalent to `-1`,
* `1` is equivalent to `1`,
* `0` is equivalent to `2`, and
* `2` is equivalent to `2`.
Equivale... |
[Question]
[
As a follow-up to this [challenge](https://codegolf.stackexchange.com/questions/87189/how-many-rectangles-in-the-grid), we now want to count the number of rectangles in grid with *r* rows and *c* columns where there is a line crossing through every diagonal of a square in the grid. Now, we are still co... |
[Question]
[
The task is very simple, when given an input, output one of the following spirals:
`Input = 1` gives a spiral with the letter `A` beginning in the top left corner:
```
A B C D E F
T U V W X G
S 5 6 7 Y H
R 4 9 8 Z I
Q 3 2 1 0 J
P O N M L K
```
`Input = 2` gives a spiral with the letter `A` beginning in... |
[Question]
[
StickStack is a very simple stack-based programming language with only two instructions:
* `|` pushes the length of the stack onto the stack
* `-` pops the top two elements from the stack and pushes back their difference (`second topmost - topmost`)
## Language details
* The stack is empty at the start... |
[Question]
[
## Background
When searches return many pages of results, GitHub avoids cluttering their UI by eliding page links. Instead, their UI lets you select:
1. Pages at the beginning of the results.
2. Pages near the current page.
3. Pages at the end of the results.
In this way, no more than 11 page links are... |
[Question]
[
*This question is a part of the [lean](/questions/tagged/lean "show questions tagged 'lean'") [LotM](https://codegolf.meta.stackexchange.com/questions/23916/).*
A ring is a type of structure that takes the rules of addition and multiplication we are familiar with and abstracts them, so we can reason ab... |
[Question]
[
Most tip calculator apps simply take a flat percentage of the meal price. So, for example, if your meal is $23.45, you can leave a 15% tip = $3.52, or a more generous 20% tip = $4.69.
Convenient enough for credit card users. But not so if you prefer to leave cash tips, in which case these oddball cent ... |
[Question]
[
# Introduction
Street talk can be really difficult to understand, in particular to programmers, who aren't known to be very streetwise.
It is your job to create an interpreter to help us all survive in the urban environment.
# Challenge
Given an English sentence as input, create a program or a function... |
[Question]
[
Write a program that takes in two non-negative integers **S** and **N** in that order. S represents the side length of a square grid of `.` characters. N represents the number of those `.`'s that need to be changed to `x`'s. You may assume N is no greater than S squared.
Your program needs to output th... |
[Question]
[
We'd like to factorize a semiprime \$N\$. The goal of this challenge is to find two small integers \$u\$ and \$v\$ such that \$uvN\$ can be trivially factorized with Fermat's method, thus allowing to easily deduct the factors of \$N\$.
## The task
Given a [semiprime](https://en.wikipedia.org/wiki/Semip... |
[Question]
[
We define a *binarray* as an array satisfying the following properties:
* it's non-empty
* the first value is a `1`
* the last value is a `1`
* all other values are either `0` or `1`
For instance, the array `[ 1, 1, 0, 1 ]` is a valid *binarray*.
## The task
Given a non-empty array **A** of non-negativ... |
[Question]
[
The [*SKI calculus*](https://en.wikipedia.org/wiki/SKI_combinator_calculus) is a variant of the Lambda calculus that doesn't use lambda expressions. Instead, only application and the combinators *S*, *K*, and *I* are used. In this challenge, your task is to translate SKI terms into Lambda terms in [β n... |
[Question]
[
### Background
[Bilibili](https://www.bilibili.com/) is a China-based video sharing platform, similar to Nico Nico Douga in Japan, and Youtube around the world.
Since the establishment, Bilibili had been using the *AV code* to reference a video. An AV code is a string of 3 or more characters, starting ... |
[Question]
[
Inspired by [A014486](https://oeis.org/A014486).
**Challenge**
Given an integer input in base 10, construct a representation for the binary forest corresponding to the input. Representations include, but are not limited to, nested arrays and strings.
**How?**
Convert the input to binary. `1`s represent... |
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.