instruction stringlengths 34 53.1k |
|---|
Input:
An integer n
Output:
A string A * B
Example
12
Possible 2 divisible numbers: 12 * 1, 6 * 2, 4 * 3
12-1 = 11
6-2 = 4
4-3 = 1
4 and 3 has the minimal absolute difference of 1
Therefore, Output:
4 * 3
Order of the numbers does not matter
This challenge idea was taken from a puzzle in Clash of Code in https://www... |
Let's say I have a non-empty list (array):
l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
I want to incrementally slice the list into incremented amount of elements per chunk.
For this array, my desired output is:
[[1], [2, 3], [4, 5, 6], [7, 8, 9, 10]]
What would be the best way to slice the array in multiple chunks.
This is c... |
I know, a bit late.
Challenge
Your challenge is, given a date, output if it's not an Advent Sunday, or the Advent Sunday of the year.
Rules
The \$4^\text{th}\$ Advent is determined by the Sunday before Christmas day (the \$25^\text{th}\$ of December). The \$3^\text{rd}\$ Advent is the Sunday before the \$4^\text{th}\$... |
Sandbox
Your challenge is to write a program that when first run, will do one of the actions below at random with equal chances of both:
A cat program
A standard cat program: read everything from STDIN and put it on STDOUT (or your language's closest equivalent).
Do nothing and halt
This shouldn't output anything.... |
This challenge is one of the two challenges which were planned for Advent of Code Golf 2021, but didn't fit into the 25-day schedule.
Related to AoC2020 Day 24, Part 2.
Given a binary configuration on a hexagonal grid, output the next generation of Hexagonal Game of Life using AoC rules:
A living cell survives if it ... |
Let's say I've got a list (or array) of:
l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
I want to get the third Cartesian power of the above list, where we take every possible triple of elements from l.
Then I want to filter and only keep the sublists where the sum of that sublist equal to the maximum value of the list.
Then I o... |
The sequence A109648 starts with the following numbers
53, 51, 44, 32, 53, 49, 44, 32, 52, 52, 44, 32,
51, 50, 44, 32, 53, 51, 44, 32, 52, 57, 44, 32,
52, 52, 44, 32, 51, 50, 44, 32, 53, 50, 44, 32,
53, 50, 44, 32, 52, 52, 44, 32, 51, 50, 44, 32,
53, 49, 44, 32, 53, 48, 44, 32, 52, 52, 44, 32,
51, 50, 44, 32, 53, 51, 4... |
The challenge is simple: Print the first and last element of a list and print them
Rules:
You will take only 1 line of input, and that is the list (e.g. [1, 5, 6, 4, 2])
You are allowed to print the 2 numbers in any order with or without spaces between them
Output the 2 numbers on 1 line and the remaining list on the ... |
Thanks to rak1507 for the suggestion
"Random" in this challenge always refers to "uniformly random" - of all possible choices, each has an equal chance of being chosen. Uniform shuffling means that every possible permutation of the array has an equal chance of being chosen.
Given an array consisting of positive digit... |
The Challenge
Create an terminating expression in SKI Combinator Calculus in less than 200 combinators (S, K, I) that reduces to the expression with the most combinators.
There will be no limit on how many parenthesis/applications can be used.
SKI
SKI expressions are created using S, K, I and parenthesis. They are redu... |
Background
A classical logic gate is an idealized electronic device implementing a Boolean function, i.e. one that takes a certain number of Boolean inputs and outputs a Boolean. We only consider two-input logic gates in this challenge.
There are \$2^{2 \times 2} = 16\$ distinct two-input logic gates (2×2 input combina... |
This task builds on: Find all reflexicons using roman numerals
An autogram is a sentence that lists the count of its own letters. Below is one of the first documented autograms found by Lee Sallows in 1983:
This pangram lists four a’s, one b, one c, two d’s, twenty-nine e’s, eight f’s, three g’s, five h’s, eleven i’s,... |
Inspired by this StackOverflow post
Given a list where each element appears a maximum of 2 times, we can define it's "sortedness" as the sum of the distances between equal elements. For example, consider
[1,1,2,3,3] (array)
0 1 2 3 4 (indices)
The sortedness of this array is \$2\$. The distance between the 1s is \$1... |
This is the second version of the task. The original task had a defect that the given range of integers was too small. This was pointed out by @harold that other methods couldn't defeat the way of hard-coding all the possible prime divisors. Now you have a larger range of integers to test from 0 to 2000000. Also, the r... |
Add++ is the Language of the Month for January 2022, and so I'm asking for tips for golfing in it. Please stick to tips specific to Add++, and avoid general tips such as "remove whitespace" or "avoid comments".
Please post separate tips as individual answers
|
Inspired by this Stack Overflow post.
Given an ascending-sorted array of possibly duplicated integers, your goal is to increment each number by a counter, starting at 0, that resets for each group.
Spec:
Any numbers may be negative (but if so, they'll be at the beginning, because the array is sorted),
The array will h... |
Given a lower case string. Ex:
s = 'abcdefghijklmnopqrstuvwxyz'
The goal is to make every other vowel uppercase.
Desired output here:
abcdEfghijklmnOpqrstuvwxyz
As you can see, from aeiou, \$`e`\$ and \$`o`\$ get uppercased.
For aeiou, the desired output is:
aEiOu
There are only lowercase characters in the strings i... |
Introduction
Congratulations! You've been selected to do research a a newly discovered animal called a fuzzy, a docile, simple creature that strongly resembles a cotton ball. Fuzzies love to be near other fuzzies, but not all fuzzies want to be near each other.
There are 6 types of fuzzies, 1a, 1b, 2a, 2b, 3a, and 3b. ... |
Add++, the Language of the Month, has the "collect" builtin as BC. Your task is to implement this builtin.
Consider a non-empty array, where each element is either:
A positive digit between 1 and 9 inclusive, or
A non-empty list of positive digits between 1 and 9
For example, all the following such arrays meet this ... |
Play the Fruit Box Game
Intro
Fruit Box is a game consisting of a 10x17 grid of numbers, each between 1 and 9, where the goal is to clear as many numbers as possible in a two-minute time window. In order to clear numbers, one selects a rectangle aligned with the grid, and if the numbers inside of it sum to 10, they are... |
This expression actually has an omitted pair of parentheses.
1 + 2 * 3
To make things clear, it should be,
1 + (2 * 3)
Even this has its parentheses missing.
1 + 2 + 3
It actually means,
(1 + 2) + 3
People often assume left-to-right evaluation to such an arithmetic expression, but I want to make everything very cle... |
Task
A reverse checkers position is a chess position where every piece for one player is on one colour and every piece for the other player is on the other colour. Your task is to find if the given (valid) position meets these criteria.
For example, this position does (click for larger images). Every white piece is on ... |
Input a non-empty array of positive (greater than 0) integers. Output another non-empty array of positive integers which encode the input array. Output array does not use any numbers used in the input array.
Rules
Output array should not contain any numbers used in the input array.
Both input and output array may con... |
hgl has a "scan" function called sc. What it does in general is a little bit abstract, so we will just talk about one specific way you can use it.
If we want to take a list of integers and get the partial sums of every prefix we can scan with + for sums and 0 as a starting value:
ghci> sc (+) 0 [1,2,3,4,5,6]
[1,3,6,10... |
A rhyme scheme is the pattern of rhymes at the end of the lines in a poem. They are typically represented using letters, like ABAB. We consider two rhyme schemes identical if they are isomorphs, and therefore only report the lexicographically earliest. Equivalently, rhyme schemes are simply strings in standard order. T... |
Given a ragged list of positive integers find the size of the largest list contained somewhere in it.
For example:
[1,[1,[8,2,[1,2],5,4,9]],2,[],3]
Here the answer is 6 because one of the lists has 6 elements and all other lists have fewer.
[1,[1,[8,2,[1,2],5,4,9]],2,[],3]
^ ^ ^ ^ ^ ^
The length doesn't ca... |
Seven countries lay official claims to parts of Antarctica: Argentina, Australia, Chile, France, New Zealand, Norway, and the United Kingdom. We will focus only on the claims of the main Antarctic landmass south of 60° S, which are:
Chile: between 90° W and 53° W
United Kingdom: between 80° W and 20° W
Argentina: betw... |
You may know the game The Six Degrees of Kevin Bacon, based on the conjecture that every actor in Hollywood can be connected to Kevin Bacon by no more than 6 "co-star" relations, so Kevin Bacon is supposedly the "best-connected" node in that graph. Your task will be to find the Kevin Bacon of a graph.
We will use posit... |
In graph theory a tree is just any graph with no cycles. But in computer science we often use rooted trees. Rooted trees are like trees except they have one specific node as the "root", and all computation is done from the root.
The depth of a rooted tree is the smallest number, \$n\$, such that any node of the tree ... |
This challenge is inspired by the High throughput Fizz Buzz challenge.
The goal
Generate a list of prime numbers up to 10,000,000,000,000,000. The output of primes should be in decimal digits followed by a newline character '\n' in ascending order starting from the lowest prime 2. You may not skip a prime number or out... |
ed is the standard text editor on Unix systems. Your goal is to write an ed clone.
Task
Write a program that reads an input stream and for every received end of line character, print ? followed by a end of line character.
The communication has to interactive. Means the program needs to output as soon as possible and h... |
Given an integer n, find the next number that follows the following requirements:
The next greater number is a number where each digit, from left to right, is greater than or equal to the previous one. For example, 1455:
1<4
4<5
5<=5
The next greater number has to be bigger than n
Testcases
10 -> 11
19 -> 22
99 -> ... |
Let's define a simple function \$f\$ which takes an integer and produces a list:
\$
f(n) = [g(1),g(2),\dots,g(n)] \\
g(n) = [f(0),f(1),\dots,f(n-1)]
\$
We can then calculate the first couple of values for \$f(n)\$:
0 ->
[]
1 ->
[[[]]]
2 ->
[[[]],[[],[[[]]]]]
3 ->
[[[]],[[],[[[]]]],[[],[[[]]],[[[]],[[],[[[]]]]]]]
4 ... |
Consider this nested array
[[1,2,4],[1,2,3],[2,3]]
In each subarray in which 1 appears, a 2 appears. You might say that 1's presence is dependent on 2's presence.
The converse is not true, as 2 appears in a subarray without 1.
Additionally, 3 is dependent on 2, and 4 is dependent on 1 and 2.
Task
Given a list of lists ... |
I am trying to write a solution to the following problem using as few characters as possible (to meme my friend and introduce him to golfing). Can any improvements be done to my code?
So the problem requires us to write a function called navigate in Python 3.6 (language of the judge, sorry, no walruses) that takes two ... |
I recently learned from a comment by MathOverflow user pregunton that it is possible to enumerate all rational numbers using iterated maps of the form \$f(x) = x+1\$ or \$\displaystyle g(x) = -\frac 1x\$, starting from \$0\$.
For example, $$0 \overset{f}{\mapsto} 1 \overset{f}{\mapsto} 2 \overset{g}{\mapsto} -\frac12 \... |
Your task, is simply to multiply 2 integers given in input, separated by a ",". The catch is, you cannot use the multiplication operator "*", even if it is being used differently, or any loops whatsoever
This is code-golf, so shortest code wins!
Test cases: i dont know if you even need it! lol
1,0 -> 0
5,6 -> 30
3920,5... |
Let's have a ragged list containing no values, only more lists. For example:
[[[],[[]],[],[]],[],[[],[],[]],[]]
And the list will be finite, meaning that eventually every path terminates in an empty list [].
It's simple enough to determine if two of these are structurally equal. Check each element in order for equali... |
Inspired by this Mathematica.SE post
Given two positive integers \$n, k\$ with \$n > k \ge 1\$, output a binary \$n\times n\$ matrix such that every row and column contains exactly \$k\$ 1s, and the leading diagonal is all zero. This is the adjacency matrix of a regular graph.
You may output any valid matrix, and it do... |
First 15 numbers of the A046173:
1, 99, 9701, 950599, 93149001, 9127651499, 894416697901, 87643708742799, 8588189040096401, 841554882220704499, 82463790268588944501, 8080609891439495856599, 791817305570802005002201, 77590015336047156994359099, 7603029685627050583442189501
Your task is simple, output the first 20 numbe... |
Let's build a sequence of positive integers. The rule will be that the next number will be the smallest number which:
It hasn't already appeared in the sequence
Its absolute difference from the number preceding it wouldn't be equal to any previous absolute difference between consecutive elements.
Task
Your task is t... |
Challenge:
Given an ASCII art of a (possibly leaky) bowl consisting of a random distinct non-whitespace and non-~ character, fill it completely with ~ characters. If the bowl is leaky, fill the bottom row below the bowl and a stream of liquid emerging from that, with the intended amount of ~ if the bowl would not have ... |
Challenge
Given a list of bases for positional numeral systems as input, output the lowest positive integer that when represented in those bases they have no common digits. The input list can be assumed to have two or more unique positive integers >= 2.
Example
For the input list of bases 2, 8, 10, 16 (binary, octal,
d... |
We are to define the idea of a fixed list as follows:
A fixed list is a list of fixed lists.
This definition is recursive so it's useful to look at some examples.
The empty list [] is a fixed list.
And list of empty lists is a fixed list. e.g. [[],[],[]]
Any list of the above two is also a fixed list. e.g. [[],[],[[... |
Background
We will be using a 3x3 cube for this challenge.
Rubik's cubers have their own notation for movements on the cube:
Each of the 6 faces has a clockwise turn notated with a single capital letter: UDLRFB. There are three additional letters MES denoting the three center slices.
Counterclockwise rotations have a ... |
My user id is 106959
How to check if the number is Fmbalbuena number?
First Step: Check if the number of digits is a multiple of 3: 6 = 3 * 2
Second step: Split the digits into even thirds: 106959 -> 10 69 59
Third step: Subtract the first set of digits from the second modulo 10: 6 - 1 = 5, 9 - 0 = 9
Last step: Check t... |
As input you will be given a ragged list of positive integers containing at least one integer at some level. For example:
[[],[[1,2,[3]]],[]]
You should output the depth of the least deep integer. For example if the input is just a list of integers, then the every integer is 1 level deep so the answer is 1. There m... |
Let's make a little stupid program that simulates the meme "Mr. incredible becoming uncanny", but in this case, our little ASCII friend is going to react to our code length.
Objective:
Create a program that takes anything (preferably a program) as input and outputs this:
Pov:
<face> you score X on codegolf
Where X ... |
Universal Command Sequence
Definition
An \$n\$-maze is a \$n\times n\$ chessboard which has "walls" on some edges, and a "king" on the board that can move to the 4 adjacent cells, which cannot pass through any walls. Starting from any cell the king should be able to reach every cell on the board.
A command sequence is ... |
Toki pona is a minimalist constructed language, and thus it has minimalist phonotactics (rules describing what sounds make valid words).
Toki Pona has 8 consonant sounds m, n, p, t, k, s, w, l and j and 5 vowel sounds a, e, i, o, u. A single basic syllable in toki pona consists of any 1 consonant, any one vowel and op... |
Wordle is a daily online word game that has received considerable attention recently.
The Game
The object is to guess a secret word in the fewest attempts. Consider the following instance of the game:
The secret word is rebus, and the player's first guess was arise. The letters r, s, and e are displayed in yellow to i... |
Introduction
A pure word (or perfect word), as defined by me, is a word where the sum of the position in the alphabet of each letter in the word is perfectly divisible by the total length of the word. For example, abcb is a perfect word because 1 + 2 + 3 + 2 = 8, and 8 / 4 = 2.
Your task
Given a word as input, output w... |
Background
This is Post's lattice:
Credit: EmilJ
It denotes the lattice of all clones on a two-element set {0, 1}, ordered by inclusion (from Wikipedia). That can be a bit of a mouthful so lets look at a concrete example. MP (located near the top) is a set that contains all boolean circuits that can be made with and a... |
You are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into sections that are enclosed in a "group" created by [...] and those that are not. e.g.
"absbn[mesl]meslo[eyyis]me"
->
"absbn"
"mesl"
"meslo"
"eyyis"
"me"
Super simple right? Well hold your horses. ... |
Very related
You're given a piece of ASCII art representing a piece of land, like so:
/‾\
__/ ‾\_
\_/‾\
\
Since an overline (‾) is not ASCII, you can use a ~ or - instead.
Your challenge is to determine if it is connected by the lines of the characters. For example, the above can be traced ... |
You will be given as input an infinite stream of positive integers.
Your task is to write a program which outputs an infinite sequence of lists with two requirements:
All lists in the output are finite sub-lists of the input stream.
Every sub-list must be output eventually by your program.
Sub-lists are not necessari... |
This is not a duplicate of this challenge.
Here by an array, I mean a nested list that is "not ragged", i.e., it is either a list of elements, or a list of arrays of the same shape. For example, this is an array of shape (2,3):
[[1, 2, 3], [4, 5, 6]]
The depth (or rank) of an array is the length of its shape. The dept... |
The task is simple, given an integer n of how many lines the next n lines is and, a multi-line input, output the resulting 90 degree tilted grid in a clockwise formation.
E.g.
Input:
2
c d
o e
Output:
o c
e d
I/O format:
Input will have spaces in between them
Input always contains alphabetical characters except the ... |
\$BB\$ is the busy beaver function, an uncomputable function.
Write a program which when given an integer \$n\$ as input, will output \$BB(n)\$, with at least \$\frac 2 3\$ probability. You can do whatever (return something wrong, infinite loop, explode, etc.) in other cases.
To help you compute it, you're given a func... |
This is an alternate version of this earlier challenge with a twist that adds a significant bit of difficulty.
Like last time, you are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into sections that are enclosed in a "group" created by [...] and those that ... |
NDos' Numeral System
NDos' numeral system is a numeral system invented by me. It represents every nonnegative integer by a binary tree. Given a nonnegative integer \$n\$:
If \$n=0\$, it is represented as the empty tree.
Otherwise, the tree has a root. With the binary expansion of \$n\$:
The left sub-tree of the root... |
Given an ASCII-art shape made of the characters /\|_, your challenge is to return the number of sides it has.
A side is a straight line of one of those, for example:
\
\
\
/
/
|
|
|
|
_____
Are all sides.
For example, this shape:
___
/ \
/_____\
Has four sides. You can assume the input will be a single va... |
Background
Note: This configuration was co-found by one of our fellow code golf enthusiasts, Zgarb
A 29 year old conjecture by John Conway about the Game of Life was recently solved.
To quote Conway from the linked article:
Indeed, is there a Godlike still-life, one that can only have existed
for all time (apart from ... |
A manufacturing company wants to print a design on mats of varying dimensions, and they hired you to program a robot to make these mats. The design consists of alternating rings of any 2 symbols on a mat. Below are some sample looks:
Column 9 by Row 7
Symbol 1: @
Symbol 2: -
Input: 9 7 @ -
@@@@@@@@@
@-------@
@-@@@@@-@... |
An Egyptian fraction is a representation of a rational number using the sum of distinct unit fractions (a unit fraction is of the form \$ \frac 1 x \$ where \$ x \$ is a positive integer).
For all[1] positive integers \$ n \ne 2 \$, there exists at least one Egyptian fraction of \$ n \$ distinct positive integers whose... |
You are probably familiar with the Cartesian product. It takes two lists and creates a list of all pairs that can be made from an element of the first and an element from the second:
\$
\left[1,2\right] \times \left[3,4\right] = \left[(1,3),(1,4),(2,3),(2,4)\right]
\$
Here the order of the result is such that the pair... |
Your task is to make a bidirectional compressor. It takes a list of bytes as input and returns a list of bytes as output. It has the property than whenever it is iterated twice it returns the original input.
In other words, if f is your program as a function, then f(f(x))=x for all x.
Now, since this is a "compressor",... |
Your task is simple, just remove the odd indices and double the even indices
Example
the input is Hello, World! and we get indices
H e l l o , _ W o r l d !
1 2 3 4 5 6 7 8 9 10 11 12 13
and remove the odd indices
el,Wrd
Double!
eell,,WWrrdd
and you are done
1-Indexing
Test cases
abcdef => bbddff
umbrella => mmrr... |
Your task is to print this exact text:
| | | | | |
&***********&
| Code Golf |
| e---------f |
| d___________l |
| o-------------o |
| C_______________G |
###Dennis$Dennis###
#####################
Rules
Trailing or leading newline is allowed
code-golf, so shortest code wins!
|
What general tips do you have for golfing in Lexurgy? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Lexurgy (e.g. "remove comments" is not an answer).
Please post one tip per answer.
Lexurgy is a tool created by Graham Hill/def-gthill meant for conlang... |
A palindrome is a word which is spelled the same backwards and forwards. For example, "racecar" is a palindrome as is "redder". A double palindrome is a palindrome whose halves are also palindromes. For example, "abbabba" is a double palindrome, as the half "abba" is also a palindrome. Similarily, "abaababaaba" is a tr... |
The \$\text{argwhere}\$ function takes a list of values and a predicate/boolean function as arguments and returns a list of indices where the predicate function returns true in the input list. For example,
argwhere([1, 2, 3, -5, 5], x -> x > 2)
would produce an output of [2, 4] because those are the (0-indexed) indice... |
You work at a bakery and every day you make exactly 100 bagels. However your customers are not as reliable and every day a random number of bagels will be ordered. So sometimes you will run out of bagels and sometimes you will have leftovers.
Now leftover bagels will still be good for 1 more day. After a day on the ... |
Robbers thread
Cops,
Choose two strings of code, one public and one secret. We will call them P and S. You will be writing a program using only repetitions of these strings.
For example: if you choose P=helloand S=world, valid programs would be hello, world, helloworld, worldhello, helloworldworldhello, hellohellohello... |
Cops thread
Robbers,
Write a program in the cop's language using the cop's P string and your own S string, and the amount of each of them specified in the cop's post. Your S string may not exceed the cop's S string in bytes.
The program
Using only strings P and S, write a program which takes a list of 5 or more non-rep... |
Choose a language and write a program in the language that:
Take a valid program of the language as input,
Output a string(bytearray, etc.). It needn't be a valid program.
Only finite valid inputs result in longer/same-length(in bytes) output.
Different valid input, even if behave same, lead to different output.
Let ... |
Fourward (Introduction)
I have an unhealthy obsession with the number 4. I love it so much, in fact, that seeing any other digit is frustrating to me. I therefour wish to create a 'Fourier Transformation': a way to represent any integer value with an expression that uses only the digit 4.
Fourmat (Challenge)
I wish to ... |
The inverse of this question.
Your challenge is to, given a piece of ASCII art generated by the above question and its enlargement factor, shrink it down to its original size.
The enlargement process
Or look at this
ASCII art within a limited character set can be enlarged to a certain (odd) size by replacing certain c... |
Your lab needed to simulate how a particular cell evolves over time in a 2D grid space. A sample 2D grid space below shows a single cell at the centre of the grid.
0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0
The cell evolution follows these rules:
'0' indicates no live cell
A positive number indicates a live ce... |
An "Egyptian fraction" is a list of distinct fractions with a numerator of \$1\$. For example:
\$
\frac 1 1+ \frac 1 2 + \frac 1 3 + \frac 1 6
\$
The "size" of an Egyptian fraction is just the number of terms involved.
Your task is to take a positive integer \$n\$ and output the smallest Egyptian fraction that sums t... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.