text stringlengths 180 608k |
|---|
[Question]
[
I am standing at point `(0,0)` in a `H` x `W` map where the altitude is represented by digits, for example:
```
1132
2221
1230 # H = 3, W = 4
```
I'd like to experience the views from every peak, which in this case are the areas with altitude `3`. However, climbing up hills is not an easy task, and ... |
[Question]
[
[Dowker notation](http://katlas.math.toronto.edu/wiki/DT_(Dowker-Thistlethwaite)_Codes) is a common way of representing mathematical knots.
Dowker notation can be derived from a knot diagram in the following way (based on the description from [the wikipedium](https://en.wikipedia.org/wiki/Dowker_notati... |
[Question]
[
Trigonometry has LOTS of identities. So many that you can expand most functions into sines and cosines of a few values. The task here is to do that in the fewest bytes possible.
# Identity list
Well, the ones we're using here.
```
sin(-x)=-sin(x)
sin(π)=0
cos(-x)=cos(x)
cos(π)=-1
sin(a+b)=sin(a)*cos(b)... |
[Question]
[
>
> [There is fairly strong support on meta](http://meta.codegolf.stackexchange.com/a/8906/8478) for challenge-writing questions to be on topic on main, provided these questions are specific and answerable. However, we don't have any such questions yet, so I figured I'd test the waters. This question ... |
[Question]
[
As we learned from [The Holy Numbers](https://codegolf.stackexchange.com/questions/73426/the-holy-numbers), there are 5 holy digits (`0, 4, 6, 8, 9`), and positive integers consisting solely of those digits are holy. Additionally, the holiness of a number is the sum of the holes in the number (`+2` for... |
[Question]
[
# Introduction
Write a solver for [integer linear programming](https://en.wikipedia.org/wiki/Linear_programming#Integer_unknowns).
# Challenge
Your task is write a solver for integer linear programming (ILP). In ILP, linear inequalities of a set of unknowns (all of which are integers) are given, and th... |
[Question]
[
# A little genetics lesson
When you only have access to someone's visible traits or *phenotype*, a pedigree of their family history is often used to figure out the actual genetic information or, *genotype* of each family member.
When dealing with [simple dominance](http://study.com/academy/lesson/simp... |
[Question]
[
On modern game consoles and other devices without traditional keyboards, trying to input text is a nightmare. Having to type with a few buttons and a joystick on a virtual keyboard is annoying, and I like to make as few movements/button presses as possible.
The keyboard you will be using looks like thi... |
[Question]
[
Your task is to write a program, that given a list of chat messages, count how many times each person gets pinged, so I can know how popular everyone is. But, since I have to do it surreptitiously, I need it to be as small as possible so I can hide the code.
# Specs
* The input comes in a list of 2-tup... |
[Question]
[
# Introduction
Every letter in the English alphabet can be represented as an ASCII code. For example, `a` is `97`, and `S` is `83`. As we all know, the formula for averaging two numbers \$x\$ and \$y\$ is \$\frac{x+y}{2}\$. I'm pretty sure you can see where this is going. Your challenge is to average t... |
[Question]
[
# Challenge
You have one string of input bytes, output *only* the last byte in it.
# Rules
Your submission may be a program or function outputting the last byte in the input which
* is either a string, *stdin* or command-line arguments, and
* is non-empty.
I was trying to solve this with brainfuck, how... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic).
Closed 9 years ago.... |
[Question]
[
This is a simple task. Given a positive or negative real number, round it to the next whole integer closer to zero.
# The challenge
* Take input through any reasonable form (stdin, function, etc.) of one positive or negative real number.
* Round this number "towards zero" - this means if it is positive... |
[Question]
[
After inputting a string [length 1-20], only containing the chars **y** for yes and **n** for no,
your program should output the result (y or n). Example input: `yynynynny` would output y.
The result is determined by combining the y's and n's in the following way:
* **y**es and **n**o equals **n**o
* *... |
[Question]
[
This challenge is to output to your terminal, window, canvas or screen the numbers zero to 10 inclusive. Each outputted number must be shown as a 4-bit wide nybble, so zero must show as `0000` and so on.
You may separate each number outputted with a space, comma or carriage return. Smallest solution wi... |
[Question]
[
>
> Based off a Scratch project
>
>
>
The pen extension in Scratch has a `set pen color to ()` block. The `()` is normally a color dropdown, but you can also use the `join()()` block. In the `join()()` block, normally a hex value is in the first input, but the second is just an empty string.
Howeve... |
[Question]
[
## Challenge
Write a program that, given a string `x` which is 10 characters long and a character `y`, outputs the number of times character `y` occurs in string `x`.
The shortest program in bytes to do so wins.
## Example
```
Input: tttggloyoi, t
Output: 3
```
---
```
Input: onomatopoe, o
Output: 4
``... |
[Question]
[
In the webcomic [Darths & Droids](http://darthsanddroids.net/episodes/0001.html), Pete, who plays R2-D2 in the fictional roleplaying campaign around which the comic is based, [once claims](http://darthsanddroids.net/episodes/1174.html) (warning: potential spoilers in the linked comic) that, with the Lo... |
[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/25003/edit).
Closed 1 year ago.
[Improve this question](/posts/25003/edit)
I... |
[Question]
[
**Task:**
Input will consist of some text, with nested `[]` separating some of it into nested groups:
```
abc[d[fgijk]nopq]rst[u[v[[w]]]xy[[[z]]]]
```
Your task is to remove all brackets, and everything wrapped in an odd number of brackets. For example, `a[b]c` would remove the `[]`, and the `b` inside... |
[Question]
[
Think of cleave as the conceptual inverse of map. If map applies a function to each number in a list...
`map([1, 2, 3], x -> x * 5)` -> `[5, 10, 15]`
then cleave applies each function in a list to a number.
`cleave(5, [x -> x * 2, x -> x - 1, x -> x * x])` -> `[10, 4, 25]`
More formally, given:
* \$n\$... |
[Question]
[
# Calculate the area of a polygon.
Inspired by this [shoelace algorithm video.](https://www.youtube.com/watch?v=0KjG8Pg6LGk&t=0s)
## Task
Your job is to create a program or function that calculates the area of a polygon. Program or function is defined according the the default definition in meta.
## In... |
[Question]
[
This challenge is rather simple:
You are given an array of positive (not including 0) integers, and have to select a random element from this array.
But here's the twist:
The probability of selecting an element is dependent on the value of the integer, meaning as the integer grows larger, the proba... |
[Question]
[
An Automorphic number is a number which is a suffix of its square in base 10. This is sequence [A003226](https://oeis.org/A003226) in the OEIS.
## Your Task:
Write a program or function to determine whether an input is an Automorphic number.
## Input:
An integer between 0 and 10^12 (inclusive), that ... |
[Question]
[
## Introduction
You're making a robot that can navigate a set of books of varying heights. It can climb books and jump off books, but if the distance is too big it will stop to prevent damage. To figure out the ideal design, you're writing a simulator.
Your program will take as input a list of numbers,... |
[Question]
[
Closely related: [How high can you count?](https://codegolf.stackexchange.com/q/124362/78410)
## Challenge
In your programming language of choice, write as many different identity programs/functions as possible, under the following constraints:
* Each program should be a function or full program that i... |
[Question]
[
## Concept
Write a program that outputs code in its programming language. That code, when executed, must output the original program.
## Rules
* Since this is a cheating quine, you can read the original source code.
* First output program must be in the same language as the original program.
* You may ... |
[Question]
[
Write the shortest code in the language of your choice to perform run length decoding of the given string.
The string will be supplied as **input on stdin** in the form
```
CNCNCNCNCNCNCNCN
```
where each `C` could be any printable ASCII character and each `N` is a digit `1` to `9` (inclusive).
Sample ... |
[Question]
[
## Challenge
Given a list of numbers, calculate the population standard deviation of the list.
Use the following equation to calculate population standard deviation:

## Input
The input will a list of integers in any forma... |
[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/126326/edit).
Closed 6 years ago.
[Improve this question](/... |
[Question]
[
Given a multidimensional array, find the recursive alternating sum. An alternating sum is simply the sum of an array, where every other item (starting with the second) is negated. For example, the alternating sum of `[7, 1, 6, -4, -2]` is the sum of `[7, -1, 6, 4, -2]`, or `14`. In this challenge, you'... |
[Question]
[
Write a function or program that takes string inputs, fully-spelled, English month names in title case: `January`, `February`, `March`, etc. (null/CR/LF terminated OK, delimited with some non-alpha character if you so choose) and either
* compares two inputs, returning a Truthy value if the second inpu... |
[Question]
[
Your task: Print or return a conversion table with every byte from `00` to `ff`'s value as an unsigned integer, to its value as a signed one (using [two's complement](https://en.wikipedia.org/wiki/Two%27s_complement)).
For example:
```
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 ... |
[Question]
[
Given a list of 2 or more strictly positive integers, sum the first and last half of the list, with the middle element being counted only in the right half if the list has an odd number of elements
Some examples of the middle element being counted in the right half:
```
[1, 2, 3, 4] -> Left: [1, ... |
[Question]
[
The [cosine similarity](https://en.wikipedia.org/wiki/Cosine_similarity) of two vectors \$A\$ and \$B\$ is defined using their [dot product](https://en.wikipedia.org/wiki/Dot_product) and [magnitude](https://en.wikipedia.org/wiki/Magnitude_(mathematics)#Euclidean_vector_space) as:
\$\frac{A\cdot B}{\|A... |
[Question]
[
# Challenge
Consider the rainbow as seven colours, represented by strings as `Red Orange Yellow Green Blue Indigo Violet`.
Your task is to create a program that receives one of these colours as input and outputs next in order rainbow colour. This includes overlapping `Violet -> Red`
# Input
A string ... |
[Question]
[
Your task is to sort an array containing the strings "quarter", "dime", "nickel", and "penny" any number of times in no specific order and sort them so that they are in this order: `quarter dime nickel penny` (in other words, greatest to least monetary value).
---
## Rules
1. Your program must take an... |
[Question]
[
*This is a cross-post of a problem I posted to anarchy golf: <http://golf.shinh.org/p.rb?tails>*
Given two integers \$ n \$ and \$ k \$ \$ (0 \le k \le n) \$, count the number of combinations of \$ n \$ coin tosses with at least \$ k \$ tails in a row.
For example, if \$ n = 3 \$ and \$ k = 2 \$, the a... |
[Question]
[
# Summary
Write a program or function, which doesn't take any input, and outputs all the integer numbers, between -1000 and 1000 in ascending order, to the stdout, one per line, like this:
```
-1000
-999
-998
-997
...
```
And after that you need to print the time taken to print these numbers, or the ti... |
[Question]
[
[Add++](https://github.com/cairdcoinheringaahing/AddPlusPlus), the [Language of the Month](https://codegolf.meta.stackexchange.com/q/24222/), has the "collect" builtin as `BC`. Your task is to implement this builtin.
---
Consider a non-empty array, where each element is either:
* A positive digit betwe... |
[Question]
[
My dad is a retired teacher, and he used to give combined spelling and math quizzes, where the student would spell a word, and then 'score' the word by adding up the letters, where a=1, b=2, etc. (e.g. cat = 3+1+20=24). This made grading the quizzes easier, as he would just have to check for incorrect ... |
[Question]
[
# Definition
Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. Characters with 10 or more instances will define 2 or more digits of the returned integer. For example, aaa... |
[Question]
[
*This question is probably harder than all of those "generate a sequence of numbers" tasks, because this requires TWO sequences working in unison.*
*Really looking forward to the answers!*
In his book "*Gödel, Escher, Bach: An Eternal Golden Braid*", Douglas Hofstadter has a quite few sequences of numb... |
[Question]
[
*Title is an homage to [this classic challenge](https://codegolf.stackexchange.com/questions/113238/is-it-true-ask-jelly)*
In [Pip](https://github.com/dloscutoff/pip), the Scalar data type encompasses strings and numbers. A Scalar value is truthy in most cases. It is falsey only if:
* It is the empty s... |
[Question]
[
The English language and most programming languages are written and read from left-to-right, top-to-bottom, but that [needn't be the case](http://en.wikipedia.org/wiki/Writing_system#Directionality).
In fact for the block of text
```
ABC
DEF
```
I can think of eight related ways it might be read:
1. Le... |
[Question]
[
Write a full program to find whether the binary representation of a number is palindrome or not?
```
Sample Input
5
Sample Output
YES
```
Print `YES` if binary representation is palindrome and `NO` otherwise.
[Answer]
## Python - 46 chars
```
n=bin(input())[2:]
print'YNEOS'[n!=n[::-1]::2]
```
[Ans... |
[Question]
[
Your task is to determine whether some arbitrary programming language has zero-indexed or one-indexed arrays based on sample inputs and outputs
### Inputs
* An array of integers with at least 2 elements
* A positive integer index
* The value of the array at that index
### Output
One of four distinct va... |
[Question]
[
A number is a de Polignac number if and only if it is **odd** and *cannot* be represented in the form **p + 2n** where **n** is a non-negative integer and **p** is a prime integer.
# Task
Write some code that takes a positive integer and determines if it is a de Polignac number. You may output two dist... |
[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 last year.
[... |
[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/2922/edit).
Closed 7 years ago.
[Improve this question](/po... |
[Question]
[
# Intro
Beauty lies in the eye of the beholder. Output lies in the choice of the compiler. There are some codes that give different outputs based on what language they are executed in. Take for instance, the code given below:
```
# include <stdio.h>
# define print(a) int main(){printf("C is better"); r... |
[Question]
[
The [Juggler sequence](https://en.wikipedia.org/wiki/Juggler_sequence) is described as follows. Beginning with an input \$a\_1\$, the next term is defined by the recurrence relation
$$a\_{k+1} = \begin{cases}
\left\lfloor a\_k ^ \frac 1 2 \right\rfloor,\text{ if } a\_k \text{ is even} \\
\left\lfloor a... |
[Question]
[
You should write a program or function that receives a positive integer `N` as input and prints out the first `N` characters of your code. If `N` is larger than the length of your code you should continue output your code cyclically.
Reading your source code in any way and reading from file, stdio, etc... |
[Question]
[
*Inspired (with the explanation stolen from) [this](https://stackoverflow.com/q/45906747/7742131)*
## Background
Say you have two lists `A = [a_1, a_2, ..., a_n]` and `B = [b_1, b_2, ..., b_n]` of integers. We say `A` is **potentially-divisible** by `B` if there is a permutation of `B` that makes `a_i`... |
[Question]
[
Input a decimal number and round it to an integer, randomly rounding up or down with a probability based on its fractional part, so the expected value of the output equals to the input value.
If input \$x\$ is an integer, the program should output it as is. If \$x\$ is not an integer, the program has a... |
[Question]
[
Okey, we all know the normal way to throw a IllegalArgumentException in Java:
```
throw new IllegalArgumentException(); // 37 characters
```
But there must be a shorter (as in less characters) ways to do so.
How can we produce a java.lang.IllegalArgumentException with even less code?
* The code fragmen... |
[Question]
[
### **Introduction:**
The [sine](http://en.wikipedia.org/wiki/Sine) of \$x\$ is given by the formula:
$$\sin(x) = x - \frac {x^3}{3!} + \frac {x^5}{5!} - \frac {x^7}{7!} + \frac {x^9}{9!} - \frac {x^{11}}{11!} + \cdots$$
The [cosine](http://en.wikipedia.org/wiki/Cosine#Sine.2C_cosine_and_tangent) of \$... |
[Question]
[
Given an integer n, your task is to determine whether it is a perfect square that when reversed, is still a perfect square. You may assume n is always positive.
When numbers such as 100 (10x10) are reversed the result may have leading zeros (001) In this case, ignore the leading zeros and treat it as 1... |
[Question]
[
You are to take a string representing a piece of brainfuck code and Explanations, containing only printable ASCII characters and newlines ( to `~`, ASCII 10 and 32 to 126) as input and output an explanation of that code, formatted to be compliant with Stack Exchange markdown.
That is, the explanation m... |
[Question]
[
Here are the first 100 numbers of a sequence:
```
1,2,33,4,55,66,777,8,99,11,111,12,133,141,1515,1,11,18,191,22,222,222,2232,24,252,266,2772,282,2922,3030,31313,3,33,33,335,36,377,383,3939,44,441,444,4443,444,4455,4464,44747,48,499,505,5151,522,5333,5445,55555,565,5757,5855,59559,6060,61611,62626,63636... |
[Question]
[
**The Challenge**
The goal of this challenge is to determine whether a given String can be typed using only one line of a standard UK QWERTY keyboard.
This is `code golf`, so shortest solution in bytes wins!
---
**IO**
Input will be a single String of zero or more characters in the ASCII decimal range ... |
[Question]
[
A family of sets is called [laminar](https://en.wikipedia.org/wiki/Laminar_set_family) if for any two sets \$A\$ and \$B\$ in the family one of the following is true:
* \$ A \subseteq B \$
* \$ A \supseteq B \$
* \$ A \cap B = \emptyset \$
Or less mathematical:
A laminar set is a list of lists that sat... |
[Question]
[
Write a function (or a whole program) that outputs (or prints) the following ASCII art:
### Output:
```
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
1 2 3 4 5 6 5 4... |
[Question]
[
### About Zeckendorf Representations/Base Fibonacci Numbers
This is a number system which uses Fibonacci numbers as its base. The numbers consist of 0 and 1's and each 1 means that the number contains the corresponding Fibonacci number, and 0 means it does not.
For example, let's convert all natural nu... |
[Question]
[
# Introduction
Yes, it's as simple as that. Download any file from the internet!
# Rules
You must use your language's API.
You must output the file you downloaded to STDOUT, the console, a file, etc.
Input should be empty, or the URL you wish to download, but the url must count to byte count..
Good luc... |
[Question]
[
## Background
A ray of light is fired from the top left vertex of an `MxN` Chamber, where `M` a denotes the width and `N` denotes the height of the chamber. The ray of light advances one grid space per second. Given that `T` is the number of seconds to be simulated, calculate the number of reflections ... |
[Question]
[
Given a ragged list, e.g.
```
[[4, 7], [5, 3, [], [6, [2]]]]
```
Your challenge is to sort only the numbers in it. For example, with the above, the result would be
```
[[2, 3], [4, 5, [], [6, [7]]]]
```
The shape of the output should remain the same, only the numeric contents should change.
This is [co... |
[Question]
[
# Objective
Given two Chinese ideographs meaning basic colors, output the ideograph that means the color resulting from mixing them.
# Basic colors
The basic colors are:
* 靑(U+9751; blue)
* 赤(U+8D64; red)
* 黃(U+9EC3; yellow)
* 白(U+767D; white)
* 黑(U+9ED1; black)
# Mixed colors
* Mixing 靑(blue) and 赤(re... |
[Question]
[
Takuzu is a logic game in which you have to complete a grid with cells containing `0`s and `1`s. The grid must follow 3 rules:
1. No three horizontal or vertical consecutive cells can be the same.
2. There must be an equal number of `0`s and `1`s in each row and column.
3. No two rows can be the same, ... |
[Question]
[
A string of characters repeats if it contains two consecutive substrings that are equivalent.
For example, `2034384538452` repeats as it contains `3845` twice, consecutively.
Therefore, your challenge is to decide whether a string contains a repeating substring. You may take the input as a string or an... |
[Question]
[
Given a positive integer, determine if it can be represented as a concatenation of two square numbers. Concatenated numbers may not begin with 0 (except for 0). Any leading zeros in input should be ignored.
Examples
```
11 -> true // because 1 and 1 are squares
90 -> true // because 9 and 0 are squar... |
[Question]
[
Generate the following soccer team ASCII art with the least number of bytes possible.
```
|.| |.| |.| |.| |.| |.| |.| |.|
]^[ ]^[ ]^[ ]^[ ]^[ ]^[ ]^[ ]^[
/~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`... |
[Question]
[
I don't like strings with more than three vowels in a row. Can you write a program that removes all the vowels I don't want from words?
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (... |
[Question]
[
A drug comes in 5mg, 2.5mg, and 1mg sized pills. The drug is taken once a day. The total daily dose will be only one of the following (all in mg):
1, 2, 3, ... 20, 22.5, 25, 27.5, 30, 32.5, 35, 37.5, 40, 42.5, 45, 47.5, 50
In words: any whole number less or equal to 20, then at 2.5mg increments up to 5... |
[Question]
[
Given two inputs `q n` determine if `q` is a quadratic residue of `n`.
That is, is there an `x` where `x**2 == q (mod n)` or is `q` a square mod `n`?
**Input**
Two integers `q` and `n`, where `q` and `n` are any integers `0 <= q < n`.
**Output**
A truthy or a falsey.
Optionally, print any (or all) `x` ... |
[Question]
[
## Statement of problem
Given a set of unique, consecutive primes (not necessarily including 2), generate the products of all combinations of first powers of these primes — e.g., no repeats — and also 1. For example, given the set { 2, 3, 5, 7 }, you produce { 1, 2, 3, 5, 6, 7, 10, 14, 15, 21, 30, ... |
[Question]
[
### Introduction
In this challenge your task is to generate the ISBN-10 code for books given its ISBN-13 code, assuming that such a code exists. Such an ISBN-13 code consists of several parts separated by `-`:
```
978-GG-PPPP-TTT-C
```
The letters `G` (group), `P` (publisher), `T` (title) and `C` (chec... |
[Question]
[
Given a 2D string as input, either as a string with newlines or a list of lines, output the coordinates `(x, y)` of all the hashes (`#`) in the list. The input will only contain hashes and spaces. (and newlines, if you choose to take input as a 2D string)
If there are no hashes, you can output anythin... |
[Question]
[
*easy mode of [my previous challenge](https://codegolf.stackexchange.com/q/251270/78410)*
A perfect number is a positive integer whose sum of divisors (except itself) is equal to itself. E.g. 6 (1 + 2 + 3 = 6) and 28 (1 + 2 + 4 + 7 + 14 = 28) are perfect.
A **sublime number** (OEIS [A081357](http://oei... |
[Question]
[
You are trapped in this 5x5 labyrinth - each room is labelled from 1 to 25 and the exit is in room 1.
[](https://i.stack.imgur.com/3pa3s.png)
You are given as input the room you are currently in. Your task is to output the shortest seq... |
[Question]
[
## Challenge:
Write a code that, when executed will output the source code of a second program that can be executed in another language. The second program should output the source code of a third program that can be executed in a third language and so on. The last program should output **`PPCG`** with... |
[Question]
[
This is a simple one. Given the input of a number, return the name and reputation score of the Stack Overflow user with that **given ID**. Your program can assume that it is always given a valid and existent user ID.
For example: given the input `764357` (which is my userID on StackOverflow) the progr... |
[Question]
[
Write a program or function that:
1. takes in a string from stdio or arguments
2. replaces all occurrences of `true` with `false` and `false` with `true`
3. reverses it, but does not reverse `true` and `false`
4. returns or prints result
Examples (left side is input):
```
"true" "fa... |
[Question]
[
The process of Reversal-Addition is where a number is added to it's reverse until the number created is a palindrome. For example, if we start with 68, the process would be:
$$68 + 86 \to 154 + 451 \to 605 + 506 \to 1111$$
As you can see, this took 3 additions to get to a palindromic number. If we were... |
[Question]
[
To each of these nine [confusingly similar](http://en.wikipedia.org/wiki/Semantic_satiation) words, assign a number 1-9 in any way you like:
```
though
through
thorough
Thoreau
throw
threw
trough
tough
troll
```
Write a program that takes in a string. If the input is one of these nine words, output the... |
[Question]
[
*Please note the special scoring for this challenge.*
Given a non-empty string made of `a-z`, output the string immediately before it in the [shortlex order](https://en.wikipedia.org/wiki/Shortlex_order).
**Shortlex order**
We enumerate strings in shortlex order by first listing the strings of length ... |
[Question]
[
**Story**
So I have a book that I want to separate from my table with nothing but other books. I want to know how many books do I need to achieve this with \$n\$ book lengths.
Here's a visualization that my friend at Wolfram drew for me:
) by replacing each decimal digit with its 4-digit binary representation
```
234 -> 0 0 1 0 0 0 1 1 0 1 0 0
```
Then rotate the list of binary digits in order to fin... |
[Question]
[
For the purposes of this challenge, a *polyphthong* is defined as a contiguous slice of a String, that only contains vowels, and has length at least 2. Given a non-empty String as input, your task is to output all the polyphthongs it contains.
For example, `"abeoic"` has the following contiguous slices... |
[Question]
[
Continuing my [*It was just a bug*](https://codegolf.stackexchange.com/questions/129523/it-was-just-a-bug) challenge:
### Input:
A string consisting of printable ASCII characters without white-spaces nor new-lines.
### Output:
First turn the input into a palindrome by reverting the input, and adding it... |
[Question]
[
When studying [numerology](https://en.wikipedia.org/wiki/Numerology), you can say two words (strings consisting entirely of letters) are compatible if they produce the same number under the following operation (let's use the string `hello` as an example):
* Map each letter to a number according to the ... |
[Question]
[
## Challenge:
### Input:
A sorted list of positive integers.
### Output:
The amount of integers which are still at the exact same index, after rotating the digits in each integer its index amount of times towards the left and sorting the modified list again.
**Example:**
Input: `[8,49,73,102,259,762,27... |
[Question]
[
Consider an array of integers:
```
[1, 0, 9, 1, 3, 8]
```
There are a lot of ways to partition this list into consecutive sublists. Here are three:
```
A: [[1, 0, 9], [1, 3, 8]]
B: [[1], [0, 9], [1, 3], [8]]
C: [[1, 0], [9, 1], [3, 8]]
```
We will call a partition *Y* and refinement of another partitio... |
[Question]
[
In this challenge you will take as input a non-empty list of binary values (these can be booleans or integers on the range 0-1), you should output all the ways to partition the list into non-empty sections such that no two adjacent equal values in the initial list are separated into different sections.... |
[Question]
[
Given a non-negative integer `n`, print the result of `P(P(...P({})))`, where the number of `P`'s is `n` (`P` is the power set function).
```
0 => {}
1 => P({})
2 => P(P({}))
3 => P(P(P({})))
n => P(f(n-1))
```
```
input result
0 {}
1 {{}}
2 {{},{{}}}
3 {{},{{}},{{{}}},{{},{{}... |
[Question]
[
**This question already has answers here**:
[Code Golf Christmas Edition: How to print out a Christmas tree of height N](/questions/4244/code-golf-christmas-edition-how-to-print-out-a-christmas-tree-of-height-n)
(116 answers)
Closed 4 years ago.
Given an integer `n>0`, write a program that will ... |
[Question]
[
# The Challenge
Given 3 numbers `X`, `Y` and `Z` in base `B`, find a `B`ase in which the addition of `X` and `Y` yields `Z`. The inputs `x = 20`, `Y = 12` and `Z = 32` could yield `5` because `20 + 12 = 32` in base 5.
* You may assume that there will always be a base in which the addition is correct (t... |
[Question]
[
From [Wikipedia](https://en.wikipedia.org/wiki/Gabriel%27s_Horn), Gabriel's Horn is a particular geometric figure that has infinite surface area but finite volume. I discovered this definition in [this Vsauce's video](https://www.youtube.com/watch?v=ffUnNaQTfZE&t=22s) (starting at 0:22) where I took th... |
[Question]
[
### Input:
A matrix containing integers in the range **[0 - 9]**.
### Challenge:
Determine if all non-zero elements are connected to each other vertically and/or horizontally.
### Output:
A [truthy value](https://codegolf.meta.stackexchange.com/a/2194/31516) if all are connected, and a [falsy value](ht... |
[Question]
[
Starting with a binary list (just `1`s and `0`s) we are going to roll a ball over it. The ball has a position and a direction. At every step the ball does the following:
* If the number at it's position is `1`, then flip the direction. It "bounces".
* Flip the number, if it's `0` replace it with `1`, i... |
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.