instruction stringlengths 34 53.1k |
|---|
Let \$ A \$ represent the alphabet, such that \$ A_1 = \$ a and \$ A_{26} = \$ z.
Let's define that a word \$ W = w_1 w_2 ... w_n \$ (where \$ w_c \in A\$) is in standard order if and only if:
\$ w_1 = A_1 \$, and
for \$ 2 \le i \le n \$, if \$ w_i = A_x \$ then \$ w_j = A_{x-1} \$ for some \$ j < i \$ and some \$x\$.... |
Task
Your task is to take an array of numbers as input, and produce a new one where each number has been shifted both right and left, leaving 0s if no number fills a spot. This process can be represented graphically like this:
[x]
/ | \
[x, 0, x]
This is done with every number in the list, with overlapping number... |
This is a cops-and-robbers challenge, the robbers' thread is here
You can change the word code into golf by changing a letter at a time in four steps:
CODE
COLE
COLD
GOLD
GOLF
Today, we’ll be doing the same thing with programs.
Your challenge is to:
choose a programming language
write two programs / functions, one th... |
This is a cops-and-robbers challenge, the cops' thread is here
You can change the word code into golf by changing a letter at a time in four steps:
CODE
COLE
COLD
GOLD
GOLF
Today, we’ll be doing the same thing with programs.
Your challenge is to crack an answer on the cops' thread. Cops will create a series of program... |
The Caesar cipher is a simple and famous cipher, where the letters of the alphabet are rotated by some secret amount. For example, if our secret rotation is 3, we would replace a with d, b with e, w with z, x with a and so on.
Here is an example (rotation amount: 10):
Robo sc kx ohkwzvo
This cipher is very weak, becau... |
.Net Technology is an incredible framework with marvellous functionalities, and among all of them, the most important one obviously stands out:
Yep, your simple task is create a program that when it takes at input:
dotnet ef
It prints the following ascii art by output:
/\__
---==/ \\
___ ___ ... |
Katlani is a constructed language being designed in chat. In this challenge, your goal is to print the largest dictionary of katlani nouns possible in 400 bytes or less.
Task
In 400 bytes or less, your program should print a list of katlani nouns. You can choose to output them as a list/array in your language, or as a ... |
You are going to be planting pumpkins soon, and you are preparing your supplies. Pumpkins come in all sorts of sizes and have their sizes written on the seed bag. A pumpkin that is size n will grow to be n units wide. However pumpkins need their space.
If a pumpkin is stuck between two other pumpkins with not enou... |
Task
Make code given on the command line that takes an unpacked hex value as input and evals that in Perl. Like this:
perl -e 'map{eval}pack q/h*/,q/072796e6470222458656275672370202d6f62756020222b302072796e6470222478616e60202f6e6560202771697020247f6020246f602029647e2c5e622/'
But with one additional restriction: Your c... |
Write a program that takes two lists of strings and generates a javascript regex that fully matches all the strings in the first list and matches none of the strings in the second list.
To be specific when for all stings in the first list str.match(/[your-output]/) must produce a match for the full string and for all s... |
TLDR: This is the hexagonal version of Is this square symmetrical?
Given a hexagonal grid, decide if it is symmetric.
The shape of the grid is a regular hexagon. Each cell in the grid has two possible states.
Let's only consider reflections and rotations. Here are all the possible symmetries:
Reflection symmetry, wher... |
Given a variable a (non array) or (any[]) convert to (any[])
function example(s: string | string[]) {
const e = Array.isArray(s) ? s: [s]
return e
}
Is Array.isArray(s) ? s: [s] the shortest way?
|
Let's have a list of positive integers
[6,1,9,3,7,4,6,3,2,7,6,6]
this will represent a river. We would like to skip a stone across this river. We can throw the stone as far as we want and whatever number it lands on it will skip that many places. So if we start by throwing it 2 spaces, it will land on the 1 skip fo... |
Caves and Cliffs edition
Part 1, Very related
You're given a piece of ASCII art representing a piece of land, like so:
/‾\ _ __
__/ _/ \‾
_/ __/‾\ |
/ / ‾\ |
\_/‾ \_/
But unlike in the previous challenge, the terrain is mountainous, with caves and cliffs, and can turn b... |
Your input is a non-empty set of non-empty sets of positive integers. For example:
{{1}, {2, 3}, {2,4}, {1,4}}
Your task is to output the maximal number of elements that can be picked from the sets with the following conditions:
You can only pick at most 1 element from a set
You can't pick the same element from 2 dif... |
You will be given as input a non-empty list of positive integers. For example:
[1,2,2,2,1]
You want to produce a ragged list as output which has this as its "depth map". This list should have the same elements in the same order but each element n should be at the depth equal to its value.
[1,[2,2,2],1]
This is a li... |
Given a multidimensional, rectangular array of nonnegative integers, sort it at every depth (lexicographically), starting from the innermost.
For example, with this array:
[ [ [5, 1, 4],
[10, 7, 21] ],
[ [9, 20, 2],
[4, 2, 19] ] ]
You'd sort at the deepest first:
[ [ [1, 4, 5],
[7, 10, 21] ],
[ [2,... |
A square-free word is a word consisting of arbitrary symbols where the pattern \$XX\$ (for an arbitrary non-empty word \$X\$) does not appear. This pattern is termed a "square". For example, squarefree is not square-free (using the lowercase letters as the alphabet), as the square ee appears; but word is square-free. A... |
If we have a list of integers we can "squish" one of them by:
decrementing it
replacing adjacent values with its new value
For example in this list:
[1,2,8,3,6]
If we squish the 8 we get:
[1,7,7,7,6]
The question is:
Given a starting array, what is the largest we can make its sum by repeatedly squishing values?
For... |
Remove one stick and output the stack updated.
Description
You can remove only sticks on top( completely drawn).
You can assume:
there are 5 sticks on the table.
there's one and only one stick you can remove.
sticks are recognizable : there aren't overlapping sticks on the same orientation and there aren't sticks join... |
In Wordle, you try to guess a secret word, and some letters in your guess are highlighted to give you hints.
If you guess a letter which matches the letter in the same position in the secret word, the letter will be highlighted green. For example, if the secret word is LEMON and you guess BEACH, then the E will be high... |
A rigid transformation of a square array is a mapping from square arrays of a certain size to square arrays of the same size, which rearranges the elements of the array such that the distance to each other element remains the same.
If you printed out the matrix on a sheet of paper these are the transforms you could do ... |
You are an evil wizard, doing evil wizard business, when suddenly your crystal ball alerts you of a hero on their way to defeat you. To crush their hopes and dreams, you decide to trap the hero in a maze. You could just make a big maze but where would be the fun in that? Instead, you decide you want to make the maze as... |
Here is the program to return [[0, 0, 0], [0, 1, 0], [0, 0, 0]]
[[0]*3,[0,1,0],[0]*3]
Try it online!
Can you shorten this code?
|
If we have a finite list of elements we can determine the probability of any one element being drawn at random as the number of times it occurs divided by the total number of elements in the list.
For example if the list is [2,3,2,4] the probability of drawing 2 is \$\frac 1 2\$ since there are \$2\$ 2s and \$4\$ eleme... |
This rar file, when decompressed, gives a 65024-byte exe file. Requiring you to output the contents of that file would be absolutely no fun.
But you aren't required to do that. Actually, you're to do something opposite: Output a binary of the same length (65024 bytes), such that no byte equals the byte at same position... |
Description
You have a list of integers and start counting from the first term to the next and continue from that to the next and so on..
How many times have you counted?
For example given [ 2, 5, 3, 8 ]
you start at 2 and count to 5 -> 3 4 5 (3 times)
then from 5.. 4 3 (2 times)
and finally 4 5 6 7 8 (5 times)
You co... |
Given an integer \$N\$, you must print a \$N\times N\$ integer involute with the numbers increasing in a clockwise rotation. You can start with either 0 or 1 at the top left, increasing as you move towards the centre.
Examples
Input => 1
Output =>
0
Input => 2
Output =>
0 1
3 2
Input => 5
Output =>
0 1 2 3 4
1... |
A ragged matrix, is a matrix that has a different number of elements in each row. Your challenge is to write a program in any favorable language to find the indices of all occurrences of target in the ragged matrix.
Input:
A list of ragged lists (can be empty) of positive integers and a target range e.g. 26-56. The tar... |
Challenge Statement
The goal of this challenge is to build the 5 state Infinite Time Turing Machine that takes the longest to halt. Since Infinite Time Turing Machines can run for infinite time your score will be a "transfinite ordinal".
That's the challenge statement, but if you don't what all this means or want to d... |
Introduction
There have been a few examples of the smallest possible OCI container that does "X". However these examples never correctly handle termination signals.
Challenge
Produce the smallest possible container that correctly handles PID 1 signal responsibilities.
The container does not need to manage child process... |
Given an integer N from 1-9, you must print an NxN grid of NxN boxes that print alternating 1s and Ns, with each box having an alternating starting integer.
Examples
Input: 1
Output:
1
Input: 2
Output:
12 21
21 12
21 12
12 21
Input: 3
Output:
131 313 131
313 131 313
131 313 131
313 131 313
131 313... |
Background
In Scrabble, players take turns placing tiles on a grid so that each contiguous set of (more than one) tiles in every row and column makes a word. In one play, tiles can be placed anywhere in a single row or column as long as there is a contiguous set of tiles that includes all of the ones placed.1 A word is... |
1d version
Given a multidimensional array of positive integers where all dimensions are the same length, animate finding the centre of it.
Simply output the array, then remove the first and last items of every array within it and output it, until the length of each dimension is less than 3 and can't have the first and ... |
Given a list of positive integers, give the longest contiguous sublist which contains at most 1 pair of identical items. In the case of a tie return any of the solutions.
This is code-golf so the goal is to minimize your source code with answers being scored in bytes.
Test cases
[] -> []
[1,2,3] -> [1,2,3]
[1,2,2,3] -... |
This is the cops' challenge. To post a robber, go here.
In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into the interpreter, trans... |
This is the robbers' challenge. To post a cop, go here.
In this challenge, cops will invent a (likely simple) programming language, and write an interpreter, transpiler, or compiler that allows you to run it. Robbers will write a program in this language that manages to inject arbitrary code into the interpreter, trans... |
There is a 3x3 square block made of 1x1 square blocks, with coins in each 1x1 block, starting from top left block you want to collect all the coins and return to top left block again, if possible provide instructions to achieve this.
Rules
From block \$(x,y)\$ in one step you can move right(R) to \$(x,y+1)\$ ,left(L) ... |
I have a coding problem that goes like this:
Given a positive integer \$N\$, return a list of all possible pairs of positive integers \$(x,y)\$ such that $$\frac1x+\frac1y=\frac1N$$
I already solved the problem using Python, but I was wondering how I can code golf it. The following is my attempt at golfing (I try to ... |
If we have a binary matrix then we will say that a \$1\$ is stable if it is in the bottom row or it is directly adjacent to a \$1\$ which is stable.
In other words there must be a path to the bottom row consisting only of \$1\$s.
So in the following matrix the \$1\$s highlighted in red are not stable.
$$
0110\color{red... |
Intro
Two numbers are a reversed multiple pair if they satisfy the following property:
$$
a\cdot b = \operatorname{reversed}( (a-1)\cdot b )
$$
Here, \$\operatorname{reversed}()\$ means to reverse the digits of a number (e. g 123 becomes 321.)
Example
$$
a=6,\quad b=9,\quad
6\cdot 9=54,\quad
5\cdot 9=45
$$
As you can ... |
This challenge is not code golf. Please read the scoring before you attempt to submit an answer.
You will be given a multi-line string as input. You should output the size of the largest contiguous chunk of non-space characters. Contiguous just means that the chunk is a single piece rather than multiple disconnect... |
Given an integer \$N\$, print or return integers \$a\$, \$b\$, and \$c\$ that satisfy all of the following conditions, if such integers exist:
\$a \times b + c = N\$
\$a\$, \$b\$, and \$c\$ are all prime
\$a > b > c\$
If no valid combination of integers exist, you should return nothing, 0, None, an empty list, or rai... |
This is the cops' thread to a cops-and-robbers challenge. Click the link to find the robbers' thread.
The challenge here is very simple. Create two programs of the same size, in the same language, which output (using 1 standard output method) two different natural numbers, \$x\$ and \$y\$. Submit both programs, bot... |
This is the robbers' thread to a cops-and-robbers challenge. Click the link to find the cops' thread.
In the cops' thread of this challenge, answerers will be writing programs which output two numbers, \$x\$ and \$y\$. As robbers, your goal will be to crack their submissions. To do this, you find a program in the ... |
Introduction
You're making a robot that can navigate a set of books of varying heights. It can climb books and jump off books, but if the distance is too big it will stop to prevent damage. To figure out the ideal design, you're writing a simulator.
Your program will take as input a list of numbers, representing the he... |
I am looking for tips to code in this golfing language Seriously, and was wondering what some of the ways for golfing this language is. "Remove comments" is not a tip. Actually is also included
|
Given a ragged list of positive integers, where the maximum depth is \$d_\text{max}\$, return the same list, except for every element \$e\$, its depth is \$d_\text{max}+1-d_e\$ (where \$d_e\$ is the depth of that element).
Your output should contain the minimal number of brackets, and you can assume the same from your ... |
I like golfing in tinylisp:
(d M(q((x)(i x(i(disp x)0(M x))0
But I also like posting explanations with nicely formatted code:
(d M
(q
((x)
(i x
(i (disp x) 0 (M x))
0))))
Can you help me generate the ungolfed code for my explanations?
The task
Given a line of tinylisp code, return or output the same cod... |
The challenge is simple, find the matching parentheses for every one of the parentheses in a given string input
E.g.
()()() -> [1, 0, 3, 2, 5, 4]
Always start with the ending parentheses index before the starting parentheses, which is why () becomes [1,0], not [0,1], unless the parentheses is stacked e.g. (()), where ... |
Rubik's Clock is a round(ish) puzzle with two flat sides. On each side, front and back, there are 9 clock faces, arranged on a 3x3 grid. In addition, there are 4 pegs (switches) in between the clock faces, and they can be set to protrude either from the front or the back. Lastly, there are 4 dials on the edge of the pu... |
Your input is an array of numbers: a permutation of \$\{1, 2 \dots n\}\$ for some integer \$n \geq 2\$.
How many times must you repeat this list before you can "pick out" the numbers \$[1, 2 \dots n]\$ in order?
That is: find the lowest \$t \geq 1\$ so that \$[1, 2 \dots n]\$ is a subsequence of \$\text{repeat}(\text{i... |
A Steiner quadruple system \$SQS(n)\$ is a collection of subsets (blocks) of size 4 of a set \$S\$ of size \$n\$ such that every subset of \$S\$ of size 3 is in exactly one block. It is easy to show that the number of blocks is \$\frac14\binom n3\$ and that a necessary condition for an \$SQS(n)\$ to exist is \$n\equiv2... |
Note to those without experience in music: Through making an attempt to solve this problem, you may find that music and computer programming are similar in the ways that they implement rules and syntax. With some help from Wikipedia, you can likely solve this problem with no prior knowledge of music theory.
Write a pro... |
Challenge
Your challenge is simple, calculate the depth of each matching brackets in the given input e.g. (()()(()))->[[1,1,[1]]], and output it in the form of a list/array/string representation
Explanation:
For every bracket in the input, you have to count how many nested brackets there are for that part of the input ... |
Your input is a ragged list of possibly empty lists of non-negative integers. For example, [[2,0],[[]],[[[],[1],[]],[]]] is a valid input. This input is a "compressed" ragged list. What this means is that when we have a list of numbers, we interpret those as a list of indices, indexing the output.
For example, if I=[[2... |
Hearts is a 4-player game that uses the following scoring rules:
Everyone starts with score 0.
Each round every player gets a non-negative amount of points. The sum of the points is 26, and at least one player gets 13 or more points.1
The points are then added to the players' score except if a player gets 26 points. I... |
In this fastest-code challenge, you take a positive integer as input, which represents the height of a sand pile, located at (0,0) on an infinite square grid. For example, if our input is 123, the sand grid looks initially like this:
\$\begin{matrix}
\ddots & \vdots & \vdots & \vdots & \cdot^{\cdot^\cdot} \\
\cdots & 0... |
My final-year project at the National University of Singapore is on Zarankiewicz's problem:
What is the maximum number of 1s in an \$m×n\$ binary matrix (\$m\$ rows and \$n\$ columns) with no \$a×b\$ minor (intersection of any \$a\$ rows and any \$b\$ columns) being all 1s?
For example, the matrix below contains a \$... |
Your task is to check the volume of water in a pool. Your have to create a program that takes in a input that is represented by an 10 by 10 grid of integers, with heights ranging from A=1 to Z=26 from the latin alphabet. Find the volume of water each pool can hold.
You have to output the volume of water that the pool c... |
Given a nonnegative integer \$n\$, determine whether \$n\$ can be expressed as the sum of two square numbers, that is \$\exists a,b\in\mathbb Z\$ such that \$n=a^2+b^2\$.
0 -> truthy
1 -> truthy
2 -> truthy
3 -> falsy
4 -> truthy
5 -> truthy
6 -> falsy
7 -> falsy
11 -> falsy
9997 -> truthy
999... |
You work for a social media platform, and are told to create a program in a language of your choice that will automatically flag certain post titles as "spam".
Your program must take the title as a string as input and output a truthy value if the title is spam, and a falsey value if not.
To qualify as non-spam, a title... |
A superpowerset (analogous to superpermutation) on \$n\$ symbols is a string over the alphabet \$\{1,2,...,n\}\$ such that every subset of \$\{1,2,...,n\}\$ appears as a substring (in some order). For instance, 12342413 is a superpowerset on four symbols because it contains 1, 2, 3, 4, 12, 13, 41, 23, 24, 34, 123, 241,... |
Inspired by this SO post.
Given a vector (first parameter), e.g.:
char = ["A", "B", "C", "A", "A"]
For each element of the vector, find the distance to the closest subsequent specified value (second parameter). When the element is identical to the specified value, return 0.
f(char, "A") -> [0 2 1 0 0]
Explanation
f(c... |
My stovetop has 10 different settings of heat (0 through 9) and a very odd way of cycling through them.
When I hit plus (+) it increments the number, unless the number is 9 in which case it becomes 0, or the number is 0 in which case it becomes 9.
When I hit minus (-) it decrements the number, unless the number is ze... |
Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded.
Cubax is composed of N³ smaller cubes (elements) linked together in a kind of doubly linked chain. The chain h... |
Background
In a 2d game that I play, each screen is a 2d grid of tiles with walls and walkable tiles, with the player only able to travel on walkable tiles, and being stopped by walls. When the player walks past the edge of the screen, he will travel to the adjacent screen on the map, with the player's relative screen ... |
Mahjong is a tabletop game played using tiles. It features three "number" suits (pins, sous, mans, represented as p, s and m) from 1 to 9, and one "honor" suit z of seven distinct tiles. Note that contrary to western card games, tiles are not unique.
To complete a hand and win, the 13 tiles in your hand are combined w... |
Curling is a sport where two teams aim to place stones as close to the centre of a target as possible. The winner of a curling end is the team whose stone is closest to the centre – they score as many points as the number of their stones closer to the centre than any of their opponents.
Task
Given two lists of pairs of... |
Problem
A fact you may have noticed about factorials is that as \$n\$ gets larger \$n!\$ will have an increasing number of \$0\$s at the end of it's base \$10\$ representation. In fact this is true for any base.
In this challenge you will be given a base \$b > 1\$ and an integer \$n > 0\$ and you will determine the sm... |
Consider a NxN pixel grid with up to M objects drawn on it, either squares or diamonds:
square
diamond
The objects may overlap, so recognition is hard. The task is to give the minimal possible numbers of objects per shape that can be "seen" in the picture and tell how many squares, how many diamonds, and how many ob... |
Robbers thread
Cops
Understanding slicing
Remember, slices are zero-indexed. Take this slice: [2:]. If the string is "abcde", the result is "cde" because the slice basically means "get all elements with an index greater than 2." Let's try [1:3]. If there is an end slice, the end slice is not included. (excluded) Theref... |
Cops thread
Robbers
Robbers, your job is to find the slices of the corresponding cop's code.
Scoring
The robber with the most cracks wins.
Example
Take this code:
iimmppoorrtt ssyymmppyy;;pprriinntt((ssyymmppyy..iisspprriimmee((iinnppuutt(())))))
The slice here is [::2], so the robber's post could look like this:
Crac... |
In Bgil Midol's question, the score of a sequence of slice is defined as
sumof|startslices|∗2+sumof|endslices|∗2+sumof|stepslices|∗3
Such scoring method makes multiple slices possibly take less score, e.g.
[::25] 75
[::5][::5] 30
Given the length of a string, an upper bound of number of slices1, and the one slice i... |
Introduction
A function that adds months to a date (without overflowing ends of months) is implemented in many languages/packages. In Teradata SQL it's ADD_MONTHS, here are some examples:
ADD_MONTHS('2021-01-31', 1) => 2021-02-28
ADD_MONTHS('2021-01-30', 1) => 2021-02-28
ADD_MONTHS('2021-02-28', 1) => 2021-03-28
... |
Starting with a binary list (just 1s and 0s) we are going to roll a ball over it. The ball has a position and a direction. At every step the ball does the following:
If the number at it's position is 1, then flip the direction. It "bounces".
Flip the number, if it's 0 replace it with 1, if it's 1 replace it with 0.... |
Given a positive integer, determine if it can be represented as a concatenation of two square numbers. Concatenated numbers may not begin with 0 (except for 0). Any leading zeros in input should be ignored.
Examples
11 -> true // because 1 and 1 are squares
90 -> true // because 9 and 0 are squares
1001 -> true // ... |
This question is inspired by this awesome answer.
The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation thereof, such that the character codes of that string add up to the inputted number. The space counts towards the sum of characte... |
The Māori language has quite simple pronouns. It uses a single word for he/she/they/etc (ia), and the words for "you" and "me" are koe and au respectively.
There are also words for groups of exactly two people:
tāua - You and me (we, au and koe)
māua - Me and them (we, au and ia)
rāua - Them (third person plural - two... |
Make a program that outputs a sequence of integers so that every finite sequence of positive integers is a substring (continuous subsequence) of the output.
For example, the following sequence satisfies the rules:
1,1,1,2,1,1,1,1,2,2,1,3,1,1,1,1,1,1,2,1,2,1,1,3,2,1,1,3,1,4,...
To see the underlying pattern, let's forma... |
Simpler version of this
Task
You must create a program that outputs a triangle of a given size N.
A triangle is made of 3 identical triangles
A triangle of size N should be made of N lines
A triangle's line starts from 1 star, and increases by 2 stars each line
Test Cases:
1 ->
*
* *
3 ->
*
***
*****
... |
You are given two regexes and your task is to determine if the strings matched by the first regex are a subset of the strings matched by the second regex.
For this we are going to use a limited mathematical definition of a regex. A regex is defined recursively as one of:
ε - This matches only the string ""
0 - This ma... |
Backstory, skip if you like
Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars effortlessly rise above the primitive notion of linearly passing time and add an exhilarating sense of unpredictability to the... |
Let's define a grouping as a flat list, which is either:
just 0
2 groupings followed by the literal integer 2
3 groupings followed by 3
4 groupings followed by 4
etc. (for all integers \$ \ge 2 \$)
Note that 1 is not included in this definition, because otherwise groupings could be infinite.
For example, these are va... |
A skyline is an array of positive integers where each integer represents how tall a building is. For example, if we had the array [1,3,4,2,5,3,3] this would be the skyline in ascii art:
#
# #
## ###
######
#######
Your task is to find the area of the largest rectangle in the skyline. In this case, the largest ... |
Introduction:
Pete likes doing word search puzzles. Despite that, he has trouble searching for words vertically, (anti-)diagonally, or reversed. Because of that, he'll always search for the words left-to-right, and rotates the entire puzzle in increments of 45 degrees clockwise.
In addition to that, he'll also always s... |
The Challenge
Given a multiline string, return the longest substring of leading whitespace present in every line, ignoring empty lines or lines composed only of whitespace. If input is empty or whitespace, return nullish or the empty string--up to you.
Update: Per Meta consensus, the input may also be treated as an ar... |
It's mentioned last time that, in Hearts,
Each round every player gets a non-negative amount of points. The sum of the points is 26, and at least one player gets 13 or more points.
Actually, it's the game part:
Average the 52 cards (♠♡♢♣ * 23456789 10 JQKA) to the 4 players
The player with a ♣2(the smallest value) s... |
More advanced version of this
The aim of this puzzle is to simulate the impact of the shock wave of bombs on a square grid. The grid initially contains cells labelled 0 along with several bombs of type A, H, or B. Display the greatest intensity of shockwaves felt at each cell after the bombs explode.
The three bombs ha... |
Using the matchstick numbers here: Count the Matchsticks
_ _ _ _ _ _ _ _
| | | _| _| |_| |_ |_ | |_| |_|
|_| | |_ _| | _| |_| | |_| _|
How many matchsticks must be moved and/or removed to change one number into another?
You will take two single digit number... |
I'd like to introduce a new? programming language I call Shue (Simplified Thue). It has very simple syntax.
Here is a program that checks if an input is divisible by three:
yes
no
3=0
4=1
5=2
6=0
7=1
8=2
9=0
00=0
01=1
02=2
10=1
11=2
12=0
20=2
21=0
22=1
0=yes
1=no
2=no
Try it online!
At the top we can see two lines. Th... |
You've been hired by a bomb defusing company to perform some "controlled" demolition of un-exploded ordnance. You are given a list of bombs represented by non-negative integers.
[3,2,4,0,3,1,2]
Every step you can set up and explode a bomb. When a bomb \$n\$ explodes, it destroys all bombs within \$n\$ places replacin... |
The knight is a chess piece that, when placed on the o-marked square, can move to any of the x-marked squares (as long as they are inside the board):
.x.x.
x...x
..o..
x...x
.x.x.
Eight knights, numbered from 1 to 8, have been placed on a 3×3 board, leaving one single square empty ..
They can neither attack each other... |
The Fibonacci Sequence is a sequence of positive integers where the first two elements are 1 and the rest are the sum of the previous two. It begins \$1, 1, 2, 3, 5, 8, 13\$ and continues forever.
But what if you started with numbers other than \$1, 1\$? You could start with \$3, 4\$ and have the sequence go \$3, 4, 7,... |
Given a undirected graph \$G\$ and a integer \$k\$, how many \$k\$-coloring does the graph have?
Here by a \$k\$-coloring, we mean assigning one of the \$k\$ colors to each vertex of the graph, such that no two vertices connected by an edge have the same color. For example, the following graph can be 3-colored in 12 di... |
Background
You awake on the ground. Above you is a giant stepped pyramid-like structure. Based on your ancient history lessons, you recognize it as a ziggurat. You have been transported by Dr. Sargostein back into ancient Mesopotamia to play a game.
In this King of the Hill Ziggurat challenge, you will write a bot that... |
A skyline is an array of positive integers where each integer represents how tall a building is. For example, if we had the array [1,3,4,2,5,3,3] this would be the skyline in ascii art:
#
# #
## ###
######
#######
A maximal rectangle is a rectangle that cannot be extended in any direction while being contained... |
I like to pretty print multidimensional arrays, like this:
[ [ [1, 2, 3],
[4, 5, 6] ],
[ [7, 8, 9],
[6, 4, 2] ] ]
But it's a pain to do by hand and it'd be nice to have a program that does this for me. Your challenge is to create a program that does this for me, taking a multidimensional array containing onl... |
You have to decompose a positive integer/fraction as a product of powers of factorials of prime numbers.
For example
22 = (11!)^1 × (7!)^(−1) × (5!)^(−1) × (3!)^(−1) × (2!)^1
10/9 = (5!)^1 × (3!)^(−3) × (2!)^1
Use this special notation: prime number#power
to denote each term, e.g. (11!)^4 is denoted as 11#4.
Output... |
Your input is the height map of a tower. The 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 [1,5,4,3,2] is a valid input. Here is a visualization:
#
##
###
####
#####
15432
Your task is to wiggle the tower. Wi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.