instruction stringlengths 34 53.1k |
|---|
Grouping takes a list and splits it into new lists of equal adjacent elements. For example
[1,1,2,1,1] -> [[1,1],[2],[1,1]]
If you then take the length of these groups you get a new list of integers
[1,1,2,1,1] -> [2,1,2]
Your task is to write a program that takes a list of positive integers and find the number of t... |
Given a number as input, print out its collective sum
What is a collective sum?
Consider the number 13214, the input
Looping through each of the digits starting from the left, we will be able to obtain its collective sum.
1 means look at the first digit, and add it to the sum, sum = 1
3 means look at the "first 3 digit... |
Intro
This is based on an actual problem I recently faced while making a computer game and I thought it would make for a nice round of code-golf.
There are seven main spectral classes of star which put out varying amounts of heat. The geology of planets around a star are greatly influenced by the amount of heat receive... |
Note that this challenge requires no handling or understanding of complex numbers.
Given a non-empty square matrix where every element is a two-element (Re,Im) integer list, determine (giving any truthy/falsy values or any two consistent values) whether this represents a Hermitian matrix.
Note that the input is a 3D ar... |
Introduction
Write a program to calculate the partial derivative of a polynomial (possibly multivariate) with respect to a variable.
Challenge
Derivatives are very important mathematical tools that has been widely applied in physics, chemistry, biology, economics, psychology and more to handle all kinds of problems. Ex... |
Introduction
Decide whether a Hexagony program composed solely of the characters .)_|\/><@ will halt using least bytes.
Challenge
Hexagony is a language developed by Martin Ender in which the source code is presented in the form of a hexagon. It has been extensively used in PPCG and there has been many impressive submi... |
A cannonball is fired so that in the first eyeblink of its flight it ascends by N treetops, during the second eyeblink by N-1 treetops, etc until it reaches the highest point of its trajectory. Then it starts falling by 1, 2, etc treetops per eyeblink until it hits the ground. At the same time the cannonball is moving ... |
Most people are familiar with the trope about counting sheep to fall asleep. There's a herd of sheep, some of them jumping over a fence, and you count the sheep as they jump. Supposedly, this helps quiet your mind and gets you into a sleep-like state so that you'll fall asleep.
Here's an ASCII sheep facing to the right... |
Given 2 inputs (m=minimum starting id, n=number of ids), generate a sequential list of ids, starting at >=m, made up of the digits 0-9 where no 2 contiguous numbers are the same, e.g. 1232 is ok, 1233 is not (contains 2 '3's next to each other).
Example
for m=985, n=6, below shows what ids would be generated/skipped
..... |
A half cardinal cyclic quine is a cyclic quine with two states, one perpendicular to the other.
Rules
You can decide which rotation you want to implement, clockwise or counter-clockwise.
Once rotated, any gaps in your code should be replaced with spaces to preserve the positioning.
Your program must satisfy the communi... |
256-color Xterm-compatible terminals add 240 colors on top of the usual 16 system colors. Colors 16-231 use 6 levels (0, 95, 135, 175, 215, 255) of red, green, and blue, ordered lexicographically. Colors 232-255 are simply 24 levels of gray (8...238 by 10s). To get a better idea of what I'm talking about, see this tabl... |
We all know of, or at least have heard of, brainfuck, one of the most famous and influential esoteric languages. While these days most implementations use an infinite tape, the original compiler by Urban Müller had a tape of 30000 cells. A little known fact* is that there is actually a special value at the end of the t... |
This challenge is inspired by this, now deleted question.
Take a positive integer N as input, and output a matrix with the numbers 1 .. N2 that follows the pattern below:
Fill in the first row with 1 .. N then fill the last row (row number N) with (N+1) .. 2N, then fill the second row with (2N+1) .. 3N and continue un... |
Challenge:
Input:
An integer n (> 0)
An integer-array a of size > 0 (which contains positive and negative values, but no zeroes)
Output:
First output the first n items
Then take the last item you've outputted (let's call it e), and go e steps forward if e is positive, or abs(e) steps backwards if e is negative. And ... |
We say a string is non-discriminating if each of the string's characters appears the same number of times and at least twice.
Examples
"aa!1 1 !a !1" is non-discriminating because each of the characters , !, a and 1 appear three times.
"abbaabb" is not non-discriminating because b appears more often than a.
"abc" is ... |
The challenge is to write codegolf for the Hafnian of a matrix.
The Hafnian of an \$2n \times 2n\$ symmetric matrix \$A\$ is defined as:
$$\operatorname{haf}(A) = \frac 1 {n!2^n} \sum_{\sigma \in S_{2n}} \prod^n_{j=1} A_{\sigma(2j-1),\sigma(2j)}$$
Here \$S_{2n}\$ represents the set of all permutations of the integers f... |
The challenge is to write the fastest code possible for computing the Hafnian of a matrix.
The Hafnian of a symmetric 2n-by-2n matrix A is defined as:
$$\operatorname{haf}(A)=\frac{1}{n ! 2^n} \sum_{\sigma \in S_{2 n}} \prod_{j=1}^n A_{\sigma(2 j-1), \sigma(2 j)}$$
Here \$ S_{2 n} \$ represents the set of all permutati... |
Given a list of stack heights, calculate the number of ways those heights could have been arrived at by stacking blocks one at a time. Shortest code wins.
Test cases:
[2, 2] 6
[3,3,3] 1680
[1,5,9,1] 480480
[] 1
[10] 1
[2,2,2,10] 720720
Reference Python implementation:
def stacking_count(stacks):
if sum(stacks) ==... |
Your task is to output the exact string
The Jabberwocky
without taking input. Normal rules for input and output apply, so both functions and programs are allowed.
Of course there is a catch, it wouldn't be fun without a catch. Your program, when stripped of non-alphabetic characters, must start the poem The Jabberwo... |
I'm attempting to create a function over multiple lines.
Parameters of the challenge:
Function returns 'barbarian'
Only 2 characters per line
40 lines maximum.
I keep trying to use a fat arrow to declare my function, but fat arrows don't seem to work if you don't have them connected.
Source of Challenge: https://www.... |
This is a somewhat proof-golf-like cops-and-robbers challenge. This is the cops' thread; the robbers' thread is here.
Cops
Your task is to define an abstract rewriting system in which the reachability of one word from another is difficult to determine. You will prepare the following things:
A set of symbols, called th... |
This is a somewhat proof-golf-like cops-and-robbers challenge. This is the robbers' thread; the cops' thread is here.
Robbers
The cops will post abstract rewriting systems. Your task is to crack their submissions by proving that the target string either can or can not be reached from the source string by applying their... |
iBug recently got a long bar made of composite, yet valuable materials. The bar is so long that iBug can't easily sell it for credits, so he wants to cut it. The bar is made of such fragile and magic materials that, if a part is broken, all parts of the bar made of the same material will break, too, making it hard to c... |
You will create a program that generates the stereographic projection of polyhedra.
In particular, to keep things simple, we'll only focus on n-chamfered dodecahedron.
Given a natural number n as input, and also a natural number d your program will output an d pixels by d pixels image which is the stereographic project... |
Block shuffle sort
The block shuffle sort is a (rather artificial) method of sorting a list.
It works as follows, illustrated by an example.
[6, 1, 0, 3, 2, 4, -2, -1]
Break list into contiguous blocks
[6][1, 0][3, 2, 4][-2, -1]
Sort each block
[6][0, 1][2, 3, 4][... |
Given some positive integer n, design a protractor with the fewest number of marks that lets you measure all angles that are an integral multiple of 2π/n (each in a single measurement).
Details
As an output, you may output a list of integers in the range 0 to n-1 (or 1 to n) that represent the position of each mark. Al... |
We have many challenges based on base 10, base 2, base 36, or even base -10, but what about all the other rational bases?
Task
Given an integer in base 10 and a rational base, return the integer in that base (as an array, string, etc.).
Process
It's difficult to imagine a rational base, so let's visualize it using Expl... |
Task
Encode a string that entirely consists of uppercase alphabets (A-Z) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple!
Rules
Your program/function must correctly handle any valid input string of length 8.
The results must have the same length for all inputs.
The results mus... |
Challenge:
Given a string only containing upper- and/or lowercase letters (whichever you prefer), put tape horizontally to fix it. We do this by checking the difference of two adjacent letters in the alphabet (ignoring wrap-around and only going forward), and filling the space with as much TAPE/tape as we would need.
... |
Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "Palindrome Compression" challenge, where he uses a pretty cool compression method for the palindrome-flag, upper/lower case indication, and l... |
Note: There are some rude words in this question.
There's an implicit puzzle posed in this classic Monty Python sketch (you can also ready the script online).
Various phrases are described as being 'woody' or 'tinny', and one is described as being 'PVC'.
Given a phrase, respond with its type according to the following... |
I once had a beautiful rectangular array. It was very symmetrical, but unfortunately it has fallen apart and now I only have the top left corner. Your task will be to rebuild the original array.
Your program will receive a 2 dimensional array of integers. For ease of parsing, you may assume they are all between 1 and 9... |
Recently, my reputation was 25,121. I noticed that each digit grouping (i.e. the numbers separated by commas) was a perfect square.
Your challenge is, given a non-negative integer N and a unary boolean Black Box Function f : Z* → B , yield a truthy value if each value of f applied to the digit groupings of N is truthy,... |
Related OEIS sequence: A008867
Truncated triangular number
A common property of triangular numbers is that they can be arranged in a triangle. For instance, take 21 and arrange into a triangle of os:
o
o o
o o o
o o o o
o o o o o
o o o o o o
Let's define a "truncation:" cutting triangles of the same s... |
This is my first time here at Code Golf SE so feel free to add your input/advice/suggestions to improve my post if necessary. The week after my computer science exam, the solutions were publicly published. One problem had a 45 line example solution but my solution was only 18 lines, (which I was very proud of), but I b... |
Cops' thread
In this thread, your task is to make a recursion-based program/function to generate any integer series. Robbers will try and find a shorter non-recursive solution over in the Robbers' thread.
Challenge synopsis
In many languages, recursive functions can significantly simplify a programming task. However, ... |
Robbers thread
In this thread, your task is to find a non-recursive solution which produces the same integer series of a submission not marked as 'safe' in the Cops' thread.
Challenge synopsis
In many languages, recursive functions can significantly simplify a programming task. However, the syntax overhead for a prope... |
This is a repost of an old challenge, in order to adjust the I/O requirements to our recent standards. This is done in an effort to allow more languages to participate in a challenge about this popular sequence. See this meta post for a discussion of the repost.
The Kolakoski sequence is a fun self-referential sequen... |
Introduction
We know that the factorial notation is valid for all natural numbers. However, Euler had extended it for all positive real numbers, as well as for complex numbers by defining a function, which is known as the Gamma Function. It is represented by Γ.
Challenge
You will be given a non-negative floating point ... |
Wanna be an Alchemist
I've been watching Full Metal Alchemist these past days and I've been wondering, It is really possible to trans-mutate matter? In the real world, I don't know if it is possible, but in the machine world, we think we "can".
Problem
Your task is, Given an input of N chemical elements (K, Mg, C, O, ... |
Challenge:
Input:
You take two inputs:
- A string only containing printable ASCII (excluding spaces, tabs or new-lines)
- A printable ASCII character
Output:
The first line will contain the string-input. Every i-modulo-3 first occurrence of this character will move in a South-East direction; every i-modulo-3 second occ... |
I know, I know, yet another primes challenge...
Related
A lonely (or isolated) prime is a prime number p such that p-2, p+2, p-4, p+4 ... p-2k, p+2k for some k are all composite. We call such a prime a kth-times-isolated prime.
For example, a 5th-times-isolated prime is 211, since all of 201, 203, 205, 207, 209, 213, 2... |
Challenge
Given a left- or right-stochastic matrix where the limit as x approaches infinity of the matrix to the power of x approaches a matrix with all finite values, return the matrix to which the matrix converges. Basically, you want to keep multiplying the matrix by itself until the result no longer changes.
Test C... |
Your challenge is to turn input text to brain-flak code that will output the text.
Tutorial taken from here with permission here
Brain-Flak has two stacks, known as 'left' and 'right'. The active stack starts at left. If an empty stack is popped, it will return 0. That's it. No other variables. When the program starts,... |
As a child, my friend had a magic 8 ball that we would ask questions to and see what the fate of that question was.
Challenge
Your challenge is to write a program (or function) that when run (or called), outputs (or returns) a random answer from the possible answers below. (Random being: each output should have a nonze... |
A maze is given as a matrix of 0s (walls) and 1s (walkable space) in any convenient format. Each cell is considered connected to its 4 (or fewer) orthogonal neighbours. A connected component is a set of walkable cells all transitively connected to each other. Your task is to identify the cutpoints - walkable cells whic... |
Related: Rather similar (but much easier) challenge horizontally: There I fixed it (with tape)
Challenge:
Given a string only containing upper- and/or lowercase letters (whichever you prefer) and new-lines, put rope vertically to fix it. We do this by checking the difference of two adjacent letters in the alphabet (ign... |
Challenge
Given a string describing a cutting rule and another string, cut parts out of the second string using the rule described by the first string.
Both strings will consist of letters a-z or A-Z, whichever one you choose (they don't have to be represented the same way). The way the second string is to be modified ... |
Write a program or function that:
Takes as input a list or array of 128 numbers.
Sends that array to a GPU
Performs a calculation on the GPU to square each element of the array and then sum them
Gets the answer from the GPU, and returns or displays it
So your program will simply return the sum of the squares of its i... |
Challenge
Create a function or program that, when given an integer size, does the following:
If size is equal to 1, output
H H
HHH
H H
If size is greater than 1, output
X X
XXX
X X
where X is the output of the program/function for size - 1
(If you prefer, you may have the base case correspond to 0, so long as you spe... |
Numbers that are easy to remember yet theoretically not easily made
Your challenge is to make a program/function in any language that generates uniformly random numbers that fit these criteria:
Length is 5 digits
There are two separate repeated digit pairs
One set of repeated digits is at the beginning or end and th... |
Your task is to pit each side of the keyboard against each other and build two programs, in the same language, one using only keys on the left-hand side of a standard keyboard that outputs Pollinium milk; plump pumpkin; lollipop?, and one using the keys on the right that outputs Weatherheaded sweetheart haberdasheress!... |
Given a printable ASCII string representing a path to a file on a POSIX-compliant system, return just the filename, i.e. remove everything until and including the last slash (/):
/full/path/file.name.ext → file.name.ext
nopath.here → nopath.here
dir/.hidden → .hidden
/dirs.can/have.exts/file → file
./here → here
don't\... |
Output the following table:
一一得一
一二得二 二二得四
一三得三 二三得六 三三得九
一四得四 二四得八 三四十二 四四十六
一五得五 二五一十 三五十五 四五二十 五五二十五
一六得六 二六十二 三六十八 四六二十四 五六三十 六六三十六
一七得七 二七十四 三七二十一 四七二十八 五七三十五 六七四十二 七七四十九
一八得八 二八十六 三八二十四 四八三十二 五八四十 六八四十八 七八五十六 八八六十四
一九得九 二九十八 三九二十七 四九三十六 五九四十五 六九五十四 七九六十三 八九七十二 九九八十一
Or you can use the first three letters in its ... |
Inspired by There, I fixed it (with rope), There, I fixed it (with Tape), There, I broke it (with scissors)
Given a string with characters from a-z or A-Z (whichever you prefer), turn missing letters into numbers and make them explode.
Example
Input: abcafabc
Output: a12344321c
Why?
1) Find the missing letters (only g... |
Introduction
So John finally has his holidays! And what better could he do than watching some movies. He indeed has a lot of movies to watch, but he is unable to decide which one to watch first. He has a list of movies, each in the format: <Movie name> (<Year>). So he makes a simple set of rules to decide his order of ... |
The goal is to make a two frame animation with ASCII art of a hammer smacking a table.
Trailing white-space is allowed and the frames need to repeat continuously. The program should iterate over both frames with a time of 0.5 seconds between frames.
Lowest byte count wins for each language!
Sample:
Animation Frames:
Fr... |
Given an integral polynomial of degree strictly greater than one, completely decompose it into a composition of integral polynomials of degree strictly greater than one.
Details
An integral polynomial is a polynomial with only integers as coefficients.
Given two polynomials p and q the composition is defined by (p∘q)(... |
(The text asks how many boxes there are in the picture)
Now you are required to generate such a problem and its answer.
Input
an integer n
(optionally) random source of two values, in case you don't want to use the default random.
Output can be
a 3D array A[n][n][n] of booleans, where A[i][j][k] => (i==0 || A[i-1][... |
Your task, if you wish to accept it, is to write a program that outputs a positive integer (higher than 0). If the source code is duplicated the output must remain the same. The tricky part is that if the source code is typed three times (triplicated?) the output will be multiplied by 3.
Rules
You must build a full pr... |
Remember the kids game, 'Duck, Duck, Goose'? No? Me neither.
The challenge
Print the word 'duck' on individual lines an indeterminate amount of times.
Print the word 'goose'.
Your program ends.
The rules
Attempt to play the game in the fewest bytes.
There must be at least one duck.
There must be exactly one goose, a... |
If you cannot see this post, you can use this image
Your task is to create a markdown parser that outputs Unicode. It should support , , , and ̲̲̲̲̲̲̲̲̲.
Every alphabetical character should be converted into Math Sans. This includes the characters before an underline character.
Underlines: Add a ̲ character (code point... |
Given a number n, calculates BB(n) (the maximum number of 1s finally on the tape, among all halting 2-symbol n-state Turing machines with tape of zeros).
To solve the problem, you are given an extra (black-box) function H as input, which takes a function in your language (f) and returns a truthy/falsy value indicates w... |
The Peirce quincuncial projection is pretty neat. It actually tessellates the whole plane:
Your job is to generate this map projection.
To simplify things, you will only need to generate the northern hemisphere.
Also, you will be given the stereographic projection of the northern hemisphere as input:
(based on https:... |
Introduction
Long ago, when I used to code card games with usual playing cards, I used to specify a number for each card and call a function with some number to get a card. This somewhat inspired me to make this challenge.
So for the people unaware of the playing cards, a deck of cards consist of 52 cards (13 in each ... |
Suppose I have a linear inequality like
x0A0 + x1A1 + ... + xnAn <= C
with xi a non-zero positive integer and Ai and C a positive non-zero multiple of 0.01. Find all the positive integer n-tuples {x1,...,xn} such that:
D <= x0A0 + x1A1 + ... + xnAn <= C
where D is also a positive non-zero multiple of 0.01.
Challen... |
What happens when the CapsLock key on your keyboard doesn't have a notch in it?
"This hPPENS."
The goal of this program is to consistently emulate keyboard misses where each A press is replaced with CapsLock. Uppercase 'A's from the source should yield the same effect. When CapsLock is enabled, capitalization is revers... |
As the title says, your task is to print the largest string using the shortest code without taking any input value.
Rules
The program must take no input and print the largest string to STDOUT
The string must contain only ASCII Characters. If you don't know the ASCII Characters, take a look at the table
No Loops are a... |
Given a triangulation of the surface of a polyhedron p, calculate its Euler-Poincaré-Characteristic χ(p) = V-E+F, where V is the number of vertices, E the number of edges and F the number of faces.
Details
The vertices are enumerated as 1,2,...,V. The triangulation is given as a list, where each entry is a list of the ... |
A string can be shifted by a number n by getting the byte value c of each character in the string, calculating (c + n) mod 256, and converting the result back to a character.
As an example, shifting "ABC123" by 1 results in "BCD234", shifting by 10 in "KLM;<=", and shifting by 255 in "@AB012".
The Task
Pick as many num... |
Introduction
Humans are a remarkable species, but we can be very awkward to understand sometimes—especially for computers.
In particular, we seem to like writing polynomials in a very convoluted fashion with seemingly arbitrary rules.
What is the shortest program you can write to format a polynomial correctly using t... |
The trumpet is a valved aerophone instrument, usually pitched in B♭. The sound is made when the player vibrates their lips to displace air inside the instrument. That vibration is acquired by setting one's mouth in a specific way, called the embouchure. Different embouchures, with tighter or looser lips, produce differ... |
The Challenge
Your program should take 3 inputs:
A positive integer which is the number of variables,
A set of unordered pairs of nonnegative integers, where each pair represents an equality between variables, and
A positive integer which represents the starting variable,
It should return a set of nonnegative integer... |
At runtime, keep prompting for a line of input until the user input is not the name of an existing file or directory or other file system item, relative to the current working directory. Then return/print that last inputted filename. You may assume that all user inputs will be valid filenames.
Pseudo-code 1
myform = ne... |
Given an array of positive integers A as the input, generate a program that, when repeated for k times, output the kth(1-index) value of the array.
For example, if the array is [1,11], the output should be a program that outputs 1, and when repeated twice, output 11. Code like print(end="1"); in Python 3 works: print(e... |
A checkerboard program is a program where each individual character's ordinal value alternates from even to odd, excluding the line terminator (which can be any standard line-endings).
A triangular program is a program where each line has one additional character than the preceding line, with the first line having one ... |
Your task is to accept as input two "ASCII Art"s, and align each piece of art next to each other horizontally.
For example, say you have two strings, "abc\ndef" and "123\n456". You need to align them horizontally to produce the string "abc123\ndef456". I'm calling this "aligning horizontally" because while the inputs, ... |
Backstory
If you visit the Steward Badge Page, you will see no one has received one of these badges from PPCG yet. However, there are two users:
DJMcMayhem & Martin Ender, that are only a few reviews away from this badge!
Challenge
Your challenge is to write a program or function that when run outputs DJMcMayhem's revi... |
Write a program (or function) (let's call it P1), that when run, outputs another program P2 of the same language and exactly 1 byte longer than P1.
Program P2 when run, should output a 3rd program P3 that's 1 byte longer than P2. P3 must output a program P4 that's one byte longer than P3, etc. The same for P5, P6, ...,... |
Four integer sequences
In this challenge, you will test four different properties of a positive integer, given by the following sequences.
A positive integer N is
perfect (OEIS A000396), if the sum of proper divisors of N equals N. The sequence begins with 6, 28, 496, 8128, 33550336, 8589869056, 137438691328, 23058430... |
Background
I saw this very interesting Venn Diagram on wikipedia: https://simple.wikipedia.org/wiki/Alphabet#/media/File:Venn_diagram_gr_la_ru.svg
It shows the letters (physical shapes) in different alphabets that are common between Russian, Greek and Latin alphabets.
The Challenge
Given an input string of characters f... |
Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English.
Your program must output the least precise amount of time which has passed, among the following metrics and their lengths in seconds:
second = 1
minute = 60
hour = 60 * 60
day = 6... |
We'll define the N-exponential potential of a positive integer M as the count of prefixes of MN that are perfect N-powers.
The prefixes of an integer are all the contiguous subsequences of digits that start with the first one, interpreted as numbers in base 10. For example, the prefixes of 2744 are 2, 27, 274 and 2744.... |
The input is an array (or space-separated string, as you wish), zero-indexed, consisting of one strictly increasing array and one strictly decreasing array (in this order, not other vice versa), each having a length of 2 at least. Example is:
-10 -2 4 18 38 46 28 19 10
The goal is to write the fastest algorithm to fin... |
So, last week I posted a challenge to play Duck, Duck, Goose. This lead to a number of Minnesotans commenting about their regional 'Gray duck' variation.
So here's the rules:
Using this list of colours:
Red
Orange
Yellow
Green
Blue
Indigo
Violet
Gray
Write a program to follow these rules:
Select one of these colours,... |
The rules are as follows:
Take in a string of integers separated by spaces. Add the first and last numbers, the second and second-last numbers, and so on.
The program must output the numbers separated by newlines.
The program must handle negative numbers, but may not handle decimals.
If an odd amount of integers are i... |
In this challenge you are to write a program or function, that takes a string as input and outputs one of two possible values. We will call one of these values truthy and one falsy. They do not need to actually be truthy or falsy. For an answer to be valid it must meet four additional criteria
When you pass your pro... |
In order to defend someone’s baffling decision, people often say that that person is going over everyone’s heads and playing “3-dimensional chess”. Now it’s your chance to play 3-dimensional chess!
Rules
There are many variants of 3D Chess, but for this challenge I’ve made up my own. My version is just like regular che... |
Inspired by I'm not the language you're looking for!
Challenge
Choose two different programming languages, and write a program that prints the following line to stdout (or equivalent):
This program errors out in <the current language> :P
and then generates different kind of error in each of the two languages.
Rules
So... |
Challenge
Consider the rainbow as seven colours, represented by strings as Red Orange Yellow Green Blue Indigo Violet.
Your task is to create a program that receives one of these colours as input and outputs next in order rainbow colour. This includes overlapping Violet -> Red
Input
A string containing one of rainbow c... |
If you have any tips regarding golfing in Sesos, a language made by Dennis, and nobody else has covered them yet, please post them here! Only one tip is allowed per answer. Your tip should be at least somewhat specific to Sesos itself, and not just brainfuck. If your tip is relevant to brainfuck in general, you should ... |
Challenge
Factory workers are usually very hard-working. However, their work is now being commonly replaced with machines.
You have to write a program that takes a number as input. It will print out a factory of 10 workers 10 times. Every time, each worker has a 1/input chance of being 'fired' and replaced by a machine... |
Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer #RRGGBBAA. But Android developers may prefer #AARRGGBB. When handling AAS file format, #AABBGGRR is needed. That's too confusing. Maybe we need a program... |
A self number (also called a Colombian or Devlali number) is a natural number, x, where the equation n + <digit sum of n> = x has no solutions for any natural number n. For example, 21 is not a self number, as n = 15 results in 15 + 1 + 5 = 21. On the other hand, 20 is a self number, as no n can be found which satisfie... |
Alice (A) and Bob (B) decided to have a battle.
Each combatant has 10 health.
They take turns to roll a 6 sided die for damage.
That damage is removed from their opponent's health.
In the end either Alice or Bob, will vanquish their foe.
Show me how the battle went. Outputting these codes for the actions which have ... |
Self-limiting lists
Consider a nonempty list L containing nonnegative integers.
A run in L is a contiguous sublist of equal elements, which cannot be made longer.
For example, the runs of [0,0,1,1,3,3,3,2,1,1] are [0,0], [1,1], [3,3,3], [2], [1,1].
The list L is self-limiting if for each integer N ≥ 1, the number of oc... |
This challenge already describes dropsort. However, I'm kinda lazy and I really only need my array to be a bit more sorted than before, it doesn't need to be sorted all the way.
In Drop Sort, we drop every element less than any element before it. In Lazy Drop Sort, we drop every element less than the one strictly prece... |
Inspired by this.
Agatha Stephendale, a sophomore who is really into raster graphics, has taken a course in linear algebra. Now she imagines matrices as rectangles, but in her artistic mind, she attaches diagonal lines to those rectangles and tries to compute traces along them. In fact, she wants to compute traces of a... |
Create a function which given a number of lines n, makes a bigA.
The horizontal bar of bigA must be at the middle row, or the lower of the two if n is even
Assume a monospace font for output
Output should be a string (or similar, eg character array) with clear linebreaks to break up the lines, and with correct whites... |
Your task is to build a program that identifies the shape of the input. The shapes to be identified can be any of the following:
Square
To be identified as a square, the source must have lines of all equal length, and the same number of lines as characters per line (newline characters excluded). An optional trailing ne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.