All Questions
13,586
questions
8
votes
1
answer
72
views
How many xor'ed waves?
In this challenge, you're given a list of overlapping waves. Each wave is a finite list with n truthy values, then n falsy ...
6
votes
0
answers
109
views
Record Least Uncommon Multiple Counts
The Greatest Common Divisor, or gcd, of two positive integers \$x\$ and \$y\$ is the largest positive integer that divides both \$x\$ and \$y\$.
The Least Common Multiple, or lcm, of two positive ...
4
votes
1
answer
193
views
Qat Equation Solver
Qat is a tool that lets you search for words matching a given pattern, often used by crossword and other word puzzle writers and solvers.
In this challenge, you will have to implement a specific part ...
8
votes
5
answers
607
views
On The Subject Of Simon Says
This challenge is from a game, Keep Talking And Nobody Explodes.
This is like one of those toys you played with as a kid where you have to match the
pattern that appears, except this one is a knockoff ...
25
votes
5
answers
1k
views
Detect sonar imposters
You are the sonar captain aboard an underwater submarine. The way sonar works is that every submarine sends out a ping at regular intervals. Each interval is a whole number of seconds. Each submarine ...
-8
votes
0
answers
74
views
I challenge you to write a decorator which flattens inputs, accepts strings, and rounds floats to integers within machine epsilon [closed]
There is an ancient exercise which used to be given to students to write a recursive function named pow which calculates things such as ...
13
votes
5
answers
495
views
Draw the GKMS aperiodic tile
Chaim Goodman-Strauss, Craig Kaplan, Joseph Myers and David Smith found the following simple (both objectively and subjectively) polygon that tiles the plane, but only aperiodically:
Indeed they ...
13
votes
4
answers
1k
views
Is it a Frog List?
Challenge:
A Frog List is defined by certain rules:
Each frog within a Frog List has an unique positive digit [1-9] as id (any 0...
6
votes
0
answers
126
views
Find the linear transformation
Given a set of bit vectors \$A\$ and a binary matrix \$M\$, we can define the set \$MA = \{ Mx : x \in A \}\$, where \$ M x \$ is the result of the matrix multiplication of \$ M \$ by \$ x \$ over \$\...
-1
votes
0
answers
70
views
Bash on *nix: bi-directional sorted mapping with adding single key [closed]
Write code in most recent Bash 4, may use POSIX utilities or coreutils.
You can reserve up to 20 global variable names.
Neither kind A nor kind B string values contain newlines or null characters.
...
5
votes
4
answers
757
views
A randomly colored walk
Given two inputs, a distance \$d\$ and a number \$n\$ output a list of \$n\$ random colors which each have distance \$d\$ from the previous.
Background
A random walk is a path which is defined by ...
-7
votes
1
answer
132
views
Do absolutely nothing [closed]
Write a program that has at least one byte that, when run, does absolutely nothing.
I thought this would be done by now, but I can't find any other challenges like this.
How to tell if it does nothing:...
5
votes
2
answers
309
views
Shortening this Code to process nested tuple even further without the use of max()
I have the code:
...
9
votes
9
answers
2k
views
Great Leap to the Right
Given a string s consisting of characters a-z lowercase, generate 5 arrays a1, a2, ...
19
votes
47
answers
4k
views
Implement the `<=>` three-way comparison operator on numbers
In C++, there exists a a <=> b three-way comparison operator that, for numerical types, does the following:
If a < b, ...
7
votes
1
answer
148
views
Is there any less code way to make a leaf (eye) shape in CSS?
I'm trying to solve a CSS challenge. It contains a rotated leaf shape (looks like an eye). Score for the challenge depends on amount of characters of the code. Here's my way to make a leaf shape:
<...
16
votes
7
answers
2k
views
We're gonna need a bigger podium!
If \$R\$ runners were to run a race, in how many orders could they finish such that exactly \$T\$ runners tie?
Challenge
Given a positive integer \$R\$ and a non-negative integer \$0\leq T\leq {R}\$ ...
-1
votes
1
answer
76
views
Write a typeracer [duplicate]
Description
a typeracer is an apps where user could type and evaluate their typing speed and accuracy.
Criteria
User could type "A quick brown fox jumps over the lazy dog."
A visual ...
15
votes
16
answers
1k
views
How long to carry sort?
Carry sort is an \$O(n)\$ "sorting" algorithm. Here's how it works. The algorithm moves left to right along a list. As it traverses a list it "carries" a single item, the largest ...
28
votes
12
answers
3k
views
Is it a valid chemical?
Non-metals typically* have a fixed number of covalent bonds in every chemical they are part of. Given the number of bonds every element requires, output whether it's possible to construct a single ...
1
vote
0
answers
152
views
How to efficiently count all powers of 2 in a given set of numbers in vb.net?
Every integer can be expressed in powers of 2. You know this as the binary system
Assume you are given a set of k numbers ...
3
votes
4
answers
809
views
Write the smallest possible code in x86-64 to implement the "<=>" operator
Languages, such as C++, have introduced a new comparison operator: <=>.
This operator returns -1, 0, or 1 when comparing two items together:
-1 means the ...
28
votes
13
answers
2k
views
Is it traversable?
Imagine that a list of integers describes the heights of some two-dimensional terrain as seen from the side.
Stamina: [ 4 4 4 4 4 4 3 3 3 3 2 2 2 - ]
O
...
12
votes
6
answers
734
views
Mapping Passing Through Point
(Inspired by this challenge.)
Given six real values in three pairs: \$(x_1, x_2), (y_1, y_2),\$ and \$(x_0, y_0)\$, where \$x_1 < x_0 < x_2\$ and \$y_1 < y_0 < y_2\$, create a function ...
9
votes
2
answers
377
views
Guess The Array
Problem author: https://stats.ioinformatics.org/people/5815
You are given a system with a hidden permutation of the numbers \$1, 2, 3, \ldots, n\$. Your task is to guess this permutation by asking the ...
4
votes
2
answers
177
views
Ragged list pattern matching, Part 2
This is a sequel to Ragged list pattern matching. In this challenge, the wildcard may match a sequence of items of any length instead of just a single item.
Given a pattern and a ragged list of ...
15
votes
5
answers
868
views
Detect round trips on a hyperbolic grid
You're driving a car in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to continue left, ...
10
votes
7
answers
764
views
Language Word Checker
Develop a program to check if a given word is part of a language defined by the following rules:
The language has a set of rules.
The empty string is considered a valid word in the language.
Two ...
13
votes
6
answers
713
views
Guessing on straws
Dedicated to Martin Gardner, taken from his book
Background
In the old days, the Slavs had a divination method for finding out whether a girl would get married. The girl would clutch six straws in her ...
15
votes
17
answers
1k
views
Sophie Safe primes
Description
Write a program or function that takes in a positive integer \$n\$ as input and outputs all Sophie Germain primes that are safe primes less than or equal to \$n\$. A prime number \$p\$ is ...
19
votes
19
answers
1k
views
"Sort" by element duplication
Inspired by one of many bugs I ran into while implementing selection sort in trilangle.
Given a non-empty list of non-negative integers, "sort" the list using the following procedure:
Find ...
19
votes
8
answers
1k
views
Bringing Down the Building
We are going to bring down an imaginary building with a series of explosions. Our building is a 5x5 matrix of integers ranging 1-9, each representing a single brick.
The challenge is to set of a ...
3
votes
1
answer
174
views
Triangularly embed a graph on a surface
This challenge arises from a claim made in a MathOverflow answer and a paper linked in that answer which seems to back up the claim:
Searching for triangular embeddings is much quicker than ...
12
votes
2
answers
258
views
Classify a surface from its fundamental polygon
This question is an extension of Who's that Polygon? to arbitrary numbers of sides.
A fundamental polygon for a surface is an polygon with a prescribed pairing for all its \$2n\$ sides, each ...
0
votes
6
answers
389
views
Generate number from given range
Your function must accept three numbers in any order:
A signed real number (or ±Infinity) - The number (N) for which you have ...
14
votes
15
answers
1k
views
Imtiaz Germain Primes
Description
"Imtiaz Germain primes" is not a technical name in Mathematics, but my weird creation, in the memoir of the famous mathematician Sophie Germain. These primes can be generated by ...
9
votes
33
answers
2k
views
Counting Letters in a String
Write a program or function that takes in a string and outputs a count of each modern English alphabet letter in the string, case-insensitive.
Input: A string consisting of printable ASCII characters (...
6
votes
24
answers
387
views
String with the smallest sum of ASCII values
Description
In this challenge, you need to write a function that takes in a list of strings and returns the smallest string based on their ASCII value. You should assume that the input list contains ...
10
votes
3
answers
269
views
Just Friends… in code golf
We already have challenges dealing with simulating vanilla Conway's Game of Life, Wireworld and rule 110, but so far none corresponding to a (specific) non-totalistic rule. So here is one.
In June ...
10
votes
3
answers
541
views
Voronoi-Lloyd ASCII art [closed]
Voronoi diagram is a partition of a plane (or part of plane) into regions close to each of a given set of objects ("seeds").
Here we’ll be dealing with discrete arrays or even rather with ...
-1
votes
5
answers
273
views
Mirror a String in Place
Write a program that takes a string as input and modifies it by reversing the string in its place by mirroring the position. The first position goes to last, second to second last and so it goes on. ...
15
votes
13
answers
2k
views
Tips for golfing in SVG
SVG is an XML vector graphics markup language embeddable in web content.
Your tips should be at least somewhat specific to SVG.
Please post one tip per answer.
4
votes
1
answer
281
views
Generate all possible equations with 10 characters
Nerdle is a Wordle variant, in which instead of words, the answers are equations. Each equation entered in the game must be a valid one.
Examples: 13³-1=2196, ...
2
votes
0
answers
130
views
Custom Games of Life
There's a lot of questions about Conway's Game of Life, but nothing about customization (Related: 2-Player Life). Given an input, determine the result on a 100x100 grid after some iterations. The ...
16
votes
7
answers
1k
views
Largest Binary Area
Take the sequence of all natural numbers in binary, (1, 10, 11, ..) then write them vertically beside each-other like this (least significant bit on top; 0s have ...
10
votes
6
answers
2k
views
Draw Parcly Taxel's cutie mark
I've been a fan of My Little Pony: Friendship Is Magic for a long time, and very early on I created a pony version of myself also called Parcly Taxel (warning: may be too cute to look at). The symbol ...
-8
votes
2
answers
214
views
Find the average, median, mode, and range
It's easier to put this into coding terminology, so here we go:
First find the average, median, mode, and range.
Then, put those values in another array, then find the new average, median, mode, and ...
5
votes
2
answers
212
views
Canonical form of a cubic Bézier curve
On Pomax's Primer on Bézier Curves this "fairly funky image" appears:
This is related to the fact that every cubic Bézier curve can be put in a "canonical form" by an affine ...
4
votes
1
answer
154
views
Encrypt AES256 (ECB Cipher Mode)
I've looked and could not find a post for this, if there is one, I'll remove it quick! Related and also related
The goal is (hopefully) clear: create the shortest code (in bytes) that implements the ...
0
votes
0
answers
87
views
Shape Animation
In PowerPoint, there's just one overly used feature: animations. For simplicity, that shape will be a non-rotated rectangle.
The data is specified as an array of eight integers: ...