instruction stringlengths 34 53.1k |
|---|
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2017 Day 16. I'm using the wording from my Puzzling SE puzzle based on the same AoC challenge instead of the original AoC one for clarity.
\$n\$ people numbered \$1, 2, \cdots, n\$ are standing in line in the order of their cor... |
Intro
Blur's song Girls & Boys featured the lines
girls who are boys who like boys to be girls
who do boys like they're girls, who do girls like they're boys
in the chorus. These lines have a pretty uniform structure: you have a subject, which is either girls or boys, a relative clause, either who are, who like, or wh... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost).
Santa is delivering presents to an infinite two-dimensional grid of houses each 1 unit apart. The delivery begins delivering... |
Definition
Given some string return an integer whose digits are the number ocurrences of a-z (case insensitive, in alphabetical order) in that string. Any character with 0 instances is skipped. Characters with 10 or more instances will define 2 or more digits of the returned integer. For example, aaaaaaaaaaaaaaaaaaaaaa... |
I was browsing Stack Overflow when I saw this post in Puzzling in the hot network questions and decided to make a challenge out of it (all credit goes to the creator of the challenge).
Overview
A Chess Number is a number that, when converted to base 18, results in a valid chess coordinate pair, where the first characte... |
Your Challenge is to take a binary string as input and get all binary numbers between itself and the reverse of its string representation (the reverse may be less than or greater than the original input).
Output must be padded with zeroes to be the same length as the input.
The Order in which the values are displayed d... |
Your challenge is to, given a positive integer n, count up to each digit of it, giving the effect of converging on it.
Basically, count up to the first digit of n by its place value (\$⌊\log_{10}\left(x\right)⌋\$). Then do the same for each subsequent digit, but with the values of the previous digits added.
Example imp... |
Related to AoC2017 Day 18, Part 2. (Anyone want to add Duet to esolangs?)
Duet is an assembly-like language that involves two processes running the same program simultaneously. Each process of Duet operates with 26 registers named a to z, all initialized to zero, except for the register p which contains the process ID... |
Write a program that translates an arithmetic expression to a Brainfuck program which evaluates the expression and prints the result in decimal numbers. For example, this arithmetic expression,
2 * (3 + 4)
can be translated to Brainfuck as,
++ 2
>+++ 3
>++++ 4
[-<+>]< add
<[>[->+>+<<]>[-<+>]<<-]>[-]>>[-<<<+>>>]<<< mul... |
The story continues from AoC2017 Day 22, Part 2.
The damn virus that was infecting a grid computing cluster now has jumped to a hexagonal computing cluster! In this cluster, the computers are connected in the honeycomb-like shape, and each computer has three neighbors.
.. .. ..
. .. .. .
.. .. ..
. .. .. ... |
Challenge
Given two binary vectors (containing two consistent values of your choice) of length \$n\$ and \$m\$, output a corresponding ascii-art hitomezashi stitching pattern.
You are to fill the following pattern, where \$n\$ is the number of A-columns and \$m\$ is the number of B-rows:
A A A A A
B+B+B+B+B+B
A A A A... |
In as few bytes as possible in t-sql, return 100 rows containing the phrase 'Have a great Christmas'
92 (I think) to beat :D
CREATE TABLE #(m char(99))
GO
INSERT # SELECT'Have a great Christmas'
GO 100
SELECT * FROM #
Previous best effort was:
WITH t(m,r)AS(SELECT'Have a great Christmas',1 UNION ALL SELECT m,r+1 FROM ... |
Introduction
Everyone knows the FizzBuzz sequence. It goes something like this:
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
.
.
.
In case you don't know, if the number is divisible by 3, it's Fizz. If it is divisible by 5, it's Buzz. If it is divisible by both, it's FizzBuzz. If it is not divisible by bo... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2018 Day 3.
But you're not Bubbler, you're Lyxal! yeah, I know.
After a long period of chaos, the Elves have finally agreed on how to cut the fabric. Unfortunately, the next day they have come up with how to utili... |
Output a sequence of all the primes that are of the following form:
123...91011...(n-1)n(n-1)..11109...321. That is, ascending decimal numbers up to some n, followed by a descending tail, all concatenated.
Background
Recently, Numberphile posted a video about primes that follow this pattern.
Output
1 -> 123456789109876... |
The input message consists of ASCII characters
The encoded output message consists of blocks of 0
A block is separated from another block by a space
Two consecutive blocks are used to produce a series of same value bits (only 1s or 0s):
After the ACSII character(s) have been converted to binary, go through the string:
... |
If you visit Code Golf often, you may have heard of Kolmogorov complexity. It's usually defined as the amount of bytes required to express some string in a programming language.
Here the Kolmogorov-complexity of a natural number is defined similarly: the number of bytes required to represent it in a programming languag... |
Euler's totient function, \$\varphi(n)\$, counts the number of integers \$1 \le k \le n\$ such that \$\gcd(k, n) = 1\$. For example, \$\varphi(9) = 6\$ as \$1,2,4,5,7,8\$ are all coprime to \$9\$. However, \$\varphi(n)\$ is not injective, meaning that there are distinct integers \$m, n\$ such that \$\varphi(m) = \varph... |
To shuffle a string \$s\$, Alice applies the following algorithm:
She takes the ASCII code of each character, e.g. "GOLF" → \$[ 71, 79, 76, 70 ]\$
She sorts this list from lowest to highest: \$[ 70, 71, 76, 79 ]\$
She reduces each value modulo the length of the string (4 in this case), leading to the list \$A = [ 2, 3... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2018 Day 7, Part 2.
Why I'm pxeger, not Bubbler
As soon as you and a few Elves successfully assemble the Sleigh kit, you spot another set of the same kit not so far away. But you noticed that the last Elf is slack... |
Challenge
Given an input string X, determine if X can be obtained from reshaping a strict prefix of itself (a prefix that is not X itself).
Reshaping a string to a length N means repeating the string as many times as needed and then taking the first N characters of it.
Examples:
The string "abba" returns Truthy becacau... |
A reflexicon is a self-descriptive word list that describes its own letter counts. Take for example the one found by Ed Miller in 1985 in English:
Sixteen e’s, six f’s, one g, three h’s, nine i’s, nine n’s, five o’s, five r’s, sixteen s’s, five t’s, three u’s, four v’s, one w, four x’s
This reflexicon contains exactl... |
Grimm's conjecture states that, for any set of consecutive composite numbers \$n+1, n+2, ..., n+k\$, there exist \$k\$ distinct primes \$p_i\$, such that \$p_i\$ divides \$n+i\$ for each \$1 \le i \le k\$.
For example, take \$\{24, 25, 26, 27, 28\}\$. We can see that if we take the primes \$2, 5, 13, 3, 7\$, each compo... |
Imagine you have a grid where some squares are walls, some are empty, and some are lights that shine for arbitrary distances in the four cardinal directions until they meet walls:
####.####
##..L....
####.##.#
####.##L.
##......L
In the above grid, the lights cover all the tiles. But in some cases, they may not be:
##... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2018 Day 8.
The license file for an imaginary software system is defined as follows:
The entire file is a sequence of non-negative integers.
The entire file defines a tree of nodes.
Each node in the tree has the following fiel... |
Given the input of n and value. The code is supposed to nest the single element list with value repeated n times. The final output should be a multilevel nested list with single repeated values in all sublists.
This is code-golf, so the shortest code in bytes wins!
Test cases:
n = 1, value = 'a': ['a']
n = 2, value = '... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 3.
On the way to vacation, you're traveling through a forest on an airplane. For some biological and geological reasons, the trees in this forest grow only at the exact integer coordinates on a grid, and the entire for... |
Yeah... it's confusing. Let me explain it a little better:
With a string, get the unicode code points of each letter
Let's use "Hello World!".
The code points would be [72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]
Of each digit of the code points, get their binary format
Get the binary of 7, then 2, the... |
Given a word, get the indexes of each letter in the alphabet.
For example: uncopyrightable becomes: [21, 14, 3, 15, 16, 25, 18, 9, 7, 8, 20, 1, 2, 12, 5]
Convert these indexes to the given numeral system.
For example, if the radix is 36, then the array above would become:
['l', 'e', '3', 'f', 'g', 'p', 'i', '9', '7',... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 11.
Crossing the bridge, you've barely reached the other side of the stream when you are overcome with a sense of deja-vu. "Haven't I done this already?" But before you can finish that thought, someone r... |
Given a positive integer \$n\$, your task is to find out the number of partitions \$a_1+a_2+\dots+a_k=n\$ where each \$a_j\$ has exactly \$j\$ bits set.
For instance, there are \$6\$ such partitions for \$n=14\$:
$$\begin{align}&14 = 1_2+110_2+111_2&(1+6+7)\\
&14 = 10_2+101_2+111_2&(2+5+7)\\
&14 = 10_2+1100_2&(2+12)\\
... |
Consider the array [5, 6, 8, 3, 9, 4, 2, 1, 7]. If we list how far each number has moved from it's (1-indexed*) index, we have (considering absolute distance):
Array: [5, 6, 8, 3, 9, 4, 2, 1, 7]
Index: [1, 2, 3, 4, 5, 6, 7, 8, 9]
Dists: 4 4 5 1 4 2 5 7 2
We can then group the elements of the array based on th... |
Consider a length-\$n\$ array of positive integers.
The complement of the element with index \$i\$ is the element with index \$n - i - 1\$.
The twin of an element \$a\$ is its complement after removing all elements not equal to \$a\$.
For example, in the array [1, 2, 3, 4, 2, 1, 3, 2], the complement of the first 2 i... |
Background
It was a normal presentation that I were in as a audience, until the presenter gave a math problem about repeat taking 2 number out of a list a replacing them with average, claiming that there will be something special about it, and our math teacher, sitting at the end of classroom, exciting rushed to me, an... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 11, Part 2.
You enter the waiting area for a ferry, and you see a bunch of people sitting at a bunch of seats. The seats form a grid like this (. is a floor, L is an empty seat and # is an occupied seat):
LL.#L
#.L.L
L... |
Loading Circle Animation
Challenge
Write a full program that takes no input (or has an unused input) that displays exactly the following ASCII animation for as long as possible or only 8 frames.
Frame 1:
#
#
# #
##
Frame 2:
##
#
#
##
Frame 3:
##
# #
#
#
Frame 4:
##
# #
# #
(Note that the line at the end... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 13, Part 2.
Why Bubbler isn't posting this; Why Riker isn't posting this
A shuttle bus service runs between the sea port (where you are) to the airport (where you need to go). Each bus has an ID number that also indica... |
Consider some arbitrary polynomial with integer coefficients,
$$a_n x^n + a_{n-1}x^{n-1} + \cdots + a_1x + a_0 = 0$$
We'll assume that \$a_n \ne 0\$ and \$a_0 \ne 0\$. The solutions to this polynomial are algebraic numbers. For example, take the polynomial $$x^4 - 10x^2 + 1 = 0$$
We have that \$x = \sqrt 2 + \sqrt 3\$ ... |
What general tips do you have for golfing code in Pascal?
I know this is a tricky language very few people use this but I would like to know any tips from the professionals out there :)
I'm looking for tips that can reduce code size (every byte counts!) with special functions or even crazy combinations
Please post each... |
Although on codingame.com, Objective C and C are two of the best golfing languages there, so I would like to know some of the best golfing methods (although I am a python person, I am currently trying to learn C++/C)
I am looking for general ways/tips to golf one's code (so please don't post tips such as "remove commen... |
Any general tips for golfing in VB.net?
This, similar to Pascal, is a very rarely used language, thus having very few resources online
Visual Basic.NET (VB.NET) is a multi-paradigm, managed, type-safe, object-oriented computer programming language. Along with C# and F#, it is one of the main languages targeting the .NE... |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 20, Part 1. (This day is a dreaded one for many of you, I know :P)
Obligatory final "but you're not Bubbler" explanation.
As the train carries you to the destination, you've got some spare time. You open the travel boo... |
Given a positive integer N, output this doubling pattern of slash squares/rectangles.
For N=1, the base is:
/\
\/
The next square is added in the bottom right direction for N=2:
/\
\/\
\/
After that, a 2x1 rectangle is added in the bottom left direction for N=3:
/\
/\/\
\ \/
\/
Then a 2x2 square is added in the t... |
The Mathematica SE question Creating the Yin Yang symbol with minimal code seems to be an out-of-the-box ready-to-go Code Golf SE question!
The following code creates the Yin Yang symbol
Graphics[{Black, Circle[{0, 0}, 1], White,
DiskSegment[{0, 0}, 1, {1/2 \[Pi], 3/2 \[Pi]}],
Black, DiskSegment[{0, 0}, 1, {3/... |
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 22, Part 2.
Combat is a simple two-player card game played with a deck of cards. A unique positive integer is written on each card. The game proceeds as follows:
... |
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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.