text stringlengths 180 608k |
|---|
[Question]
[
In this challenge, you'll take an answer as input, and print the answer before it. If the answer passed as input is the first answer, print your own submission's source. You'll be passed any answer in the chain up to and including your own answer, but none after it in the chain.
For example, if the fir... |
[Question]
[
Seeing that the current language for [Learn You a Lang for Great Good](https://codegolf.meta.stackexchange.com/a/24341/96039) is Piet, and that we don't seem to have a tips page for Piet yet, I decided to make one.
[Piet](https://github.com/cincodenada/bertnase_npiet) is a stack-based esoteric programm... |
[Question]
[
Left in [sandbox](https://codegolf.meta.stackexchange.com/questions/2140/sandbox-for-proposed-challenges/20752#20752) for at least 3 days.
I want to verify if this inequality is true:
for \$n\geq4\$, if \$a\_1,a\_2,a\_3,\dots,a\_n\in R\_+\cup\{0\}\$ and \$\sum\_{i=1}^na\_i=1\$, then \$a\_1a\_2+a\_2a\_3... |
[Question]
[
We define \$a(n)\$ as the 1-indexed position of \$n\$ in the sequence of positive integers with the same binary weight, i.e. the same number of 1's in their binary representation. This is [A263017](https://oeis.org/A263017).
Given a positive integer \$n\$, your task is to determine how many positive in... |
[Question]
[
## Task
Given two positive integers \$m,n\$, imagine a chessboard of size \$m \times n\$. A chess queen is on the upper-left corner. In how many ways can it reach the lower-right corner, by moving only right, down, or diagonally right-down (possibly moving many steps at once, because it's a queen)?
The... |
[Question]
[
The [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one.
The challenge is to compute the average Levenshtein distance between two indepen... |
[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/194089/edit).
Closed 4 years ago.
[Improve this question](/posts/194089/edit)... |
[Question]
[
[This 128-language quine ouroboros](https://github.com/mame/quine-relay) (a program which outputs a program in another language, which outputs a program in yet another language, (125 languages later), which outputs the original program) is pretty impressive. But unfortunately, it has a static number of... |
[Question]
[
Hexcells is a game based off of [Minesweeper](https://en.wikipedia.org/wiki/Minesweeper_(video_game)) played on hexagons. (Full disclosure: I have nothing to do with Hexcells. In fact I don't really like the game.) Most of Hexcells rules can be pretty easily expressed in Generalized Minesweeper (Minesw... |
[Question]
[
# Introduction
You are a supervisor of a parking lot and your manager is preparing for shrinking the size to the extreme.
It is a simplified and adapted version of a problem in last year's [PAT](https://www.patest.cn/) top-level.
# Challenge
You are asked to calculate how many cars are in the lot at th... |
[Question]
[
The goal of this challenge is to collect selected items in a list and move them to a certain location in the list.
As a visual example, take the input values (represented by black boxed integers) and a corresponding list of truthy values where true denotes the item is selected (represented by blue boxe... |
[Question]
[
Given a list of integers, output the number of permutations of the integers, with indistinguishable permutations counted once. If there are `n` integers, and each group of indistinguishable numbers has length `n_i`, this is `n! / (n_1! * n_2! * ...)`
## Rules
* Input will be some form of list as argume... |
[Question]
[
Given an integer *N*, count how many ways it can be expressed as a product of *M* integers > 1.
Input is simply *N* and *M*, and output is the total count of *distinct* integer groups. Meaning you can use an integer more than once, but each group must be distinct (`3 x 2 x 2` would not count if `2 x 2 ... |
[Question]
[
Your mission is to write a function/program that converts an array of bytes (i.e: an array of integers from 0 to 255), to base64.
Using built-in base64 encoders is not allowed.
The required base64 implementation is RFC 2045. (using "+", "/", and mandatory padding with "=")
Shortest code (in bytes) wins... |
[Question]
[
Following my entry to the [Obfuscated Hello World](https://codegolf.stackexchange.com/a/3695/2764) I thought it might be fun to share the underlying code. But why just show the code, lets make it a golf too!
**Challenge**
Write a script that scrolls a string across the terminal, from right to left, set... |
[Question]
[
A reflexicon is a self-descriptive word list that describes its own letter counts. Take for example the one found by Ed Miller in 1985 in English:
>
> Sixteen e’s, six f’s, one g, three h’s, nine i’s, nine n’s, five o’s, five r’s, sixteen s’s, five t’s, three u’s, four v’s, one w, four x’s
>
>
>
Th... |
[Question]
[
## Background
A [bijective base \$b\$ numeration](https://en.wikipedia.org/wiki/Bijective_numeration), where \$b\$ is a positive integer, is a bijective positional notation that makes use of \$b\$ symbols with associated values of \$1,2,\cdots,b\$.
Bijective base 2 representations of positive integers ... |
[Question]
[
**This question already has answers here**:
[Tell me, how many squares are there?](/questions/120649/tell-me-how-many-squares-are-there)
(2 answers)
Closed 2 years ago.
In a 9 by 9 grid some points have been marked. The task is it to
make a program that counts all distinct squares that can be ma... |
[Question]
[
For today's task, we have two programs, P and Q, both in the same language. Each of them receives a single-character input.
If P receives character K, P says how many times K appeared in Q. (You can use any output format for P or Q; they need not be the same, the only requirement is that your format ca... |
[Question]
[
Related: [Ellipse circumference](https://codegolf.stackexchange.com/q/211763/78410)
## Introduction
An **ellipsoid** ([Wikipedia](https://en.wikipedia.org/wiki/Ellipsoid) / [MathWorld](https://mathworld.wolfram.com/Ellipsoid.html)) is a 3D object analogous to an ellipse on 2D. Its shape is defined by t... |
[Question]
[
Given a sequence of integers or to be more specific a permutation of `0..N`
transform this sequence as following:
* output[x] = reverse(input[input[x]])
* repeat
For example: `[2,1,0]` becomes `[0,1,2]` and reversed is `[2,1,0]`. `[0,2,1]` becomes `[0,1,2]` and reversed `[2,1,0]`.
**Example 1**
```
In... |
[Question]
[
This challenge is created in celebration of my first esoteric language, [Backhand](https://github.com/GuyJoKing/Backhand)!
Backhand is a one dimensional language with a non-linear pointer flow. The pointer moves three steps at a time, only executing every third instruction.
The program `1..1..+..O..@` ... |
[Question]
[
Given an integer matrix `a` and a nonnegative integer `i`, output a mapping `b` that maps the distinct values in the `i`th column of `a` to rows of `a` who have that value in the `i`th column.
You may assume that `i` is in the half-open range `[0, num_cols(a))` (or `[1, num_cols(a)]` if you choose to u... |
[Question]
[
### Challenge:
You'll be given an ASCII image of a pile of weights as input, and must output the combined weight of the pile.
[](https://i.stack.imgur.com/fe6XLs.jpg)
### Format:
There are 5 different weights, weighing **1, 2, 5, 10, ... |
[Question]
[
I have an issue with my keyboard (more likely an issue with my browser). Some times when I click on a new text field and begin typing all my text comes out backwards. After a very short amount of time (for the purpose of the challenge we will say it is 10 milliseconds) it resumes typing forwards again.... |
[Question]
[
In a steam-punk multidimensional world, our boss wants to affix printed index labels to each drawer in our conglomerate's multidimensional file cabinet.
The boss wants to typeset the entire label sheet as a single form, using a font bought only for this purpose, so we have to order the [sorts](https://... |
[Question]
[
## The scenario
I drive along a road with my car and it begins to rain. The raindrops are falling on my window randomly and now i ask myself, where is the biggest connected wet area?
## The task
To make it easier, the window is split in a matrix of 10\*10 squares.
Your job is to find the biggest connec... |
[Question]
[
For this challenge, you must implement Ruby's [`Abbrev`](http://www.ruby-doc.org/stdlib-2.2.0/libdoc/abbrev/rdoc/Abbrev.html) module in as little code as possible.
## Challenge
* The input will be whatever your language has as an array (array, list, sequence, etc.) of strings. You may write a function,... |
[Question]
[
My robot has short circuited somehow and randomly run off somewhere from my lab!
Luckily, whenever he does this, his shut-down sequence initiates, giving him enough time to randomly turn and run in the direction its facing for five rounds before he switches off. His gyro and accelerometer functions are... |
[Question]
[
Write a program that takes a brainfuck program and compiles it to executable machine code. You can target x86, x86\_64, jvm (java bytecode) or armv6, and use one of the following executable formats: ELF, a.out, class file, exe, com. The executable should work in Linux or Windows (or Java on either).
Ne... |
[Question]
[
USGS's seismometers have just detected a major earthquake! Emergency response teams need a quick estimate of the number of people affected. Write a program to compute this estimate.
Your program receives 2 inputs. The first is the details of the earthquake itself. The earthquake modeled as a line segme... |
[Question]
[
## Challenge
>
> In this task you would be given an integer N
> (less than 10^5), output the [Farey
> sequence](http://en.wikipedia.org/wiki/Farey_sequence) of order N.
>
>
>
The input N is given in a single line,the inputs are terminated by EOF.
**Input**
```
4
3
1
2
```
**Output**
```
F4 = {0/1... |
[Question]
[
Recently [I asked](https://codegolf.stackexchange.com/q/264316/56656) for tips on improving some code-golf of mine. The code was *supposed* to output every third value of the Fibonacci sequence starting with 2:
```
2,8,34,144,610,2584,10946,46368,196418,832040
```
However, I made a mistake in deriving ... |
[Question]
[
This is a [quine](/questions/tagged/quine "show questions tagged 'quine'") challenge related to [Write the shortest self-identifying program (a quine variant)](https://codegolf.stackexchange.com/q/11370/84844)
Write a function or a full program that compares lexicographically its source code and input,... |
[Question]
[
This challenge is inspired by the game [No More Jockeys](https://www.youtube.com/channel/UCS8aP7SiA_eTfvT_Gruxzsw).
The input is a list of tuples of natural numbers (potentially including 0), in some appropriate input format. Starting with player 0 and alternating with player 1, each player chooses som... |
[Question]
[
Word changer is a game where you are trying to turn one word into another via single-character edits, with each step being its own word. For this challenge, edits may be replacements, insertions, or deletions. For example, WINNER → LOSER can be done with this route (there may be others):
```
WINNER
DIN... |
[Question]
[
# Introduction
Write a program to output the outgoing spiral of the famous pangram following given rules.
# Challenge
A [pangram](https://en.wikipedia.org/wiki/Pangram) is a sentence using every letter of a given alphabet at least once. One of the most famous pangrams is the one used extensively in Win... |
[Question]
[
[Basic rules (different from mine)](http://www.wikihow.com/Play-Chopsticks)
### Story
It is the year 4579, humans now have 2 hands with 1001 fingers each. Chopsticks has become based off of points. And @Dennis has more rep then @Martin... Hand drawn red circles are now downvoted... Jon Skeet has hit 2 ... |
[Question]
[
In [graph-theory](/questions/tagged/graph-theory "show questions tagged 'graph-theory'") a [Prüfer code](https://en.wikipedia.org/wiki/Pr%C3%BCfer_sequence) is a unique sequence of integers that denotes a specific tree.
You can find the Prüfer code of a tree with the following algorithm taken from Wiki... |
[Question]
[
For a given DAG (directed acyclic graph), each of its topological sorts is a permutation of all vertices, where for every edges *(u,v)* in the DAG, *u* appears before *v* in the permutation.
Your task is to calculate the total number of topological sorts of a given DAG.
## Rules
* You can use any forma... |
[Question]
[
## Challenge
You must create a simple model of how disease spreads around a group of people.
## Rules and Requirements
The model must be a 1000 by 1000 2D array with each element being a different person.
The user must input three variables using argv: the probability of transmission (how likely someon... |
[Question]
[
Presumably everybody here knows that for the legacy BIOS, the tiniest bootable disk image is 512 bytes (the lower bound is due to the 2-byte magic at offset 510), and there is a bootsector demoscene where people try to fit the entire demo into the 510 bytes of usable space.
Now that the BIOS is being s... |
[Question]
[
## Task
The input consists of a JSON object, where every value is an object (eventually empty), representing a directory structure. The output must be a list of the corresponding root-to-leaf paths.
Inspired by [this](https://stackoverflow.com/questions/71479690/turn-dictionary-values-into-paths/714809... |
[Question]
[
Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details.
The story continues from [AoC2017 Day 11](https://adventofcode.com/2017/day/11).
---
Crossing the bridge, you've barely reached the other side of the stream when yo... |
[Question]
[
Given an array of integers, find *"the next to the middle"*.
>
> The next to the middle is the smallest integer greater than the smallest among mean, median and mode of the given numbers, that is neither the mean, median or mode and is also contained in the array.
>
>
>
For example, in the followin... |
[Question]
[
# Note
This is the decryption challenge. The encryption challenge can be found [here](https://codegolf.stackexchange.com/questions/155194/lets-encrypt-it).
# Challenge
The challenge is to decrypt a given string, using the rules as specified below. The string will only contain **lowercase alphabets**, *... |
[Question]
[
[Lost](https://esolangs.org/wiki/Lost) is a 2-Dimensional programming language where the instruction pointer starts at a random location, moving in a random direction. A description of the language can be found at the bottom of the post for completeness' sake and a tutorial for the language can be foun... |
[Question]
[
The task here is to write a program that takes an natural number, \$n\$, and produces the \$n\$th term of an OEIS sequence. That sequence should have an identifier in the form of `A` followed by 6 digits. Now when you take your source code and reverse the order of it's bytes to produce a new program, t... |
[Question]
[
There's a satirical song called [*Little Boxes*](https://en.wikipedia.org/wiki/Little_Boxes), originally by Malvina Reynolds, about suburban sprawl that has lyrics as follows:
>
> Little boxes on the hillside,
>
> Little boxes made of ticky-tacky,
>
> Little boxes on the hillside,
>
> Litt... |
[Question]
[
Imagine a straight river and a road that goes across the river **n** times through bridges. The road does not loop on itself and is infinitely long. This road would be considered an open meander. An [open meander](https://www.wikiwand.com/en/Meander_(mathematics)#/Open_meander "Meander (mathematics) - ... |
[Question]
[
Below is a (schematic) [Digital timing diagram](https://en.wikipedia.org/wiki/Digital_timing_diagram), for the [XNOR](https://en.wikipedia.org/wiki/XNOR_gate) logic gate.
```
┌─┐ ┌─┐ ┌─────┐ ┌─┐ ┌─┐ ┌───┐
A ──┘ └─┘ └─┘ └─┘ └─┘ └─┘ └──
┌───┐ ┌───┐ ┌─┐ ┌─────┐ ┌─┐ ┌─┐
B ┘ └─┘ └─... |
[Question]
[
# The Golfer Adventure
This is the first challenge ! There will be more challenges later that will require data from the previous challenge :)
## Chapter 1 : The Vase
Let's imagine a minute.. You are a powerful God, your powers are limitless but require one thing : Souls.
Each soul is here represented ... |
[Question]
[
### Definition
A vector *a* containing *n* elements is said to
[majorize](https://en.wikipedia.org/wiki/Majorization) or
[dominate](https://en.wikipedia.org/wiki/Dominance_order) a vector *b* with *n*
elements iff for all values *k* such that 1 ≤ *k* ≤ *n*, the sum of the first
element of *a↓* through ... |
[Question]
[
The [Secretary Problem](https://en.wikipedia.org/wiki/Secretary_problem) is a famous problem described as thus:
1. You need a new secretary
2. You have N applicants that you can interview one at a time
3. You are able to score each applicant after the interview. Your scoring system will never give two ... |
[Question]
[
*If you've read the book* Contact *by Carl Sagan, this challenge may seem
familiar to you.*
---
Given an input of a set of mathematical equations consisting of a number, an
unknown operator, another number, and a result, deduce which operators
represent addition, subtraction, multiplication, or divisio... |
[Question]
[
A polynomial with coefficients in some [field](https://en.wikipedia.org/wiki/Field_(mathematics)) *F* is called [irreducible](https://en.wikipedia.org/wiki/Irreducible_polynomial) over *F* if it cannot be decomposed into the product of lower degree polynomials with coefficients in *F*.
Consider polynom... |
[Question]
[
The game [BattleBlock Theater](http://en.wikipedia.org/wiki/BattleBlock_Theater) occasionally contains a puzzle which is a generalised version of [Lights Out](http://en.wikipedia.org/wiki/Lights_Out_(game)). You've got three adjacent blocks, each of which indicates a level between 1 and 4 inclusive wit... |
[Question]
[
[Box blur](https://en.wikipedia.org/wiki/Box_blur) is a simple operation for blurring images. To apply box blur, simply replace each pixel with the average of its and the surrounding 8 pixels' values. Consider, for example, the following example, in which each "pixel" has a one-digit value:
\begin{arra... |
[Question]
[
These are the classical puzzles:
>
> You need to boil eggs for exactly 9 minutes, or else the visiting Duchess will complain, and you will lose your job as head chef.
>
>
> But you have only 2 Hourglasses, one measures 7 minutes, and the other measures 4 minutes. How can you correctly measure 9 minu... |
[Question]
[
## The challenge
Given two strings, each of length up to 30, consisting of printable ASCII characters (codes \$[32, 126]\$), put them onto a balance scale in the fewest bytes of code! This consists of the following steps:
1. Calculate and compare the weights of the strings
2. Choose the appropriately t... |
[Question]
[
OEIS sequence [A020872](https://oeis.org/A020872) counts the number of restricted forests on the [Möbius ladder](https://en.wikipedia.org/wiki/M%C3%B6bius_ladder) Mn.
## The Challenge
The challenge is to write a program that takes an integer as an input `n > 1` and returns `A020872(n)`, the number of r... |
[Question]
[
## Background
For my [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") submissions in C, I need a processing tool. Like in many other languages, whitespace is mostly irrelevant in C source (but not always!) -- still makes the code much more comprehensible for humans. A fully ... |
[Question]
[
### Description
A Caesar Shift is a very simple monoalphabetic cipher where each letter gets replaced by the one after it in the alphabet. Example:
```
Hello world! -> IFMMP XPSME!
```
*(`IBSLR, EGUFV!` is the output for the actual challenge, this was an example of shifting by 1.)*
As you can see, spac... |
[Question]
[
[Röda](https://github.com/fergusq/roda/) is a stream-based scripting language created by [fergusq](https://codegolf.stackexchange.com/users/66323/fergusq).
What general tips do you have for golfing in Röda? I'm looking for ideas that can which can be applied to code-golf problems and which are also at ... |
[Question]
[
You are given a bunch of ASCII test-tubes, your task is to reduce number of test-tubes used.
Each test tube looks like this:
```
| |
| |
| |
|~~|
| |
| |
| |
| |
|__|
```
Obviously, `~~` is the water level. Test-tube can be also empty, in which case there are no `~~` characters inside. Single tu... |
[Question]
[
## Eh!
You know, the problem with us Canadians is that sometimes, after a long day of moose hunting and dam repairing, we forget our way back to our cabins! Wouldn't it be great if our handy laptop (which, is always at our side), had some way to point us home? Well, it's been long told that, if you dis... |
[Question]
[
Your job is write a program that prints all times (in the format HH:MM, 24 hours) that follow any of the following patterns:
* Hours equal to minutes, e.g. 22:22,01:01
* Hours equal to reverse minutes, e.g. 10:01, 01:10, 22:22
* Sequences, that match H:MM, or HH:MM, always printed with HH:MM. E.g. 00:1... |
[Question]
[
What general tips do you have for golfing in AWK? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to AWK. Please post one tip per answer.
[Answer]
These are not in any particular order, and some of them might even apply to other langu... |
[Question]
[
## Background
[Page 219 of *A New Kind of Science*](https://www.wolframscience.com/nks/p219--systems-based-on-constraints/) (a book by Stephen Wolfram, the creator of Mathematica) shows an interesting 2D pattern generated by constraints. The relevant section in the book starts at [page 210](https://www... |
[Question]
[
My phone number (which I will not be sharing here) has a neat property where there is a two digit number, which when iteratively removed from my phone number will eventually remove all the digits. For example if my phone number were
```
abaababbab
```
Then by repeatedly removing `ab` we would eventuall... |
[Question]
[
[The Onion](https://www.theonion.com/) (warning: many articles are NSFW) is a satirical news organization that parodies traditional news media. In 2014, The Onion launched [ClickHole](https://www.clickhole.com) (warning: also frequently NSFW), a satirical news website that parodies "clickbait" sites li... |
[Question]
[
# Definition
An "integer triangle" is one with integer coordinates. For example the following triangle is an integer triangle:
```
(0, 0), (0, 1), (1, 2) with perimeter 1 + sqrt(2) + sqrt(5) ≈ 4.650.
```
# Task
The goal of this challenge is to count all integer triangles (up to congruence) with perimet... |
[Question]
[
Today, we'll be computing the most efficient binary function. More specifically, we'll be computing the function which, when an expression is created from applying the function to the constant input 0 or its own output, can represent all positive integers with the shortest possible expressions, placing... |
[Question]
[
In [this challenge](https://codegolf.stackexchange.com/questions/18541/period-of-the-decimal-representation) 2 years ago, we found the **period** of a unit fraction (`1/n where n is a natural number`).
Now, your task is to write a program/function to find the **repetend** of a unit fraction.
The **repe... |
[Question]
[
Given 5 distinct points on a two-dimensional plane, determine the type of conic section formed by the points. The output shall be one of `circle`, `hyperbola`, `ellipse`, or `parabola`.
### Rules
* The points will be in general linear position, meaning that no three points are collinear, and thus the c... |
[Question]
[
Sliding doors have varying prices based on the width of the doors. The different prices are as follows:
* 60 - 80 cm: ¤150
* 81 - 100 cm: ¤200
* 101 - 120 cm: ¤220
When buying a closet you would obviously want to minimize the cost, so your task is to find the width of the doors that minimizes the total... |
[Question]
[
This one is inspired by Calvin's Hobbies recent [multiplication table challenge](https://codegolf.stackexchange.com/questions/65051/sort-the-unique-numbers-in-a-multiplication-table).
Write a function or program that takes an integer `N` as input and prints or returns a N-by-N unique multiplication spi... |
[Question]
[
INPUT: Any string consisting exclusively of lowercase letters via function argument, command line argument, STDIN, or similar.
OUTPUT: Print or return a number that will represent the sum of the distances of the letters according to the following metric:
You take the first and second letter and count t... |
[Question]
[
Write a program that takes a birth date (month and day-of-month) as input and outputs the corresponding sign, element and quality of the [western zodiac](https://en.wikipedia.org/w/index.php?title=Western_astrology&oldid=608954699#The_twelve_signs). For the purposes of this challenge, these are defined... |
[Question]
[
(Adapted from [Problem C of the first qualifier of the ACM Programming Contest of 2012/2013](http://www.cs.sfu.ca/SeminarsAndEvents/ACM/120922/probC.pdf))
You have several arrays, named \$A\_1, A\_2, ... , A\_n\$, each sorted in ascending order. Every item in the array will be a 32-bit integer.
A **san... |
[Question]
[
Here's an advanced version of the [Count the Liberties](https://codegolf.stackexchange.com/questions/243956/count-the-liberties) challenge.
The definitions of the terms *liberty* and *group* are the same as the previous challenge, so have a look at the previous one for details, but briefly put,
* A *gr... |
[Question]
[
Inspired by certain puzzles on *Flow Free: Warps*.
## Background
We all know that L-triominos can't tile the 3x3 board, and P-pentominos can't tile the 5x5 board. But the situation changes if we allow the board to wrap around in both dimensions:
### L-triominos can tile 3x3 toroidal grid
The 3rd tile w... |
[Question]
[
>
> Yes, It's basically [You're a Romanizer, Baby](https://codegolf.stackexchange.com/questions/65272/), but *harder*. like, *way* harder.
>
>
>
Learning Korean is HARD. at least for a person outside Asia. But they at least have the chance to learn, right?
# What you must do
You will be given a Kor... |
[Question]
[
Given two numbers n and m, evaluate the infinite power tower:
>
> n^(n+1)^(n+2)^(n+3)^(n+4)^... mod m
>
>
>
Keep in mind that ^ is right-associative. So 2^3^4 = 2^(3^4). Now how can you possibly assign a value to an infinite sequence of right-associative operators?
Define f(n,m,i) as the power towe... |
[Question]
[
## Introduction: Combinatory Logic
Combinatory logic (CL) is based off of things called *combinators*, which are basically functions. There are two basic "built-in" combinators, `S` and `K`, which will be explained later.
### Left-associativity
CL is *left-associative*, which means brackets (containing... |
[Question]
[
# Balancing Act
A see-saw (supposedly from the French 'ci-ça', meaning 'this-that') forms a third of the holy trinity of playground equipment, along with the similarly ubiquitous slide and swing. A see-saw is in perfect balance if, and only if, the sum of the moments on each side are equivalent. A see-... |
[Question]
[
## Introduction
I defined the class of antsy permutations in [an earlier challenge](https://codegolf.stackexchange.com/questions/97217/antsy-permutations).
As a reminder, a permutation **p** of the numbers from **0** to **r-1** is antsy, if for every entry **p[i]** except the first, there is some earli... |
[Question]
[
[Related](https://codegolf.stackexchange.com/questions/78615/calculate-the-kronecker-sum-of-two-matrices), but very different.
---
In the examples below, \$A\$ and \$B\$ will be \$2\times2\$ matrices, and the matrices are one-indexed.
A [Kronecker *product*](http://mathworld.wolfram.com/KroneckerProduc... |
[Question]
[
# Introduction
Imagine you are on a two dimensional cartesian plane and want to determine your position on it. You know 3 points on that plane and your distance to each of them. While it is always possible to calculate your position from that, doing that in your head is pretty hard. So you decide to wr... |
[Question]
[
The Scream™ Winter Sale is on and you just nabbed yourself an intense minimalist action game, [Super Square](http://superhexagon.com/). Upon playing it, you come to the realisation that either the game's just ridiculously hard or you're just *really* bad at it. In particular, there's this ["rain" patte... |
[Question]
[
This challenge is partly an algorithms challenge, involves some math and is partly simply a fastest code challenge.
For some positive integer `n`, consider a uniformly random string of `1`s and `0`s of length `n` and call it `A`. Now also consider a second uniformly chosen random string of length `n` w... |
[Question]
[
This is the second of two challenges about "pulling functions taut". [Here is the slightly simpler Part I](https://codegolf.stackexchange.com/q/38313/8478).
Let's drive *m* nails into a board at positions *(x1, y1)* to *(xm, ym)*. Tie a rubber band to the first and last of those and stretch around the ... |
[Question]
[
## Background
Most people on here should be familiar with several base systems: decimal, binary, hexadecimal, octal. E.g. in the hexadecimal system, the number *1234516* would represent
```
1*16^4 + 2*16^3 + 3*16^2 + 4*16^1 + 5*16^0
```
Note that we're usually not expecting the base (here, `16`) to cha... |
[Question]
[
## Kakuro Combinations
Because I can't do mental arithmetic, I often struggle with the [Kakuro](http://en.wikipedia.org/wiki/Kakuro) Puzzle, which requires the victim to repeatedly work out which distinct numbers in the range 1 to 9 (inclusive) sum to another number in range 1 to 45 when you know how m... |
[Question]
[
Write a program that encodes given text into its own text, provided as input, without disrupting its logic. The program must also work as a decoder, restoring the original message from its text. It must retain its encoding/decoding functions after transformation.
More formally speaking, the required pr... |
[Question]
[
## My Problem
At my current place of employment, I single-handedly (ok dual-handedly because I'm missing no limbs) maintain approximately 700 laptops. Due to the nature and frequency of their use, I often find they are returned with a bit of damage. For this problem, my primary concern is when a laptop... |
[Question]
[
There have been many questions involving calculators; however, it does not appear that any involve implementing a graphing calculator.
**The Challenge**
You are to write a complete program that takes multiple formulas as input from STDIN and graphs them to STDOUT. Input will take the form `f1(x)=x^2-x-... |
[Question]
[
Write the shortest function to generate the [American Soundex code](http://www.archives.gov/research/census/soundex.html) for a surname only containing the uppercase letters A-Z. Your function must produce output consistent with all the linked page's examples (given below), although it need not and sho... |
[Question]
[
Input a list of strings `a` and a string `s` for search keyword. Find out all strings in `a` which contains `s` as subsequence. And sort them in the following order:
1. Exactly equals to `s`
2. Starts with `s`
3. Contains `s` as substring (continuous subsequence)
4. Contains `s` as subsequence
## Detai... |
[Question]
[
What general tips do you have for golfing in BQN? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to BQN (e.g. "remove comments" is not an answer).
Please post one tip per answer.
At the moment of writing, the [official BQN site](https://ml... |
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.