Questions tagged [fastest-code]
The winner of a fastest-code challenge is determined by the runtime performance of the submissions. For fairness, all submissions should be benchmarked on the same machine, which usually means all submissions have to be tested by the host of the challenge. Alternatively, the submission can be compared to a reference program. For scoring by asymptotic time complexity, use [fastest-algorithm] instead.
216 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-5
votes
4
answers
221
views
Locate \r\n\r\n in a HTTP/1.1 POST request
Given an HTTP/1.1 POST request represented as a buffer (e.g., Uint8Array; uint8_t) of bytes, ...
6
votes
1
answer
582
views
Can you beat numpy convolve?
The task is to compute the convolution of an array with itself as quickly as possible. The array will contain 80-bit extended precision long doubles and I will specify how the array is to be created. ...
4
votes
4
answers
573
views
Find the boolean logic to check if a number is prime!
Your task is to find a boolean expression that uses AND (\$\land\$), OR (\$\lor\$), XOR (\$\oplus\$), and NOT (\$\lnot\$) operators and binary digit positions (\$d_1,d_2,d_3,d_4,d_5,d_6,d_7,d_8,d_9,d_{...
2
votes
4
answers
297
views
Find the busiest unfriendly matrix
This is about \$n\$ by \$n\$ binary matrices. Call a pair of rows unfriendly if the Hamming distance between the two rows is larger than the number ones they have in common positions. Let us call a ...
7
votes
2
answers
551
views
Count the possible folds of an n² grid
Update: 8x8 case from @gsitcia has finished! according to that code, there are 162,403,827,553,180,928 ways it could be folded. now to get it into the oeis...
Inspired by this recent video, I figured ...
4
votes
4
answers
636
views
Fill in matrices for matrix bit flipping as quickly as possible
Consider an n by n binary matrix. If it has rank r <= n, then we want to compute the largest number bits flips necessary to reduce its rank to a specific value. All computations should be done ...
3
votes
4
answers
595
views
Create 251610 matrices as quickly as possible
There are 251610 6 by 6 binary matrices that are inequivalent. We say two matrices are equivalent if there is some permutation of their rows and/or columns that makes them equal.
For example:
...
8
votes
6
answers
1k
views
Pólya trees counted efficiently
The number of unlabeled rooted trees with n nodes is a fundamental sequence in graph theory and in discrete mathematics in general.
Some authors call these trees 'Polya trees'. The number of these ...
2
votes
3
answers
339
views
Non-Decreasing Fibonacci Sequence modulo M
Given integers \$a,b,m, k, n\$ and array \$F = (f_1, f_2,...,f_n)\$ defined as:
\begin{cases}
f_1 = \text{a}\\
f_2 = \text{b}\\
f_i = (f_{i-1} + f_{i-2}) \text{ mod m},∀i > 2
\end{cases}
When \$F\$ ...
12
votes
6
answers
2k
views
9-16-25 2D Matrix
Given three grids and the sum of rows and columns of each grid, your task is:
Grid ×ばつ3\$: Fill the grid from \1ドル\$ to \9ドル\,ドル ensure no repeats within the grid.
Grid ×ばつ4\$: Fill the grid from \1ドル\...
user avatar
user123147
0
votes
3
answers
565
views
Sum of Positive and Negative Powers of 2
Given a binary string equivalent to \$n\,ドル write out the least possible number of terms needed to express \$n\$.
A term is defined as an addition of either \2ドル^k\$ or \$(-2^k)\,ドル where \$k\$ is a non-...
user avatar
user123116
3
votes
4
answers
792
views
Fastest count of certain hypercubes with labeled vertices
CHALLENGE
This is a fastest-code challenge.
Count how many n-dimensional hypercubes with n=1,2,3,4 exist, with vertices labeled with either 1 or 0, such that there does not exist any rectangle formed ...
2
votes
2
answers
275
views
Binary expansion and partition numbers [closed]
Not sure if it's correct to ask such a question on this site, but let's try.
Let a(n) be a sequence of positive integer such that a(1) = 1. To reproduce the sequence a(n) through itself, use the ...
user avatar
user104951
10
votes
5
answers
2k
views
Random factorized numbers
Input
The code should take an integer \$n\$ between 1 and 1000.
Output
The code should output positive integers with \$n\$ bits. Accompanying each integer should be its full factorization. Each ...
6
votes
6
answers
926
views
Count the size of the Levenshtein neighborhood
Input
A binary string \$s\$ of length \$n\$ and a positive integer \$k \leq n\$.
Output
The number of binary strings with Levenshtein distance exactly \$k\$ from the string \$s\$.
Example outputs
Each ...