instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Note This is the decryption challenge. The encryption challenge can be found here. Challenge The challenge is to decrypt a given string, using the rules as specified below. The string will only contain lowercase alphabets, digits, and/or blank spaces. If you want to know how the input string has been encrypted, refer t...
stackexchange_codegolf
Let's build a simulation for an aspect in the card game, which I personally know by the Dutch name 'Oorlog' (translates to 'War'). How does 'Oorlog' work? Two decks of cards (each including two Jokers) are equally divided between the amount of players playing. Each player shuffles their own stock, put it upside down in...
stackexchange_codegolf
Church Subtraction Lambda calculus has always been a fascination of mine and the emergent behaviors of passing functions into each other is delightfully complex. Church numerals are representations of natural numbers contructed from the repeated application of a function (normally the unary addition of a constant). For...
stackexchange_codegolf
Thanks to your help in the Mark My Mail challenge, PPCG-Post has successfully stamped all of its parcels with the generated barcodes! Now, it's time to decode them. In this challenge your program will, given a barcode generated from the Mark My Mail challenge, decode it and return the encoded integer. But watch out! Th...
stackexchange_codegolf
CGCC hasn't always had MathJax. Back in the dark ages, it would have been necessary to write \$x^2\$ as x² (the horror!). In this challenge, you will be given some math which may include superscripts, and you should convert it to MathJax. Input: Input will consist of one or more letters a to z, some with superscripts. ...
stackexchange_codegolf
Output the area \$A\$ of a triangle given its side lengths \$a, b, c\$ as inputs. This can be computed using Heron's formula: $$ A=\sqrt{s(s-a)(s-b)(s-c)}\textrm{, where } s=\frac{a+b+c}{2}.$$ This can be written in various ways, such as $$ A= \frac{1}{4}\sqrt{(a+b+c)(-a+b+c)(a-b+c)(a+b-c)}$$ $$ A= \frac{1}{4}\sqrt{(a^...
stackexchange_codegolf
Solve an Inglenook Sidings Puzzle Background The Inglenook Sidings Puzzle is a shunting/switching yard puzzle by Alan Wright for model railroading. The rules for the puzzle are as follows: (Source) Form a departing train consisting of 5 out of the 8 wagons sitting in the sidings. The 5 wagons are selected at random. T...
stackexchange_codegolf
Task: Given sample index, x, calculate sample value f(x) of triangular wave, with period of 4 samples and amplitude 1. Offset can be negative and sample value could be either {0, 1, -1}. Test cases: -5 -> -1 -4 -> 0 -3 -> 1 -2 -> 0 -1 -> -1 0 -> 0 1 -> 1 2 -> 0 3 -> -1 4 -> 0 5 ->...
stackexchange_codegolf
I am currently working on a golfing language. Do you have any suggestions for this language? What are some helpful features of a good golfing language? What features do you find useful? Do you suggest a language based on variables, stack(s), tapes, registers, etc? As usual, please post separate tips in separate answers...
stackexchange_codegolf
Vowels rhyme: Apples and Bananas There is a traditional children's song that repeats the same text over and over, only each time every vowel is replaced with a random vowel, but constant across the current stanza. Challenge The objective is to propose the shortest code that performs such a transformation on an input te...
stackexchange_codegolf
CHALLENGE This is a fastest-code challenge. Count how many n-dimensional hypercubes with n=1,2,3,4 exist, with vertices labeled with either 1 or 0, such that there does not exist any rectangle formed by 4 vertices such that one diagonal is 1-1 and the other diagonal is 0-0. To be more clear, the forbidden rectangles ha...
stackexchange_codegolf
Write a program or function that takes in a single string containing only lowercase a-z, and prints or returns a truthy value if the word is the feminine version of the thing it represents and a falsy value if it is the masculine version. For example, hen is the feminine version for chicken and rooster is the masculine...
stackexchange_codegolf
Your pyramid The pyramid I want you to build is made entirely of cubes. It has 24 layers, and the Nth layer from the top contains N2 cubes arranged in an N by N square. The pyramid looks like this: To build the pyramid, you will need a supply of cubes. You are given 4900 cubes arranged in a 70 by 70 square that looks ...
stackexchange_codegolf
Wow, time really flies! It's already been one year since the debut of the Code Golf Stack Exchange site design. Let's celebrate this milestone with a code golf challenge... to imitate the site logo! Golf a program that outputs a graphic of a medal enclosed in curly braces {}, along with two lines of text containing COD...
stackexchange_codegolf
Challenge Let's have a list L of n elements. The task is to swap every two elements in this list. Constrains the list L has at least two elements size of the list L is a multiple of two (i.e. number of elements is even) Example input: [1,2,3,4,5,6] output: [2,1,4,3,6,5] input: [0,1,0,1] output: [1,0,1,0] Rules ...
stackexchange_codegolf
Yesterday while playing with my kid I noticed the number in his toy train: So we have $$4281$$ that can be split into $$4-2-8-1$$ or $$2^2-2^1-2^3-2^0$$ So simple challenge: given a non-negative number as input, return consistent truthy and falsey values that represent whether or not the string representation of the n...
stackexchange_codegolf
Your challenge is to write a program or function that hiccups a string. It should take a string as input (via any standard method), then follow these steps: Generate a (not necessarily uniformly) random integer n between 1 and 10, inclusive. Wait n seconds. Print the initial/next n chars of the input, or the rest of t...
stackexchange_codegolf
I've been a fan of My Little Pony: Friendship Is Magic for a long time, and very early on I created a pony version of myself also called Parcly Taxel (warning: may be too cute to look at). The symbol below is her "cutie mark", which you will be drawing here: Construction All key points of the cutie mark lie on a rotat...
stackexchange_codegolf
Given a non-negative integer n, print the result of P(P(...P({}))), where the number of P's is n (P is the power set function). 0 => {} 1 => P({}) 2 => P(P({})) 3 => P(P(P({}))) n => P(f(n-1)) input result 0 {} 1 {{}} 2 {{},{{}}} 3 {{},{{}},{{{}}},{{},{{}}}} ... The result should only contai...
stackexchange_codegolf
Chained Binary Operations Here's a challenge involving truth tables and binary operations. For this specific challenge, your task is to use the following table of operations: To create a function that takes in two inputs f(p,a), where p is the initial truthy/falsy value and a is a list of tuples representing multiple ...
stackexchange_codegolf
Write a program or function that given n ≥ 1 returns the number of solutions to ±1 ± 2 ± 3 ± ... ± n = 0. For n = 6 there are no solutions, so the answer is 0. For n = 4 there are two solutions, so the answer is 2 (the two solutions are 1 - 2 - 3 + 4 = -1 + 2 + 3 - 4 = 0). This is OEIS sequence A063865. Some example in...
stackexchange_codegolf
An "Egyptian fraction" is a list of distinct fractions with a numerator of \$1\$. For example: \$ \frac 1 1+ \frac 1 2 + \frac 1 3 + \frac 1 6 \$ The "size" of an Egyptian fraction is just the number of terms involved. Your task is to take a positive integer \$n\$ and output the smallest Egyptian fraction that sums t...
stackexchange_codegolf
Challenge: Input: A sorted list of positive integers. Output: The amount of integers which are still at the exact same index, after rotating the digits in each integer its index amount of times towards the left and sorting the modified list again. Example: Input: [8,49,73,102,259,762,2782,3383,9217,37846,89487,7471788]...
stackexchange_codegolf
John, a knight wants to kill a dragon to escape the castle! The dragon has A heads and B tails. He knows, that: if you cut off one tail, two new tails grow if you cut off two tails, one new head grows if you cut off one head, one new tail grows if you cut off two heads, nothing grows To defeat the dragon, John needs ...
stackexchange_codegolf
If you don't know what the Tower of Hanoi is, I'll explain it briefly: There are three rods and some discs each of which has a different size. In the beginning all discs are on the first tower, in sorted order: The biggest one is at the bottom, the smallest at the top. The goal is to bring all the discs over to the thi...
stackexchange_codegolf
Given a non-empty array of positive integers, determine if it is possible to take squares with side lengths specified by each integer, and arrange them in space such that they form a square. The output can have anything as truthy / falsey values, and the input array may contain duplicates. For the truthy testcase [3,2,...
stackexchange_codegolf
This task builds on: Find all reflexicons using roman numerals An autogram is a sentence that lists the count of its own letters. Below is one of the first documented autograms found by Lee Sallows in 1983: This pangram lists four a’s, one b, one c, two d’s, twenty-nine e’s, eight f’s, three g’s, five h’s, eleven i’s,...
stackexchange_codegolf
!!!Batch is another derivative of the Windows Batch programming language, its wiki is here Your challenge is to create an compiler/translator that reads a !!!Batch program and returns a Windows Batch program. In !!!Batch each token braced in two question marks like ?!!!? is converted to another ASCII character, like '?...
stackexchange_codegolf
Given an integer \$ n \ge 2 \$, you need to calculate \$ \lfloor n \log_2(n) \rfloor \$, assuming all integers in your language are unbounded. However, you may not ignore floating-point errors - for example, in python lambda n:int(n*math.log2(n)) is an invalid solution, because for example for n=10**15, int(n*math.log2...
stackexchange_codegolf
I noticed that it seems nobody has posted a non-ASCII (related) USA flag challenge yet, so what better time than the 4th of July? The Challenge Draw the current (as of 2022) flag of the United States of America. Here is the flag: Specifications Hoist (height) of the flag: A = 1.0 Fly (width) of the flag: B = 1.9 Hoi...
stackexchange_codegolf
Tom the lumberjack is going to do his daily routine: chop trees. After all, it's his job to do so. His boss has ordered him to chop trees in a straight line marked with a special tape to identify them, so he knows which trees he is going to have to chop. However, Tom quickly realizes he has a problem. His axe will only...
stackexchange_codegolf
The TAK function is defined as follows for integers \$x\$, \$y\$, \$z\$: $$ t(x, y, z) = \begin{cases} y, & \text{if $x \le y$} \\ t(t(x-1,y,z), t(y-1,z,x), t(z-1,x,y)), & \text{otherwise} \end{cases} $$ It can be proved that it always terminates and evaluates to the simple function below: $$ t(x, y, z) = \begin{cases}...
stackexchange_codegolf
Within the scope of this question, let us consider only strings which consist of the character x repeated arbitrary number of times. For example: <empty> x xx xxxxxxxxxxxxxxxx (Well, actually it doesn't have to be x - any character is fine as long as the whole string only has 1 type of character) Write a regex in any ...
stackexchange_codegolf
Inspired by this challenge, and similar to this and this. After seeing these, I figured I would continue the trend as there was no inclusive/exclusive sum. The goal here is to sum an interval of integers, either inclusive and exclusive, and output the total to stdout. Input format: either a ( or [ followed by 2 comma s...
stackexchange_codegolf
Challenge Create the shortest program that meets the requirements Requirements The code must generate a 5x5 grid of 0s, like so: 00000 00000 00000 00000 00000 The code must accept an input (column, row, character). The grid must change accordingly: Start: 00000 00000 00000 00000 00000 Input: (2,5,*) Output: 0*000 0...
stackexchange_codegolf
Base: part 1 This is part 2, Strongly suggest you go try out the first one if you haven't tried it. Story As one of the solvers, You've managed to get to the door of the base heaven. In front of the door stands the base guard @lyxal, they were angry that you all just left the encoded text on the ground, they demand tha...
stackexchange_codegolf
How can we depict a turned shape simply and nicely using ascii characters in 3D space? I suggest this method : Instead of a circle we use a square rotated by 45° for the cutting section so that we only need '/' and '\' characters to draw it. /\ / \ \ / \/ And we use '_' character for the profiles: upper, lower ...
stackexchange_codegolf
Given a rectangle input with only \, / and space, decide if it's a valid output of Drawing in Slashes Empty lines and columns at edge get cleaned up, so the 3rd true case is true. True cases: /\/\ / /\ \ \/ / \ /\/ /\ \ \ / \/ \ \ \ \ \/ /\/\ / /\ \ / \ \/ / /\ \/\ \/ \ / / / ...
stackexchange_codegolf
Given two integers greater than one, A and B, output four mathematical expressions in this order: The plain expression A^B (A to the power B). e.g. if A = 2 and B = 3, 2^3. The expansion of A^B in terms of repeated multiplications of A. e.g. 2*2*2. The expansion of A^B in terms of repeated additions of A. e.g. 2+2+2...
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
Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values. The challenge is to write the shortest program that takes a polynomial, of degree at most 4, and simply returns how many distinct real roots said polynomial...
stackexchange_codegolf
My wires are all tangled! Isn't it annoying when wires get all tangled up? Well, that just happened to me, so I'd like to to help me untangle them! For your convenience, I've disconnected them all from the device, but they're all still connected to the outlet. Your challenge is to figure out how to untangle them! Input...
stackexchange_codegolf
Today's challenge: Given an ordered list of at least 3 unique integer 2D points forming a polygon, determine if the resulting polygon is Rectilinear. A polygon is rectilinear if every interior angle is a right angle. The edges do not necessarily have to be purely vertical or horizontal (parallel to the x or y axis), ...
stackexchange_codegolf
UTF-8 is a relatively simple way to encode Unicode codepoints in a variable-width format such that it doesn't easily confuse code that isn't Unicode aware. UTF-8 overview Bytes in the range of 1-0x7F, inclusive, are normally valid Bytes with the bit pattern 10XX XXXX are considered continuation bytes, with the six lea...
stackexchange_codegolf
There is a job which can be decomposed into x equally-sized smaller tasks. You have a team of size y <= x, where every member works equally fast on any task. The goal for this challenge is to divide the work as evenly as possible such that every member of your team has at least 1 task to perform. As evenly as possible ...
stackexchange_codegolf
Your task is to translate a 103-smooth number into an English word, using the method described below. How? Generate the list of prime factors (with repetition) of the input number. Sort the list: If 2 is not one of the prime factors, sort the list in ascending order. If 2 is one of the prime factors, remove it from ...
stackexchange_codegolf
Based on the question How many positive integers < 1,000,000 contain the digit 2?. I'm looking for the most creative solution to count all the Integers from X to Y containing the Integer Z. Z can be from 0 to Y. Every found Integer only counts once, even if the integer Z appears more often. For example: Z = 2 123 coun...
stackexchange_codegolf
The λ-calculus, or lambda calculus, is a logical system based on anonymous functions. For example, this a λ-expression: λf.(λx.xx)(λx.f(xx)) However, for the purposes of this challenge, we'll simplify the notation: Change λ to \ (to make it easier to type): \f.(\x.xx)(\x.f(xx)) The . in lambda headers is unnecessary,...
stackexchange_codegolf
A directed graph G is given with Vertices V and Edges E, representing train stations and unidirectional train routes respectively. Trains of different train numbers move in between pairs of Vertices in a single direction. Vertices of G are connected with one another through trains with allotted train numbers. A hop is ...
stackexchange_codegolf
Draw a tiled cube of any size, in ASCII art. You will be given three numbers a, b and c, and the program should output an a*b*c sized cube. Examples 3 3 3 -> ____ ____ ____ /____/____/____/| /____/____/____/|| /____/____/____/||| |____|____|____|||/ |____|____|____||/ |____|____|____|/ 5 2 3 -> ____ ____ _...
stackexchange_codegolf
Definition We say a pair of integers \$(a,b)\$, where \$0<a<b<N\$ and \$N\$ is an integer larger than 4, is an inverse neighbor pair respect to \$N\$ if \$ab\equiv1\text{ }(\text{mod }N)\$ and \$1\le b-a\le\log_2{N}\$. There may be no such pairs respect to some integers \$N\$. To illustrate the definition, consider \$...
stackexchange_codegolf
It is quite simple, any language, make output show the time in the HH:MM or HH:MM:SS while the numbers and the colons being ascii art(The output is ascii art not the program) Sample output: ____________ ________ _____ .________ ________ /_ \_____ \ /\ \_____ \ / | | /\ | ____// _____/ | ...
stackexchange_codegolf
Recursion is actually quite powerful, sometimes its doesn't look like that child problem of itself exist, but recursion is just helpful. One case per answer.
stackexchange_codegolf
This is the Cop post. The Robber post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written backwards: 1, 4, 9, 61, 52, 63, 94, 46, 18, 1, 121, 441, ... Note that leading zeros are trimmed away (100 becomes 1, not 00...
stackexchange_codegolf
Inspired by a recent Daily WTF article... Write a program or function that takes a GUID (string in the format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, where each X represents a hexadecimal digit), and outputs the GUID incremented by one. Examples >>> increment_guid('7f128bd4-b0ba-4597-8f35-3a2f2756dfbb') '7f128bd4-b0ba-45...
stackexchange_codegolf
This is the robbers' thread for 'Almost Illegal Strings'. See the cop's thread for information on participating. A section from the post is included here for convenience. The Robbers' Challenge Find an uncracked answer. Write a program in the language specified that contains as a contiguous substring the almost illega...
stackexchange_codegolf
Introduction Every string has an "alphabet", composed of the characters that make it up. For example, the alphabet of \$abcaabbcc\$ is \${a, b,c}\$. There are two operations you can do with alphabets: getting the alphabet of a string, and seeing if another string has a given alphabet. Challenge Given two strings, you m...
stackexchange_codegolf
The International Phonetic Alphabet is a system of phonetic notation intended to be able to accurately represent every sound used in spoken language. The alphabet contains 29 vowel letters iyɨʉɯuɪʏʊeøɘɵɤoəɛœɜɞʌɔæɐaɶäɑɒ and 81 consonant letters, although I missed three (ɦǀǂ) when I first posted this challenge, so you on...
stackexchange_codegolf
I majored in computer science in the area of communication technologies and I fluently speak Python, Java, C, Bash, Matlab, Octave and some others. But you guys know things I have never ever heard about like "Fish" or "R" or "Whitespace" or some kind of crazy things. Sometimes these languages are not even build by ASCI...
stackexchange_codegolf
Magic the gathering has many unique names for colour combinations in decks, as an example when Blue and White appear together in a deck, the deck maye sometimes be named after the Ravnican Guild that features those colours, namely 'Azorius'. There are some exceptions, and oddities though. Below is a list of colour lett...
stackexchange_codegolf
Introduction Jonny wants to play Frogger. However, he's not very good. In fact, he will only try to move forward, and only after the platforms have moved. Find out if Jonny's frog manages to reach the end of the path or if it dies on its way. Challenge The program will be receiving as input a Frogger grid composed by 0...
stackexchange_codegolf
A sequel to What dice do I need to display every integer up to X? Numbers are great, but let's take it to the next level. I'd like to have a set of dice that can be arranged and rotated to display any words I want. Think Boggle: And not just that; I want to specify the number of sides those dice have. The set should c...
stackexchange_codegolf
Challenge Write the shortest program that, when compiled or executed, produces a fatal error message smaller than the program itself. The error message may not be generated by the program itself, such as Python's raise. A valid answer must include both the code and the error message. Shortest valid answer wins. No erro...
stackexchange_codegolf
Given a list of integer coordinates, find the area of the biggest convex polygon you can construct from the list such that - every vertex is in the list no element of the list is contained within the polygon. Example: (0, 0) (8, 0) (0, 1) (3, 1) (7, 1) (1, 2) (5, 2) (9, 2) (2, 3) (5, 3) (7, 3) (3, 4) (5, 5) (11, 5)...
stackexchange_codegolf
Inspired by a polyglot on the Stack Overflow 404 page: Goal Your goal is simple, to create a polyglot that outputs the number 404, and then terminate, in as many languages as possible. Restrictions Here's the twist, there's a restriction to make it harder: You have to write N programs and pick N languages in a particu...
stackexchange_codegolf
Maybe some of you already know this game: you have a collection of jelly beans of different colors. For every color, the bean can have different tastes, some are good and some are bad, and you cannot tell them apart. You have to pick a bean of a given color, and pray you have select a good one. So, write the shortest p...
stackexchange_codegolf
Produce Graham's Number in Magic the Gathering using the fewest number of cards and without using any infinite combos. Rules: Producing Graham's number means do anything that requires Graham's number to represent the game state. For example, you could produce Graham's number 2/2 zombie tokens, have Graham's number li...
stackexchange_codegolf
I really hate looking up to the top right of the screen to look at the time on OS X's clock widget; I'd much rather keep my eyes at least somewhere near my workspace to check the time. I also hate other people using my clock to check the time as they walk by -- after all, it's called a personal computer, right? But we'...
stackexchange_codegolf
Write a program or function that takes in a positive integer and prints or returns an ASCII art depiction of an archery arrow, scaled according to the input. If the input is 1 the output is /\ / \ \__/ || || || || || || || || /||\ / || \ / || \ // \\ / \ If the input is 2 the output is /...
stackexchange_codegolf
When making phone calls internationally, phone numbers are prefixed with a code indicating what country the number is located in. These codes are prefix codes, meaning that no code is a prefix of another. Now, earlier today you missed a call, and you're kind of curious where that call might have come from. So you want ...
stackexchange_codegolf
zipwith is a functional construct that takes three arguments: one binary function and two lists of the same length, and returns a single list where each element is constructed by applying the binary function to each pair of elements from the two lists: zipwith (a+b) [1,2,3] [4,5,6] = [5,7,9] You are to take a black-bo...
stackexchange_codegolf
Skittles are colored candy where there are 5 distinct flavors; grape, green apple, lemon, orange, and strawberry represented by (p)urple, (g)reen, (y)ellow, (o)range, and (r)ed respectively. I used to eat skittles by sorting all the different colors, then eating them in sequence. After getting a few weird looks in the ...
stackexchange_codegolf
Given a number N from 2 to 8, place any nonzero number of queens on a grid of any size so that every queen has exactly N queens (counting itself) in each of its row, column, and each diagonal. This challenge has a significant restricted-time runtime limit. Your code must finish all N from 2 to 8 (combined) within the 6...
stackexchange_codegolf
The challenge is to implement a function or program that takes two numbers, \$x\$ and \$y\$ and return the result of \$x^y\$. The program cannot use any other mathematical operation other than \$+\$ or \$-\$, so no multiplication or division. Functions built into languages are also not allowed. The code in the least a...
stackexchange_codegolf
Craps is a fairly simple dice game often played in casinos. Even if you aren't a gambler (which I'm not), it's still a fairly interesting game. Here's the rules: At the start of a game of Craps there's what is called the come-out round. The player rolls two d6s (six-sided die) and the two die rolls are added. If the re...
stackexchange_codegolf
This challenge is to write a minimax function in a language of your choice, to output the next best move in an NxN game of tic-tac-toe given the current board state. The board input can be accepted as a Matrix, 2D Collection or anything else that makes sense to you, but adheres to the rules. The output being the next b...
stackexchange_codegolf
A stem and leaf plot displays a bunch of numerical values in groups, which are determined by all but the last digit. For example, suppose we have this set of data: 0, 2, 12, 13, 13, 15, 16, 20, 29, 43, 49, 101 We could produce this stem and leaf plot: 0|02 1|23356 2|09 3| 4|39 5| 6| 7| 8| 9| 10|1 The first row's stem...
stackexchange_codegolf
Input a decimal number and round it to an integer, randomly rounding up or down with a probability based on its fractional part, so the expected value of the output equals to the input value. If input \$x\$ is an integer, the program should output it as is. If \$x\$ is not an integer, the program has a \$x-\left\lfloo...
stackexchange_codegolf
What could be more polar opposites than chess and demolition derby. You would think that no one who enjoys one would enjoy the other... until today. Rules The starting position is a standard chess board: RNBQKBNR PPPPPPPP PPPPPPPP RNBQKBNR Looks normal enough, until you find out it's an EVERY PIECE FOR ITSELF, ...
stackexchange_codegolf
Background Python 3 has many types of string literals. For example, the string this 'is' an exa\\m/ple can be represented as: 'this \'is\' an exa\\\\m/ple' "this 'is' an exa\\\\m/ple" r"this 'is' an exa\\m/ple" '''this 'is' an exa\\\\m/ple''' """this 'is' an exa\\\\m/ple""" r'''this 'is' an exa\\m/ple''' r"""this 'is' ...
stackexchange_codegolf
Super simple challenge today, or is it? I feel like we've heard a fair bit about double speak recently, well let's define it in a codable way... Double speak is when each and every character in a string of text is immediately repeated. For example: "DDoouubbllee ssppeeaakk!!" The Rules Write code which accepts one ...
stackexchange_codegolf
Introduction Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. The first challenge in this series is to output a(n) for a given n as input, where a(n) is A064413, also known as the EK...
stackexchange_codegolf
The Dank Memes Casino is one of the best casinos of the world. They have a rule that if you win or lose money, you will be paid at the beginning of the next month. But, catastrophe struck and there was an earthquake, which demolished the casino. Now, all the poker players have gathered and realised that the casino is n...
stackexchange_codegolf
A Caesar shift is probably something we're all familiar with. (You might be even doing it as a homework task. If so, please don't copy these answers, your teacher almost certainly doesn't want anything like the answers here.) Just in case you aren't, a Caesar shift is a very simple form of cipher. It takes a string to...
stackexchange_codegolf
My first code golf question post! Hope u like it ;-) The task is simple. Write either an stdin-stdout program or a function. Input is a 2D array which contains only either characters or the integer 0. You are allowed to replace the integers with the character '0' or null instead in any language (kudos to @SuperStormer ...
stackexchange_codegolf
This is the cops' thread to a cops-and-robbers challenge. Click the link to find the robbers' thread. The challenge here is very simple. Create two programs of the same size, in the same language, which output (using 1 standard output method) two different natural numbers, \$x\$ and \$y\$. Submit both programs, bot...
stackexchange_codegolf
A challenge I thought that would be very cool is to make an interpreter for a Turing-complete language of your choosing. The rules are simple: You may use any language to create this interpreter even if it is newer than this challenge. You may use any Turing-complete language as long as it is not the same as the one y...
stackexchange_codegolf
Given a positive input \$n > 0\$, output the amout of two types based on their rarity. The two types are called \$A\$ and \$B\$, we know the followings: \$n\$ is a limited input and the maximum is \$nmax\$ At the start \$B\$ is twice as rare as \$A\$ As the presence of \$A\$ increade the rarity of \$B\$ decreases When...
stackexchange_codegolf
For a 2 dimensional array we will define the elements in either the first row or the last column to be the largest "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted: \$ \begin{bmatrix} \color{red}{\underline 1} & \color{red}{\underline 2} & \color{red}{\underline 4}...
stackexchange_codegolf
Objective Given a list of three-word passphrases, crack them all. Each time you guess, you will be given a clue in the style of Mastermind, depicting how many characters match the password, and how many are in their correct position. The objective is to minimize the total number of guesses over all test cases. Passphr...
stackexchange_codegolf
Background Tatamibari is a logic puzzle designed by Nikoli. A Tatamibari puzzle is played on a rectangular grid with three different kinds of symbols in it: +, -. and |. The solver must partition the grid into rectangular or square regions according to the following rules: Every partition must contain exactly one symb...
stackexchange_codegolf
Background You've been given a task to take notes for a meeting. You start typing on your Google Doc, but you don't have enough time during the meeting to look at your keyboard while you type. Fortunately for you, you can type without looking at your keyboard. After the meeting, you realize that everything you typed wa...
stackexchange_codegolf
You are given 4 positive integers: volume of the first container (v1), volume of the second container (v2), volume of the liquid in the first container (l1), and volume of the liquid in the second container (l2). Your task is to move some of the liquid from container 1 to container 2, making the amount of empty space i...
stackexchange_codegolf
Try it online! currently has 680 listed languages, all of which are searchable. For most of those languages, when searching for it, you don't have to enter the entire string. For example, entering lega results in just 05AB1E (legacy) appearing, and entering d+ results in only Add++. However, for some languages, there i...
stackexchange_codegolf
I was looking for this page to help me enhance my first answer with SQLite, but I couldnt find one. So here we are! What general tips do you have for golfing in SQLite? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to SQLite. Please post one tip per answe...
stackexchange_codegolf
You should write a program or function which receives a block of chars represented as a string and outputs or returns a similar string in which the letters adjacent in the alphabet are connected. A visual example (in the form of input => output): b d b d |\ /| ...
stackexchange_codegolf
I've looked and could not find a post for this, if there is one, I'll remove it quick! Related and also related The goal is (hopefully) clear: create the shortest code (in bytes) that implements the AES256 ECB cipher mode. Either convert the result to Base64 or output a array of bytes. The input contains two parts. The...
stackexchange_codegolf
Write the shortest possible program to remove all partial matched duplicates from a list and only retain the longest lines. Sort order does not matter. For following inputs, the intent is to search for the string reminder followed by a number and retain the longest unique reminder + number lines. Some rules reminder i...
stackexchange_codegolf
Using ASCII print a section of a hexagon ring tiling. Here's a small section: /\__/\ /_/ \_\ /\__/\ \__/ /\__/\ /_/ \_\/__\/_/ \_\ \ \__/ /\__/\ \__/ / \/__\/_/ \_\/__\/ /\__/\ \__/ /\__/\ /_/ \_\/__\/_/ \_\ \ \__/ /\__/\ \__/ / \/__\/_/ \_\/__\/ \ \__/ / \/__\/ Here's a larger...
stackexchange_codegolf
Introduction I have some JavaScript code that uses Array.prototype.map to map an array of functions fns to their return values: const fns = [() => 1, () => 2]; const result = fns.map( fn => fn() ); console.log(result); // => [1, 2] Challenge The argument to map above is fn => fn(). The challenge is to rewrite th...
stackexchange_codegolf