All Questions

Filter by
Sorted by
Tagged with
23 votes
23 answers
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 ...
user avatar
14 votes
8 answers
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 ...
user avatar
  • 1,443
23 votes
18 answers
4k 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 ...
user avatar
  • 89.4k
5 votes
1 answer
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 ...
user avatar
  • 2,263
10 votes
6 answers
727 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 ...
user avatar
  • 1,357
28 votes
21 answers
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 ...
user avatar
  • 31.5k
7 votes
4 answers
965 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, ...
user avatar
19 votes
15 answers
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 ...
user avatar
  • 643
12 votes
5 answers
488 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 ...
user avatar
15 votes
10 answers
728 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 ...
user avatar
  • 89.4k
7 votes
12 answers
554 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-...
user avatar
1 vote
0 answers
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. ...
user avatar
7 votes
1 answer
217 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 ...
user avatar
  • 89.4k
18 votes
13 answers
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 ...
user avatar
  • 31.5k
34 votes
37 answers
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 ...
user avatar
  • 22.2k
18 votes
31 answers
2k views

Reverse hex cipher

Characters in strings are sometimes represented as their ASCII hexadecimal codes. Printable characters have two hex digits in their representation. Swapping those digits leads to another character, ...
user avatar
  • 12.1k
33 votes
33 answers
5k views

Eh, codegolf shmodegolf

This challenge is about implementing Shm-reduplication, originating in Yiddish, where one takes a word, duplicates it, and replaces the first syllable in the second word with "Shm" in order ...
user avatar
  • 663
16 votes
16 answers
1k views

Divisible subset sums

Inspired by the recent 3Blue1Brown video Consider, for some positive integer \$n\$, the set \$\{1, 2, ..., n\}\$ and its subsets. For example, for \$n = 3\$, we have $$\emptyset, \{1\}, \{2\}, \{3\}, \...
user avatar
13 votes
8 answers
915 views

Can a run ascending list be made?

A run ascending list is a list such that runs of consecutive equal elements are strictly increasing in length. For example [1,1,2,2,1,1,1] can be split into three ...
user avatar
  • 89.4k
18 votes
28 answers
4k views

Generate All 8 Knight's Moves

Introduction In chess, Knights can move two squares in one direction, and then one square in an orthogonal direction. On an x/y plane, these can be thought of as being a relative change of coordinates,...
user avatar
  • 180
13 votes
12 answers
2k views

I want 8 bits for every character!

This is the reverse of this challenge. Given an encoded list of codepoints and the characters used to encode it, you need to decompress it to its original string. For example, given the encoded list <...
user avatar
  • 8,986
18 votes
12 answers
1k views

In between fractions

Given two positive integer fractions \$x\$ and \$y\$ such that \$x < y\$, give the fraction \$z\$ with the smallest positive integer denominator such that it is between \$x\$ and \$y\$. For example ...
user avatar
  • 89.4k
7 votes
24 answers
2k views

Find the nth Fibonacci number, where n is the mth Fibonacci number

Introduction If \$\newcommand{\fib}{\operatorname{fib}}\fib(x)\$ calculates the \$x\$th Fibonacci number, write a program that calculates \$\fib(\fib(m))\$ for any integer value of \$m \ge 0\$. (Of ...
user avatar
  • 195
14 votes
13 answers
745 views

Find the dimensions of a ragged list

For any ragged list its dimensions will be a list of non-negative integers defined as follows: Elements that are not a list will have dimensions \$\textbf{[}\,\,\textbf{]}\$. An empty list has ...
user avatar
  • 89.4k
6 votes
2 answers
234 views

Solve the Zany car game

The Zany Car Game is a tile matching game. You are given a number of tiles, with coloured cars split into a top and bottom half. To win the game, you need to find a square arrangement of the tiles so ...
user avatar
  • 1,201
10 votes
13 answers
2k views

Robbers: Smallest subset of characters required for Turing Completeness

This is the robbers' challenge. The cops' one is here. In Fewest (distinct) characters for Turing Completeness, the goal is to find the minimum number of characters which make a language Turing ...
user avatar
27 votes
30 answers
7k views

Smallest subset of characters required for Turing Completeness

In Fewest (distinct) characters for Turing Completeness, the goal is to find the minimum number of characters which make a language Turing Complete...in other words, allow it to do any computation ...
user avatar
12 votes
15 answers
5k views

LOOOOONG TEEEEEXT

Definition of long text Long text usually shows emphasis, for instance, loooooool or yaaaaaaaaaay. Usually the vowel is ...
user avatar
16 votes
21 answers
2k views

Apartment Building

Draw an "apartment" building according to the specifications below. Basic Rules Take, as input, the number of floors of the building. Return a building with that many floors meeting the ...
user avatar
  • 1,308
6 votes
1 answer
459 views

Irradiated Polyglots

Design a function or program that, when run normally, outputs the triangular numbers. However, when any single character is deleted, the program/function should not function in the original ...
user avatar
  • 1,308
2 votes
1 answer
265 views

King of the Cards

King of the Cards Code available here! In this King of the Hill challenge, you must write a bot that can play Crazy Eights. This is a card game often played by children, in which the objective is to ...
user avatar
  • 3,410
12 votes
8 answers
782 views

Count the Liberties - Advanced

Here's an advanced version of the 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, ...
user avatar
  • 2,263
17 votes
26 answers
2k views

Alternating sums of multidimensional arrays

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 ...
user avatar
13 votes
9 answers
2k views

Magic: the Gathering - Colour Sorting

Related: Deck Names Friends or Foes Paying for Spells The Magic: the Gathering card game has five colours of magical mana: white (W), blue (U), black (B), red (R), and green (G). Cards can be any of ...
user avatar
-2 votes
3 answers
183 views

Graphical Hello World [closed]

In this challenge, you will create the shortest graphical program that displays exactly "Hello, world!" You will need no input. You might be asking yourself, "what does he mean by ...
user avatar
14 votes
24 answers
2k views

There's more than one way to skin a set

Given a set of positive integers \$ S \$, output the set of all positive integers \$ n \$ such that \$ n \$ can be made by summing a subset of \$ S \$ in more than one different way, i.e., that are ...
user avatar
  • 22.2k
4 votes
1 answer
148 views

BitCycle Metagolf

Background BitCycle is a two-dimensional Turing-complete programming language involves moving bits around a playfield. Because I am too lazy to write BitCycle programs myself, you will be writing a ...
user avatar
  • 5,712
18 votes
23 answers
3k views

Crossing a Lily Pond

The Narrative You are a frog who is at the edge of a pond with waterlilies. You would like to cross the pond without getting wet, so you plan to jump from lily to lily. There is, however, one problem: ...
user avatar
  • 1,357
11 votes
9 answers
413 views

Convert Alpha-2 to Alpha-3

The Task The task is easy: given an Alpha-2 country code, output the Alpha-3 equivalent. The input may be in any case you choose, and the output in any consistent case of your choosing. Here are the ...
user avatar
  • 3,347
-3 votes
2 answers
197 views

King of the Hill: Greed Control [duplicate]

King of the Hill: Greed Control What is Greed Control Greed control is a multiplayer round-based game in which in every round, a player bet a number inside a ...
user avatar
7 votes
2 answers
264 views

Write a (simplified) BitCycle interpreter

Implement a function or program that can run simplified BitCycle code. The functions you must implement are: <^>v: Change the direction of a bit to the ...
user avatar
  • 1,308
11 votes
14 answers
1k views

Draw the Archimedean Spiral

Overview I was playing with Desmos and discovered a really cool spiral: Doing some research, I discovered that this spiral was the Archimedian spiral. Every point on the spiral is exactly \$\theta\$ ...
user avatar
  • 3,347
10 votes
15 answers
338 views

center a matrix [closed]

The words "center a" probably give flashbacks to any decent HTML developer. Luckily, we are not working with divs, we are working with matrices. Given a matrix where w=h, and given a "...
user avatar
  • 691
8 votes
6 answers
269 views

Random Pixels Image Compression

Challenge: Given an integer \$n\$, guaranteed to be \$\geq2\$ and a power of 2, we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of \$n\$ ...
user avatar
21 votes
13 answers
2k views

Bitwise XOR of floats

This is different from Floating Point XOR, and more in the spirit of a comment by R.. GitHub STOP HELPING ICE on that challenge, but I thought of this idea independently. Generalized XOR The bitwise ...
user avatar
-4 votes
2 answers
77 views

Is it a good chord?

Is it a good chord? Definition of a chord: We define a chord as three notes together. Definition of a ...
user avatar
4 votes
18 answers
2k views

Palindromic Powers

Powers We define an important power as a number that can be represented as \$ x^y \$ where \$ x ≥ 2 \$ and \$ y ≥ 2 \$. Palindrome We define an ...
user avatar
27 votes
5 answers
4k views

Haplololololololology!

Haplology Haplology is a linguistic term: the omission of one occurrence of a sound or syllable that is repeated within a word, for example probly for probably. For this challenge, it means ...
user avatar
14 votes
10 answers
1k views

Storing a band matrix

Related challenge A band matrix is a matrix whose non-zero entries fall within a diagonal band, consisting of the main diagonal and zero or more diagonals on either side of it. (The main diagonal of a ...
user avatar
  • 33.3k
-3 votes
6 answers
493 views

Connecting Dots

Connecting Dots We define a type of question on the test, connecting the dots Question parameters There are two parameters. Suppose they are 5 and ...
user avatar

15 30 50 per page