All Questions

Filter by
Sorted by
Tagged with
13
votes
1answer
201 views

Buildings made from cubes

In this fastest-code challenge, you are provided with a set of \$n\$ identical blocks and need to determine how many unique buildings can be constructed with them. Buildings must satisfy the following ...
2
votes
0answers
141 views

Cutting Sequence for N dimensions

Inputs: The program or function should take 2 vector-like (e.g. a list of numbers) O and V of the same number of dimensions, and a number T (all floating-point numbers or similar) Constraints: T >=...
16
votes
22answers
991 views

Smallest number such that concatenation is a square

Challenge Write a program or function that takes a number \$n\$ and returns the smallest \$k\$ such that concatenation \$n'k\$ is a square. This sequence is described by A071176 on the OEIS. I/O ...
-4
votes
0answers
45 views

Time complexity of combinations of n pairs of parentheses [closed]

I have the following code snippet for combinations of n pairs of parentheses. ...
14
votes
10answers
1k views

Are the beams above or below the notes?

In musical notation, groups of notes shorter than one beat are joined together by a line at the bottom called a beam. Here are a few bars of music with the beams highlighted: (Taken from Second Suite ...
0
votes
12answers
2k views

Move my liquid to make me equal

You are given 4 positive integers: volume of the first container (v1), volume of the second container (v2), volume of the liquid ...
11
votes
8answers
551 views

Spotify Shuffle (music playlist shuffle algorithm)

Background Perfect shuffle algorithms like Fisher-Yates shuffle don't produce great results when it comes to music playlist shuffling, because it often produces clusters of songs from the same album. ...
9
votes
3answers
434 views

Keta Bracket Autocompletion

Special thanks to Bubbler and AdmBorkBork for supplying feedback about this challenge Keta (Keyboard tacit — clever naming, I know!) is a golfing language I’ve been working on recently. One of it’s ...
-6
votes
0answers
45 views

Please help with this C++ question [closed]

write a program that loads 10 values from a file and computes the average. you should only open the file once. C++
20
votes
17answers
7k views

99 ways to say “I love you”

Inspired by this blog post. Write a program that outputs 99 distinct programs (in the same language) that output the string I love you. How the programs are ...
-2
votes
0answers
56 views

What is the correct complexity of All paths from Source to Target DFS solution [closed]

The question: "Given a directed, acyclic graph of N nodes. Find all possible paths from node 0 to node N-1, and return them in any order." The DFS solution is described here. https://leetcode.com/...
4
votes
1answer
277 views
+50

Average number of strings with Levenshtein distance up to 4

This is a version of this question which should not have such a straightforward solution and so should be more of an interesting coding challenge. It seems, for example, very likely there is no easy ...
16
votes
10answers
349 views

Decomposition of a matrix in \$ SL_2(\mathbb{Z}) \$

Background The special linear group \$ SL_2(\mathbb{Z}) \$ is a multiplicative group of \$ 2 \times 2 \$ matrices whose elements are integers and determinant is 1. It is known that every member of \$...
0
votes
0answers
143 views

In any compiled language, generate as much assembly as possible in under 80 characters [closed]

challenge: for any selected compiled language, write a program that compiles to as many lines of assembly as possible. Ideally, use Godbolt.org to find out how much assembly is generated. Rules: ...
6
votes
14answers
1k views

Print out execution time of program [closed]

Challenge Write a complete program that prints out the time it took to execute a certain part of itself. That part must include a process whose total number of operations (and therefore execution ...
1
vote
0answers
46 views

Compositional inverse of a power series [duplicate]

If \$f(x) = x + \sum_{i>1} a_ix^i\$ and \$g(x)=x+\sum_{i>1}b_ix^i\$ then there is a composite power series \$f(g(x))\$ also of this form. Given a power series \$f\$ the goal is to find a ...
-2
votes
0answers
44 views

count all pair of vertex with constraints in an undirected graph [closed]

I'm struggling with an algorithmic puzzle: given a graph with N vertex and N edges I've to count all pairs of vertex (A,B) with the following properties: A>B and exists at least one path made of all ...
16
votes
18answers
5k views

Largest monetary amount impossible to make with two types of coin

Suppose we have two different types of coin which are worth relatively prime positive integer amounts. In this case, it is possible to make change for all but finitely many quantities. Your job is to ...
3
votes
2answers
162 views

Inter-language 2-cycle quine [duplicate]

Challenge Create 2 programs A and B The output of program A is exactly program B The output of program B is exactly program A Neither program should depend on inputs to yield the correct output A ...
19
votes
15answers
805 views

Cartesian LCM of two arrays

Given two nonempty arrays of natural numbers \$a\$ and \$b\$, return the shortest nonempty array of pairs of natural numbers \$q\$ such that the sequence of first elements of \$q\$ consists of a whole ...
24
votes
40answers
3k views

Convert a 32 bit binary IPv4 address to its quad-dotted notation

Challenge Write a program or function that converts a 32 bit binary number to its quad-dotted decimal notation (often used for representing IPv4) Quad-dotted decimal A quad-dotted decimal is formed ...
5
votes
3answers
168 views

Recreate a simplified version of the card game L.L.A.M.A

In LLAMA, you want to dump cards from your hand as quickly as you can, but you might not be able to play what you want. Each player starts a round with six cards in hand; the deck consists of llama ...
9
votes
16answers
3k views

How many ACUs do I have?

Posted from sandbox The Intro What is an ACU? This challenge is based on the concept of money and since this is an international community, we all use different currencies, so in keeping with our ...
-6
votes
13answers
323 views

Dissect a word and arrange all its letters in alphabetical order

Question Write a program to accept one string on the console only and print back its letters arranged in alphabetical order. The string must only have the following characters: ...
-4
votes
5answers
236 views

Signpost reading [closed]

Challenge source: My: https://testovac.ksp.sk/tasks/ls18-signpost/download/ dated 11. 7. 2016 SPOJ: https://www.spoj.com/problems/SIGNPOST/ dated 2018-03-22 Challenge definition == Example input/...
15
votes
6answers
3k views

What's the Mayan date?

Just over seven years ago, everybody suddenly stopped talking about the Maya people. It is time to rectify that! For clarification, I am talking about the Mesoamerican Long Count Calendar. Your ...
12
votes
7answers
447 views

Make a random drum loop

Do randomly generated drum loops sound good? A drum loop is a \$5\times 32\$ matrix \$A\$ of \$1\$s and \$0\$s such that \$A_{1,1}=A_{1,17}=A_{2,9}=A_{2,25}=1\$, for each \$i\$, the \$i\$th row has ...
14
votes
15answers
4k views

Drum fill generator

Create a program that generates a drum fill. Your program will output a pattern of L (left hand hits), 'R' (right hand hits), and ...
4
votes
2answers
1k views

Shortest Solution in Python 3 for Caught Speeding - CodingBat

I am trying to find the shortest code in python 3, to solve this problem: You are driving a little too fast, and a police officer stops you. Write code to take two integer inputs, first one ...
14
votes
8answers
1k views

Is this quadrilateral tangential?

Related: Is this quadrilateral cyclic? Background A tangential quadrilateral is a quadrilateral which has an incircle: Examples include any square, rhombus, or a kite-like shape. Rectangles or ...
27
votes
10answers
6k views

Write a program that sees the New Year in itself

Write the smallest program that maps strings injectively to outputs and maps itself to 2020. To be clear, your program \$p\$ must have the following properties: every possible input string \$s\$ has ...
9
votes
4answers
476 views

When is Hannukah?

Input The input will be a year between 1583 and 2239. We just want to know when Hannukah was or will be in that year. This is information used by millions of people every year and put in calendars ...
30
votes
22answers
3k views

Generate a Nine-Ball Pool rack

Introduction Nine-Ball is a popular pool game played casually and as a competitive sport. There is one of each numbered ball, with the numbers 1 to 9. The game starts with all 9 of the balls in a ...
2
votes
3answers
178 views

Partial tq interpreter

In this task you are expected to provide a list output given an input tq program. The tq programs will not contain whitespace inside them. What is tq, in the first place? tq is a lazy-evaluated ...
14
votes
9answers
392 views

Partitioning Digits into Distinct Integers

Given a sequence of base-10 digits, output the longest list of integers that contains all the digits exactly once, in the order in which they appeared in the input, without repeating any integers. ...
9
votes
10answers
369 views

Integer Keys and Duplicates

Given a non-empty list/vector of positive integers, write a function to check the following conditions in as few bytes as possible. Take the first integer (the key, or k1) and check that the next k1 ...
9
votes
1answer
361 views

Caddyshack or: How to compress already-golfed code

In golf, a knowledgable caddie helps an already good golfer to be even better. In this challenge, you build a "caddie" to help you code golf. In particular, your caddie will compress golfed code in ...
-2
votes
2answers
223 views

Shorten String as Much as Possible [closed]

Introduction In a list of strings, there is a certain length you can shorten strings to before they become indistinguishable. This is a pretty bad explanation, so here is an example. ...
11
votes
9answers
671 views

Random spanning tree of a rectangular grid

Significantly harder version of Spanning tree of a rectangular grid. Background A spanning tree (Wikipedia) of an undirected graph is a subgraph that is a tree which includes all of the vertices of ...
22
votes
11answers
1k views

Random triple with uniform marginals

Output a random triple \$(x,y,z)\$ of real numbers such that \$x+y+z=\frac{3}{2}\$ Each of \$x,y,z\$, taken alone, is uniformly distributed from \$0\$ to \$1\$. Please explain in your answer what ...
10
votes
4answers
1k views

Can you calculate the average Levenshtein distance exactly?

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. The challenge is to compute ...
0
votes
1answer
173 views

Determine if a number is less than another [closed]

Introduction Your job is to write a function or program that detects if a number a is less than a number b. But... You are not ...
8
votes
4answers
708 views

Polyglot self-interpreter time

Your task is to make a program which interprets the language it is run in, but also works in many languages. Let's say you make a Brainfuck-Underload self-interpreglot, as it will be called. Run in ...
5
votes
3answers
329 views

Swaps to Sort an Array

You are given an array \$A\$, which may contain duplicate elements. In each swap, you may swap the value of any two indices \$i, j\$ (i.e. switch the values of \$A_i\$ and \$A_j\$). What is the least ...
3
votes
1answer
188 views

How Shuffled is this Sequence?

Given a sequence \$S\$ with length \$n\$ of exactly one each of whole numbers from \$1\$ to \$n\$, your task is to return a number \$\sigma\$ indicating how shuffled it is. Definition of shuffledness ...
5
votes
1answer
488 views

Average number of strings with Levenshtein distance up to 3

The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. Given a binary string \$S\$ of ...
27
votes
37answers
2k views

CahartcreS awppnig (Character Swapping)

Intro/Background I was looking at "You Had One Job" pictures lately, and noticed an old favourite of mine: And I said to myself: "I need a program that can generate text like that". So I devised a ...
9
votes
1answer
244 views

Maximal 2-distance Sets

In the plane (\$\mathbb R^2\$) we can have at most five distinct points such that the distances from each point to every other point (except itself) can assume at most two distinct values. An example ...
28
votes
15answers
3k views

.-…--..---.-…--… the red-nosed reindeer

Can you recover a sequence of letters from a sequence of dots and dashes? In Morse code, x is represented by -..-, but without ...
13
votes
0answers
362 views

Is this ordinal prime?

You are given an countable ordinal \$1 < r < \varepsilon_0\$. Determine whether or not it is prime. If not, provide exactly two ordinals \$r_0, r_1 < r\$ such that \$r_0r_1 = r\$, following ...

15 30 50 per page