text stringlengths 180 608k |
|---|
[Question]
[
([related](https://codegolf.stackexchange.com/q/6443/42963))
A [*Pythagorean Triple*](https://en.wikipedia.org/wiki/Pythagorean_triple) is a list `(a, b, c)` that satisfies the equation *a2 + b2 = c2*.
A *Primitive* Pythagorean Triple (PPT) is one where `a`, `b`, and `c` are all [coprime](https://en.wi... |
[Question]
[
Write a program or function that takes in a string of the characters `-=o.` where the `-=o`'s and `.`'s always alternate, character to character. The string will have an odd length greater than one and always start and end in one of `-=o`.
Basically, the input will look like a line of emoticon faces th... |
[Question]
[
`your shift key is broken. wheNever you type two lines, the cApitaL`
`LetteRs in them get swappeD. you must write a program to fiX THIS!`
## Description
The input is two strings, `s1` and `s2`, equal in length. They will each contain only printable ASCII and be at least one character in length. You m... |
[Question]
[
# Input
An alphanumeric string `s`.
# Output
The shortest string that occurs exactly once as a (contiguous) substring in `s`.
Overlapping occurrences are counted as distinct.
If there are several candidates of the same length, you must output all of them in the order of occurrence.
In this challenge, t... |
[Question]
[
[Stack Exchange doesn't know how to transpose tables.](https://meta.stackexchange.com/a/357504/317948) Let's help.
**Given a markdown table, transpose it.**
Input assumptions:
* There will be at least two rows (including header) and two columns
* Either all cells have no leading space or all cells have... |
[Question]
[
# Problem
Recreate the UI from a torrent program
Given no input, output the following:
```
+----------+----------+----------+
|a.exe |##########|seeding |
+----------+----------+----------+
|b.exe 10% |# |leeching |
+----------+----------+----------+
|c.exe |##########|seeding |
+-... |
[Question]
[
A mortality table or life table is an actuarial tool that gives the probability that a person aged \$A\$ years will die in the next year, and is used to help calculate the premiums for life insurance, among other things. One of the first people to compile a life table was [Edmond Halley](https://www.yo... |
[Question]
[
Given the spiral of size `S` and the step `N`, output the "square" `S*S` spiral having `N` asterisks, built from the outer to inner radius clockwise.
Test cases (examples) below.
1. Input: `4 3`
Output:
```
***
```
2. Input: `4 6`
Output:
```
****
*
*
```
3. Input: `4 11`
Output:
```
****
*
* ... |
[Question]
[
Suppose we have a matrix like this:
```
11111
12221
12321
12221
11111
```
This matrix represents a terrain, and each cell represents a portion of terrain. The number in each cell represents the time the portion of terrain needs to be completely burnt (in minutes, if a measurement unit is needed), accor... |
[Question]
[
Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first `5` rows (borrowed from [Generate Pascal's triangle](https://codegolf.stackexchange.com/q/3815/42963)):
```
1
1... |
[Question]
[
Write a function that contains five lines.
If you run the function as-is, it should return 0.
If you remove any one of the five lines and run the function, it should tell you which of the lines has been removed (e.g., if you remove the final line it should return 5).
Brevity, novelty, and elegance all ... |
[Question]
[
We start with a blank 1-indexed sequence:
```
_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,...
```
In the nth step, we fill in every a(n) blanks with the integers greater than 1 starting at the first remaining blank, where a(n) is the nth entry in the sequence.
After the first step:
```
2,_,3,_,4,_,... |
[Question]
[
Here in California, we're in a drought so we need to know how much water we have left so we can conserve as much water as possible.
Because water is limited supply, your code will need to be as short as possible.
## Examples
```
| |
| |
|~~~|
|___|
Output: 0.5
```
```
|~~~~~|
| |
| |
|_____... |
[Question]
[
Given a rectangular text as a word search puzzle and a search string, determine if the text contains the search string. The search string may appear:
* horizontally, vertically or diagonally
* forwards or backwards
You may write a function or a program and take two strings as input via function argumen... |
[Question]
[
Given the 2-dimensional positions and velocities of a pair of billiard balls right before impact, calculate their velocities after a perfectly [elastic collision](https://en.wikipedia.org/wiki/Elastic_collision). The balls are assumed to be ideal spheres (or equivalently: circles) with the same radius,... |
[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 7 years ago.
[Improve this quest... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic).
Closed 7 years ago.... |
[Question]
[
## Background
Boolean Algebra concerns representing values with letters and simplifying expressions. The following is a chart for the standard notation used:
[](https://i.stack.imgur.com/kWE7v.png)
Above is what actual boolean algebra looks like. For the ... |
[Question]
[
Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.
Your program must output the *least precise* amount of time which has passed, among the following metrics and their lengths in seconds:
```
second = 1
minute = 60
hour... |
[Question]
[
The [Chaos Game](http://en.wikipedia.org/wiki/Chaos_game) is a simple method to generate fractals. Given a starting point, a length ratio *r* and a set of 2D points, repeatedly do the following:
* From your set of points, pick one at random (uniformly).
* Average that point and the last drawn point (or... |
[Question]
[
## Terms
A **worm** is any list of nonnegative integers, and its *rightmost* (i.e., *last*) element is called the **head**. If the head is not 0, the worm has an **active segment** consisting of *the longest contiguous block of elements that includes the head and has all of its elements at least as lar... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic).
Closed 7 years ago.... |
[Question]
[
The [Factorial Number System](http://en.wikipedia.org/wiki/Factorial_number_system), also called factoradic, is a mixed radix numeral system. The factorials determine the place value of a number.
In this system, the right most digit can be either 0 or 1, the second rightmost digit can be 0, 1 or 2, and... |
[Question]
[
## The task
This is a simple challenge.
Your input is a single non-empty string, containing only digits `0123456789` and hashes `#`.
It will contain exactly one run of digits, which encodes a nonnegative integer and may wrap around the end of the string, and at least one `#`.
The integer may have leadi... |
[Question]
[
A little known fact about vampires is that they must drink the blood of victim that has a compatible donor blood type. The compatibility matrix for vampires is the same as the regular [red blood cell donor/recipient matrix](http://en.wikipedia.org/wiki/Blood_type#Red_blood_cell_compatibility). This can... |
[Question]
[
[Deadfish](http://esolangs.org/wiki/Deadfish) is one of the best known non Turing-complete programming languages. It has only one accumulator (which starts at 0) to store data, and only four commands:
```
i - Increment the accumulator
s - Square the accumulator
d - Decrement the accumulator
o - Output ... |
[Question]
[
Consider the following spiral of positive integers:
[](https://i.stack.imgur.com/FlVDV.png)
We now define [grambulation](https://www.reddit.com/r/mathmemes/comments/tvn2gj/the_solution_to_the_april_fools_math/) as a binary operation \$\lozenge :... |
[Question]
[
## Challenge
Write code which, given an image of a panel from a random xkcd comic, returns a truthy value if Blackhat is in the comic or falsey if not.
## Who is Blackhat?
[Blackhat](http://www.explainxkcd.com/wiki/index.php/Black_Hat) is the unofficial name given to the character in xkcd comics who we... |
[Question]
[
Note, challenge copied from question asked at [math.stackexchange](https://math.stackexchange.com/q/2094351/196018).
Recently, I attained quite some skill at blowing bubbles. At first I would blow bubbles like this:
[](https://i.stack.... |
[Question]
[
For an ***N*** by ***N*** image, find a set of pixels such that no separation distance is present more than once. That is, if two pixels are separated by a distance ***d***, then they are the only two pixels that are separated by exactly ***d*** (using [Euclidean distance](http://en.wikipedia.org/wiki/... |
[Question]
[
I like pizza!
# Task
Given the radius of a pizza and a list of ingredients, create the corresponding ascii pizza!
Example size 4 pizza with mozzarella cheese, olives and ham:
```
#####
#@@@@M#
#H@O@@@@#
#M@@@H@@#
#@OO@@@@#
#@@H@@@@#
#M@M@@@@#
#O@@@H#
#####
```
# Input
A positive integer `r`... |
[Question]
[
Output the following excerpt from Pachelbel's Canon in D as audio:
[](https://i.stack.imgur.com/icQVs.png)
## Rules
* Any format/encoding may be used, so long as a codec existed prior to the creation of this challenge
* Any instrument (a rea... |
[Question]
[
Given three mutually tangent circles, [we can always find](http://en.wikipedia.org/wiki/Descartes%27_theorem) two more circles which are tangent to all three of those. These two are called *Apollonian circles*. Note that one of the Apollonian circles might actually be *around* the three initial circles... |
[Question]
[
As we all know, [it's turtles all the way down](https://en.wikipedia.org/wiki/Turtles_all_the_way_down). But is it primes all the way down too?
A number is considered a "turtle-prime" if it satisfies the following conditions:
```
1) It is prime.
2) It is possible to remove a single digit leaving a prim... |
[Question]
[
# Introduction
Everyone knows the FizzBuzz sequence. It goes something like this:
```
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
.
.
.
```
In case you don't know, if the number is divisible by 3, it's `Fizz`. If it is divisible by 5, it's `Buzz`. If it is divisible by both, it's `FizzBuz... |
[Question]
[
On Math Stack Exchange, I asked a question about the [smallest region that can contain all free n-ominos](https://math.stackexchange.com/q/2831675/121988).
I'd like to add this sequence to the [On-Line Encyclopedia of Integer Sequences](https://oeis.org/) once I have more terms.
# Example
A nine-cell ... |
[Question]
[
```
Given a width and a block of
text containing possible hyphen-
ation points, format it fully-
justified (in monospace).
```
Fully justified means it is aligned on the left *and* the right, and is achieved by increasing the spacing between words until each line fits.
Related:
* [Justify a text ... |
[Question]
[
If you're going to invent some fake news, you'll want to fabricate some data to back it up. You must already have some preconceived conclusions and you want some statistics to strengthen the argument of your faulty logic. This challenge should help you!
Given three input numbers:
* *N* - number of data... |
[Question]
[
Imagine a bunch of rectangles drawn in the plane, each rectangle with its vertices at integer coordinates and its sides parallel to the axes:

The rectangles partition the plane into a number of disjoint regions, coloured red and blue... |
[Question]
[
## Introduction
You have recently accepted a job offer at a Pretty Good Software Company. You're pretty content with the size of your office, but do you have the **biggest** office? Its kinda hard to tell from just eyeballing your co-workers' offices when you stop by. The only way to figure this out is... |
[Question]
[
Write a function or program than can do simple arithmetic (addition, subtraction, multiplication and division) in both base 10 and base 2.
The function will take a mathematical expression as input, and output the correct result in the correct base. The input will be `n` numbers separated by one or seve... |
[Question]
[
Write a program that takes in a string containing only spaces, newlines, and angle brackets: `<`, `>` (*[chevrons](https://en.wikipedia.org/wiki/Bracket#History)*). Output a string of spaces, newlines, and slashes: `/`, `\` (*[soliduses](https://en.wiktionary.org/wiki/solidus#English)*) whose shapes co... |
[Question]
[
In this challenge, your task is to take an anion and a cation, and output the chemical formula of the compound.
## Input rules
* Take in 2 strings (in any order) representing the anion and cation, e.g. `F`, `NH_4`, or `Al`.
* To take in the charge of each ion, you can either have it as part of the stri... |
[Question]
[
## Background
This challenge is in honor of [apsillers](https://codegolf.stackexchange.com/users/7796/apsillers), who won the [Not as simple as it looks](http://meta.codegolf.stackexchange.com/a/11192/32014) category in Best of PPCG 2016 with their challenge [Can my 4-note music box play that song?](ht... |
[Question]
[
**Context:**
>
> A reclusive billionaire has created a game show to attract the world's best and brightest programmers. On Mondays at the stroke of midnight, he chooses one person from a pool of applicants to be the contestant of the week, and provides them with a game. You are this week's lucky conte... |
[Question]
[
## Introduction
My calculator is behaving weird. Sometimes when I type in an `8` it displays a `2`. And sometimes when I type in a `6` it displays a `+`. Some buttons are mixed up!
Could anyone help me determine which?
## Challenge:
**Input:** List of *incorrect* equations, with *correct* results.
**... |
[Question]
[
Your task is to write a piece of code that zeros the current cell in the Brainfuck variant that, each cell can contain a **signed** integer of arbitrarily large magnitude, instead of the normal 0 to 255.
You may assume there are *l* cells to the left and *r* cells to the right of the current cell that ... |
[Question]
[
## Introduction
In the strategy game Starcraft 2, there are three "races" to choose from: Terran, Zerg, and Protoss. In this challenge we will be focusing on the Protoss and the iconic phrase "You must construct additional pylons!" This message is stated when you run out of supply to build your army. S... |
[Question]
[
# Golf Me An OOP!
Two important components of object-oriented programming are inheritance and composition. Together, they allow for creating simple yet powerful class hierarchies to solve problems. Your task is to parse a series of statements about a class hierarchy, and answer questions about the hier... |
[Question]
[
# Challenge Description
Cycle all letters from the first part of the alphabet in one direction, and letters from the second half of the alphabet in the other. Other characters stay in place.
# Examples
1: Hello world
```
Hello_world //Input
Hell ld //Letters from first half of alphabet
o wor ... |
[Question]
[
## Challenge:
### Input:
You take two inputs:
- A string only containing printable ASCII (excluding spaces, tabs or new-lines)
- A printable ASCII character
### Output:
The first line will contain the string-input. Every `i`-modulo-3 first occurrence of this character will move in a South-East dire... |
[Question]
[
# Decipher Neurotic Frogs
Now that Puzzling.SE has finally cracked [my amphibian-obsessed cipher](https://puzzling.stackexchange.com/q/31212/21402), let's write a program or function to decrypt it!
**(If you want to look at the puzzle before having it spoiled for you, click the above link now.)**
---
#... |
[Question]
[
**Objective**
Given a grid of numbers, fill in the inequalities.
**Assumptions**
The number of columns and rows in the grid are equal.
The maximum size of the grid is 12x12.
The grid only consists of integers 0-9.
The output may contain a trailing newline.
The input is exactly as written below,... |
[Question]
[
You must generate an text stereogram according to an input string containing a paragraph of text, an empty line then the hidden message.
The result will be displayed as a pair of paragraphs, one with different spacing causing the effect of it being raised up when viewed stereographically (An explanatio... |
[Question]
[
**Introduction**
Knowledgeable code golfers [prepared us for the doomsday flood](https://codegolf.stackexchange.com/q/23259/18487). Areas at risk were evacuated, and the population moved to high ground.
We underestimated the flood (or perhaps there was a bug in @user12345's code). Some high-ground area... |
[Question]
[
[](https://i.stack.imgur.com/PFi6b.png)
The above image displays a hexagonal grid of hexagons. Each cell in the grid is assigned an index, starting from the center and spiraling counterclockwise around as shown. **Note that the grid will con... |
[Question]
[
You will be given a list of radii, you must output the area of the smallest rectangle which they will all fit in.
For example, given the list `[5,3,1.5]` you would output `157.460`.
This is the image:
[](https://i.stack.imgur.com/gWPlw.png)
The width is 15.7460 ... |
[Question]
[
Suppose one day you are digging through your big box of unused computer cords and adapters (USB to USB mini, VGA to DVI, etc.). There are tangled cords everywhere making quite a mess, and you wonder if you could simplify things by attaching all the cords together in one long strand, and then just rolli... |
[Question]
[
Let's define a simple 2D language, which we'll give the incredibly original name *befinge*. Befinge has 5 instructions:
* `<>^v`, as in most 2D esolangs, redirect the instruction pointer in their respective directions.
* `.` is a no-op.
The instruction pointer starts out at the top-left corner going ri... |
[Question]
[
Consider some binary sequence, using `1` and `2`, e.g.:
```
1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1 ...
```
Let's write down the run lengths of that:
```
1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1 ...
_ _ ____ ____ _ _ _ ____
1, 1, 2, 2, 1, 1, 1, 2, ...
```
In this case we happen to get another binar... |
[Question]
[
Write a program or function that draws a tree of trees, thus constructing a forest.
The trees are drawn like stacking a pyramid. The first (top) row contains `1` tree, the next row down contains `2` (for a total of `3`), the next contains `3` (for a total of `6`), and so on. If there aren't enough tree... |
[Question]
[
I like the [Hilbert Curve](https://en.wikipedia.org/wiki/Hilbert_curve).
---
Your task for this challenge is to take an image (strictly a square image where all the sides are a power of two pixels wide) and unravel it line by line in a zig-zagging fashion and ravel it back up in a pseudo-Hilbert curve.... |
[Question]
[
Your task is to determine whether a graph is planar.
A graph is planar if it can embedded in the plane, or in other words if it can be drawn without any crossing edges.
**Input:** You will be given an undirected graph in your choice of the following formats:
* Edge list, e.g. `[(0, 1), (0, 2), (0, 3)]`... |
[Question]
[
On the advice of Ms. Pac-Man who's worried about him getting overweight, Pac-Man has decided to keep track of his daily Pac-Dot intake. Help him count the number of Pac-Dots on a given path in the maze!
## The maze
[](https://i.stack.imgur.com/h1mJK.png)
To h... |
[Question]
[
I have a pile of clean socks that I want to sort into pairs. Unfortunately, I can only take socks from either end of the pile, not the middle. Further, I can only remove socks from the pile a matching pair at a time. My strategy is to first split the pile into one or more smaller piles. I think some ex... |
[Question]
[
Given a list of integer coordinates, find the area of the biggest [convex polygon](https://en.wikipedia.org/wiki/Convex_polygon) you can construct from the list such that -
* every vertex is in the list
* no element of the list is contained within the polygon.
Example:
>
> (0, 0) (8, 0) (0, 1) (3, 1) ... |
[Question]
[
## Challenge
Given a (floating-point/decimal) number, return its reciprocal, i.e. 1 divided by the number. The output must be a floating-point/decimal number, not just an integer.
### Detailed specification
* You must receive input in the form of a floating-point/decimal number...
+ ...which has at le... |
[Question]
[
**Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
**This challenge has ended!** Congratulations **Flonk**!
I was sure I would get a good grade, but ... |
[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/22864/edit).
Closed 6 years ago.
[Improve this question](/p... |
[Question]
[
[Inspired by this](https://codegolf.stackexchange.com/questions/53675/calculate-average-characters-of-string)
# Task
Your task is to output the average character of your code.
## What is an average character?
Say we have a string `golf()`.
We then take the ASCII value of each separate symbol, so our st... |
[Question]
[
Given a list of non-negative integers, return whether or not that list is all the same number.
## Rules
* Input and output can be taken/given in any reasonable and convenient format
* Truthy/Falsey values can be represented as any value of your choice as long as it's reasonable and relatively consisten... |
[Question]
[
# Task
Given a string as input, generate a "blurred" version of that string.
# Input
Your input will be a single-line string of ASCII characters, containing a minimum of 2 alphanumeric characters
# Output
A string that is the "blurred" version of the input string.
A blurred string is one where every al... |
[Question]
[
## Background
Hello is a language "written" by [Anne Veling](https://esolangs.org/wiki/Anne_Veling), which errors if the program does not contain only `h`, and will print `Hello World` for every `h`
## Task
You are to write an interpreter/compiler for Hello.
## Example in Python
```
import os
i = input... |
[Question]
[
*Yet another blatant [rip-off](https://codegolf.stackexchange.com/questions/193021/i-reverse-the-source-code-you-negate-the-input) of a [rip-off](https://codegolf.stackexchange.com/q/192979/43319) of a [rip-off](https://codegolf.stackexchange.com/q/132558/43319). Go upvote those!*
Your task, if you wis... |
[Question]
[
## Implement a simple integer operation scriptable calculator.
**Concept**
The accumulator starts at 0 and has operations performed on it. At the end of the program output the value of the accumulator.
**Operations:**
* `+` adds `1` to the accumulator
* `-` subtracts `1` from the accumulator
* `*` mult... |
[Question]
[
The code should take input a text (not mandatory can be anything file, stdin, string for JavaScript, etc):
```
This is a text and a number: 31.
```
The output should contain the words with their number of occurrence, sorted by the number of occurrences in descending order:
```
a:2
and:1
is:1
number:1
T... |
[Question]
[
Take the string of brackets `]][][[`. When you rotate it to the right once, you get `[]][][`. If you rotate it again, you get `[[]][]`. All brackets in this string are balanced.
**The Task:**
Your program (or function) will be given a string of brackets, represented in any reasonable format (including ... |
[Question]
[
**Input**
A list of words separated by any number of spaces.
**Output**
A horizontal ASCII art graph, where the n-th line is composed by as many asterisks (`*`) as the n-th word is long.
**Example usage**
The `>` signals user input, you should not input it when testing the program.
```
> This is an exa... |
[Question]
[
### Instructions
Given an unknown input string `i` with a value of either *heads* or *tails*, return `1` for *heads* or `-1` for *tails* with the shortest code.
### Sample not golfed code (55b):
```
if(i == "heads"){
print(1);
}else{
print(-1);
}
```
### Sample golfed code (16b):
```
print("t">... |
[Question]
[
Given strings X and Y, determine whether X is a [subsequence](http://en.wikipedia.org/w/index.php?title=Subsequence&oldid=594253998) of Y. The empty string is regarded as a subsequence of every string. (E.g., `''` and `'anna'` are subsequences of `'banana'`.)
### Input
* X, a possibly-empty case-sensit... |
[Question]
[
# Challenge
Given a string of any length which contains only digits from `0` to `9`, replace each consecutive run of the digit `0` with its length.
## Test Cases
1. `1234500362000440` → `1234523623441`
2. `123450036200044` → `123452362344`
3. `000000000000` → `12`
4. `0123456789` → `1123456789`
5. `123... |
[Question]
[
I [didn't](https://github.zhaw.ch/munt/Gulf) invent this challenge, but I find it very interesting to solve.
For **every** input number, e.g.:
```
4
```
Generate a range from 1 to that number:
```
[1 2 3 4]
```
And then, for every item in that list, generate a list from 1 to that number:
```
[[1] [1 2]... |
[Question]
[
## The challenge is to calculate the digit sum of the factorial of a number.
---
Example
```
Input: 10
Output: 27
```
10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27
You can expect the input to be an integer above 0.
Output can be ... |
[Question]
[
Originally the Multiplicative digital root
# Challenge
~~Basically do what the title says~~
# Method
Given a positive integer **1** <= **N** <= **100000000** through one of our [standard input methods](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods), m... |
[Question]
[
# Challenge
Your task in this question is to write a program or a named function which takes a positive integer `n` (greater than 0) as input via STDIN, ARGV or function arguments and outputs an array via STDOUT or function returned value.
**Sounds simple enough ? Now here are the rules**
* The array w... |
[Question]
[
Given a string that contains only lowercase letters, encode that string with the alphabet cipher.
To encode with the alphabet cipher (I will be using the example `hello`):
1. First, convert each letter in the string to a number depending on its position in the alphabet (`a` = `1`, `b` = `2`, etc.) Exam... |
[Question]
[
### Introduction
Let's observe the following string:
```
ABCDEFGHIJKLMNOP
```
If we swap the **ends of the string**, which are these:
```
ABCDEFGHIJKLMNOP
^^ ^^
```
We get the following result:
```
BACDEFGHIJKLMNPO
```
After that, we delete the ends of the string, which in this case are `B` ... |
[Question]
[
Code golf: Print an image of the source code.
**Requirements**
1. Must output the image of the source code itself, not a version stored elsewhere and retrieved at run time.
2. Code must be legible enough to copy out by hand and reproduce the results.
Any image format is applicable.
**Bonuses**
* -10% ... |
[Question]
[
Inspired by [this StackOverflow post](https://stackoverflow.com/q/70508442/7742131)
Given a list where each element appears a maximum of 2 times, we can define it's "sortedness" as the sum of the distances between equal elements. For example, consider
```
[1,1,2,3,3] (array)
0 1 2 3 4 (indices)
```
T... |
[Question]
[
Since today marks the occasion of the 26th [leap second](https://en.wikipedia.org/wiki/Leap_second) ever to occur, your challenge will be to output the date and time of every leap second in GMT or UTC that has occurred so far, as well as the one to occur today.
### Input
There is no input.
### Output
`... |
[Question]
[
Output the numbers 1-16 (or any other set of 16 distinct items). Then, repeatedly, output a random value chosen uniformly from the last 16 items outputted.
After the same item is printed 16 times in a row, halt.
If a number appears multiple times in the last 16 values, it should have proportionally mor... |
[Question]
[
### Introduction
For this example, let's take the string `Hello, World!` and the array `[3, 2, 3]`. To find the substring chain, we go through the following process:
The first number of the array is `3`, so we get the substring `[0 - 3]`, which is `Hel`. After that, we remove the first `3` characters f... |
[Question]
[
[Sandbox](https://codegolf.meta.stackexchange.com/a/18337/78850)
*A spin-off of a [rip-off](https://codegolf.stackexchange.com/questions/193315/i-reverse-the-source-code-you-reverse-the-input/193317#193317) of a [rip-off](https://codegolf.stackexchange.com/questions/193021/i-reverse-the-source-code-you... |
[Question]
[
Banknotes in many countries come in denominations of 1,2,5,10,20,50,100,200,500,1000, etc. That is, one of \$ \{ 1,2,5\} \$ times a power of \$10\$. This is OEIS [A051109](https://oeis.org/A051109), except we'll extend the sequence to bigger values.
Given a positive integer as the input, the program sh... |
[Question]
[
In a single file, write a program that requires no input and produces no output. When run it should reverse the name of the file it is contained in, **regardless of what the name is**, without altering the code or producing other lasting side effects.
Any way of achieving this is fine. It only matters ... |
[Question]
[
What general tips do you have for golfing in Scala? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala (e.g. "remove comments" is not an answer). Please post one tip per answer.
[(This is a shameless copy of ... in Python)](https://co... |
[Question]
[
# Problem:
Your task is to decide if in a sequence of numbers, every number contains at least one of the digits of the number that preceded it.
For example, the following should return truthy:
```
[1, 12, 203, 0, 30]
^ ^ Contains a 0
^ Contains a 2
^ Contains a 1
```
The... |
[Question]
[
**NOTE: Some terminology used in this challenge is fake.**
For two integers `n` and `k` both greater than or equal to 2 with `n > k`, `n` is *semidivisible* by `k` if and only if `n/k = r/10` for some integer `r`. However, `n` may not be divisible by `k`. Put more simply, the base 10 representation of ... |
[Question]
[
Write a program that displays on the screen the sum of the divisors of a number (1 ≤ N ≤ 100) entered by the user in the range of 1 to N.
This is [OEIS A000203](https://oeis.org/A000203).
---
Examples:
**Input**: 7
```
7 / 1 = 7
7 / 7 = 1
7 + 1 = 8
```
**Output:** 8
---
**Input:** 15
```
15 / 1 = 15
15... |
[Question]
[
**Input:**
* A string (the wave-snippet) with a length `>= 2`.
* A positive integer *n* `>= 1`.
**Output:**
We output a single-line wave. We do this by repeating the input string *n* times.
**Challenge rules:**
* If the first and last character of the input string matches, we only output it once in the... |
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.