All Questions

Filter by
Sorted by
Tagged with
9 votes
19 answers
90 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
  • 18.5k
13 votes
23 answers
552 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
  • 10.9k
25 votes
30 answers
3k 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
  • 501
15 votes
16 answers
807 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
12 votes
8 answers
828 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
  • 84.9k
15 votes
24 answers
3k 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
  • 150
13 votes
10 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
  • 4,086
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
  • 84.9k
6 votes
24 answers
2k views

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

Introduction If fib(x) calculates the xth Fibonacci number, write a program that calculates ...
user avatar
  • 185
-1 votes
0 answers
91 views

Find the Lowest Allowable Integer Which is an Optimal Even-Harmonic of the Values in a List [closed]

PROBLEM For a list of numbers, list: Find the lowest possible integer, x, which is optimally close to the whole number even-...
user avatar
14 votes
13 answers
701 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
  • 84.9k
6 votes
2 answers
193 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
  • 991
8 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
22 votes
26 answers
2k 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
  • 519
15 votes
19 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,260
6 votes
1 answer
251 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,260
1 vote
1 answer
198 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,224
12 votes
8 answers
748 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,121
16 votes
25 answers
1k 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
131 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
23 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
  • 18.5k
4 votes
1 answer
131 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
  • 3,890
16 votes
23 answers
2k views
+200

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
  • 985
12 votes
9 answers
327 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
  • 2,497
-3 votes
2 answers
143 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
  • 519
7 votes
2 answers
240 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,260
10 votes
13 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
  • 2,497
10 votes
15 answers
325 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
230 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
20 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
60 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
  • 519
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
  • 519
27 votes
5 answers
3k 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
  • 31.8k
0 votes
6 answers
451 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
  • 519
18 votes
6 answers
2k views

Matrix Meets ASCII Art

A binary matrix represents a shape in the plane. 1 means a unit square at that position. 0 means nothing. The background is 0. For example, the array ...
user avatar
  • 519
15 votes
7 answers
1k views

Euler characteristic of a binary matrix

A binary matrix represents a shape in the plane. 1 means a unit square at that position. 0 means nothing. The background is <...
user avatar
  • 32.8k
20 votes
8 answers
2k views

ASCII-Art n'th Root

Challenge: Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal ...
user avatar
1 vote
1 answer
361 views

Best performance on x/(y+z) + y/(x+z) + z/(x+y) = N

Consider the equation $$\frac x {y+z} + \frac y {x+z} + \frac z {x+y} = n$$ for positive integers \$x, y, z\$ and \$n \ge 4\$. Your code will receive \$n\$ as an input, and output three integers \$x, ...
user avatar
  • 519
5 votes
9 answers
317 views

I Need Moore(less) Chips

If you wanted to compute a very large long problem, that on a machine that you could buy today for an inflation adjusted price, will take some amount of years/decades. The issue is, if you only have ...
user avatar
  • 457
9 votes
2 answers
310 views

Sorting passengers on a plane

A few days ago I made a puzzle about moving people on an airplane. Now I am interested in the general version of this puzzle and the shortest code golf for it. I will briefly summarise the puzzle here....
user avatar
12 votes
5 answers
434 views

Unshuffle my poker chips

This part is somewhat detached from the actual array manipulation side of the challenge, scroll down for an explanation that is much more array-based You've been learning how to shuffle poker chips ...
user avatar
26 votes
28 answers
2k views

Derivative of a product

In calculus, the derivative of a mathematical function defines the rate at which it changes. The derivative of a function f(x) can be marked as ...
user avatar
  • 27.3k
21 votes
16 answers
4k views

Who needs 8 bits for one character?

Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed ...
user avatar
  • 4,086
14 votes
6 answers
658 views

Rounding a range

You have a line with two endpoints a and b (0 ≤ a < b) on a 1D space. When ...
user avatar
  • 2,121
15 votes
25 answers
1k views

Implement the Conjunction of a Three-Valued Logic

Your task, should you choose to accept it, is to take two input values \$a\$ and \$b\$, where \$a\$ and \$b\$ are in the set \$\{T, U, F\}\$, and compute and output their logical conjunction in a ...
user avatar
  • 1,021
11 votes
7 answers
638 views

Shortest restricted superstring

Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$. There are almost always multiple possible ...
user avatar
  • 18.5k
12 votes
7 answers
1k views

Is Wally there?

Inpired by recent Stand-up Maths' video. Task Wrapping a list x can be seen as inserting "line-breaks" into x every <...
user avatar
  • 10.9k

15 30 50 per page
1
2 3 4 5
262