# All Questions

13,168 questions
Filter by
Sorted by
Tagged with
44 views

### Build a file/directory tree

Task In this challenge, your task is to write a program or function which takes an array of paths with an additional boolean indicating it is a file or directory and outputs a file/directory tree in ...
• 161
276 views

### Golf Github's Pager Logic

Background When searches return many pages of results, Github avoids cluttering their UI by eliding page links. Instead, their UI let's you select: Pages at the beginning of the results. Pages near ...
• 27.3k
650 views

### Erverse Hte Ifrst Wto Eltters fo Aech Owrd

Inspired by this accidental misspelling If you could read the title, then you already know what the challenge is about. If not, then I'll tell you. Easy: simply take each word (single space delimited)...
• 3,007
1k views

### Draw the USA flag

I noticed that it seems nobody has posted a non-ASCII (related) USA flag challenge yet, so what better time than the 4th of July? The Challenge Draw the current (as of 2022) flag of the United States ...
• 2,250
116 views

### Output your Code Golf submission from Try It Online

When using Try It Online, there is an option to copy a Code Golf submission: Using a language currently on Try It Online, your task is to output the exact submission copied to your clipboard from ...
• 13.5k
40 views

### Bijective Function (mapping integer to arbitrarily large integer tuple) [duplicate]

Find a bijective function which maps integers to arbitrarily large tuples of integers. Given the input $n$, output the tuple it matches to. Edit: The empty tuple is included in the mapping.
• 183
474 views

### Get multi-dimensional indices in a list

Given a matrix of non-negative numbers (of arbitrary dimension) and a number, get all multi-dimensional indices of the number in that list. For example, let's say we have the list ...
• 6,480
564 views

### Is it an ordinal?

Background (feel free to skip) Ordinals are the abstract representation of well-orders. A well-order of a set is a total order, which basically means that every element in the set can be compared ...
• 6,705
809 views

### Implement Binary Exponentiation

Background In programming, there is a recursive algorithm called binary exponentiation, which allows for large integer powers to be calculated in a faster way. Given a non-zero base $x$ and a non-...
• 4,707
109 views

### Find the best character arrangement

You want to write your English essay. However, all characters on your keyboard broke other than the arrow keys and the enter key. You want to find out how to place the characters so you can write your ...
• 3,173
641 views

### Draw this fractal generated by applying Newton's method to cosh(x) - 1

I came across this picture the other day: (Credit to Josep M Batlle I Ferrer) Your job is to generate this picture. This graph is generated by repeatedly applying newton's method to the graph of: f(...
• 1,013
759 views

### Number of binary partitions

We all know that any positive integer can be represented as the sum of powers of two. This is how binary representations work. However there's not just one way to do this. The canonical method, ...
• 88.3k
777 views

### Word stays a word after taking away a letter

This is a repost of this challenge Challenge There is an old, popular riddle: Find an English word with 8 letters that, taken away one letter, creates a new valid word. Repeat that until there are ...
• 4,423
927 views

### Pairs at every distance

Given a list $X$ of 2 or more integers, output whether, for all $n$ such that $0 \leq n < length(X)-2$, there exists a pair of equal integers in $X$ separated by exactly $n$ elements. In ...
• 1,857
410 views

### Draw the Progress Pride flag

Challenge Create the image of a progress pride flag. Output Dimensions Rules Your program must create the image and not just load it from a website The colours can be just your language's default ...
• 327
1k views

### Bloons TD 6 Upgrade Paths

Background The monkeys need help organizing their defense and have asked you, Benjamin the code monkey, to create a program that will list all tower upgrade options. Each tower has three unique ...
• 11k
1k views

### Weighted coin flip strings

Given n, k, and p, find the probability that a weighted coin with probability p of heads will flip heads at least k times in a row in n flips, correct to 3 decimal digits after decimal point (changed ...
• 183
403 views

### Collect data on mushroom forests

In these previous challenges[1][2] I've been dealing with "mushroom forests". To help with these I draw little diagrams of the forests to help. In this challenge we are going to reverse ...
• 88.3k
81 views

### No A, just CAPS LOCK... but even more annoying [closed]

Inspired by: No A, just CAPS LOCK. The question is currently in Sandbox. My keyboard doesn't have a caps lock key. It's... switching between Chinese and English. What happens when the CapsLock key on ...
• 1,252
279 views

### Which R version is it? It's Peanuts!

This challenge will be based on an R language trivia: every release is named and it's a reference to Peanuts comic strips (see here and here). Task Given a release name, output its number. For ...
• 11.7k
2k views

### Write a near crystalline program

A pristine program is a program that does not have any errors itself but will error if you modify it by removing any contiguous substring other than the entire program. A crystalline program is sort ...
• 88.3k
3k views

### Print the ASCII Code page

Goal You have to print the ASCII printable characters' code page (0x20-0x7E). The output should look like this: ...
• 403
898 views

### Is it shuffled FizzBuzz?

A twin of this. FizzBuzz is where a range of positive integers is taken, and numbers divisible by 3 are replaced with "Fizz", divisible by 5 with "Buzz" and divisible by 15 with &...
• 30.5k
1k views

### Decipher a squashed sequence

Given a string containing a sequence of ascending consecutive positive integers, but with no separators (such as 7891011), output a list of the separated integers. ...
• 21.4k
299 views

### Help me design an unfair laundry machine

There's a payment machine for laundry in my building which does a few frustrating things. The ones relevant to this challenge are: It doesn't make change. So if you pay over the amount then you are ...
• 88.3k
334 views

Lambda calculus is a system of computation based on single-argument functions; everything in it is such a function. Due to this functional nature, juxtaposition is commonly used to denote function ...
• 15.8k
3k views

### Fix my FizzBuzz

FizzBuzz is where a range of positive integers is taken, and numbers divisible by 3 are replaced with "Fizz", divisible by 5 with "Buzz" and divisible by 15 with "FizzBuzz&...
• 30.5k
1k views

### Compress Jelly's code page

In this challenge, you'll print out the SBCS of Jelly, a popular golfing language. Its code page looks like this: _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F 0_ ...
• 17.4k
406 views

Write the shortest program or function that mimics the addition in this XKCD strip: Input Two positive decimal integers containing only the digits 150. Output The ...
• 2,973
5k views

### Doing a little trolling with the microwave timer

Related Sometimes when I use my microwave, I do a little trolling and enter times such as 2:90 instead of 3:30 because they end ...
• 22.1k
180 views

### Is this a strange pond?

In this challenge we considered a frog hopping around a lily pond. To recap the lily pond was represented as a finite list of positive integers. The frog can only jump forward or backwards by a ...
• 88.3k
59 views

### Extract the word containing this index [duplicate]

For this challenge, a word is defined as a string of letters, separated by spaces. Given a string of words, and an integer i representing an index into that string, ...
• 21.4k
2k views

• 1,281
1 vote
194 views

### Implement the slowest possible sorting algorithm that retains a fast best case [closed]

I have recently been on a quest to create really really slow sorting algorithms that make Bogosort seem like it is the best. The task is simple: Sort an array of integers in as long average time as ...
• 27
3k views

### backwardS_hybriD-snakE_kebaB-cameL_case

There are a bunch of different casing conventions, like camelCase, PascalCase, snake_case ...
• 30.5k
2k views

### Create Bernard from Desmos

Background In the online graphing calculator Desmos, there is a certain shape that appears in the lower left portion of the graph in many high detail graphs, which the Desmos community has dubbed &...
• 4,707
1k views

### Gray coded Gray code convertor

To increase data safety at our company, we are planning to start using Gray code numbers (where successive values differ by only one bit) instead of classical binary ones. Please help us to make a ...
• 647
1k views

### Extend a matrix in all directions

Given a multidimensional, rectangular array and a list of dimensions, such as: [ [1, 2], [3, 4] ] [3, 4] Your challenge is to extend the matrix to the ...
• 30.5k
1k views

### Truncate words in a sentence

Inspired by wezl. Your challenge is to take words (sequences of [a-zA-Z]) and truncate them to length 3. For example, ...
• 30.5k