instruction stringlengths 34 53.1k |
|---|
Task similar to this one. Take a string of ASCII characters and convert it to base-3 equivalents separated by a space.
For example:
Hello, world!
Should be converted to
02200 10202 11000 11000 11010 01122 01012 11102 11010 11020 11000 10201 01020
The output should only contain numbers with the same number of digits. ... |
Given \$ i = \sqrt{-1} \$, a base-\$ (i - 1) \$ binary number \$ N \$ with \$ n \$ binary digits from \$ d_{0} \$ to \$ d_{n - 1} \$ satisfies the following equation.
$$ N = d_{n - 1} (i - 1) ^ {n - 1} + d_{n - 2} (i - 1) ^ {n - 2} + \cdots + d_{1} (i - 1) + d_{0} $$
For example, a decimal number \$ 15 \$ is \$ 1000111... |
Task is pretty simple. Your program should take a number N from 1 to 20 and draw the following ASCII art.
When N=1:
_____
| | |
| | |
| | |
| | |
| | |
| | |
| | |
|_|_|
\ /
\-/
v
When N=2:
_______
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| ... |
Given a string that represents a bunch of tables stacked on top of each other and/or arranged side-by-side, disassemble all the tables.
Tables
A table looks like this:
-------
| |
| |
More formally, a table has a tabletop, composed of n dashes, and two visible legs. (Obviously, there are two hidden behind, but... |
A truncated square-pyramid of height \$h\$ has \$h\$ square layers where each layer has a side \$1\$ greater than the one above it, apart from the top layer which is a square of blocks with a given side length.
Here is a truncated square-pyramid of height \$7\$ and top side-length \$4\$ viewed from the side:
... |
Given a random code written using Brainfuck commands. You program should translate that code into the following ascii art: each Brainfuck command represents as 5x9 array of A and B symbols. All commands are concatenated with 5x3 arrays of A symbols. Symbols A and B you choose yourself.
For example, when input is ><+,.[... |
A tower is made out of layers, each one being one unit shorter than the one below it. Every layer is completely on top of the previous layer. For example, here is a tower along with it's height map:
#
##
###
####
#####
14532
Because the lengths of the layers are the integers from 1 to n, and because the layers ar... |
Let's consider the following sequence:
$$9,8,7,6,5,4,3,2,1,0,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71...$$
This is the sequence of \$9\$'s complement of a number: that is, \$ a(x) = 10^d - 1 - x \$ where \$ d \$ is the number of digits in \$ x \$. (A061601 in the OEIS).Your task is to add the first \$n\... |
Your input is a matrix (2d array) of positive integers. For example:
\begin{matrix}
1 & 1 & 4 & 7\\
1 & 3 & 5 & 6\\
2 & 1 & 4 & 5 \\
\end{matrix}
A semi-continuous transformation of this matrix is a rearranging of elements that preserves immediate neighbors. For example, we can swap the \$2\$ in the bottom left, and th... |
Your regex will receive a string of the form
!XX!
#<extra>
where X is any hexadecimal digit (0-9 and A-F capital letters only), and <extra> is a character sequence to your choosing. (perhaps something like 0123456789ABCDEF0 could be useful?)
You may use any regex flavour.
Scoring will be calculated as: find regex len... |
Given a volume level V in the range 1-10. Your program should draw the following ASCII art.
When V=1:
\
|
/
When V=2:
\
\ |
| |
/ |
/
When V=3:
\
\ |
\ | |
| | |
/ | |
/ |
/
And etc. Trailing spaces are allowed.
This is a code-golf challenge so the shortest solution wins.
|
Your input is an array of integers in the range [-1,4]. An array element of -1 means that there might be a bomb in that position. A non-negative element means that there is not a bomb in that position and also the numeric value tells how many bombs there are within distance 2.
For example, if we have the following arra... |
Overview
Shue (Simplified Thue) is a language that was designed by AnttiP for this challenge. A Shue program consists of the possible outputs and a list of string replacements. For example, the following program prints "yes" if an unary string is even:
yes
no
11=2
12=1
22=2
1=no
2=yes
Try it online!
The possible outpu... |
Given the signal level L in the range 0-4. Your program should draw the following ASCII art.
When L=0:
....
....
.... ....
.... ....
.... .... ....
.... .... ....
.... .... .... ....
.... .... .... ....
.... .... .... ....
When L=1:
....
... |
Your input is a ragged list of positive integers and a positive integer. Your task is to find that positive integer and return it's index, or if the positive integer doesn't exist, indicate it's nonexistence.
How are indices in ragged lists defined? They are simply lists of indices that when used consecutively to index... |
Given the battery level L in the range 0-5, your code should draw the following ASCII art.
When L=0:
############
# ###
# ###
# ###
############
When L=1:
############
### ###
### ###
### ###
############
When L=2:
############
##### ###
##### ###
##### #... |
Did you know that Heronian Tetrahedra Are Lattice Tetrahedra? A Heronian tetrahedron is a tetrahedron where
the length of each edge is an integer,
the area of each face is an integer, and
the volume of the tetrahedron is an integer.
It's always possible to place such a tetrahedron in space such that all of the vertic... |
A finite-permutation is a function which takes an \$n\$-tuple and produces an \$n\$-tuple such that every element of the input is present in the output, and the ordering does not rely on the values of the inputs.
We can unambiguously represent these permutations with an \$n\$-tuple where each element is the index of wh... |
the goal
Build an optimizing Brainfuck implementation. Whether it is a compiler, an interpreter, a JIT compiler, or whatever else is up to you.
scoring
A reference implementation (bfi) will be given. Each implementation will run the same program (mb.b) also given at the end.
Your score is
time spent to run `mb.b` trans... |
Task
Given a finite permutation output its inverse.
You may take input and output in any reasonable format equivalent to a list of natural numbers. You may choose to use 0 indexing or 1 indexing. Your input and output format should be the same. You may assume a permutation has at least 1 element.
This is code-golf so... |
A band matrix is a matrix whose non-zero entries fall within a diagonal band, consisting of the main diagonal and zero or more diagonals on either side of it. (The main diagonal of a matrix consists of all entries \$a_{i,j}\$ for which \$i=j\$.) For this challenge, we will only be considering square matrices.
For examp... |
Given an \$n\times m\$ matrix \$A\$ and two integers \$w,h\$, output a matrix of \$w\times h\$ called \$B\$, such that $$B_{i,j} = \int_{i-1}^i\mathbb dx\int_{j-1}^j A_{\left\lceil \frac xw\cdot n\right\rceil,\left\lceil \frac yh\cdot m\right\rceil}\mathbb dy\text{ (1-index),}$$ $$B_{i,j} = \int_i^{i+1}\mathbb dx\int_j... |
It's 22022 and the Unicode consortium is having a problem. After the writing system of the ⮧⣝Ⅲⴄ⟢⧩⋓⣠ civilization was assigned the last Unicode block, the consortium members have been scrambling to find a new encoding to replace UTF-8. Finally UTF-∞, a proposal by Bob Rike, was adopted. UTF-∞ is backwards compatible wit... |
You've arrived on an alien planet. The writing system, the culture and the language there are completely foreign to any language you know. But somehow they are all playing wordle already.
So as a method to learn their language and culture you start playing their version of wordle. Their wordle works a little bit dif... |
Inspired by @emanresu A's Is it a fibonacci-like sequence? Make sure to upvote that challenge as well!
We say a sequence is Fibonacci-like, if, starting from the third term (\$1\$-indexed), each term is the sum of the previous two terms. For example, \$3, 4, 7, 11, 18, 29, 47, 76, 123, 199\cdots\$ is a Fibonacci-like s... |
Task:
With the minimum amount of bytes, determine today's Zodiac sign using the programming language of your choice.
Rules:
This is code golf, the answer with the fewest characters wins. The initialization of getting the current date into a variable (e.g. var now = new Date();) does not add to the count. Leap years mu... |
Robbers thread
In this cops-and-robbers challenge, your task is to write a program h that outputs "Hello Shue!". Next, you have to choose a string i and also write a Shue program p, so that p(i)=h. Your score is len(p)+len(i). Your answer will contain the language of h, i and your score (please write the score as len(p... |
Cops thread (read first)
Robbers, your task is to find a Shue program p that when given the cops input i, outputs a program h, which outputs "Hello Shue!". The length of your p has to be less than or equal to the length of the cop's p. The robber with the most cracks wins.
|
Modern hardware can perform multiplication very fast in a constant latency of 3~4 cycles. But some tiny chips for embedded environments sometimes lack hardware multiplication, which has to be emulated by a series of instructions.
Goal
You are given a primitive CPU with a set of basic operations. Your job is to implemen... |
Your task is simple: output the letter x a random number of times. Every possible length of xs must have a non-zero probability of being output.
Of course, there must be some lengths whose probabilities tend to \$ 0 \$, in order for the total probabilities to sum to \$ 1 \$, but all must still be theoretically possible... |
Digital sum, DR, Digit root is the iterative process of summing digits of a number until you end up with a single digit root number: e.g. digit root of 12345 is 6 since 1 + 2 + 3 + 4 + 5 = 15 = 1+5. Also look at Digit root challenge.
Input:
Given integers m and n which are the modular and multiplier for sequence.
Outpu... |
Your friend Jack is a picky eater. He only likes certain foods, and he only likes to eat a certain amount of them each day. Despite this, Jack has very strict calorie and macronutrient goals that he strives to meet with his diet. To complicate things further, Jack's cravings change day by day, and he will only eat the ... |
You met a 4-th dimensional being who challenged you to a game of dice. The rules are simple: each player rolls 3 6-sided dice and takes the sum of each combination of 2 dice. The player with the highest sum wins. If the first-highest sum is a tie, consider the second-highest sum, and so on.
Your opponent's dice look no... |
Your challenge is to write a program that constantly prompts for input, and when input is given, output that five seconds* later. However, your program must continue prompting for input during that time.
Since this is a bit confusing, here's a demo.
<pre id=x></pre><input id=h onchange='var k=this;(()=>{let a=k.value... |
Your task is, given a array of numbers, that is strictly increasing, output the crate stack. The input is an array of positive integers which represents which layer has how many crates there are. So the first number is the top layer and so on. The sum of the array is the size of the crate.
Since the array order follows... |
Given an integer n, output the following ASCII art to n rows:
1+1=2
1+2=3
2+3=5
3+5=8
5+8=13
Essentially, the first row is 1+1=2 and the nth row (1-indexed) is \$f_n + f_{n+1} = f_{n+2}\$ where \$f\$ is the Fibonacci sequence, padded so the numbers line up with the previous row.
You may instead out... |
I'm making a page selector for my super cool terminal-based blog program. In order for it to fit correctly into the design, it has to have some constraints.
The page selector can only display a certain number of numbers at a time due to the constraints of the UI system. If there are more characters then can fit, they m... |
Imagine there is a card game where the primary objective of the game is to get 4 of one card in your hand.
Game mechanics
Each player starts of with 10 cards in their hand. The remaining 32 cards (jokers are taken out of the deck) are put in the center.
Each turn, a player can put one of their cards (which is chosen at... |
Let's continue the fibonacci based challenges stream, here's the next one:
Task
Draw a Fibonacci spiral ascii-art of n segments where starting from the first term:
each nth segment has a length of nth Fibonacci term.
each segment is joined to the end of the previous, rotated by 90 degrees taking the end of previous s... |
Usually each cell in brainfuck has 256 states, which is not enough to tell whether input is EOF or a character (usually \xFF). To fix it we can add one more state to it, and EOF (256) isn't mistake from a byte.
Since outputting EOF is also not defined, . on 256 works as reading, and therefore , is removed from the mod... |
Can the Tune be Played?
Explanation
A broken musical keyboard has keys labelled with positive integers. It is broken in two ways:
It takes a long time to process key presses: after pressing the key labelled with the number \$n\$, there is a gap of \$n\$ seconds before the \$n\$th note is heard.
So, for example, the \$... |
Related | Related
Given an ASCII art with |, _, and , check if you can draw the art in one stroke.
Description
Your task is, if the ASCII art is representing lines, then check if you can draw the whole art in one stroke, which means:
without drawing an already drawn line again
without lifting and continuing the stro... |
For a given number n, output an strictly decreasing array whose sum is n and its lexicographical order is the smallest for any possible outputs
Smallest lexicographical order means that for or sum n=9 the following strictly decreasing arrays are possible: [[9],[8,1],[7,2],[6,3],[5,4],[6,2,1],[5,3,1],[4,3,2]]. Putting t... |
Given a list of N lists, each containing M positive integers, and a separate list of M positive integers (target values), return a list of N scalars (integers with a value of 0 or more) that correspond to each list in the lists of lists, such that when each value in a list is multiplied by it's scalar, and the values a... |
Given a list of integers, output a list where the \$ i \$th element of the list equals the first number in the input list which is \$ \ge i \$, until there are no such numbers.
For example, if the input is:
2 3 5 7 11
then we "expand" the sequence out to show where the gaps are:
_ 2 3 _ 5 _ 7 _ _ __ 11 # input
1 ... |
A donut distribution (for lack of a better term) is a random distribution of points in a 2-dimensional plane, forming a donut-like shape. The distribution is defined by two parameters: the radius r and spread s, in which the distance to the origin follows a normal (Gaussian) distribution around r, with a standard devia... |
Task
Given a winning Wordle play results (clues), the target ("secret") word and a list of words, output a possible sequence of words leading to such results.
The words in the list will be distinct and so should be the output.
You may assume that for given inputs a solution exists. If there is more than one, you may ou... |
An integer \$x\in[0,2^{32}-1]\$ divided by an integer \$d\in{[1,2^{31}]}\$ will produce an integral quotient \$q\$ and a remainder \$r\$, so that \$x=d\times q+r\$.
Any \$q\$, in fact, can be calculated by the following formula.
$$y=\left\lfloor\frac{mx}{2^{32}}\right\rfloor\\q=\left\lfloor\frac{y+f\lfloor(x-y)/2\rfloo... |
Introduction:
Every workday I read the newspaper in the morning while eating breakfast, and also do some of the puzzles at the back. When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one. The word-searches in the newspaper have two columns of words, and afte... |
Your task is to make a program that decides if a real number between 0 and 1 is irrational or not. As stated, this is obviously impossible, so instead we will use the following definition:
p is your program, which takes in a decimal expansion of a number (list of integers), and returns 0 (≈Rational) or 1 (≈Irrational).... |
A Gray code is a permutation on binary numbers where incrementing or decrementing a number only ever causes a single bit to change. For example, a Gray code for the binary numbers up to 7 (so, with 3 bits) are:
000
001
011
010
110
111
101
100
You can see that only one bit is different between each consecutive pair.
Th... |
Yes, this is very similar to this question. However, that concerns infinite linked lists, and you do not need to handle out of bounds indexes in that question.
You are in a strange city, looking for the fabled Nineteenth Bakery, where it is said they sell the most delicious deleted posts. The order of shops here is s... |
Black Box is a board game, Your task is to reveal all clues.
What is black box
Black box is a board game with hidden atoms, Your task is given input, All atoms, reveal all clues.
I/O
Input
The atoms can be any 1-char that is not newline (Used for separator) Like this.
O....
...O.
..O..
.....
....O
Output
When the code... |
Inspired by this building (United States Air Force Academy Cadet Chapel, Colorado)
Your task is simple, given a positive integer n, output the spiked building to size n
Testcases
1
->
^
/|\
/.|.\
/..|..\
_______
2
->
^ ^
/|\/|\
/.|..|.\
/..|..|..\
__________
7
->
^ ^ ^ ^ ^ ^ ^
/|\/|\/|\/|\/... |
For the given string s, generate generate a table like below.
Input:abcd
Output:
abcd
bbcd
cccd
dddd
Input:Hello, world!
Output:
Hello, world!
eello, world!
llllo, world!
llllo, world!
ooooo, world!
,,,,,, world!
world!
wwwwwwwworld!
ooooooooorld!
rrrrrrrrrrld!
llllllllllld!
dddddddddddd!
!!!!!!!!!!!!!
Trailin... |
Background
This challenge is about the game of Go. Go is a game played on a board with a square grid N x N. You don't have to know how to play the game to do this challenge, but if you are interested, google "Tromp-Taylor rules" for a minimal and precise set of rules to play a full game.
Let's use a 4 x 4 board. As the... |
The Challenge
The challenge is simple: given an input list a and another list b, repeat a until it is longer than b.
As an example, call the repeated list ra. Then the following condition must hold true: len(b) < len(ra) <= len(b) + len(a). That is, a must not be repeated more than is required.
Sample Python Implementa... |
Sometimes in chat, if someone says something you agree with, you'll send a message with an ^, which points at the message above:
Radvylf: Cats are far superior to JavaScript
You: ^
Sometimes you'll also add some text:
Radvylf: I sure do like integers
You: I mostly agree with ^ but floats are pretty neat too
You can a... |
Output the infinite list of pairs of integers (a, b), where both \$ a > 1 \$ and \$ b > 1 \$, ordered by the value of \$ a^b \$. When there are multiple pairs where \$ a^b \$ is equal, they should be ordered lexicographically.
For example, \$ 2^4 = 4^2 = 16 \$, but (2, 4) should come before (4, 2), because it is lexico... |
Bounty
One of the convincing conjectures, by Loopy Walt is,
maxlib(n) = 0, if n = 1
2, if n = 2
6, if n = 3
(2n - 1)⌊n / 3⌋, if n % 3 = 0
(2n - 1)⌊n / 3⌋ + n, if n % 3 = 2
2n⌊n / 3⌋ + 1, otherwise
Loopy Walt's post below explains how this conjecture is derive... |
Given an unordered list of musical pitches, write the shortest program/function (scored in bytes) to sort the list from lowest pitch to highest.
Pitches will be given in scientific pitch notation, consisting of a tone name followed by an octave number. Here, the tone name will be a single letter A–G, possibly followed ... |
Given a string, determine if it is an int, a float or neither.
Examples
123 - int
62727.0033 - float
644c.33 - neither
Your code should output a different value depending on which it is. For example it could return "i" for int, "f" for float and "n" for neither.
Details
The following are floats:
1.00 -0.0 1.0
The fo... |
In this challenge you will take two lists as input and you will zip them. The zip can be defined with this recursive expression:
\$
\mathrm{zip}(a,b) = \begin{cases}
\left[\,\,\right] & a = \left[\,\,\right] \\
[a_0]\mid\mid\mathrm{zip}(b, t) & a = [a_0] \mid\mid t
\end{cases}
\$
or this Haskell program if you would l... |
Given an array of integers as input(including negative integers), find all (can include duplicates) permutations that do not have the same number next to each other, then print them all out.
If no permutations were found, print Nothing or return an empty list or any consistent output indicating that none were found.
No... |
Task
Given a positive integer n, output the joined compound of circles
The circles are of square of size n+2 but removing the corner edges and the middle, before finally overlapping n times of itself
E.g.
2
->
####
####
####
####
->
##
# #
# #
##
->
## ##
# # #
# # #
## ##
Testcases
1
->
#
# #
#
2
->
... |
Given a ragged list, e.g.
[[4, 7], [5, 3, [], [6, [2]]]]
Your challenge is to sort only the numbers in it. For example, with the above, the result would be
[[2, 3], [4, 5, [], [6, [7]]]]
The shape of the output should remain the same, only the numeric contents should change.
This is code-golf, shortest code wins!
All... |
My third word search related challenge in a row. :)
Challenge:
Brief explanation of what a word search is:
In a word search you'll be given a grid of letters and a list of words. The idea is to cross off the words from the list in the grid. The words can be in eight different directions: horizontally from left-to-right... |
Given a positive integer as input, output that integer, but with its bits rotated two times to the right. Also, think of the number as a donut of bits, eg. 21 -> (10101). If all of the bits suddenly decided to move to the right, they would wrap around. eg. rRot(21) -> (11010) = 26. Do what i explained 2 times (at the s... |
Task
Given an \$m\times n\$ binary ascii "photo", return the negative of the photo
Example:
#
# #
# #
# #
#
->
## ##
# # #
###
# # #
## ##
General rules:
This is code-golf, so the shortest answer in bytes wins
Standard rules and default I/O rules apply
Your output characters must be the same as your in... |
Note: This challenge was inspired by Joe Z's many excellent questions surrounding NAND golfing.
Description
Your goal in this challenge, should you choose to accept it, is to implement a very simple ALU using just NAND gates. The ALU can only perform the the following four operations:
00, meaning increment (wrapping a... |
Given a ragged list of positive integers return a full cycle of recursive rotations starting with the unchanged input and ending with the state immediately before revisiting the initial state.
Examples:
[[2,3],4,5,5] -> [[2,3],4,5,5] , [4,5,5,[3,2]] , [5,5,[2,3],4] , [5,[3,2],4,5]
[1,10,[2,2,4],6,[[5,6],7],1] -> [1,10... |
Input a decimal number and round it to an integer, randomly rounding up or down with a probability based on its fractional part, so the expected value of the output equals to the input value.
If input \$x\$ is an integer, the program should output it as is. If \$x\$ is not an integer, the program has a \$x-\left\lfloo... |
A long period prime is a prime number \$p\$ such that decimal expansion of \$1/p\$ has period of length \$(p-1)\$. Your task is to output this number sequence. For purposes of this challenge we will consider only odd primes.
Period of a decimal expansion of a rational number is the smallest period \$k\$ that makes the ... |
You are given a string of unknown length that contains a varied amount of (, {, [ and their respective closing parentheses (in this context all referred to as brackets).
With one exception, all the brackets are all balanced, meaning an opening one has a corresponding closing one somewhere afterwards in the string.
The ... |
As you probably know, there is a war going on in Ukraine. I noticed that it seems nobody has posted a Ukrainian flag challenge yet, so I thought I'd do it myself in support of Ukraine.
The Challenge
Here is the flag:
The flag is divided horizontally across the middle into two equally sized stripes.
Stripe colors: (0,... |
What?
Let's say I have this graph:
1
\
\
2 3
\ /
\ /
4
I can represent it in 2 ways:
A list of connected vertices. [[1,3],[2,4],[3,4]]
A boolean matrix which shows where edges are:
c |1 2 3 4
--|-------
1 |0 0 1 0
2 |0 0 0 1
3 |1 0 0 1
4 |0 1 1 0
----- or -----
[[0,0,1,0],[0,0,0,1],[1,0,0,1],... |
Input: a whole positive number greater than 4
Output: A whole positive number that describes the highest possible period an oscillator could have inside a square space of size (input)x(input) in a "life" grid that follows the rules of Conway's Game of Life. The oscillator never leaves this area throughout its cycles. I... |
Your task is to output a square sandbox of size n+2 with / characters in the corners and | for the sides, and - for the top, with n**2 layers of sand (.) overflowing out of the sandbox of width n+2
Testcases
1
->
/-/
|.|
/./
...
2
->
/--/
|..|
|..|
/../
....
....
....
....
3
->
/---/
|...|
|...|
|...|
/.../
.....
...... |
It's Nowruz and you want to set up a Haft-Sin table by words. This means finding seven words that start with letter s.
The Challenge
Write a program which its input is a list of words separated by space, and output at most first 7 words which starts by letter s. If the s is before letter h it doesn't count because it w... |
Minecraft has a fairly unique lighting system. Each block's light value is either one less than the brightest one surrounding it, or it is a light source itself. Your task is to write a method that takes in a 2D array of light source values, and then returns a 2D array with spread out lighting, where 0 is the minimum v... |
Your task is to output a spaceship of size n with shooters/guns and n bullets of character - (with spaces in between each bullet) for each gun
Rules
If n is odd, you must output the guns every even numbered row
If n is even, you must output the guns every odd numbered row
All rows with guns must have n+1 # character... |
Introduction:
In my recent Strikethrough the Word Search List challenge I mentioned the following:
When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one.
In some cases I do them in reversed order as a change of pace, although that doesn't matter too much r... |
Take an input, and convert it from Two's Complement notation (binary where the first bit is negated, but the rest are taken as normal) into an integer (in a somewhat standard output form). Input can be as a string, a list of digits, a number, or pretty much any other format which is recognizably Two's Complement. Leadi... |
kolmogorov-complexity is one of the tags on this site, representing challenges that test how much code is needed to output a given fixed result (usually a piece of text). The info page for this tag lists the string 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd as an example of a string with a high Kolmogorov complexity, sta... |
You want to send an ASCII letter to someone, but you need an envelope to put it in. Your task is to output an envelope given a size as input.
Rules:
Given positive integer input i, your envelope will be i characters tall (not counting the top row), and i*2 characters wide (not counting the side columns). In other word... |
Given two integers, compute the two numbers that come from the blending the bits of the binary numbers of equal length(same number of digits, a number with less digits has zeros added), one after the other, like such:
2 1
10 01
1 0
1001
0 1
0110
some examples:
Input
Binary
Conversion
Output
... |
There are times when a large number of people need to choose something. They all want to get the stuff they choose, obviously, but it's impossible to please everyone that way, so a usual compromise is to give people three choices and try to make sure that everyone gets one of their choices.
For instance, consider three... |
4, 32, 317, 3163, 31623, 316228, 3162278, 31622777, 316227767, 3162277661, 31622776602, 316227766017, 3162277660169, 31622776601684, 316227766016838, 3162277660168380, 31622776601683794, 316227766016837934, 3162277660168379332, 31622776601683793320, 316227766016837933200, 3162277660168379331999, 31622776601683793319989... |
In Super Auto Pets, players build teams of animals that face off in battles to the death unconsciousness. Each animal has an Attack and Health value, and combat occurs in iterations of the following process:
The front animals of each team deal damage to each other equal to their Attack at the same time.
Both animals ... |
This is OEIS sequence A055397.
In Conway's Game of life, a still life is a pattern that does not change over time. We can see from the rules of Conway's Game of life that, a pattern is a still life if and only if:
every living cell has exactly two or three living neighbors,
none of the dead cells have three living nei... |
Input
An \$m\$ by \$n\$ binary matrix, with \$m\$ and \$n\$ both at least 2.
Think of the ones as gobs of melted cheese, which stretch as we expand the matrix horizontally and vertically.
More precisely...
Output
A \$2m-1\$ by \$2n-1\$ binary matrix, constructed as follows...
First insert rows of zeros between the rows... |
Inspired by @AviFS.
Given a string containing brackets, e.g.
[xyz]]abc[[def]hij[
You can parse through it with a stack of brackets. When you find an open bracket, push a value to the stack, when you find a close bracket, pop from the stack. If you make these values indices, you know where you need to remove brackets.
... |
The sci-fi shooter Destiny 2 contains guns which have the ability to regenerate ammunition directly into the magazine if, and only if x (precision) shots are landed (in a fixed amount of time), returning y bullets to the magazine. For example, the perk (ability) "Triple Tap" will return 1 bullet to the magazine if 3 pr... |
(l, r) defines a line whose left end is at l and the right end is at r, on a 1-dimensional space.
Given 2 lines b = (0, bz) and f = (i, i + fz), v = (l, r) is the overlapping part of these lines. When b and f do not overlap (when v cannot have a positive length), v = (0, 0).
(input) -> (output)
bz, fz, i -> l, r
The... |
One of your acquaintances has a hobby of making make-shift electrical gadgets using various types of batteries. However, since they're thrifty, they want to use as few batteries as possible for their projects. This challenge uses several types of batteries; your job is to output the fewest number of batteries that will... |
+-= is a language created by Esolangs user Anonymous in 2017.The language consists of only three commands:
+ increases the accumulator by one.
- decreases the accumulator by one.
= outputs the accumulator and a newline.
Rules
This is code-golf, all usual golfing rules apply.
Standard rules apply.
You may assume inpu... |
For a 2 dimensional array we will call the elements in either the first row or the last column the "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted:
\$
\begin{bmatrix}
\color{red}{\underline 1} & \color{red}{\underline 2} & \color{red}{\underline 4} & \color{red}{\... |
Cops' Challenge
Robbers' challenge here.
It has now been four days since the challenge was posted so all new answers should be marked as non-competing in the title. These answers can still be cracked by robbers but will not go towards their total, and cannot win this challenge.
In this cops-and-robbers challenge, you... |
Robbers' Challenge
Read the cops' challenge first.
In this cops-and-robbers challenge, you (the robbers) must find the correct string of characters, which, when added into the cop's code, will make it produce the correct (case-sensitive) output (except that there may also be an extra trailing newline at the end).
The n... |
Fennel is a lispy language which compiles to Lua.
From its page:
Fennel is a programming language that brings together the speed, simplicity, and reach of Lua with the flexibility of a lisp syntax and macro system.
I am looking for general tips for golfing in this language. Tips should be specific to Fennel, "Remove ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.