instruction stringlengths 34 53.1k |
|---|
You are given an array A of n strictly positive integers, with n ≥ 2.
Your task is to map each entry Ai to:
1 if Aj mod Ai is odd for each j such that 1 ≤ j ≤ n and j ≠ i
2 if Aj mod Ai is even for each j such that 1 ≤ j ≤ n and j ≠ i
0 otherwise (mixed parities)
Example
For A = [ 73, 50, 61 ], we have:
50 mod 73 = ... |
A repost of this challenge. Meta discussion. Sandbox post. Body of the question similar to the original
Robber's challenge
This cops and robbers is now (08/03/2018) closed to further competing cop entries, as robbers may no longer be competing to crack answers, but feel free to post new answers.
The Cops challenge was... |
Cops challenge
The Robbers' Challenge
Find a vulnerable answer. That is, an answer which hasn't been cracked yet and which isn't safe yet either.
Crack it by figuring out its language. That is, find any language in which the given program is a valid program (subject to the rules outlined in the Cops' Challenge above)... |
Choose a set of four bytes without replacement (i.e. no byte repeated), and not necessarily in any particular order, from any one of the following four sets:
The characters of any one single-byte encoding
The Unicode characters in the range 00–FF
The signed decimal integers in the range −128–127
The unsigned decimal i... |
Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first 5 rows (borrowed from Generate Pascal's triangle):
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
. . .
Collapse these rows to the left
1
1... |
Introduction
Write a program to output the outgoing spiral of the famous pangram following given rules.
Challenge
A pangram is a sentence using every letter of a given alphabet at least once. One of the most famous pangrams is the one used extensively in Windows font viewer, namely "The quick brown fox jumps over the l... |
This is a different type of compression challenge. In a normal kolmogorov-complexity challenge, you are required to recreate a list exactly. Here, you are allowed to round the values in any way you wish. What's the catch? Your score is penalized based on how wrong your output is.
At the bottom of this question is a... |
Write a code that runs or compiles in as many programming languages as possible and prints a newline separated list of names of previous and current programming languages.
Every used language must have 1 character longer name than previous; ex. C#, C++, Ruby, Jelly, Python...
Each language must output a list of langua... |
Note
This is the encryption challenge. The decryption challenge can be found here.
Challenge
The challenge is to encrypt a given string, using the rules as specified below. The string will only contain lowercase alphabets, digits, and/or blank spaces.
Equivalent of a Character
Now, firstly you would need to know how to... |
An Izhikevich neuron is a simple yet quite effective model of a biological neuron, designed for use in a discrete time-stepping simulation. In this golfing challenge, you will be implementing this model.
Parameters
This model involves only 7 variables organized into 2 differential equations, compared to the dozens of p... |
Context
Consider square matrices with n columns and rows containing the first n^2 (i.e. n squared) positive integers, where n is odd. The elements of the matrices are arranged such that the integers 1 through n^2 are placed sequentially in a counterclockwise spiral starting at the center and initially moving to the lef... |
Your task is to write a computer program such that when it is cut up into lines (split on the newline character) every arrangement of the lines will output a different number between 1 and n! (where n is the total number of lines). No number should be output by two different arrangements and every arrangement should o... |
I was messing around with infinite resistor networks (long story) when I came across the following interesting recursive pattern:
|-||
|---
Each instance of this pattern is twice as wide as it is tall. To go from one level of the pattern to the next, you break up this rectangle into two sub-blocks (each of which is a ... |
Amazingly, this is the easier of the three card tricks I know off the top of my head...
The aim of this is to have your compiler perform a specific card trick. There's no slight of hand, and the compiler won't be memorizing the choice and saying "Voila, this is your card!" The code will basically manipulate a stack of ... |
Introduction:
I collect twisty puzzles, so I'm quite the fan of rubiks-cube-challenges (even though most are fairly difficult). So, let's try a fairly easy rubiks-cube-challenge for a change.
When an NxNxN Cube gets scrambled during a WCA (World Cubing Association) competition, the cube is always held in the same way b... |
You will be given a square matrix of integers M and another positive integer n, strictly smaller than the size of M. Your task is to generate all square sub-matrices of M of size n.
For the purposes of this challenge, a square sub-matrix is a group of adjacent rows and columns contained in M.
Input / Output Formats
Yo... |
Statement
Given N distinct integers, output them in order such that
for any integer J from 2 to N,
for any K>0 obtainable by dividing J by 2 (rounding down) at least one time,
the Jth integer output is larger than the Kth if and only if the division by 2 that gave K (i.e., the last division) divided an odd integer... |
A cyclic difference set is a set of positive integers with a unique property:
Let n be the largest integer in the set.
Let r be any integer (not necessarily in the set) greater than 0 but less than or equal to n/2.
Let k be the number of solutions to (b - a) % n = r where a and b are any members of the set. Each solu... |
Yes, It's basically You're a Romanizer, Baby, but harder. like, way harder.
Learning Korean is HARD. at least for a person outside Asia. But they at least have the chance to learn, right?
What you must do
You will be given a Korean Statement. For example, 안녕하세요. You must convert the input to its Roman pronunciation. ... |
Jack is a little businessman. He found out a way to earn money by buying electricity on days when it's cheap and selling it when it's much more expensive. He stores the electricity in a battery he made by himself.
Challenge
You are given N (if required), the number of days Jack knows the cost of electricity for, and X,... |
John has made an array of numbers which are important to him. Unfortunately, John lost the array.
Luckily, he knows some details about the array. You will receive each of these sets of details (which are lists of 3 integers).
Each detail is the sum of a section of the list. Each has the numbers a, the starting index... |
Most Android smartphones allow the user to use a swipe pattern to open their phone:
Certain patterns are legitimate, and others are impossible. Given an input swipe pattern, return a truthy or falsy indicating if the given input pattern is legal or not.
Input
The grid is labelled row-wise 1 through 9:
1 2 3
4 5 ... |
Pancake sorting is the colloquial term for the mathematical problem of
sorting a disordered stack of pancakes in order of size when a spatula
can be inserted at any point in the stack and used to flip all
pancakes above it. A pancake number P(n) is the minimum number of
flips required for n pancakes. 1
In 1979, a you... |
A palindrome is a string which is the same when read forwards and backwards. For example "racecar" is a palindrome, but "Racecar" is not. A substring is a contiguous set of characters in a larger string. Your task is to write a program or method which takes a string or character array as input and outputs the length of... |
Given a string l, find all palindromic substrings p of l (including duplicates and single character strings). Next, rearrange all sub-strings in p into a valid palindrome (there may be multiple correct answers). If it is not possible to rearrange p into a single palindrome, your program may have undefined behavior (err... |
Bertrand's Postulate states that for every integer n ≥ 1 there is at least one prime p such that n < p ≤ 2n. In order to verify this theorem for n < 4000 we do not have to check 4000 cases: The Landau trick says it is sufficient to check that
2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 5003
are all prime. ... |
Output or display the following three lines of text, exactly as they are shown below. A trailing newline is accepted.
bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ
That block of text is the same as the one below, but where the n'th column is rotated n times downward:
!"#$%&'()*+,-./... |
Sequence Definition
Construct a sequence of positive integers a(n) as follows:
a(0) = 4
Each term a(n), other than the first, is the smallest number that satisfies the following:
a) a(n) is a composite number,
b) a(n) > a(n-1), and
c) a(n) + a(k) + 1 is a composite number for each 0 <= k < n.
So we start with a(0) =... |
Given a list of positive integers determine if there is an element that is either greater than its two neighbors or less than its two neighbors (a "bump"). To be clear a bump can never be the first or last item of the list because they only have one neighbor.
Your program should output one of two consistent values eac... |
Yabasic, or Yet Another Basic is a dialect of basic created by Marc-Oliver Ihm that may be run on Windows, Unix and PAL versions of the Sony PlayStation 2. Development for this language is ongoing.
Helpful Resources
Yabasic Official Website
Yabasic Manual
Yabasic Wikipedia Page
Yabasic GitHub
Yabasic PS2 Documentatio... |
This page is not for Visual Basic .NET Tips or VBA tips
Visual Basic (VB or VB6) is an object-oriented and event-driven dialect of basic that was developed and released by Microsoft in 1991. The last release of Visual Basic came as Visual Basic 6.0 in 1998, and the language was declared a legacy language in 2008. Visu... |
This page is not for Visual Basic Tips
Visual Basic .NET (VB.NET) is an multi-paradigm dialect of basic that was developed and released by Microsoft in 2002 as a replacement for Visual Basic. The current version of VB.Net as of Feb 2018 is Visual Basic .NET 15.0.
Unlike Visual Basic (VB), Visual Basic .NET (VB.NET) is ... |
Local periods
Take a non-empty string s.
The local period of s at index i is the smallest positive integer n such that for each 0 ≤ k < n, we have s[i+k] = s[i-n+k] whenever both sides are defined.
Alternatively, it is the minimal length of a nonempty string w such that if the concatenation w w is placed next to s so t... |
This is a brainfuck version of Largest Number Printable, and this.
Let's think about brainfuck interpreter such that,
Has array that can be stretched left & right arbitrary large
Each cell can contain arbitrary large integer
Can contain negative integer too
When the interpreter starts, every cell is intialized by ... |
Please participate in the meta discussion about reopening this challenge before casting a vote.
Introduction
This challenge was inspired by semicolon-#.
Deadfish is a non-Turing-complete programming language, created by Jonathan Todd Skinner. It has an accumulator register and contains 4 commands, i, d, s, and o, sta... |
A permutation of size n is a reordering of the first n positive integers. (meaning each integer appears once and exactly once). Permutations can be treated like functions that change the order of a list of items of size n. For example
(4 1 2 3) ["a", "b", "c", "d"] = ["d", "a", "b", "c"]
Thus permutations can be co... |
Given an unsorted list of unique strictly positive integers, minimally sort it into a 2D matrix. The input list is guaranteed to be of composite length, which means the output matrix is not necessarily square, but is of size n x m with n,m > 1.
"Minimally sort" here means the following:
Sort the list in ascending orde... |
Write the shortest code you can solving the following problem:
Input:
An integer X with 2 <= X and X <= 100
Output:
Total combinations of 2, 3, and 5 (repetition is allowed, order matters) whose sum is equal to X.
Examples:
Input: 8
Output: 6, because the valid combinations are:
3+5
5+3
2+2+2+2
2+3+3
3+2+3
3+3+2
Inp... |
tl;dr: Output the values where the reduced prime factorization leader changes.
Every positive integer has a unique prime factorization. Let's call the reduced prime factorization just the list of multiplicity of the prime factors, ordered by the size of the factors. For instance, the reduced prime factorization of 1980... |
Polystrips are a subset of polyominoes conforming to the following rules:
each piece consist of 1 or more cells
no cell can have more than two neighbours
the cells should not enclose a hole
Free polyominoes are distinct when none is a rigid transformation (translation, rotation, reflection or glide reflection) of ano... |
Goal
You will be given a positive integer number less than 10^20. You must convert it to Korean.
For example, if the input is 12345, the output should be 일만이천삼백사십오.
Technical details (Small)
Let's starts with simple numbers.
// 1 - 9
1 -> 일
2 -> 이
3 -> 삼
4 -> 사
5 -> 오
6 -> 육
7 -> 칠
8 -> 팔
9 -> 구
// 10, 100, 1000
10 ->... |
Your task is to implement a Tetris strategy balanced in terms of score vs code size.
In this version of the game tetrominoes are rotated and dropped from above into a grid of 20 rows and 10 columns. While falling, they cannot be rotated or moved horizontally. As usual, a dropped piece stops when it reaches the bottom o... |
Guidelines
Task
Write a function that takes in a sentence (a string, or list of characters) and reverses all the words that are greater than or equal to 5 in length.
Examples
"Hey fellow code golfers" -> "Hey wollef code sreflog"
"I aM noT a cAr" -> "I aM noT a cAr"
"I Am a tRaiN" -> "I Am a NiaRt"
Rules
Since this ... |
Guidelines
Task
Given a DNA strand, return its RNA complement (per RNA transcription).
Both DNA and RNA strands are a sequence of nucleotides.
The four nucleotides found in DNA are adenine (A), cytosine (C),
guanine (G) and thymine (T).
The four nucleotides found in RNA are adenine (A), cytosine (C),
guanine (G) and ur... |
Guidelines
Task
Given two non-negative integers, find the sum of both numbers... to the power of 4.
Examples
2, 3 -> 97 (2^4 + 3^4 = 97)
14, 6 -> 39712 (14^4 + 6^4 = 39712)
0, 25 -> 390625 (0^4 + 25^4 = 390625)
Rules
You will only ever receive two non-negative integers as input (bonus points if you get it to work wi... |
or: Build a vertical quine
Inspired by Take a stand against long lines.
Your task is to build a vertical quine with as short a line length as possible.
Scoring
Shortest line length (excluding newlines) wins, with code-golf criteria as a tie-breaker.
Line length is determined as the longest line in your program excludin... |
Your task is to write a program which prints following four verses extracted from the lyrics from The Beatles' song "Hey Jude" (© Sony/ATV Music Publishing LLC):
Hey Jude, don't make it bad\n
Take a sad song and make it better\n
Remember to let her into your heart\n
Then you can start to make it better\n
\n
Hey Jude, d... |
Related.
Given a printable ASCII string, split it into a list of non-empty strings with a new sub-string beginning every time a character, which has not previously been seen in the same case, occurs.
Examples
"mississippi" → ["m","i","ssissi","ppi"]
"P P & C G" → ["P"," P ","& ","C ","G"]
"AAA" → ["AAA"]
"Adam" → ["... |
The Challenge
Given a number, find the sum of the non-composite numbers in the Fibonacci sequence up to that number, and find the prime factors of the sum.
For example, if you were given 8, the non-composite numbers would be 1, 1, 2, 3, and 5. Adding these up would get 12. The prime factors of 12 are 2, 2 and 3, so you... |
Guidelines
Task
Given two notes, inputted as strings or lists/arrays, calculate how many semitones apart they are (inclusive of the notes themselves), outputting as a number.
Explanation of a semitone:
A semitone is one step up or down the keyboard. An example is C to C#. As you can see below the note C is on a white n... |
Stack Cats is a reversible, stack-based language. Its reversible nature makes for somewhat weird loops. This challenge is about the conditional loop (...). When these loops are nested in certain ways, it's possible to transform the code to reduce the nesting depth. Here are the rules (where A and B stand for an arbitra... |
So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code...
Here's a (short) example output:
+
+
+
+
+
+
+
... |
Introduction
Write a solver for integer linear programming.
Challenge
Your task is write a solver for integer linear programming (ILP). In ILP, linear inequalities of a set of unknowns (all of which are integers) are given, and the goal is to find the minimum or maximum of a linear function.
For example, for the inequa... |
The first magic card trick I ever learned as a child was the following:
Have 1 deck of cards where the pattern on the back is not vertically symmetric.
Organize all cards to be facing one direction.
Ask an individual to, "pick a card, any card, memorize it and give it back to you".
Proceed to put it into the deck (in ... |
It is easy to describe a finite state machine that recognizes multiples of 9: keep track of the digit sum (mod 9) and add whatever digit is accepted next. Such a FSM has only 9 states, very simple! By the equivalence between FSM-recognizability and regular languages, there is a regular expression for multiples of 9. Ho... |
This is a very simple challenge, and it is to print the numbers -1, 0, and 1.
The following paragraph is credited to Print numbers from 1 to 10
Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of those, etc., but no digits), and pr... |
Given an ordered list of numbers (possibly with leading zeros), arrange the numbers vertically, then let all zeros drop all the way to the bottom and all overhangs drop to the bottom-most open slot. Output the resulting integers, removing leading zeros.
Worked Example
Say we were given the following as input:
['0000312... |
Inspired by this unassuming StackOverflow question.
The idea is simple; given a String and an array of Strings, remove any instances of words in the array (ignoring case) from the input String other than the first, along with any additional whitespace this may leave. The words must match entire words in the input Strin... |
Very heavily inspired by this challenge Code Golf: Your own pet ASCII snake - I thought making it horizontal would add an extra layer of complexity.
An example horizontal snake:
0 0
0 0 0 000
00 0 00 000 0 0
000 0 0 0 00
0 ... |
In this challenge you will be given an alphabetic string as input. We will define the "anti-string" of a given input to be the string with the case of all the letters inverted. For example
AaBbbUy -> aAbBBuY
You should write a program that takes a string as input and searches for the longest contiguous substring who... |
Given a list of n strings, return a list of that strings in ascending order. However, be aware, that in this case we want integer comparison for all numbers appearing in the strings, meaning that "12" > "3".
Example cases:
{"abc123", "abc6", "abc47", "abd49"} -> {"abc6", "abc47", "abc123", "abd49"}
{"foo0", "bar12", "f... |
Recently there have been a couple of ASCII pet snake challenges (e.g. here)
0 0
0 0 0 000
00 0 00 000 0 0
000 0 0 0 00
0 000
This challenge is to take a randomly generated horizontal pet snake (height of five line... |
This task is to output the shortest path to a file, after glob expansion.
What is shell globbing? In most shells, you can use the * character in a path to represent any characters at the position. For example, If directory foo contains files bar baz and asdf, then foo/b* will expand to foo/bar foo/baz.
Now, lets say t... |
Introduction
Your task is to generate the first 1000 terms in the continued fraction representation of digit-wise sum of square root of 2 and square root of 3.
In other words, produce exactly the following list (but the output format is flexible)
[2, 6, 1, 5, 7, 2, 4, 4, 1, 11, 68, 17, 1, 19, 5, 6, 1, 5, 3, 2, 1, 2, 3,... |
Task
Given an array of non-negative integers a, determine the minimum number of rightward jumps required to jump "outside" the array, starting at position 0, or return zero/null if it is not possible to do so.
A jump from index i is defined to be an increase in array index by at most a[i].
A jump outside is a jump wher... |
...or "snakes but not too long".
Inspired by this challenge and this comment.
Task
Write a program or a function that takes no input and outputs its own source code formatted as a snake according
to the rules below:
If your code has any whitespace, it will not be output; it will just be skipped.
There will be one char... |
Inspired by We do tower hopping and related to 2D Maze Minus 1D
Introduction
Your task is to find the shortest path to get out of an array maze following specified rules.
Challenge
A 1D array a with n elements can be regarded as a maze composed of n points, where point with index k is connected to the points with k+a[k... |
I was at a friend's house for dinner and they suggested the idea of a "Prime-factor vector space". In this space the positive integers are expressed as a vector such that the nth element in the vector is the number of times the nth prime divides the number. (Note that this means that our vectors have an infinite numb... |
We have some new sheriffs moderators in town, Mego and DJMcMayhem. We need a challenge to properly honour them for their new positions, so there we go.
Here's something that has caught my attention when hovering over their profiles – their user IDs are \$31716\$ and \$45941\$. If you perform digit-wise subtraction, y... |
A Brainfuck derivative
Let's define a simple Brainfuck-like programming language.
It has a two-directional tape of cells, and each cell holds one bit.
All bits are initially 0.
There is a moving head on the tape, initially at position 0.
A program is a string over the characters <>01!, executed from left to right, with... |
There's already a comprehensive list of tips for python here, so what I'm asking for are tips that specifically apply to using the numpy, scipy or pylab libraries.
These can be either ways to shorten code already using numpy, or ways to shorten common python operations by using these libraries.
One tip per answer, plea... |
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.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.