instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
A "simple circular" word is a word whose chords do not intersect. The chords of a word may be seen by laying out the alphabet in a circle, and then connecting the word's consecutive letters. Examples of Simple Circular Words ROLE LAKE BALMY Failing Example A word fails to be simple circular if any of its chords in...
stackexchange_codegolf
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...
stackexchange_codegolf
You are going to be planting pumpkins soon, and you are preparing your supplies. Pumpkins come in all sorts of sizes and have their sizes written on the seed bag. A pumpkin that is size n will grow to be n units wide. However pumpkins need their space. If a pumpkin is stuck between two other pumpkins with not enou...
stackexchange_codegolf
Take the vector of unknowns , and apply some generic differentiable function . The Jacobian is then given by a matrix such that: For example, suppose m=3 and n=2. Then (using 0-based indexing) The Jacobian of f is then The goal of this challenge is to print this Jacobian matrix. Input Your program/function should ...
stackexchange_codegolf
The dice game Mia introduces a very non-trivial order of sets of size two: {3,1} < {3,2} < {4,1} < {4,2} < {4,3} < {5,1} < {5,4} < {6,1} < {6,5} < {1,1} < {2,2} < {6,6} < {1,2} In general, the order within a tuple does not matter {x,y}={y,x}, {1,2} is greater than anything else, Pairs are greater than non-pairs and th...
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
(Note: this challenge is distinct from my other challenge (Draw a path made from direction changers) because of it's rendering of direction (horizontal or vertical), crossing points and single or double paths.) Let's start with a frame drawn in Ascii characters. For this challenge it will always be 20 characters wide ...
stackexchange_codegolf
In math, a permutation σ of order n is a bijective function from the integers 1...n to itself. This list: 2 1 4 3 represents the permutation σ such that σ(1) = 2, σ(2) = 1, σ(3) = 4, and σ(4) = 3. A square root of a permutation σ is a permutation that, when applied to itself, gives σ. For example, 2 1 4 3 has the squa...
stackexchange_codegolf
Using the following table (source) write some code that takes the names of two planets and returns the distance between them: +-------------------+---------------+ | Planets | Distance (km) | +-------------------+---------------+ | Mercury -> Venus | 50290000 | | Venus -> Earth | 41400000 | | Ea...
stackexchange_codegolf
There are one hundred members of the United States Senate. Assuming that nobody filibusters and that the Vice President isn't cooperating, at least fifty-one members are necessary to pass a bill. But some members work together better than others, entropy-wise. Your task: Output the last names of at least 51 of the US s...
stackexchange_codegolf
Your task is to make a quine, that is a non-empty computer program that prints it's own source without reading it. In addition if you remove any one byte from your original program the new program should print the source of your original program. This is code-golf so answers are scored in bytes with fewer bytes being ...
stackexchange_codegolf
Challenge For each character of the string except for the last one, do the following: Output the current character. Followed by randomly outputting from the following list a random number of times between 1 - 5 (inclusive): The current character The next character of the string The switchcase version of the character...
stackexchange_codegolf
I'm trying to solve a CSS challenge. It contains a rotated leaf shape (looks like an eye). Score for the challenge depends on amount of characters of the code. Here's my way to make a leaf shape: div { width: 200px; height: 200px; border-radius: 99% 0; rotate: 45deg; background: #d9d9d9; } <div></div> He...
stackexchange_codegolf
Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length l and height h without ever having 3 consecutive Xs in a row diagonally, horizontally, or vertically. This is a code-golf challenge so shortest code wins! Input A single line containing values l and h, representing the length and heigh...
stackexchange_codegolf
You will receive an integer less than 2000000000 and bigger than -2000000000 and you have to test what type(s) of number this is out of: Factorial Square Cube Prime Composite Triangular Positive Negative Here is a definition of all the different types of numbers: Factorial - A number That is equal to the product of a...
stackexchange_codegolf
You are given a square matrix of width \$\ge2\$, containing square numbers \$\ge1\$. Your task is to make all square numbers 'explode' until all of them have disappeared. You must print or return the final matrix. More specifically: Look for the highest square \$x^2\$ in the matrix. Look for its smallest adjacent neig...
stackexchange_codegolf
In computer science, a suffix automaton is the smallest partial deterministic finite automaton that recognizes the set of suffixes of a given string. (Wikipedia) Given a string \$S\$ consisting of lowercase letters (a-z), construct the suffix automaton for it. A suffix automaton is an array of states, 0-indexed or 1-...
stackexchange_codegolf
Task Your task is to generate a password that is both secure and short in the fewest bytes possible given an integer seed as input. Input No seed Or An integer seed Output A password Scoring Your score is how many seconds the password takes to crack on How secure is my password divided by (bytes * password length) Scor...
stackexchange_codegolf
Given a string that is one of the directions on a 16-point compass rose output the two directions that are immediately adjacent to the input direction, in clockwise order. Specifically, you need to handle these (and only these) input/output pairs: Input Output N NNW NNE NNE N NE NE NNE ENE ENE NE E E ...
stackexchange_codegolf
I have a problem at work. I need to compare two numbers that come as strings from two different databases. The numbers may come with leading zeroes and/or leading/trailing spaces. So I may have "0001 " from one database and " 1 " from the other one. I solved the problem in C# with the following code: Func<string, st...
stackexchange_codegolf
Challenge In this challenge, the input will be an ordered set of numbers and the program should be able to tell if the set of numbers is an Arithmetic Sequence. Input The input will be a list separated by ,(comma) or , (comma+space). The minimum length of the list should be 3 elements. Output The Output can be a Boo...
stackexchange_codegolf
Standard ML (or golfier: SML) is a general-purpose, modular, functional programming language with compile-time type checking and type inference. (from Wikipedia) Though you almost certainly will never win a code golf challenge with SML, (ab-) using it for golfing can nevertheless be quite fun (<- keyword for function d...
stackexchange_codegolf
About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post. Although I have a bunch of i...
stackexchange_codegolf
Given a word list, find all sets of five words of five letters each, such that the words of each set have 25 distinct letters in total. This challenge was inspired by this video by Matt Parker. Testcases Use this file if you want to test your code against the English vocabulary. Sample output sets: ["fjord", "vibex", ...
stackexchange_codegolf
Write a function that takes an ASCII-printable-only (all charcodes ∈ [32..126]) string input x and provides an ASCII-printable-only output string f(x), such that for every x f(f(x))=x f(x) is all-numeric (all charcodes ∈ [48..57]) iff x is not all-numeric You can assume input is not empty and never provide empty outp...
stackexchange_codegolf
A troll has captured you and is forcing you to write malware (defined as a program that damages the computer that runs it). The troll can read and understand code, but is not so good at spotting bugs. Your goal is to write a program that: Looks like malware; i.e., a beginning programmer reading the code will be convin...
stackexchange_codegolf
Introduction The arena is a flatland dotted with skyscrapers, which your enemies use for cover. You and your enemies shoot each other with lasers. All of you carry jet packs, allowing flight. Which enemies can you hit with your laser, and which are hiding? Problem First, the size of an arena is given by an integer n on...
stackexchange_codegolf
In English, nouns can take on two different forms depending on whether they are singular (one) or plural (anything else). For example, we would say "1 dog" but "2 dogs", "0 dogs", "57 dogs" and so forth. In Russian, there are three categories. Instead of "1 dog, 2 dogs, 5 dogs", in Russian it would be "1 собака, 2 соба...
stackexchange_codegolf
Credits to @Agawa001 for coming up with this question. Explanation My new "keybore" only has 2 buttons, namely + and -. The number in the memory starts at 0. Each consecutive press of + or - will increment/decrement the memory for exactly how many times it has been pressed consecutively. Therefore, if you press + 4 tim...
stackexchange_codegolf
Inspired by Flow Fit: Sudoku, a brand-new mobile puzzle game (as of Nov 2019). Background A Latin square is a square grid of side length \$ n \$ filled with \$ n \$ different symbols, where each row and column contains each symbol exactly once. Let's define a row (resp. a column) as a maximally consecutive group of cel...
stackexchange_codegolf
Computers like binary. Humans like base 10. Assuming users are humans, why not find the best of both worlds? Your task is to find the first n terms in the sequence A008559 where each term is the binary representation of the previous number interpreted as a base 10 number. Input An integer greater than 0. Note that the ...
stackexchange_codegolf
Where am I now? Given a string d, containing only the letters NSWE, determine the coordinates I've traveled (from left to right, consuming greedily) and the final coordinate where I reside. The rules for reading coordinates from left-to-right: If the next character is N or S: If the character after the N or S is anot...
stackexchange_codegolf
The Task I guess everybody loves automatic code generation and saving some time during work. You have to create a lot of classes and members during the day and you don't want to create all those getters manually. The task is to write a program or function, that generates getters for all class members automatically for ...
stackexchange_codegolf
The problem You just got a new job, hurray! You expect to be given various interesting tasks, and be able to learn a lot in the next few months. Good news, your boss gave you your first work this morning. You are now in charge of... Writting adresses on envelopes. Yay. Fortunatelly, you are not required to write everyt...
stackexchange_codegolf
EDIT It is not clear how answers to the question of compressing a long text, without cumulative properties are relevant to golfing a short cumulative strong, any more than general Lempel Ziv techniques are relevant to code-golfing. Take note that the complexity of 99 bottles of beer is not O(Sqrt(n)) Knuth suggested t...
stackexchange_codegolf
On CodingGame, there is a Puzzle that ask to write words with ascii art. I solve the puzzle then tried to golf it. What improvement can I do on it? INPUT >>> 20 >>> 11 >>> MANHATTAN >>> .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------...
stackexchange_codegolf
I was wondering if it was possible to make this code even shorter than it already was. f=lambda x:f(x-1)+f(x-2) if x>1 else 1 [print(f(i))for i in range(20)] Expected output: 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 Good luck, "golfers" (I'm assuming thats what you guys are called) Note: spe...
stackexchange_codegolf
Given no input, output the following: _ | ~-_ | o ~-_ | ~ ~-_ | \~~~~~~ | * \ | \ |~~~~~~~~~~\ Note the backslashes are actually \, which is U+FF3C Trailing whitespace is allowed, however leading whitespace is not. This is code-golf so fewest bytes in each language wins!
stackexchange_codegolf
Write a function or program that accepts one character (or a string of length 1) as input, and outputs the number of times that character occurs inside the code. This program must be a Proper Quine, only in the sense that it cannot, for example, read itself as a file, etc. Input can be any character, printable or not...
stackexchange_codegolf
Context The water buckets riddle or the water jugs riddle is a simple riddle that can be enunciated in a rather general form as: Given \$n > 0\$ positive integers \$a_1, a_2, \cdots, a_n\$ representing the capacities (in units of volume) of \$n\$ buckets and a positive integer \$t \leq \max(a_1, a_2, \cdots, a_n)\$, fi...
stackexchange_codegolf
The riddle In yesterday's newspaper, I found a puzzle in which a Rook should start in the lower-left corner of a 12x12 checkerboard and then, during a round trip, visit each field exactly once except for a selection which must be avoided. The puzzle came with a picture that identified the fields to be avoided as black:...
stackexchange_codegolf
It's well known that corrupted JPEG files or NTSC/PAL streams will appear as distorted versions of the true images, or versions covered in random-looking blocks of pixels. Consider the below image (from here): If we run it through this filter (with settings 44, 7, 21, 83, for anyone who wants to reproduce it), it end...
stackexchange_codegolf
This will be a bit of a different challenge. Back in 2023, I developed a 2D esolang called Electra, and looking back at my hello world program, (which is 582 bytes by the way) I see a lot of room for golfing. There are some topics that aren't covered in the spec, e.g. in which order the currents are generated/interpret...
stackexchange_codegolf
There has been a question about yes in the past, but this one is slightly different. You see, despite yes having a rather long size, it is incredibly fast. Running the following command: timeout 1s yes > out yields a file that is 1.9 GB. Compared to this program: int puts();main(){while(1){puts("y");}} which yields a...
stackexchange_codegolf
Inspired by this game Challenge: Given an ASCII art string representing a number, output that number. Example: Input: &&&& ##### .====.. .&&& $$$$$. %% %% % % . +. . @@@ . @@ . = . = . ???? +++. && &&. % % = = $$$ . @@@@@ # # . ===. .$$$$$ ...
stackexchange_codegolf
Codegolf challenge - mapping values in a multidimensional array [ [0, 0, 0], [0, 0, 0], [0, 0, 0] ] This 2D array is sick of being so false, and wants to find the truth about life, once and for all. Your task is to write a map function to act as a highway to all the values in this array. An example implementatio...
stackexchange_codegolf
Challenge: Given a number, take the largest prime strictly less than it, subtract it from this number, do this again to this new number with the biggest prime less than it, and continue doing this until it's less than 3. If it reaches 1, your program should output a truthy value, else, the program should output a false...
stackexchange_codegolf
We're getting markdown tables! I assume this is what they look like: data data data data --------------------- | | | | | | | | Your task is to make a program or function to generate one of these tables. You'll be given input (string, list of ...
stackexchange_codegolf
This is a nice exercise for becoming more fluent in that programming language you've been meaning to learn, but have only tinkered with lightly. This involves working with objects, using or simulating closures, and stretching the type system. Your task is to write code to manage lazy lists, then use it to implement th...
stackexchange_codegolf
In this challenge, Turing machines operate on a zero-initialized binary tape that is infinite in both directions. You are given an integer \$N\$, where \$1 \le N \le 20000\$. Your program has to output a Turing machine that takes exactly \$N\$ steps to halt, including the final step. Alternatively, you can write a prog...
stackexchange_codegolf
This question is inspired by ongoing tournament of "the hooligan's game played by gentlemen", the Rugby World Cup, which has just completed the pool stage. There are 20 teams in the tournament, and they are divided into 4 pools of 5 teams each. During the pool stage each team plays against all the other teams in their ...
stackexchange_codegolf
According to Wikipedia, a strongly Darboux function is one for which the image of every (non-empty) open interval is the whole real line In other words, a function \$f\$ is strongly Darboux if given 3 arbitrary real numbers \$a\$, \$b\$, and \$y\$, it is always possible to find an \$x\$ between (distinct) \$a\$ and \...
stackexchange_codegolf
Challenge Premise Consider a mosaic of \$m\times n\$ tiles, in \$k\$ unique colours designated by integers. Example (\$3\times6\$, four colours): 4 1 3 2 4 2 1 2 4 2 1 3 4 3 2 1 4 4 My poor man's mirror is a pane of glass of width \$\sqrt{2}\cdot\min(m,n)\$. I stand it diagonally on the mosaic, like so: 4 1 3 M 4 2 1 ...
stackexchange_codegolf
Given a map from arrays of integers of same size to single integers, determine if there is a set of indices such that the output is equal to the maximum of the elements at those indices for every corresponding pair. You can take the input as a map if your language support, arrays of pairs, separated 2D array of input a...
stackexchange_codegolf
Input A string of printable ASCII characters, for example: This is an example string. Output For every consonant (BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz) that is not followed by a vowel (AEIOUaeiou) add the last vowel before it, in lowercase. Consonants before the first vowel are left as-is: Thisi isi ana examapal...
stackexchange_codegolf
Inspired by this challenge and related to this one. Background Badugi [bæduːɡiː] is a low-ball draw-poker variant. The Pokerstars World Cup Of Online Poker $1K event starts within 3 hours and I'll need to know how good my hands are! The game uses a standard deck of 52 cards of four suits and thirteen ranks. The suits...
stackexchange_codegolf
Background Benford's Law is freaky! Of all the numbers in the world, roughly 30% of them start with a 1! 17.6% start with a 2, 12.5% start with a 3, and so on, and so on. For example, take a look at the following graph. Take the largest 120000 towns in the world, take their altitude, and voila - they obey Benford's law...
stackexchange_codegolf
Lambda calculus is a system of computation based on single-argument functions; everything in it is such a function. Due to this functional nature, juxtaposition is commonly used to denote function application, grouped from left to right. For example, \$(f g) h=f g h\$ denotes what would conventionally be written \$(f(g...
stackexchange_codegolf
Sandbox Your challenge is to write a program that when first run, will do one of the actions below at random with equal chances of both: A cat program A standard cat program: read everything from STDIN and put it on STDOUT (or your language's closest equivalent). Do nothing and halt This shouldn't output anything....
stackexchange_codegolf
You have been assigned the task of installing new locks to the company's building. However, the locks you use are quite unusual: they require some combination of keys to open. Now, you want to figure out which locks are the most secure, so you can prioritize the most important locations. The keys you use are numbered b...
stackexchange_codegolf
Given an integer \$N\$ consider a permutation \$p=p_1,p_2,p_3,\ldots\$ of \$1,\ldots,N-1\$. Let \$P = p_1 , p_1+p_2 \bmod N, p_1+p_2+p_3 \bmod N, \ldots\$ be its prefix sums modulo \$N\$. Sometimes \$P\$ will be a permutation of \$1,\ldots,N-1\$ itself. For example, \$N=4: p=3,2,1 \rightarrow P=3,1,2\$ Negative example...
stackexchange_codegolf
Wheat Wizard has once tried to come up with a parsing problem unsuitable for regex, but it failed due to Anders Kaseorg's Perl regex answer. This is the second attempt. Now that we know that Perl regex is far more powerful than we've imagined, this challenge aims to be un-golfy for it instead. Introduction A lambda ter...
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
Given a UTF-16 string, test its endianness. Rules: As long as the input is in UTF-16 without BOM, its type doesn't matter. In C++ on Windows, it can be std::wstring or std::u16string. In Haskell, it can be [Int16] or [Word16]. The endianness is tested by noncharacters. If the input contains a noncharacter, it is in wr...
stackexchange_codegolf
This ascii-art challenge is about walking around a string like a snake. s-n-a-k .---. e d <-' a n-u-o-r You will be given a string \$ S \$ of length \$ l \$ and a positive integer \$ n \$ where \$ n ^ 2 \ge l + 1 \$. The string rotates 90° after writing \$ n \$ characters of \$ S \$, or when it hits itself. When \$ S ...
stackexchange_codegolf
Challenge Given a polynomial \$p\$ with real coefficients of order \$1\$ and degree \$n\$, find another polynomial \$q\$ of degree at most \$n\$ such that \$(p∘q)(X) = p(q(X)) \equiv X \mod X^{n+1}\$, or in other words such that \$p(q(X)) = X + h(X)\$ where \$h\$ is an arbitrary polynomial with \$ord(h) \geqslant n+1\...
stackexchange_codegolf
Generator functions This gives the context for why this challenge came to life. Feel free to ignore. Generator functions are a nice way of encoding the solution to a problem of combinatorics. You just write some polynomials, multiply them and then your solution is the coefficient of one of the terms. For example, how m...
stackexchange_codegolf
Given a binary number, your task is to create a 'branch' of that number, with a depth of 2. For example, given 0 as input, you should output exactly this: /000 /00 / \001 0 \ /010 \01 \011 This should be fairly self explanatory of how the branches should be created. Depth 2 means we calculate branc...
stackexchange_codegolf
Abracadabra is a magic word. To make it even more magical, let's make several alterations to how it may be written: Change the casing for any subset of characters; for example: aBrAcAdAbRa Append an exclamation mark to it: abracadabra! Change each occurrence of a into a different vowel: ybrycydybry Change any single c...
stackexchange_codegolf
Input a scientific notation number (base 10), output scientific notation in base 16 (as defined below). Details In scientific notation, all non-zero numbers are written in the form $$ m \times 10^n $$ Where \$ n \$ is an integer, and \$ m \$ is a real number, \$ 1 \leq |m| < 10 \$. Consider scientific notation in base ...
stackexchange_codegolf
Backstory Meet my friend Jimmy: /o\ Jimmy is a little character who likes to stand on platforms. Here's Jimmy safely standing on a platform: /o\ ------------- Now, Jimmy has a good sense of balance, so he can safely stand with one leg off of the platform, like so: /o\ ------------------- Although i...
stackexchange_codegolf
In the poker game there are 1277 unique 'High Card' ranks. It's 1287 (13 over 5) if we include all straights. The challenge is to write a function which returns an integer value corresponding to the rank of each 'High Card' poker combination including all straights. Possible cards are(in ascending order): '23456789TJQK...
stackexchange_codegolf
This is the first part of a three part challenge. The next parts will be released on August 13 and 14. This challenge series was inspired by another challenge series. You can view the original one at Random Golf of the Day #1: Shuffle an Array. Instructions Your goal in this code golf is to reverse a URL, but not full...
stackexchange_codegolf
There is a sentence with many cats: there is a cat house where many cats live. in the cat house, there is a cat called alice and a cat called bob. in this house where all cats live, a cat can be concatenated into a string of cats. The cat called alice likes to purr and the cat called bob likes to drink milk. The Task ...
stackexchange_codegolf
I like golfing in tinylisp: (d M(q((x)(i x(i(disp x)0(M x))0 But I also like posting explanations with nicely formatted code: (d M (q ((x) (i x (i (disp x) 0 (M x)) 0)))) Can you help me generate the ungolfed code for my explanations? The task Given a line of tinylisp code, return or output the same cod...
stackexchange_codegolf
Inspired by one of many bugs I ran into while implementing selection sort in trilangle. Given a non-empty list of non-negative integers, "sort" the list using the following procedure: Find and output the smallest value in the list. If the list only has one element, stop. Recurse on a sublist: If the last element in t...
stackexchange_codegolf
Write 2 programs in the same language which count the number of shared subsequences of consecutive elements from 2 given sequences. For example, given "test" and "enter", there are 5 shared subsequences of consecutive elements: t t e e te One possible algorithm consists in counting, for each subsequence of consecutive...
stackexchange_codegolf
Create A "Hello, World!" program but without any vowels. Winner is the program with the least bytes. Rules: No vowels are allowed in the code. Must print to STDOUT Must be a full program. Submissions are measured in Bytes Any language goes as long as there aren't any vowels Edit: Y is only a vowel if there aren't any...
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
The divisors of a natural number form a poset under the relation of "a divides b?", \$a | b\$. This challenge is to produce the number, \$C\$, of non-empty chains of such posets for natural numbers, \$N\$. This is A253249 in the Online Encyclopedia of Integer Sequences. That may sound complicated, but it's not really, ...
stackexchange_codegolf
I'm golfing a program to sum two numbers in C++. Example: 10 3 13 I found out that this problem can be solved in 54 symbols (without spaces and so on) using C++. My code (63 symbols): #include <iostream> main() { int a, b; std::cin >> a >> b; std::cout << a + b; } I have no idea how to make my program sho...
stackexchange_codegolf
This was originally a pure mathematics question, but I think I've got the best chance for an answer here. The Challenge For concreteness, consider Peano Arithmetic (PA). For some language L of your choosing, construct a computer program of length at most N bits in L such that: If it terminates, it outputs a number th...
stackexchange_codegolf
The challenge Simply write a program that outputs its own source code. Nothing more than a regular quine. The problem We don't have a computer so we have to run the program on a programmable logic device (such as an FPGA, a CPLD, a gate array ...). The rules Any device available on the market (such as a printer connec...
stackexchange_codegolf
Given a PPCG user's user ID, calculate how much times is their Each SE site reputation is from average reputation in the Stack exchange sites they have made accounts. Let me explain, If someone's total network reputation (Total reputation in the stack exchange sites he has participated) is 10k, and if he has participat...
stackexchange_codegolf
Leonardo of Pisa (ca. 1175 - ca. 1245) is better known as Fibonacci. But this is actually a short for the Latin "filius Bonacci" (the son of Bonacci) which was made up during the 18th century (according to Wikipedia). In this challenge, you'll be given an ordinal number (in the literal sense) between 1st and 20th and y...
stackexchange_codegolf
In this variant of the Four fours puzzle your should use up to x x's (and no other number) and a defined set of operations to reach every number from 0 to 100. If x = 4 then you can use up to four 4s and this question becomes the classic four fours puzzle (except you can use up to four 4s rather than having to use exac...
stackexchange_codegolf
Maximillian is the chief commander of the Great Greek Army and he is leading his forces into a crucial war with Spain. If all the enemy soldiers stand in a straight line incrementally marked starting from position 1, and a particular soldier at position \$i\$ dies, the soldiers at position \$2i\$ and \$2i+1\$ die as we...
stackexchange_codegolf
Your Challenge is to take a binary string as input and get all binary numbers between itself and the reverse of its string representation (the reverse may be less than or greater than the original input). Output must be padded with zeroes to be the same length as the input. The Order in which the values are displayed d...
stackexchange_codegolf
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. ...
stackexchange_codegolf
You have played \$N\$ matches in some game where each match can only result in one of the two outcomes: win or loss. Currently, you have \$W\$ wins. You want to have a win percentage of \$P\$ or more, playing as few matches as possible. Output the minimum win streak that you need. Assume the current win streak is at \$...
stackexchange_codegolf
Because I can't concentrate on any task for more than about 5 seconds, I often find myself breaking up words into a sub-strings, each of which is a different length and doesn't contain any repeated characters. For example, the word "pasta" might be broken up in "past" & "a", "pas" & "ta", or "pa" & "sta" and you get th...
stackexchange_codegolf
If the agent is at the origin it always moves right when you choose it. The goal is to get one agent to 10. The cost is the sum of the square of the total number of moves (left or right) taken by each individual agent until the first agent gets to 10. You want to minimise the expected cost Once you have fixed a strateg...
stackexchange_codegolf
You need to print A-Z like this: 1. A 2. B 3. C 4. D 5. E 6. F 7. G 8. H 9. I 10. J 11. K 12. L 13. M 14. N 15. O 16. P 17. Q 18. R 19. S 20. T 21. U 22. V 23. W 24. X 25. Y 26. Z But your source code cannot use 1,2,4,6. Trailing newlines in output allowed,, but leading ones not allowed. Standard loopholes apply, shor...
stackexchange_codegolf
Dropbox recently released Lepton (GitHub), a method that losslessly compresses JPEG images round-trip, saving an average of 22%. Because of the pigeonhole principle, any general compression algorithm cannot be guaranteed to result in a smaller file (general because it doesn't apply to inputs constrained to a specific ...
stackexchange_codegolf
The goal of this challenge is to check and extend the OEIS sequence A334248: Number of distinct acyclic orientations of the edges of an n-dimensional cube. Take an n-dimensional cube (if n=1, this is a line; if n=2, a square; if n=3, a cube; if n=4, a hypercube/tesseract; etc), and give a direction to all of its edges ...
stackexchange_codegolf
In this challenge you will take as input a non-empty list of binary values (these can be booleans or integers on the range 0-1), you should output all the ways to partition the list into non-empty sections such that no two adjacent equal values in the initial list are separated into different sections. For example if t...
stackexchange_codegolf
Background Here in the UK1, these are the income tax rules: You get a personal allowance (untaxed) of up to £12,570: If you earn less than £100,000, you get the full £12,570 as personal allowance For every £2 over £100,000, your personal allowance goes down by £1 After the personal allowance, the next £37,700 is ta...
stackexchange_codegolf
Your task is to output all possible ways to end a game with a tie (all rows, columns, and diagonals are completely filled and do not have 3 X's or 3 O's, and there are exactly 5 X's and 4 O's in total) in Tic-Tac-Toe (assuming X goes first): OXO XXO XOX OXX XOX OOX XOX XOO XOX XXO OXO OXX XOX XOX OXX XXO O...
stackexchange_codegolf
Given a non-empty matrix of non-negative integers, answer which unique rows contribute most to the sum total of elements in the matrix. Answer by any reasonable indication, for example a mask of the unique rows order of appearance (or sort order), or indices (zero- or one- based) of those, or a submatrix consisting of ...
stackexchange_codegolf
Given a ragged list, we can define an element's depth as the number of arrays above it, or the amount that it is nested. For example, with the list [[1, 2], [3, [4, 5]]] the depth of the 2 is 2, as it is nested within two lists: The base list, and the list [1, 2]. The depth of the 4 is 3 as it is nested within three li...
stackexchange_codegolf