# All Questions

13,167 questions
Filter by
Sorted by
Tagged with
997 views

### Enumerate all pure sets

In set theory, a set is an unordered group of unique elements. A pure set is either the empty set $\{\}$ or a set containing only pure sets, like $\{\{\},\{\{\}\}\}$. Your challenge is to write a ...
• 30.5k
2k views

### Is it a valid list?

Given a string like [[[],[[]]],[]], made of only commas and square brackets, your challenge is to determine whether it represents a list. A list is either: ...
• 30.5k
1k views

### Position from atomic number in the periodic table

Let us consider the following representation of the periodic table. ...
• 321
222 views

### 12 with no 1234567890, but polyglot

This is my 12th question, so I thought of this idea. Goal: Output 12, with any preceding or trailing whitespace permitted In as many languages as possible (where different versions or flags count as ...
• 1,252
584 views

### Universal Unicode Clock

Plot contrivance You wake up to find that something has gone horribly wrong! Your time machine has malfunctioned and you are lost sometime between June 2022 and October 1991. You check the computer ...
• 88.3k
2k views

### Iteratively delete a list

Say I have a ragged list, like: [ [1, 2], [3, [4, 5] ] ] And I want to iterate over each item and delete it one-by-one. However, I don't know the ...
• 30.5k
198 views

### Find the Circle-Tangent Polynomials

Introduction A circle-tangent polynomial is a polynomial of degree $N\ge3$ or above that is tangent to the unit circle from inside at all of its N-1 intersection points. The two tails that exits the ...
• 6,068
5k views

### Can the 🐸 visit all the 🪷?

In this challenge you will be simulating a frog jumping from lily-pad to lily-pad in a pond. A frog's jump distance is uniquely determined by the size of the lily pad it jumps from. So for example ...
• 88.3k
2k views

### Don't touch the walls!

Given a multi-dimensional rectangular array of non-negative integers, pad it with the minimal number of zeroes so that only zeroes are "touching the edges" of the array, in every dimension. ...
• 21.4k
3k views

### Give f and g that sometimes commute

Let $Z$ be either the integers, the positive integers, or the non-zero integers; pick whatever's convenient. Give two functions $f$ and $g$, each $Z \to Z$, such that: $f(g(a)) = g(f(a))$, ...
• 1,221
2k views

### Speed up, slowpoke!

In this king-of-the-hill challenge, you will program a bot, consisting of a python function of the form def BOTNAME(info, me, round): pass # ... main body ...
• 1,433
3k views

### Consecutive coin flips

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$ ...
• 17.6k
2k views

### Print the power set of the power set ... of an empty set

Given a non-negative integer n, print the result of P(P(...P({}))), where the number of P's ...
• 319
403 views

### Parenthetical Names

Parenthetical names Your challenge is to build a program that puts parentheses around the 'title' part of names. For example, Sonic the Hedgehog is converted to <...
2k views

### Tell me how many there are, in Polish

Today, you're going to be writing Polish. No, not Polish notation—Polish, the actual language spoken in Poland. Given a number and a noun, output a Polish sentence telling me that there are that many ...
• 849
2k views

### Count /[^a-z]/ig with /[a-z]/ig

Write a program or function which takes a string of text as input and outputs the number of non-alphabetical characters in it (standard I/O rules apply). A non-alphabetical character is any character ...
• 1,857
239 views

### Sort my Cups︎︎︎︎︎︎︎︎︎︎ [closed]

I have a set of colored plastic cups. They come in four colors: green, yellow, pink, and blue. When I put them on my shelf, I like to stack them in a certain pattern. Your job is, given a list of any ...
• 3,350
2k views

### Concatenatable numbers

Given a list of positive integers such as [69, 420], your challenge is to generate the sequence of numbers that can be formed by concatenating numbers from the ...
• 30.5k
137 views

### Good Rectangles and Evil Numbers

Good Rectangles and Evil Numbers This is meant to be a Puzzling Challenge: Good Rectangles and Evil Numbers - Integrated Original: https://puzzling.stackexchange.com/questions/116168/good-rectangles-...
• 1,252
1k views

### Make the list Fibonacci-like

Related, but not dupe. Challenge A list of integers $a_1, a_2, a_3, \dots, a_n$ ($n ≥ 1$) is Fibonacci-like if $a_i = a_{i-1} + a_{i-2}$ for every $i > 2$. Note that every list that ...
• 827
2k views

### Detect Mongolian vowel harmony

The Mongolian language has "vowel harmony". In short the vowel harmony means that certain vowels are not allowed to be placed next to each other in a word. This means that suffixes of ...
• 88.3k
771 views

• 827
635 views

### Increasing permutation trees

For this challenge a "binary tree" is a rooted tree where each node has 0 children (leaf) or 2. The children of a node are unordered, meaning that while you might draw the tree with left ...
• 88.3k
485 views

### Two In One: Guess That Language - Robbers

Cops' challenge This cops-and-robbers challenge challenges the Cop to write a non-empty program that, when run, produces some non-empty output in language A, and, when reversed, produces some non-...
• 1,252
1k views

### Two In One: Guess That Language - Cops

Robber's challenge This cops-and-robbers challenge challenges the Cop to write a non-empty program that, when run, produces some non-empty output in language A, and, when reversed, produces some non-...
• 1,252
403 views

### Fill the rectangle

Challenge In this challenge, you have to fill an $M$ x $N$ rectangle grid with the most $A$ x $B$ rectangle pieces possible. Requirements: The sizes of the $M$ x $N$ rectangle grid is ...
• 827
388 views

### Durable Durations

Introduction Time is a really simple concept. Seconds pass, one after the other, all the same. But humans love making it hard. This Stackoverflow question has gathered many answers and even though ...
• 169
701 views

### Count alternating permutations

An alternating permutation is a permutation of the first $n$ integers $\{ 1 ... n \}$, such that adjacent pairs of values in the permutation alternate between increasing and decreasing (or ...
• 21.4k
62 views

### Tips for golfing in J-uby

J-uby is the Language of the Month for June 2022, so I'm looking for tips for golfing in it. As usual, please post one tip per answer, and avoid general tips such as "remove whitespace" or &...
• 6,460
1k views

### Extract the contained powers of two!

Take as input an integer in any reasonable format. Then, output all the proper sub-strings of the base-10 digits of that integer that are powers of two, in any reasonable format. Test cases ...
• 1,433
2k views

### How many light changes will a 7-segment display need?

Problem Assume you have a single 7-segment display without a decimal point, so 7 "lines" that can be labelled A through G as seen here. This display will only show the numbers from 0 to 9 ...
• 287
10k views

### lol is an ambigram, dad isn't

Given a word, decide if it is an ambigram. When rotated: b > q d > p l > l n > u o > o p > d q > b s > s u > n x > x z > z Assume ...
• 1,252
2k views

### But is it a pretty place?

Your challenge, should you choose to accept it, is to take as input: A program in DirectionLang (as an ASCII string consisting of DirectionLang instructions) A list of pairs of integers, henceforth ...
• 1,433
3k views

### What's the best die to roll?

The "standard" polyhedral game dice have 4, 6, 8, 10, 12 and 20 sides. (Yes, I know that there are two 10-sided dice which together make a d100, but we're ignoring that right now.) If I want ...
• 88.3k
1k views

### fastest matrix multiplication on x86

This challenge requires integration with C, so you can stop reading if you're not interested. Matrix multiplication is a simple operation, but the performance depends a lot on how efficiently the code ...
• 2,213
715 views

### Counting Rhythms

The Narrative You are a bad musician. You never bothered to learn how to count rhythms. To remedy this shortcoming, you decide to write a program that will tell you how to count in any given time ...
• 1,207
4k views

### Add a hidden language to a polyglot

Inspired/mostly copied but I don't think it's a dupe. Also Inspired. In this challenge, you will create polyglots that include all languages from previous answers, and another language which you won't ...
• 30.5k
859 views

### Invert a Non-commutative Function

Intro Imagine a list of elements and their outcomes when some non-commutative function is applied to them. For example, we will use the elements Rock, ...
• 1,857
1k views

### Sample integers that sum to one hundred

Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted). Your random sample ...
• 393
479 views

### Whyte Notation Translator

Whyte Notation is a classification method mainly for steam locomotive, that classifies by wheel arrangement. On a steam locomotive ( we're only focusing on non articulated locomotives here ), the ...
• 2,101
723 views

### Determine Uilta Pitch Accent

Uilta is a minority tungusic language spoken in the far east of Russia. A neat thing about Uilta is that it has pitch accent which can be predicted by a computer program. In this challenge we are ...
• 88.3k
547 views

### Calculate the Lowest Even-Harmonic of the Values in a List

PROBLEM For a list of numbers, list: Find the lowest possible integer, x, which is optimally close to the whole number even-...
1 vote
133 views

### Figure out the least amount of duplicate data to fill a quota [closed]

You are given 100 arrays/sets of 5-8 numbers between 1-20. If you combine all the arrays you will always get at least one of each number (1-20), so don't worry about an "unsolvable" case. ...
214 views

### Find run ascending lists faster

In this question I asked you to determine if a run ascending list could be made. It was code-golf so naturally most the answers are very slow. But what if we want it to be fast. In this challenge I ...
• 88.3k
2k views

### Straighten my corners... diagonally

We can arrange the positive integers like this: 1_| 2 | 5 | 10 4___3_| 6 | 11 9___8___7_| 12 16 15 14 13 That is, in L-shaped brackets expanding down and right ...
• 30.5k
4k views

### Previous Fibonacci number

The sequence of Fibonacci numbers is defined as follows: $F_0 = 0 \\ F_1 = 1 \\ F_n = F_{n-1} + F_{n-2}$ Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not ...
• 21.4k