instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
You will be given a nested array. Your program has to visualize the array. But.. How? For example, let's assume we have a nested array, like [["1","2"],[["1","2"],"3"],"4",[[[["5"]]]],"6"]. This nested array can be visualised as: ->1 ->2 -->1 -->2 ->3 >4 ---->5 >6 Examples Input 1: ["Atom",["Proton",["Up Quark", "Up...
stackexchange_codegolf
Some built-in functions in PHP return mixed types, like file_get_contents that returns both string or false. Union structs in C can be used to simulate this, but is there a way to make it polyglot, that is, can be run in both PHP and C without (major) modification? Macros is often one way. $result === false can be rep...
stackexchange_codegolf
If we have a list of integers we can "squish" one of them by: decrementing it replacing adjacent values with its new value For example in this list: [1,2,8,3,6] If we squish the 8 we get: [1,7,7,7,6] The question is: Given a starting array, what is the largest we can make its sum by repeatedly squishing values? For...
stackexchange_codegolf
Problem Create a program or function that can calculate the result of a matrix raised to the nth power. Your code will take an arbitrary square matrix A and a non-negative integer n, and return a matrix with the value An. Restrictions Built-in functions that compute the matrix power and matrix product are not allowed. ...
stackexchange_codegolf
We all know and love the corpulent DDL expressions one can write in PostgreSQL with wording like DEFERRABLE INITIALLY DEFERRED, ALTER FOREIGN DATA WRAPPER, or even DROP TEXT SEARCH CONFIGURATION. But how far can one go? Here comes the definitive challenge for the longest DDL expression, with constraints of course. Mwah...
stackexchange_codegolf
Introduction In a list of strings, there is a certain length you can shorten strings to before they become indistinguishable. This is a pretty bad explanation, so here is an example. ['hello', 'help', 'helmet'] ['hell', 'help', 'helme'] ['hell', 'help', 'helm'] ['hel', 'hel', 'hel'] <- At this point the strings are i...
stackexchange_codegolf
Input A non-empty string or list of capital letters k with length between 3 to 5000. Output A value indicating whether k can be expressed as a+b+b, where a and b are non-empty. Truthy test cases SSS SNYYY SNYY SNNYY SNYNY Falsy test cases FALSYTESTCASES FALSYFALSYTESTCASES FALSYTESTCASESXFALSYTESTCASES FALSYTESTCASESF...
stackexchange_codegolf
The Len(language,encoding) family of languages is a variety of Lenguage derivatives. To encode a program into a Len language, you replace every character with its representation in a certain encoding, then turn that into a giant integer. Your challenge is to write a function or program that encodes your language into a...
stackexchange_codegolf
Given 4 points on the 2D planes A, B, C, D, calculate the area of the intersection region of the triangles OAB and OCD, where O is the center of the plane, having coordinate (0, 0). Algorithms that runs in constant time complexity (in terms of arithmetic operations) are encouraged, but not forced. Rules Each point is ...
stackexchange_codegolf
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...
stackexchange_codegolf
It's strange this question hasn't been asked yet, so here it is: Calculate the length of a string given through STDIN Rules As said, your string will be given through STDIN, not via command line arguments Print the length of the string to STDOUT Only ASCII chars will be given, and all printable ASCII chars count! This...
stackexchange_codegolf
Challenge I've checked that there is a question Compute the Discrete Cosine Transform which is a competition for implementing a shortest solution to compute the one dimensional discrete cosine transform. The goal of this challenge is to implement a program to calculate three dimensional discrete cosine transform which ...
stackexchange_codegolf
I personally love quines, but they all seem to be so... static. So why not create a quine that can do more. Challenge The challenge here is to create a quine that without any sort of input is a normal quine. Then if it receives a different input, it outputs a different quine in a different language. (basically like a p...
stackexchange_codegolf
I'm a musician, and I need more polyrhythms in my life! A polyrhythm occurs in music (and in nature) when two events (claps, notes, fireflies flashing etc.) are occurring at two different regular intervals. The two kinds of event happen a different number of times in the same interval. If I tap with my left hand twice,...
stackexchange_codegolf
Write the shortest code you can that produces an infinite output. That's all. You code will only be disqualified if it stops producing output at some point. As always in code golf, the shortest code wins. Here's a list of answers that I think are really clever, so they can get credit: The comma is both code and data I...
stackexchange_codegolf
Background The computer game NetHack dates from 1987, before the use of graphics in computer games was widely established. There are lots of monsters in the game, and potentially a lot need to fit on screen at once, so monsters are drawn in a very minimal way: a monster is simply drawn as an ASCII character on screen. ...
stackexchange_codegolf
This is somewhat similar to The centers of a triangle, but with a different point. The Fermat Point is the point P in triangle ABC such that the value of AP + BP + CP is minimized. There are two cases: If there is an angle greater than 120 degrees, that vertex is the fermat point. Otherwise, draw equilateral triangles ...
stackexchange_codegolf
The challenge given to me is comparatively easy, and specific to MySQL only. I'm given a table expressions which have mathematical calculations done by a kid. Basically, I've to select all the right calculations! The table have the following properties, a : an integer, the left operand. b : an integer, the right opera...
stackexchange_codegolf
Challenge Your goal is to find the furthest point on a graph (from a provided start node). Your code doesn't need to handle cycles in the graph properly, but it might pose a fun challenge. For this question, you can assume the graph is actually a tree. Input data Input can be provided in any suitable format for the lan...
stackexchange_codegolf
Today is Halloween and it's time to carve some pumpkins! & ((^.^)) Given an input integer, string, list of integers, etc., output the corresponding pumpkin. The input will always be of the form Stem, Eyes, Mouth, Width. For example, 2331 would be a valid input. The pumpkin takes the form: S ((EME)) where S is t...
stackexchange_codegolf
You've gotten out of Earth's gravity well - good for you! However, you're feeling a bit uncomfortable in zero-gravity, and you want to replicate 1 \$g\$ of force in a centrifuge. Use the equation for force in a centrifuge: $$\text{RCF} = \frac{r_\text{m} \, \left(\frac{2 \pi N_\text{RPM}}{60}\right)^2}{g}$$ Where \$\t...
stackexchange_codegolf
Every now and again, I'll encounter a large string of alphabetical text encoded as numbers from 1-26. Before I knew that I could just google a translator online, I had to personally, painstakingly copy and paste the entirety of the encoded text into a text document and translate it myself. Thankfully, I did know about ...
stackexchange_codegolf
We have a challenge to output your own score, but it seems like all the answers there just hardcode the output and that's boring1. So lets have a new challenge. Your program must output its own length in bytes followed by the string " bytes", but in order to prevent hardcoded solutions if we reduce its size by removi...
stackexchange_codegolf
I found another sequence not yet in the OEIS The binary expansion sequence is defines as follows, assuming 0 indexing: The even numbers of the sequence are how often 0 has appeared in the binary expansion of all previous items in the sequence The odd elements are the same, but for 1s. If you choose to 1-index, revers...
stackexchange_codegolf
A number is balanced if the sum of the digits on each half of the number is equal, so: 1423 is balanced because 1+4 = 2+3, so is: 42615 because 4+2=1+5. Note that the middle digit is not included on either side (or it's included on both sides) if there's an odd number of digits. Challenge: Take a positive integer as in...
stackexchange_codegolf
Write a program to solve a series of linear equations as short as possible. It must solve arbitrary number of equations problems. They can inputted however you like, coefficients of augmented matrix is probably the easiest. The program doesn't have to handle non-integer coefficients or solutions. No degenerate or inval...
stackexchange_codegolf
Introduction Inspired by Dyalog Ltd.'s 2016 student competition. The challenge there is to write good APL code, but this is a code-golf and it is open to all languages. Derived from this closed challenge. The real challenge here is to combine the various (quite trivial) parts of the problem in a byte-efficient way by r...
stackexchange_codegolf
Hermite polynomials refer to two sequences of polynomials: The "probabilist's Hermite polynomials", given by $${He}_n(x) = (-1)^n e ^ \frac {x^2} 2 \frac {d^n} {dx^n} e ^ {-\frac {x^2} 2}$$ where \$\frac {d^n} {dx^n} f(x)\$ refers to the \$n\$th derivative of \$f(x)\$ The "physicist's Hermite polynomials", given by $...
stackexchange_codegolf
Input A bound m <= 4294967295. Output Consider values sampled uniformly at random from integers in the range 0 to m, inclusive. Your output should be the expected (average) number of trailing zeros in the binary representation of the sampled value. Your answer should be exact, for example given as a fraction. Example ...
stackexchange_codegolf
Lets say you saw your friend enter his or her password into their Android phone. You don't remember how they made the pattern but you remember what the pattern looks like. Being the concerned friend that you are you want to know how secure their password is. Your job is to calculate all the ways that a particular pa...
stackexchange_codegolf
Consider a sequence of natural numbers for which N appears as a substring in N^2. A018834 Output the nth element of this sequence. Rules Program takes only n as input and outputs just one number - N. The sequence can be 0-indexed or 1-indexed. Sequence: 1 5 6 10 25 50 60 76 100 250 376 500 600 625 760 ... Squares: 1 2...
stackexchange_codegolf
The Narrative You are a bad musician. You never bothered to learn how to count rhythms. To remedy this shortcoming, you decide to write a program that will tell you how to count in any given time signature. You are still a bad musician, but you can at least pretend that you can count rhythms. The Objective Given a time...
stackexchange_codegolf
NOTE: The winner of this competition is Jack!!!. No more submissions will be accepted. Here is the chat room for this king-of-the-hill challenge. This is my first one so I'm open to suggestions! Reaper is a game concept developed by the Art of Problem Solving which involves patience and greed. After modifying the game ...
stackexchange_codegolf
I'm currently working with a branchless language which does not have native Less-Than, Greater-Than or Equal-To functions. I do however have min, max and abs functions and standard arithmetic (+, -, / and *) available to me. I'd like to create these three functions (as L(a, b), G(a, b) and E(a, b) respectively, which w...
stackexchange_codegolf
Challenge For any two non-empty strings A and B, we define the following sequence : F(0) = A F(1) = B F(n) = F(n-1) + F(n-2) Where + denotates the standard string concatenation. The sequence for strings "A" and "B" starts with the following terms: A, B, BA, BAB, BABBA, ... Create a function or program that, when given...
stackexchange_codegolf
We know that not all fractions have a terminating binary representation. However every fraction can be written as a leading portion followed by a repeating portion. For example \$1/3\$ starts with \$0.\$ and then just repeats \$01\$ endlessly. This corresponds to the bar notation taught in primary school. For examp...
stackexchange_codegolf
The Jaccard index / similarity coefficient, also known as the Tanimoto index / coefficient, is a statistic used for gauging the similarity and diversity of finite sample sets. It was developed by Grove Karl Gilbert in 1884 for the field of weather forecasting [1] and later independently developed by Paul Jaccard [2] wh...
stackexchange_codegolf
It's really frustrating when I'm working and I have a ton of windows open that are completely or partially hidden behind other windows. To make things worse, I'm still using two 1024x768 monitors. Your task is to take a list of coordinates that designate the area, in pixels, on a screen, that a list of windows occupy a...
stackexchange_codegolf
What are some tips for golfing in Turing Machine But Way Worse, a language made by MilkyWay90 and ASCII-only? Tips should be Turing Machine But Way Worse-specific and not be trivial (For examples that you shouldn't post, removing unnecessary whitespace or using shorter state names). EDIT: Added documentation to TMBWW
stackexchange_codegolf
Consider the Tetris pieces, but made out of some number of (hyper)cubes instead of four squares, where two blocks are considered the same if one is a rotation, reflection, or translation of another. The goal of this challenge is to take two positive integer input values, n and k, and count the number of \$n\$-celled po...
stackexchange_codegolf
A shape is chiral if no amount of rotation can make it look like it's mirror image. In this puzzle we will be writing chiral computer programs. For this puzzle we will think of a program as a rectangular matrix of characters. As such all solutions to this challenge must be rectangular (that is all lines must be of th...
stackexchange_codegolf
You are trapped in this 5x5 labyrinth - each room is labelled from 1 to 25 and the exit is in room 1. You are given as input the room you are currently in. Your task is to output the shortest sequence of moves (north, east, south, west) needed to reach room 1. Moves can be output in any format you wish (list, string, ...
stackexchange_codegolf
For functions \$f, g: \{0,1\}^n \rightarrow \{0,1\} \$, we say \$f \sim g\$ if there's a permutation of \$1,2,3,...,n\$ called \$i_1,i_2,i_3,...,i_n\$ so that \$f(x_1,x_2,x_3,...,x_n) = g(x_{i_1},x_{i_2},x_{i_3},...,x_{i_n})\$. Therefore, all such functions are divided in several sets such that, for any two functions \...
stackexchange_codegolf
This is my first challenge, so I'm keeping it fairly simple. If you've ever typed telnet towel.blinkenlights.nl on your command line and pressed enter, you will have experienced the joy of asciimation. Asciimation is, quite simply, doing an animation with ascii art. Today we will be doing a very basic asciimation of a ...
stackexchange_codegolf
Given an integer k and either a block of text, or a 2d array that the inner arrays may have unequal lengths (that resembles a block of text), rotate every character or element in the k-th column up or down to the next position that exists. Example Rotate the 20th column of the following text (1-based): A line with more...
stackexchange_codegolf
This is a challenge in which two people, 1 and 2, are running for office. People deterministically vote in certain ways in the world of 1 and 2, which can allow for the candidates to figure out the results before the election. NOTE: this is not meant to refer to any outside elections or other political events. Two peop...
stackexchange_codegolf
According to MDN, every WebSocket message is sent as one or more frames. Your job is to extract the payload given a (masked) client-to-server text frame. The steps to extract the payload is as follows: ignore byte 1; read byte 2 if it is 254, skip the next 2 bytes if it is 255, skip the next 8 bytes, otherwise, conti...
stackexchange_codegolf
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...
stackexchange_codegolf
Your task is to compute the greatest common divisor (GCD) of two given integers in as few bytes of code as possible. You may write a program or function, taking input and returning output via any of our accepted standard methods (including STDIN/STDOUT, function parameters/return values, command-line arguments, etc.). ...
stackexchange_codegolf
Challenge The challenge is to implement the bottom encoding (only encoding, not decoding). There is a wide variety of existing implementations in the bottom-software-foundation org. Bottom is a text encoding where each character is separated into multiple emoji. Unicode escape(s) Character Value U+1FAC2 200 ...
stackexchange_codegolf
Getting the average of a list (e.g [2,6,7]) Get the length of the list: [2,6,7] -> 3 Sum the numbers in the list: 2 + 6 + 7 = 15. Divide the sum by their count: 15 / 3 = 5. You should compare the averages of two lists of positive integers N and M, by returning a value if N has a higher average, another value if M ha...
stackexchange_codegolf
Challenge Given an integer, n, as input where 0 <= n <= 2^10, output the nth even perfect number. Perfect Numbers A perfect number is a number, x where the sum of its factors (excluding itself) equals x. For example, 6: 6: 1, 2, 3, 6 And, of course, 1 + 2 + 3 = 6, so 6 is perfect. If a perfect number, x, is even, x mo...
stackexchange_codegolf
Take a line of input (function arguments or stdin, etc.). Remove comments in it, where a comment starts and ends with ". Do not remove comments in string literals, which start and end with '. String literals do not contain escapes, because smalltalk has nice, easily lexable syntax ;). Output this string. The number of...
stackexchange_codegolf
Every positive integer can be expressed as the sum of at most three palindromic positive integers in any base b≥5.   Cilleruelo et al., 2017 A positive integer is palindromic in a given base if its representation in that base, without leading zeros, reads the same backwards. In the following, only base b=10 will be c...
stackexchange_codegolf
The Oscars are coming up soon and we all know who's going to win Best Actor in a Leading Role this year right? The great Leonardo DiCaprio of course! Despite his superb performances in all of his films during his career, he has yet to win an Academy Award. So as tribute and as a way to wish him luck during the Awards C...
stackexchange_codegolf
Write code to generate a PDF file containing 6 bingo cards. Winner is the one that uses the shortest code and needs no actions except for installing a library and running the code. (No Save As PDF). Rules are as follows. The generated PDF file should display accurately in Adobe's PDF reader, Google Chrome and Moxilla ...
stackexchange_codegolf
This simple challenge is very similar to this one: How many days in a month? The only difference is you yield the number of days in a month given the index of the month instead of its name. The reason I ask this near-duplicate is curiosity about mathematical patterns in the sequence of numbers. For example, a simple ob...
stackexchange_codegolf
Pretty simple challenge here. Who can make the fastest algorithm (lowest time complexity) to determine whether or not the circle is "boxed in" given the following setup? Input: Your program receives a pair of numbers (a,b) that denotes the position of a circle on a grid like this with arbitrary dimensions: Where a-1 i...
stackexchange_codegolf
We don't have a challenge for conversion between Cartesian and polar coordinates, so ... The challenge Write two programs (or functions) in the same language: one that converts from polar to Cartesian coordinates, and the other from Cartesian to polar coodrinates. The score is the sum of the two program lengths in by...
stackexchange_codegolf
Challenge Given a positive integer \$n\$, output the \$n\$-dimensional pyramidal list. Example \$n = 1\$: Objects arranged in a 1D pyramid (line) with side length 1 is just by itself. So, the output is {1}. \$n = 2\$: Objects arranged in a 2D pyramid (a triangle) with side length 2 would have one on the first row (...
stackexchange_codegolf
You have to write a program, if its source code is reversed, then it will error. For example, if your source is ABC, then reversing it and writing CBA should crash/throw an error. And ABC itself should be a vaild program (I mean your primary source should be a valid program). Output of the main source code can be empty...
stackexchange_codegolf
Strassen's algorithm was the first method of matrix multiplication in subcubic time complexity, namely O(n**log2(7)) for a pair of n*n matrices (assuming the numbers therein are large enough that their O(n*log2(n)) exact multiplication has become the constraint on your performance, and any nested structures and functio...
stackexchange_codegolf
The goal of this challenge is to create a program that takes in a matrix and outputs its reduced row-echelon form. A matrix is in reduced row-echelon form if it meets all of the following conditions: If there is a row where every entry is zero, then this row lies below any other row that contains a nonzero entry...
stackexchange_codegolf
See also: Granma loves Ana You will be given a string of lowercase ASCII letters. Using this dictionary file (UPDATED), your task is to solve the anagram. To solve an anagram, you must output all words or groups of words that can be formed using each letter from the input string exactly once, separated by newlines. Gro...
stackexchange_codegolf
Challenge Statement The goal of this challenge is to build the 5 state Infinite Time Turing Machine that takes the longest to halt. Since Infinite Time Turing Machines can run for infinite time your score will be a "transfinite ordinal". That's the challenge statement, but if you don't what all this means or want to d...
stackexchange_codegolf
Again inspired by a task for Programming 101 here's another challenge. Input: A positive integer n >= 3. (has to be odd) Output: n lines of asterisks, where the first line has n asterisks and every new line has two asterisks less than the line before. Until hitting 1 asterisk. From there every new line has two aster...
stackexchange_codegolf
You are Odysseus, and are finally free from Calypso (who has kept you captive for many years) after you drugged her while she was sleeping1. You wish to return to your homeland of Ithaca, but the ship you've stolen is a bit damaged and cannot steer. However, you have also stolen a map which contains the location of Cal...
stackexchange_codegolf
Can you decrypt me? Cops Cops, post obfuscated code that hides a number \$n\$ (n must not be greater than the program length) inside its code. If \$n\$ chars are changed (no additions or deletions), the program outputs exactly one \$n\$ (any amount of whitespace before or after is allowed.) Otherwise, it outputs someth...
stackexchange_codegolf
Inspired by this wonderful (based on the number of views and votes) challenge, which, in my humble opinion, has way too few answers. Given (by any means) a list of strings, return (by any means) a set of letters that, when removed from the given strings, leaves the total length of (what remains of) the strings as small...
stackexchange_codegolf
Since jq is the Language Of The Month for September 2021, what general tips do you have for golfing in jq? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to jq (e.g. "remove comments" is not an answer). Please post one tip per answer.
stackexchange_codegolf
The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of words in the string. In this case, output is 5, as it's the most often length of words in the string. Definition of an alphabetical word (for this challenge): a string th...
stackexchange_codegolf
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...
stackexchange_codegolf
Yes is a stack-based language that has a few space-separated instructions: yes: Push 1 to the stack no: Push 0 to the stack what: Push the input to the stack (input is taken at the start of program execution and is the same for the whole execution) sure: Increment the last item in the stack nah: Decrement the last item...
stackexchange_codegolf
Goal Sort a list of items ensuring that each item is listed after its specified dependencies. Input An array of arrays of integers, where each integer specifies the 0-based or 1-based index of another item that this item must come after. The input may be an array or string or anything else human readable. For example,...
stackexchange_codegolf
Objective Take \$a \in ℤ_{>1}\$ and \$b \in ℤ_+\$ as inputs. Write a function \$f\$ such that: $$ f(a,b) = \left\{ \begin{array}{ll} \log_ab & \quad \text{if} \space \log_ab \in ℚ \\ -1 & \quad \text{otherwise} \end{array} \right. $$ Rules Types and formats of the inputs doesn't matter. Type a...
stackexchange_codegolf
Your Task: You all know what a magic square is! But what about a magic cube? A magic cube is the 3D version of a magic square, and is a set of numbers in a cube, where the sums of every straight (not diagonal) line are equal. You must write a program or function that receives an integer, and returns the number of va...
stackexchange_codegolf
This is my first code golf challenge, as such I am not entirely certain if it is suitable as a Code Golf challenge, but it's all a learning experience. The challenge is that in as few characters as possible, using whichever language you prefer, develop a code to complete the following: Take a value from stdin Return a...
stackexchange_codegolf
You know those riddles where every letter is swapped for another letter? E.g. you get a text like JME JG EPP IFAPE EPJE CJPPPC BP, UIJCG JC EPP EFE GPJB EJIP EJ EJIP, F EPJIG MPJEPPPP AJUC BJL UP GJP BL MICJIJMPPJUIP CJMI. and are supposed to find out that it stands for OUT OF THE NIGHT THAT COVERS ME, ...
stackexchange_codegolf
The setup: A social network reports the number of votes a post has in two ways: the number of net upvotes (total upvotes - total downvotes), and the % of votes that were upvotes, rounded to the nearest integer (.5 rounds up). The number of net upvotes is an integer (not necessarily positive), and the second is guarant...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Santa has a bunch of presents wrapped in cuboid boxes of various sizes. As his sled flies above a chimney, a stack of presents will be automatically dropped through it. Santa wants to carefully choose the presents so that all of them f...
stackexchange_codegolf
This task is rather simple, and makes use of three distinct "operator" characters. Your task is, given a simple sequence of letters, perform the following task to encode it using <,>,*. You may choose to use either upper or lowercase letters, you do not have to handle both. Cipher Explanation The cipher is simple, you...
stackexchange_codegolf
Defenestration is the act of throwing someone or something out of a window. —Wikipedia Input The input will consist of two parts: A floor plan and a person inside the house/building. v><^ represents a person, pointing in the direction signified by the arrow. The input will contain exactly one person. - and | repres...
stackexchange_codegolf
Given a string, first square it as follows: First, write the string. abcde Next, write the string rotated one left. abcde bcdea Keep doing this until you have written len(string) lines. abcde bcdea cdeab deabc eabcd Now, read from the string like this: ----+ +--+| |+>|| |+-+| +---+ Which gives: abcdeabcdcbaedcbcdea...
stackexchange_codegolf
Given the output of the cop's program (o), the byte-count (n) and the number of unique bytes (c) used, come up with a corresponding piece of code that is n bytes long with c unique bytes which matches the cop's output o. This is the cops thread. Post solutions that are to-be-cracked here. The robbers thread is located...
stackexchange_codegolf
Lucky dice rolls In pen and paper roleplaying games dice are used for various chance calculations. The usual way to describe a roll is \$n\textbf{d}k\$ where \$n\$ is the number of dice and \$k\$ is the number of faces on a die. For example \$3d6\$ means that you need to roll the classical 6-sided die 3 times (or roll ...
stackexchange_codegolf
Remove every pair of newline characters, that means every two newline characters appearing together are elided, whereas unaccompanied newline characters remain present. Example: echo -ne 'a\n\nb\nc\n\n\n\nd\n\n\n' | your-command should output the same as echo -ne 'ab\ncd\n' Watch out, some POSIX tools have implementa...
stackexchange_codegolf
Your task is to generate an emoticon of three characters, the first character being one eye, the second the mouth, and the third another eye. Each eye is a random one of these characters: $'*+-;O^`ox~, and the mouth is a random one of these: ,-._coux. Each eye and the mouth must be on the same general level. These eyes...
stackexchange_codegolf
Background Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation to make programming easier and faster. The challenge Let's look at snippet written by Joe a moment ago: 0+++++1+++++0[3+...
stackexchange_codegolf
Input Your program will take in the integer coefficients of the equation \$ax^3+bx^2+cx+d=0\$ as inputs (a, b, c, and d). Output All real solutions of the input equation, with an accuracy of at least the thousandths place, sorted from smallest to largest. Rules Built-in equation solver are not allowed Native math ...
stackexchange_codegolf
I just had a genius idea for making the work-life easier - a countdown to a specific date which only counts workdays. The basic task is to create a countdown to a specific date which only includes the workdays in the countdown. As workday counts Monday, Tuesday, Wednesday, Thursday and Friday. The Input should be a sp...
stackexchange_codegolf
A leaper is a category of fairy chess piece which moves by "jumping." A normal knight is a (1,2)-leaper, meaning each move involves moving a distance of 1 square in an orthogonal direction and 2 squares in the perpendicular direction. .o.o. o...o ..N.. o...o .o.o. There are many different leapers. The (1,3)-leaper is...
stackexchange_codegolf
Stack Exchange doesn't know how to transpose tables. Let's help. Given a markdown table, transpose it. Input assumptions: There will be at least two rows (including header) and two columns Either all cells have no leading space or all cells have exactly one leading space (you must handle both) If the cells have a lead...
stackexchange_codegolf
Given an input of a positive integer, output the number of steps it takes to find the input via a binary search starting at 1. We are simulating a binary search for the integer that was given as input, in which the simulated searcher can repeatedly guess an integer and be told whether it is too high, too low, or correc...
stackexchange_codegolf
Input : Two decimal integers m and n that respectively give the number of rows and columns of the table. m and n are greater than or equal to 1. Output : A table in HTML that has m rows and n columns. The table should be displayable by a modern browser of your choice. Most browsers will display everything properly even...
stackexchange_codegolf
You are a historian studying a long forgotten language. You have just discovered a clay tablet which seems to list all known words in the language, in alphabetical order. Your task is to find this alphabet's order, if it exists. The Task Given an ordered list of words, try to output an ordered list of characters such t...
stackexchange_codegolf
Given the following Python "reference implementation" of non-terminating FizzBuzz: i=1 while True: if i%15 == 0: print("FizzBuzz") elif i%3 == 0: print("Fizz") elif i%5 == 0: print("Buzz") else: print(i) i += 1 We can represent its output as an infinite array of char...
stackexchange_codegolf
In the MMORPG Final Fantasy XIV, the Ninja class has the ability to use combinations of up to three handsigns (Ten, Chi and Jin) to perform a variety of ninjutsu skills. The skill you cast depends on the last sign used, and using two or more of the same sign makes the ninjutsu skill fail and puts a little bunny on your...
stackexchange_codegolf
Challenge Given two question IDs, try to figure out how similar they are by looking at the answers. Details You will be given two question IDs for codegolf.stackexchange.com; you may assume that there exist questions for both IDs that are not deleted, but are not necessarily open. You must run through all of the answer...
stackexchange_codegolf
It is trivially possible to create a bijective function from \$\mathbb{Z}\$ (the set of all integers) to \$\mathbb{Z}\$ (e.g. the identity function). It is also possible to create a bijective function from \$\mathbb{Z}\$ to \$\mathbb{Z}^2\$ (the set of all pairs of 2 integers; the cartesian product of \$\mathbb{Z}\$ an...
stackexchange_codegolf
Input a list of strings a and a string s for search keyword. Find out all strings in a which contains s as subsequence. And sort them in the following order: Exactly equals to s Starts with s Contains s as substring (continuous subsequence) Contains s as subsequence Detail When two strings belongs to the same sortin...
stackexchange_codegolf