instruction stringlengths 34 53.1k |
|---|
Let \$S \subset \mathbb N_{\geq0}\$ be a subset of the nonnegative integers, and let $$
S^{(k)} = \underbrace{S + S + \dots + S}_{k\ \textrm{times}} = \{ a_1 + a_2 + \dots + a_k : a_i \in S\}.
$$
For example, $$\begin{align}
\{1,2,3\}^{(2)}
&= \{1+1, 1+2, 1+3, 2+1, 2+2, 2+3, 3+1, 3+2, 3+3\}\\
&=\{2,3,4,5,6\}
\end{align... |
Information
Given a non-negative odd integer (let's call it \$n\$), find the number of all possible paths which covers all squares and get from the start to end on a grid.
The grid is of size \$n\$×\$n\$.
The start of the path is the top left corner and the end is the bottom right corner.
You have to count the number ... |
Output the flattened version of the sequence A297359, which starts like the following:
1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 2, 4, 6, 4, 2, 1, 6, 10, 10, 6, 1,
1, 7, 16, 20, 16, 7, 1, 3, 8, 23, 36, 36, 23, 8, 3, 3, 11, 31, 59,
72, 59, 31, 11, 3, 1, 14, 42, 90, 131, 131, 90, 42, 14, 1,...
----------------
1,
... |
Gobar primes (A347476) are numbers which give a prime number when 0's and 1's are interchanged in their binary representation.
For example, \$10 = 1010_2\$, and if we flip the bits, we get \$0101_2 = 5\$ which is prime. Therefore, 10 is a Gobar prime
As simple as that: print the series with any delimiter. Shortest code... |
Input
4 integers w, x, y, z from the range -999 to 999 inclusive where none of the values is 0.
Output
4 integers a, b, c, d so that aw + bx + cy + dz == 0 where none of the values is 0.
Restrictions
Your output should be the solution with the smallest sum of absolute values possible. That is the smallest value of \$|... |
Inspired by a question (now closed) at Stack Overflow.
Given a square matrix, let its double trace be defined as the sum of the entries from its main diagonal and its anti-diagonal. These are marked with X in the following examples:
X · · X
· X X ·
· X X ·
X · · X
X · · · X
· X · X ·
· · X · ·
· X · X ·
X · · · X
No... |
Introduction
This challenge is about producing a code to count the frequency of bigrams in a text. A bigram is two consecutive letters in a text. For instance 'aabbcd' contains the bigrams aa, ab, bb, bc, cd once each. Counting bigram frequencies is super useful in cryptography. In a brute force algorithm, this code ma... |
Challenge
Build the Wheat Wizard's stove using 2-input NAND gates. The solution with the fewest NAND gates wins.
Externally, it works in the following way: (the first line is added from the original spec for physical output)
It has 10 levels, from 0 to 9. The display has 9 lights, and if the current level is L, exactl... |
In this challenge, you'll create some programs which behave similarly to genes. When you run one, it will return one of its two "alleles" (a half of its source code), and concatenating any two alleles from your programs will result in a new, functioning program (which returns its own alleles).
As an example, say you wr... |
We all know about the Fibonacci sequence. We start with two 1s and keep getting the next element with the sum of previous two elements.
n-bonacci sequence can be defined in similar way, we start with n 1s and take the sum of previous n elements to get the next element.
Challenge
Given a positive integer m > 1, output t... |
Background
Zeckendorf representation is a numeral system where each digit has the value of Fibonacci numbers (1, 2, 3, 5, 8, 13, ...) and no two consecutive digits can be 1.
Nega-Zeckendorf representation is an extension to this system that allows encoding of all integers, not just positive ones. Its base values are ne... |
Background
The recurrence of the Fibonacci sequence is defined as
$$
f(n+2) = f(n+1) + f(n)
$$
From this recurrence alone, the following gap formulae (recurrences relating three terms with certain amount of gaps) can be derived:
$$
f(n+4) = 3f(n+2) - f(n) \\
f(n+6) = 4f(n+3) + f(n) \\
f(n+8) = 7f(n+4) - f(n)
$$
You mig... |
Challenge
Given two integer values \$a \ge 2\$ and \$0 \le b < a\$, generate a \$(2a-1) \times (2a-1)\$ matrix consisting of the integers 0, 1, and 2 as follows:
Create a checkerboard of 0s and 1s of the given size, corners being 0.
If \$b > 0\$, overwrite the checkerboard with 2s in the X shape at the center, each le... |
All variables in this question are integer valued.
Input
4 integers w, x, y, z. They can be positive or negative and will be less than 1048576 in absolute value.
Output
The general solution to the equation.
\$ aw+bx+cy+dz = 0 \$.
The variables \$a, b, c, d\$ must all be integer values.
Output format
Your output should ... |
Write a function that accepts a rectangular grid of ids in any reasonable format, for example a multi-line string:
IIILOO
ILLLOO
and a string or list of box drawing charcters such as:
' ═║╔╗╚╝╠╣╦╩╬'
or
[0x20, 0x2550, 0x2551, 0x2554, 0x2557, 0x255a, 0x255d, 0x2560, 0x2563, 0x2566, 0x2569, 0x256c']
(see below for more... |
The goal is to create a generator generator [...] generator generator comprehension.
The generator must be created via generator comprehension.
The following expression must be valid for any number of nestings: next(next(next(next(next(generator))))).
The winner is whoever achieves this with the fewest number of byte... |
Based on this game.
Description :
Based on Wikipedia's description.
The 24 Game is an arithmetical card game in which the objective is to find a way to manipulate four integers so that the end result is 24.
For example, for the card with the numbers 4, 7, 8, 8, a possible solution is :
\begin{equation}
( 7 − ( 8 ÷ 8 ) ... |
Challenge
Generate the 2D sequence of bits of A141727. (Allowed I/O methods explained at the bottom.)
1
1 0 1
1 0 0 1 0
1 0 1 0 1 0 0
1 0 0 1 1 0 1 1 1
1 0 1 0 0 0 0 0 1 1 0
1 0 0 1 0 0 0 0 1 1 1 0 0
1 0 1 0 1 0 0 0 1 1 0 0 1 1 1
... |
Given an integer \$n \geq 2\$, print a triangle of height \$n\$ of (triangles of height \$n\$ of asterisks), as in this SO question.
For \$n=2\$, print:
*
***
* * *
*********
For \$n=3\$, print:
*
***
*****
* * *
*** *** ***
***************
* * ... |
I was trying to write a short MIPS32 code for computing the median of three registers.
The rules:
Assume that some values are pre-loaded into $t0, $t1, $t2.
The median of the three values should be placed in $t0.
No branches are allowed, but otherwise any instruction is okay.
You may arbitrarily modify the values of a... |
There is a division-free algorithm for computing determinants published by R.S.Bird in 2011 that uses only matrix multiplications. Given a \$n×n\$ matrix \$X\$, the matrix \$Y=μ(X)\$ is another \$n×n\$ matrix which entries are given by
$$Y_{i,j} = \begin{cases}
0 & \text{ if } j < i \\
X_{i,j} & \text{ if } j > i \\
-(... |
A triplet of real tensors \$(A,B,C)\$ of size \$\gamma \times \gamma \times \sigma\$ represents a matrix multiplication algorithm with \$\sigma\$ elementary multiplications iff the following function evaluates to zero:
$$ \text{error}(A,B,C) \equiv \sum_{i,j,k,l,m,n=1}^\gamma\left(\sum_{r=1}^{\sigma}{A_{ij}^r B_{kl}^r ... |
Given a positive integer \$n\$ and another positive integer \$b\$ (\$1 < b < 36\$), return the number of digits/length of \$n\$ in base \$b\$
1597 16 -> 3
1709 9 -> 4
190 29 -> 2
873 24 -> 3
1061 27 -> 3
289 26 -> 2
1575 34 -> 3
1135 15 -> 3
1161 22 -> 3
585 23 -> 3
1412 23 -> 3
1268 14 -> 3
714 12 -> 3
700 29 -> 2
100... |
Given two integer matrices a and b, your challenge is to replace any occurences of b in a with a matrix of the same size filled with 0s. For example:
Given:
a: [ [1, 2, 3],
[4, 3, 2],
[3, 5, 4] ]
b: [ [3],
[2] ]
b occurs once in a:
[ [1, 2, 3],
[4, 3, 2],
[3, 5, 4] ]
Fill that area with zeroes:
[ [1,... |
Similar to this.
Input a list and rotate N numbers in it given their indices. The following example uses 1-indexing, but feel free to use either.
In other words, take a list of indices and a list of numbers:
[1,2,3,4,5,6,7]
[1,3,6]
Separate out the elements at those indices:
[ 2 4 5 7]
1 3 6
Rotate those... |
Background
The summary of a non-negative integer \$n\$ is the concatenation of all digits that appear in \$n\$ in increasing order, with each digit being preceded by the number of times it appears in \$n\$.
Some Examples:
n -> summary(n)
1221 -> 2122 (2 ones, 2 twos)
1212 -> 2122 (2 ones, 2 t... |
Quell is a single-player grid-based puzzle game. Pearls are scattered across a 2D map and the aim is to collect them all by rolling a drop of water over them. For this challenge we will only consider basic maps containing the drop, pearls, walls, and empty spaces. (The full game includes a variety of additional objects... |
Given an integer n as input, write a function that dynamically allocates n bytes and returns their address.
Rules
The allocator must be able to dynamically allocate memory at runtime.
It doesn't matter where the memory is allocated to or in what form, as long as it's allocated in a valid location which can be read fro... |
The objective is to make the smallest SB3 file that can simply be imported into Scratch 3.0 without a "The project file that was selected failed to load" error. Any means can be used, like editing the JSON or better compression. Here's where I am with project.json, the only file inside mine:
{"targets":[{"isStage":true... |
Background
A bijective base \$b\$ numeration, where \$b\$ is a positive integer, is a bijective positional notation that makes use of \$b\$ symbols with associated values of \$1,2,\cdots,b\$.
Bijective base 2 representations of positive integers look like this:
1 -> 1
2 -> 2
3 -> 11
4 -> 12
5 -> 21
6 -> 22
7 -> 111
8 -... |
This code-golf challenge (and test cases) are inspired by the work of Project Euler users amagri, Cees.Duivenvoorde, and oozk, and Project Euler Problem 751. (And no, this isn't on OEIS). Sandbox
A non-decreasing sequence of integers \$a_n\$ can be generated from any positive real value \$\theta\$ by the following proc... |
Consider a non-empty binary matrix M and a natural number n. For the purposes of this challenge, M is said to have blockiness n if it can be built using adjacent square blocks of size n, where each block has equal entries; and it cannot be formed using square blocks of any larger size. Intuitively, n can be thought of ... |
Yes, I know there is a similar question, but this one specifically concerns any possible words, even with letters left over, while the linked one restricts to a permutation of the input
Objective
Have you ever had those moments in a Scrabble game where you're staring at your letters, trying to find a good word, and y... |
Background
J has trains similar to APL's. Given a sequence of verbs (functions), three rightmost verbs are grouped to form a derived verb (a fork) recursively, until one or two verbs remain. If the sequence has odd length, the entire train is a chain of forks. Otherwise, two verbs remain at the end, forming a hook.
... |
Challenge
Let's have a list L of n elements. The task is to swap every two elements in this list.
Constrains
the list L has at least two elements
size of the list L is a multiple of two (i.e. number of elements is even)
Example
input: [1,2,3,4,5,6]
output: [2,1,4,3,6,5]
input: [0,1,0,1]
output: [1,0,1,0]
Rules
... |
Alienese refers to two "languages" in the show Futurama. In actuality, they are two ciphers of English text with a pictographic alphabet. The first is a simple substitution cipher, but the second is slightly more complex. The second is a type of autokey cipher that follows these steps:
Take a word to be encrypted, e.g... |
I'm designing a new space station for generic super-villain purposes (something something megalaser), but I'm having trouble designing the solar panels.
My genius team of scientists can calculate exactly how many square meters of paneling we need to power the station, but the problem is our solar panels only come in sq... |
Given a sorted array of unique positive integers \$A\$ \$(A_0<A_1<\cdots<A_{n-1})\$, and an integer \$t\$, where \$A_0\le t\le A_{n-1}\$. Output the value \$i\$ such that:
If \$t \in A\$, \$A_i=t\$.
If \$t \notin A\$, \$ \left(i-\left\lfloor i\right\rfloor\right)\cdot A_{\left\lceil i\right\rceil} +\left(\left\lceil i... |
Consider all arrays of \$\ell\$ non-negative integers in the range \$0,\dots,m\$. Consider all such arrays whose sum is exactly \$s\$. We can list those in lexicographic order and assign an integer to each one which is simply its rank in the list.
For example, take \$\ell=7, s=5, m=4\$, the list could look like:
(0... |
I'm not really sure if this is the right place to ask this.
Now, I know I can convert a float to an int with int, but is there some shorter way?
|
Consider a linear system of equations, in \$n\$ unknowns, expressed as
$$A \textbf x = \textbf b$$
where \$A \in M_{n,n}(\mathbb Z)\$ is an \$n \times n\$ matrix of integers, \$\textbf x\$ is a column vector of unknowns \$(x_1, x_2, \dots, x_n)\$ and \$\textbf b = (b_1, b_2, \dots, b_n)\$ is a column vector of integers... |
Assume the result of an exam has been published.
After 5 minutes, First person knows the result.
In next 5 minutes, new 8 persons know the result, and in total 9 know it.
Again after 5 minutes, new 27 people know, and total 36 know.
In similar fashion, total 100, 225..... people keep knowing it on 5 minute interval.
Ch... |
I am trying to push my limits of making a python code as short as possible.
I left the readability part way behind.
I was attempting the K-Goodness String problem from Round A of Google Kick Start 2021.
The following was my initial solution:
def func(N, K, S):
if not S: return 0
y = 0
for i in range(N//2)... |
Your input will consist of an 18×18 image in any reasonable format, containing a horizontally and vertically centered 14px Roboto Mono character. This can be any of 94 printable ASCII characters (not including the space). But: you only need to be able to recognize some 80 character subset of your choice.
Output should ... |
Your task is to write a short program that represents a large (infinite) ordinal, using a well-ordering of the set of positive integers. Your program will take two different positive integers and indicate which one is greater in your chosen well-ordering. The order type of the well-order is the represented ordinal. The... |
A digit small number is a positive integer \$n\$ such for any two numbers that multiply to \$n\$, their total number of digits is more than the digits in \$n\$.
In otherwords: there are no two positive integers \$a\$ and \$b\$ such that:
\$
ab = n
\$
and
\$
\left\lfloor\log_{10}(a)\right\rfloor+\left\lfloor\log_{10}(b)... |
UTF-9 was an April Fool's Day RFC joke specifications for encoding Unicode suitable for 9-bit nonet platforms.
Challenge
Your task is to implement a program or a function or a subroutine that takes one integer, who represents the codepoint of a character, to return a sequence of integers that represents its correspondi... |
Adapted from this StackOverflow question
In this challenge you will take a list of lists of integers, e.g.
A = [[1,2],[3,4],[5],[]]
And an additional single integer (e.g. n = 7). If you were to add n to the front of one of the lists in A there would be as many ways to do that as there are lists in A. In this example ... |
You are to take a string representing a piece of brainfuck code and Explanations, containing only printable ASCII characters and newlines ( to ~, ASCII 10 and 32 to 126) as input and output an explanation of that code, formatted to be compliant with Stack Exchange markdown.
That is, the explanation must satisfy:
Each... |
Every phone needs a calculator app. Because of the limited screen real estate, the developer of mine has decided to save some buttons. Instead of having two dedicated bracket buttons - one for open ( and one for close ) - there is just a single bracket button (). It looks something like this:
When the button is presse... |
What general tips do you have for golfing in Chef? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Chef (e.g. "remove unnecessary whitespace" is not an answer).
Please post one tip per answer.
|
Brainfuck is an esoteric programming language that is Turing Complete, meaning you can't tell whether a given program will halt without running it. It's cell-based and has an infinite tape of cells, values containing an unsigned integer from 0 to 255, but if you give it arbitrary-size cells, just three is enough to mak... |
I've been doing quite a few code golf recently and I realised that a lot of times, I have to do something involving list.
Most of the times lists are space-separated or comma-separated values in the first argument (argv[2]), and the return value should also be a space/comma-separated string.
Are there any tips for conv... |
From my CMC.
Given a regex and a non-empty printable ASCII text, return one bit per character in the text, indicating the positions of beginnings of non-overlapping matches, and also the positions of beginnings of sequences that are not part of any non-overlapping matches.
You can:
take the regex as a regex object, st... |
UTF-1 is one of the methods to transform ISO/IEC 10646 and Unicode into a sequence of bytes. It was originally for ISO 10646.
The UTF-1 encodes every character with variable length of byte sequence, just like UTF-8 does. It was designed to avoid control codes. But it was not designed to avoid duplication of a slash cha... |
Consider the \$4\$ divisors of \$6\$: \$1, 2, 3, 6\$. We can calculate the harmonic mean of these numbers as
$$\frac 4 {\frac 1 1 + \frac 1 2 + \frac 1 3 + \frac 1 6} = \frac 4 {\frac {12} 6} = \frac 4 2 = 2$$
However, if we take the \$6\$ divisors of \$12\$ (\$1, 2, 3, 4, 6, 12\$) and calculate their harmonic mean, we... |
I was pondering today about how many characters it would take in each language to throw an exception, and noticed there wasn't any existing collection of answers, so:
The task
Throw an exception in the least amount of characters. If your language does not have exceptions, then a panic is valid. A panic constitutes as a... |
Infix notation is a method of printing mathematical expressions where each operator sits between its two arguments, such as \$ \left(5 \cdot 4\right) + 3 \$.
Prefix notation is a method of printing expressions where operators sit before their arguments. The equivalent of the above is +*543. It's a bit harder to underst... |
Task :
Wonky numbers are 3-or-more digit numbers that meet one or more of the following criteria:
Any digit followed by all zeros: 100, 70000
Same digit throughout the entirety of the number : 1111, 777777777
The digits are in consecutive ascending order : 1234, 1234567890 (for 0 see below)
The digits are in consecuti... |
So, normally, this is a forbidden loophole to fetch the desired output from an external source. But this challenge is an exception ! In this challenge you will have to fetch data from the internet and output it to the SDTOUT.
The task
For the purpose of this challenge, you'll be the owner of the imaginary a.pi domain!... |
Task
Implement a kind of "some users are typing" system, which can be found in Discord and some other chat clients.
If 1 user (say, Bubbler) is typing, output Bubbler is typing...
If 2 users (say, Bubbler and user) are typing, output Bubbler and user are typing...
If 3 or more users are typing (say, Bubbler, randomuse... |
Introduction
In computer science, a literal is a notation for representing a fixed value in source code. Almost all programming languages have notations for atomic values, some also have notations for elements of enumerated types and compound values. Wikipedia
For example 1 usually represent an integer value, "Hello"... |
Given an array of integers, count the number of contiguous subarrays with an even sum. You may assume that the array is non-empty, and contains only non-negative integers.
This is code-golf, so the shortest code in bytes wins.
Test Cases
Input -> Output
[7] -> 0
[8] -> 1
[3, 5] -> 1
[6, 2] -> 3
[2, 4, 5] -> 3
[7, 4, 0,... |
What general tips do you have for golfing in TypeScript's type system? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to TypeScript's type system (e.g. "remove comments" is not an answer).
Please post one tip per answer.
If you're not familiar with program... |
Background
Slowsort is an in-place, stable sorting algorithm that has worse-than-polynomial time complexity. The pseudocode for Slowsort looks like this:
procedure slowsort(A[], i, j) // Sort array range A[i ... j] in-place.
if i ≥ j then
return
m := floor( (i+j)/2 )
slowsort(A, i, m) ... |
Task
Continuously print a random character (a-z, A-Z, 0-9) not separated by a newline (\n).
Expected output
b7gFDRtgFc67h90h8H76f5dD55f7GJ6GRT86hG7TH6T7302f2f4 ...
Note: output should be randomised.
Requirements/Rules
Output must be continuous (i.e. never ending),
Output may not comprise of newlines,
Output must b... |
Inspired by this Puzzling SE question: All distances different on a chess board.
Introduction
Lets define a sequence \$a(n), n\geqslant 1\$ as how many pawns can you put on a \$n \times n\$ chessboard in such a way that all the distances between two pawns are different.
Pawns are placed always in the centre of the squ... |
I've recently stumbled upon a Russian site called acmp.ru, in which one of the tasks, HOK, asks us to find the LCM of two positive integers. The full statement, translated to English is as follows:
The only line of the input contains two natural numbers A and B separated by a space, not exceeding 46340.
In the only l... |
Originally from caird coinheringaahing's idea, I (Bubbler) am hosting Advent of Code Golf 2021.
On each day from today (Dec 1) until Christmas (Dec 25), a challenge will be posted at UTC midnight, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes ... |
I'm writing a program that takes a number from input (call it x), loops from 0 to (x - 1) (let's call our iterator y) and prints \$y^x+x\$ for each y.
After the loop, it then prints "SUM: N" (without a newline) where the N is the sum of the all of the previously printed values.
How can I make the code I already have sh... |
What general tips do you have for golfing in BQN? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to BQN (e.g. "remove comments" is not an answer).
Please post one tip per answer.
At the moment of writing, the official BQN site is the most comprehensive res... |
Background
I want to display rich, vibrant images on my theoretical fancy custom display, but due to budget constraints, it displays everything in 3-bit colour! Whilst Regular Dithering would work, I don't want to sacrifice resolution, so I would like my images to be dithered through time!
Specs
Provided an Input Image... |
Code Python 3, 245 bytes
E=print
def F():
B,C,A=1,1,1;yield 0
while True:yield B;B,C,A=B+C+A+1,C+A+1,A+1
C=int(input())
D=0
for A in range(C):
E(end='*'*(C-(C-A)+1));B=A
while 0<B:E(end=' '+chr(42+B)*B);B-=1
E();D+=1
for A in F():
if D==0:E(end=str(A));break
D-=1
Try it online!
What it does?
Takes a number from... |
Given string s of even length as input, randomly capitalize exactly half of the letters.
You can assume the input will always be a non-zero, even length
You can assume the input will consist of only lowercase letters ([a-z])
Exactly half of the letters should be capitalized in the output
Every permutation that has exa... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 5, Part 2.
Santa needs help figuring out which strings in his text file are naughty or nice. He has already tried two sets of rules, but they're totally ad-hoc, cumbersome, and janky, so he comes up with ... |
Introduction
I have decided that this Christmas, as a "present" to a friend, I wish to purchase the things described in the classic song "The 12 Days of Christmas". The only problem is, I don't know how to calculate the total price!
Your Task
Given a list of prices (in order from first to last), calculate the total pri... |
A basis of a vector space \$V\$ is a set of vectors \$B\$ such that every vector \$\vec v \in V\$ can be uniquely written as a linear combination of the vectors in \$B\$. In other words, let \$B = \{\vec b_1, \dots, \vec b_n\}\$ be a basis of some vector space \$V\$. For every possible \$\vec v \in V\$, we can say tha... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2015 Day 10.
Here's why I'm posting and not Bubbler
The Elves are playing a variation of the game called look-and-say. In plain look-and-say, they take turns making sequences by reading aloud the previous sequence and using tha... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2015 Day 20, Part 1.
Here's why I'm posting instead of Bubbler and why not emanresuA
To keep the Elves busy, Santa has them deliver some presents by hand, door-to-door. He sends them down a street with infinite houses numbered ... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 24, Part 2.
Here's why I'm posting instead of Bubbler
To recap: Santa gives you the list of gift packages' weights. The packages must be split into multiple groups so that each group has the same weight, ... |
We all know how binary conversion works: the sequence of bits
$$ b_1, b_2, ..., b_{n-1}, b_n $$
encodes the number
$$ b_1 \times 2^{n-1} + b_2 \times 2^{n-2} + ... + b_{n-1} \times 2^1 + b_n \times 2^0 $$
This gives an unambiguous representation when we limit all bits \$ b_i \$ to be only 0 or 1.
...but what if we allo... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2016 Day 1, Part 1.
You're airdropped near Easter Bunny Headquarters in a city somewhere. "Near", unfortunately, is as close as you can get - the instructions on the Easter Bunny Recruiting Document the Elves intercepted start ... |
Inspired by my geography class, Sandboxed
Simulate weathering / erosion.
Input
Input will be given as a string of any 2 characters (or see below) you like in the shape of the rock (here i use spaces and hashes):
###
####
#####
#######
#######
########
Or if your language doesn't support strings, a square matrix ... |
Following the theme of strange kitchen appliances, let's talk about my microwave.
Introduction
My microwave has a keypad that is laid out like this:
30 > 15
1 2 3
4 5 6
7 8 9
+/- 0 S/M
I can press the +/- and S/M keys to switch between adding and subtracting minutes or seconds.
The microwave starts in a... |
Each natural number (including 0) can be written as a sum of distinct powers of integers (with a minimum exponent of 2). Your task is to output the smallest power required to represent \$n\$.
For example:
2 = 1^2 + 1^3 // Output 3
9 = 1^2 + 2^3 = 3^2 // Output 2
15 = 2^2 + 2^3 + 1^4 + 1^5 + 1^6 // Output 6
20 = 2^2 + ... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2016 Day 2, Part 2.
You finally figure out the bathroom code (on the weird diamond-shaped keypad) and open the bathroom door. And then you see another door behind it, with yet another keypad design:
For those who... |
Solve an Inglenook Sidings Puzzle
Background
The Inglenook Sidings Puzzle is a shunting/switching yard puzzle by Alan Wright for model railroading. The rules for the puzzle are as follows: (Source)
Form a departing train consisting of 5 out of the 8 wagons sitting in the sidings.
The 5 wagons are selected at random.
T... |
The event scheduler is a recurrent theme in event-driven architectures: something triggers an event that needs to be checked in the future one or more times. I has particular use in trading where you want to correlate one market event with price movements in the future at several time deltas (1ms, 100ms, 1s, 1 min, etc... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost).
Santa is delivering presents to an infinite two-dimensional grid of houses. The delivery begins delivering a present to the ... |
Your task
Randomly pick and print "Joe Mama" or "Joe Biden" in as little bytes as possible.
Rules
No trailing lines, spaces, or anything else weird like that
No election fraud! Both "Joe Mama" and "Joe Biden" must have equal chaces of winning
Prize
The winner will get a spot in https://github.com/Sid220/joe-mama-or-j... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2017 Day 3, Part 2.
You come across an experimental new kind of memory stored on an infinite two-dimensional grid.
Each square on the grid is allocated in a spiral pattern starting at a location marked 1 and then counting up wh... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2017 Day 6.
A debugger program here is having an issue: it is trying to repair a memory reallocation routine, but it keeps getting stuck in an infinite loop.
In this area, there are n memory banks; each memory bank can hold any... |
Definition
Given some number, x calculate the smallest number i such that 2i≥x. This is not a duplicate of this question. It is slightly different in that an input of 16 should yield an output of 4 whereas 16 returns 5 in the linked question.
Input
Input will be an unsigned 32-bit integer.
Output
Output will be an unsi... |
Your task is to input a sequence of integers and chunk sort it. You may assume the input list can always be chunked into groups of 1, 2, and 3.
Definition
Chunk sorting (a term I made up for the purpose of this challenge) is the action of first chunking a sequence into groups of 1, 2, and 3 in a cycle and then sorting ... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2017 Day 9.
Weekends are Bubbler's days off from posting these lol
A large stream blocks your path. According to the locals, it's not safe to cross the stream at the moment because it's full of garbage. You look down at the str... |
Challenge
Draw lines in ASCII corresponding to given inputs:
in the first line there are given size of rows and columns of the view and number of separators between each point
in the second line is given list of lines separated by space
a line contains the position of head and tail coordinates (within the size of colum... |
For the context of this challenge, a matched group is a digit \$n\$, followed by \$n\$ more matched groups. In the case of \$n = 0\$, that's the whole matched group. Digits only go up to 9.
For example, 3010200 is a valid matched group, as:
3 # 3, capturing three elements...
0 # a 0 (group 1)
1 # a 1 ... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 11.
Obligatory why me and not Bubbler link
After having rescued a child process lost on a hexagonal infinite grid, you hear someone else screaming for help. You turn around, and unsurprisingly, there is a... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 14.
To recap: The disk is a rectangular grid with \$r\$ rows and \$c\$ columns. Each square in the disk is either free (0) or used (1). So far, you have identified the current status of the disk (a 0-1 ma... |
Introduction
My gnome friends are writing a programming language and have asked for my help. Due to their size, the gnomes can only handle small superscript numbers instead of big numbers. However, the language they're writing the interpreter in only accepts big numbers!
Your Challenge
Given an input of a superscript n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.