Newest Questions
14,357 questions
12
votes
4
answers
1k
views
Efficiently navigate a 6 sided die
An ant needs help moving around specific faces on a 6 sided die in order. Write a program or function which, given a series of numbers between 1 and 6, outputs the shortest set of instructions to ...
4
votes
0
answers
181
views
Find the factor to use for shortest simple Brainfuck data initialization loop
I like writing answers using Brainfuck, since this language basically simulates a Turing machine, and it is pretty challenging to find the shortest answer for any problem, since there are a lot of ...
11
votes
9
answers
869
views
All possible swaps for the permutation
Given a permutation of {1,2,...,n} named A, do each swap of form swap A[i], A[j] exactly once, where ...
6
votes
2
answers
143
views
Inequality region vertices with 4 equations
Given the following inequalities:
$$
\begin{align}
ax+by&\leq c\\
dx+ey&\leq f\\
gx+hy&\leq i\\
jx+ky&\leq l
\end{align}
$$
These inequalities enclose a region in the shape of a convex ...
10
votes
2
answers
220
views
Make a pretty cryptic crossword grid
Write a function/program that generates an aesthetically pleasing square cryptic crossword grid for a given size N. You do not need to include numbers.
The rules for aesthetically pleasing are:
The ...
15
votes
7
answers
1k
views
Draw all 11 cube nets
There are 11 ways of flattening a cube onto a flat surface, like a piece of paper, which can then be folded back up into a cube. Each of these is called a cube net.
Your task is to write a program or ...
21
votes
17
answers
1k
views
Convert a parent vector to a depth vector
Consider the following diagram of a tree structure, with each node numbered by its index in a depth-first pre-order traversal:
...
17
votes
13
answers
2k
views
Fix that slightly incorrect sum!
Oh no! A beautiful addition has been ruined by a typo.
Write a function which can fix a single incorrect digit in an otherwise correct sum.
Input
Three integers a, <...
12
votes
4
answers
1k
views
Who's that evolution?
Given two first generation pokemon names as input, write a function (or a whole program) that outputs a Truthy value if the second one is an evolution of the first one (and a Falsy value otherwise).
...
-6
votes
4
answers
302
views
Find the argmin of the cusum
Input
You will be given an array arr of length 10 of float64s. They will all be between -1 and 1.
Output
You must give the index in the array of the minimum value ...
12
votes
8
answers
737
views
Output the symmetric inverse semigroup
The symmetric inverse semigroup is a very important object in the study of semigroups, for a number of reasons, but most obviously due to the Wagner-Preston theorem. In brief, for any set \$X\$, the ...
0
votes
2
answers
243
views
minimum line queries in logarithmic time
Input
You are given 2 positive integers, n, q, followed by q queries. the queries can be of two forms:
0 a b: add the line a*x + b. a and b are integers between -...
8
votes
5
answers
2k
views
Tips for golfing in ☾ (Moon)
What general tips do you have for golfing in ☾ (Moon)? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to ☾ (e.g. "remove ...
12
votes
14
answers
1k
views
Generate the indices of the corners of the 12 face triangles of a cube
A cube has 6 faces. We can define it in terms of triangles only, by splitting each square face on the diagonal.
Each vertex of the cube is numbered 0 through 7. The coordinates of a vertex are that ...
9
votes
15
answers
1k
views
A121016: Numbers whose binary expansion is properly periodic. or A328594: Numbers whose binary expansion is aperiodic
I have been studying how to compress the Dis programs into their equvalent ones. One of the possibly easiest subset is programs with only } and ...