instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Introduction Busy Beavers are programs (specifically Turing Machine programs) that aim to output the most ones as possible, while having the least states as possible and halting. Challenge Your challenge is to make a busy beaver, which outputs as many ones as possible, but also outputs a second busy beaver. That secon...
stackexchange_codegolf
Your challenge is to output the number of twisted corners given a 2x2 Rubik's Cube scramble. For the purpose of this challenge, twisted corners are defined as corners where the colour of the top/bottom face before (usually white or yellow) is not facing the top/bottom after the scramble. Eg. if the cube were to be orie...
stackexchange_codegolf
A SMILES (Simplified molecular-input line-entry system) string is a string that represents a chemical structure using ASCII characters. For example, water (\$H_2O\$) can be written in SMILES as H-O-H. However, for simplicity, the single bonds (-) and hydrogen atoms (H) are frequently omitted. Thus, a molecules with on...
stackexchange_codegolf
Challenge description Let's call a two-dimentional, rectangular array (meaning its every subarray has the same length), a grid. Every unit of a grid is either an empty space or a border. In a grid of characters, empty space is represented by a single whitespace; any other character is treated as a border. Sample grids ...
stackexchange_codegolf
Pascal's triangle is generated by starting with 1 and having each row formed from successive additions. Here, instead, we're going to form a triangle by alternating multiplication and addition. We start row 1 with just a solitary 1. Thereafter, addition is done on the odd rows, and multiplication is done on the even r...
stackexchange_codegolf
Given the sequence OEIS A033581, which is the infinite sequence, the n'th term (0-indexing) is given by the closed form formula 6 × n2 . Your task is to write code, which outputs all the subsets of the set of N first numbers in the sequence, such that the sum of the subset is a perfect square. Rules The integer N is g...
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
I suddenly really want to play tennis, but alas I do not have a court! Surprise! This is where you come in. You have to print a tennis court for me, but you have to do it in the fewest bytes possible because of confidential reasons. Tennis court --------- | | --------- | | | xxxxxxxxx | | | --------- | ...
stackexchange_codegolf
So I was playing around with this emulator of the Intel 4004 and decided I wanted to set a challenge for myself. The first use for the 4004 was in a calculator, so I decided that I would try to code golf every operator on said calculator(addition, subtraction, multiplication, division, decimal points, and the square r...
stackexchange_codegolf
The Kempner series is a series that sums the inverse of all positive integers that don't contain a "9" in their base-10 representations (i.e., \$\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + .. + \frac{1}{8} + \frac{1}{10} + ...\$). It can be shown that, unlike the Harmonic series, the Kempner series converges (to a value ...
stackexchange_codegolf
Your task, if you choose to accept it, is simple. Objective You must make a program that, when run, prints some (as many as you want) terms in a sequence that you choose. The sequence must be a valid OEIS sequence. The twist is that when you take the characters from your code that make up your sequence, string them tog...
stackexchange_codegolf
Consider a finite, one-dimensional grid where each cell is marked with one of two symbols (I will use the symbols < and >, but you can use other symbols). When a pinball is placed on one of the cells, it moves according to the following rules: If the pinball is on a cell that is marked with <, the pinball moves one ce...
stackexchange_codegolf
Make an upside down triangle of positive integers. Every number in the triangle must be distinct. Each number is the summation of its two parents (similar to how Pascal's triangle is constructed, but upside-down). Construct it in such a way that the bottom number is minimized. For example, for input n = 4, here is a po...
stackexchange_codegolf
My coworker, Jimmy is kinda new to C/C++. He's also kind of a slow learner. Now, to be fair, his code always compiles, but he has some really sloppy habits. For example, everybody knows that you can define an array like this: int spam[] = {4, 8, 15, 16, 23, 42}; Everybody that is, except for Jimmy. He is convinced tha...
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
Your program's input is a string containing whitespaces, parentheses, and other characters. The string is assumed to be parenthesed correctly, i.e. each right parenthesis matches a unique left parenthesis and vice versa : so the program is allowed to do anything on incorrectly parenthesed strings, such as )abc, (abc or...
stackexchange_codegolf
.Net Technology is an incredible framework with marvellous functionalities, and among all of them, the most important one obviously stands out: Yep, your simple task is create a program that when it takes at input: dotnet ef It prints the following ascii art by output: /\__ ---==/ \\ ___ ___ ...
stackexchange_codegolf
Traditionally presents are kept secret in boxes wrapped in paper. Since the ice caps are melting Santa Claus has begun to investigate some ways they might make the whole gift wrapping operation a little more eco-friendly. The first thing they've decided to do is to put all presents in perfectly cubic boxes. This makes...
stackexchange_codegolf
Challenge You must, in the least bytes possible, implement the Binary Heap data structure and each of the following methods that operate on it: A function which takes no arguments and returns an empty Heap A function which takes a list of arguments with an arbitrary length and returns a Heap containing the elements A ...
stackexchange_codegolf
Output the following result (which is a result of calculating 6 * 9 in bases from 2 to 36). Make sure letters are uppercase, and the multiplication itself is outputed on every line. 6 * 9 = 110110 6 * 9 = 2000 6 * 9 = 312 6 * 9 = 204 6 * 9 = 130 6 * 9 = 105 6 * 9 = 66 6 * 9 = 60 6 * 9 = 54 6 * 9 = 4A 6 * 9 = 46 6 * 9 =...
stackexchange_codegolf
Calculate a product or ratio of SI units. For example, kg m / s s (kilogram-meter per second squared) should return N (newton). The input will always be either: A list of symbols for SI units, space-separated (representing a product) or The above, /, and the above (representing a ratio). The input will never contain ...
stackexchange_codegolf
Consider a connected undirected graph. A matching set of edges on this graph is defined as a set of edges such that no two edges in the set share a common vertex. For example, the left figure denotes a matching set in green, while the right figure denotes a non-matching set in red. A matching set is said to be maximal...
stackexchange_codegolf
The partitions of an integer N are all the combinations of integers smaller than or equal to N and higher than 0 which sum up to N. A relatively prime partition is an integer partition, but whose elements are (overall) coprime; or in other words, there is no integer greater than 1 which divides all of the parts. Task G...
stackexchange_codegolf
A Window is an ASCII-art square with odd side length of at least 3, with a single character border around the edge as well as vertical and horizontal strokes in the middle: ####### # # # # # # ####### # # # # # # ####### An MS Window is a window where the border is made only of the characters M and S. Your tas...
stackexchange_codegolf
For a 2 dimensional array we will call the elements in either the first row or the last column the "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} & \color{red}{\...
stackexchange_codegolf
How many of you that still use your own knuckle to determine whether a month is having a full 31 days or less? You job is to write a program to count how many months, in a month range, are having a full 31 days and how many are having less than 31 days by "counting the knuckles". Courtesy: amsi.org.au Input A pair of...
stackexchange_codegolf
Challenge Given a real number as input, calculate the number of times which the natural logarithm function ln can be applied to it before the resulting number becomes imaginary. Explanation Applying ln to a negative number results in a non-real number. This means that, by repeatedly applying ln to a number, you will ev...
stackexchange_codegolf
RollerCoaster Tycoon 2's maze is the inspiration for this question. Credit to Marcel Vos for thoroughly breaking the classic RCT2 AI. The pathfinding AI in this question is the AI in the latest version of OpenRCT2 at the time of writing, which was updated in response to that video. Suppose a guest enters a \$w \times...
stackexchange_codegolf
Given a set of substrings, such as [ca, ar, car, rd], it's possible to create infinitely many strings by concatting them together. Some examples of this for the given substrings could be: ca caar card rdca carrd rdrd ... One interesting property of this set of substrings is that any string can only be constructed in o...
stackexchange_codegolf
The cop's thread is here The robber's task is to find a program of size equal to or less than the cop's program, which, when given an itself as input, produces the same output as the cop's program. Additionally, even if a cop's answer is provisionally marked Safe and has been revealed, you can still crack it by finding...
stackexchange_codegolf
Background You are planning your trip away from the Diamond City, and must travel through Diamond Road. However, Diamond Road branches away from Diamond City to different locations. Out of curiosity, you'd like to measure the total distance of unique roads used for all paths. We define a path as a string that only cont...
stackexchange_codegolf
Given a list of n strings, return a list of that strings in ascending order. However, be aware, that in this case we want integer comparison for all numbers appearing in the strings, meaning that "12" > "3". Example cases: {"abc123", "abc6", "abc47", "abd49"} -> {"abc6", "abc47", "abc123", "abd49"} {"foo0", "bar12", "f...
stackexchange_codegolf
Write a program that prints an associative array (key-value) to a table. Requirements Standard loopholes are forbidden Please include a link to an online interpreter and the byte count in the answer Use box drawing characters to draw the table. You can write both a full program or a function. Key or value can't cont...
stackexchange_codegolf
Given two strings as input, return the result of XORing the code-points of one string against the code points of the other. For each character in the first input string, take the code-point (e.g. for A, this is 65) and XOR the value against the corresponding index in the second string and output the character at the co...
stackexchange_codegolf
Explanation: Last year in math class, on homework we would occasionally get these extremely simple, although equally annoying questions called diamond puzzles. These were basically questions where we would be given a sum, and a product then were asked to find the two numbers which when multiplied give the product, and ...
stackexchange_codegolf
Quell is a single-player grid-based puzzle game. Pearls are scattered across a 2D map and the aim is to collect them all by rolling a drop of water over them. For this challenge we will only consider basic maps containing the drop, pearls, walls, and empty spaces. (The full game includes a variety of additional objects...
stackexchange_codegolf
Input A string S of length between 10 and 16 inclusive. The characters are taken from the 95 printable ASCII characters, byte values 32 (0x20) to 126 (0x7E) ( to ~) Output Your code must compute and output all strings within Levenshtein distance 2 of S. You can have duplicates as long as you also have all the differen...
stackexchange_codegolf
A nice simple one Input Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long. [false, false, true, false, false] Output Invert every element of the array and output it. [true, true, false, true, true] Rules You can write a full program or just a func...
stackexchange_codegolf
Context After attempting to program in Grass for the entire morning, you decide to go outside and mow some real grass. The grass can be viewed as a string consisting exclusively of the following characters: wWv. w denotes tall grass which takes \$ 1 \$ unit of energy to mow. W denotes extremely tall grass which takes \...
stackexchange_codegolf
Given three numbers m,n and p, your task is to print a list/array of length p starting with m and n and each element after p represents the difference of the 2 numbers before it, m-n (Counter-Fibonacci Sequence) For this challenge you can either use a function to return or print the result or a full program. Input Thr...
stackexchange_codegolf
Write a program or function that prints an input string around the discrete circle that has the minimum possible radius. For example, for input This is an example, your program should output: a si n s i e h x T a m p le Circle generation You shall use the M...
stackexchange_codegolf
Today is Purim on which one custom is to give out triangle-shaped cookies with filling called hamantaschen (singular: hamantasch). Another custom is to drink heavily. I'm not the most perfect baker.... I have so many irregularly-sized hamantaschen to give out and so many friends to give them to! If I sent you a pictur...
stackexchange_codegolf
Description : Given x and y positions of two circles along with their radii, output the area of intersection of the two circle. Input : You will be given following input : array 1 = x and y positions of circle a array 2 = x and y positions of circle b radius = radii of the two congruent circles Input method : ([12 ,...
stackexchange_codegolf
This page is not for Visual Basic .NET Tips or VBA tips Visual Basic (VB or VB6) is an object-oriented and event-driven dialect of basic that was developed and released by Microsoft in 1991. The last release of Visual Basic came as Visual Basic 6.0 in 1998, and the language was declared a legacy language in 2008. Visu...
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
Implement a function or program that can run simplified BitCycle code. The functions you must implement are: <^>v: Change the direction of a bit to the direction this is pointing. +: Turn all 0s left and all 1s right. \ and /: Reflect one bit 90 degrees, then become inactive. In regular BitCycle, this is displayed as -...
stackexchange_codegolf
The Challenge Given a list of words and a grid of letters, your job is to determine which of the given words can be found on the grid in all 8 directions (forward, backward, up, down, and the 4 diagonal directions), much like a word search. The grid is toroidal, so the grid wraps around on the edges. Letters can be reu...
stackexchange_codegolf
Al wanted to use my computer to do some simple calculations, so I lent him the use of my R terminal for a bit. He complained though, saying it wasn't set up how he liked it. I said "No problem Al, set it up how you like and I'll just revert it later." This suited Al, and I left him to it. Al isn't a big fan of online R...
stackexchange_codegolf
Here's yet another Steenrod algebra question. Summary of the algorithm: I have a procedure that replaces a list of positive integers with a list of lists of positive integers. You need to repeatedly map this procedure over a list of lists and flatten the output until you reach a fixed point. Then for each sublist, if i...
stackexchange_codegolf
Recently, I have found my reputation changing time to time. I would like to know my reputation changing real-time. The job Given an id of a user on PPCG (ex.64499), Print the user's reputation every 10 seconds. You may ignore the daily quota. Examples 64499 3808 40695 Possible output format 12345 12,345
stackexchange_codegolf
In a very unusual accident involving a small sample of radium, an electrocuted whale, and three gummy bears, some of The Management™'s source code has been mutated. Little does The Management™'s boss know, it was actually the Cops© who had been responsible, in an attempt to thwart The Management™'s "evil" plans. So the...
stackexchange_codegolf
Mountain range number A number is a mountain range number if the inequalities satisfied by their consecutive digits alternate. In a way, looking at the number's digits should exhibit a /\/\/\... or a \/\/\/... pattern. More formally, if our number n has \$k\$ digits $$n = d_1d_2d_3\cdots d_k$$ then n is a mountain rang...
stackexchange_codegolf
Inspired by this question over on Math. Let the prime factorization of a number, n, be represented as: \$P(n) = 2^a\times3^b\times5^c\times\cdots\$. Then the number of divisors of n can be represented as \$D(n) = (a+1)\times(b+1)\times(c+1)\times\cdots\$. Thus, we can easily say that the number of divisors of \$2n\$ is...
stackexchange_codegolf
Your input will consist of an 18×18 image in any reasonable format, containing a horizontally and vertically centered 14px Roboto Mono character. This can be any of 94 printable ASCII characters (not including the space). But: you only need to be able to recognize some 80 character subset of your choice. Output should ...
stackexchange_codegolf
Challenge Write a program or function that takes in a string s and integer n as parameters. Your program should print (or return) the string when transformed as follows: Starting in the top-left and moving down and to the right, write s as a wave of height n. Then, from top to bottom, combine each row as a string (with...
stackexchange_codegolf
It seems that simple changes to a C++ file, especially with templates, can generate pages of errors. This contest is to see what the largest "bang of the buck" is, that is the more verbose error output with the smallest change to the source code (1 character addition). Because other languages are more sane, this will b...
stackexchange_codegolf
Given a binary number A as input with d > 1 digits, output a binary number B with d digits according to the following rules for finding the nth digit of B: The first digit of B is zero if the first and second digits of A are equal; otherwise, it is one. If 1 < n < d, then if the (n-1)th, nth and (n+1)th digits of A ar...
stackexchange_codegolf
Introduction: I have loads of different ciphers stored in a document I once compiled as a kid, I picked a few of the ones I thought were best suitable for challenges (not too trivial, and not too hard) and transformed them into challenges. Most of them are still in the sandbox, and I'm not sure yet whether I'll post al...
stackexchange_codegolf
Implement a function \$f\$ (as a function or complete program), such that \$ \displaystyle\lim_{n\rightarrow \infty} f(n) \$ converges to a number which is not a computable number. Answers will be scored in bytes with fewer bytes being better. IO formats Your answer may be in any of the following formats A program or ...
stackexchange_codegolf
The goal of this challenge is to reduce a list of string to a shorter more general list of string. Input The Input is provided with space between the string (a b c) or in list form (["a","b", "c"]). It's a list list of string that can be of the following form : aaa aaaX aaaX/Y With aaa any set of non capital alphabet...
stackexchange_codegolf
Inspired by this. Background The evil farmer has decided to burn your wheat field down in order to drive up the prices. To ensure total destruction, he has also soaked your field in gasoline. Even more unfortunately, you happened to be walking on the field when it was lit on fire, and you must get out quickly to surviv...
stackexchange_codegolf
Given a snippet of fizz buzz output with all numbers removed, fill in the correct numbers with the lowest possible values such that the fizz buzz snippet is correct. For the purposes of this challenge, fizz and buzz have their usual values of 3 and 5, respectively. If the input is an invalid sequence of fizz, buzz and...
stackexchange_codegolf
In Salesforce CRM, every object has 15-character alphanumeric ID, which is case-sensitive. If anyone's curious, actually it's base-62 number. However, tools used for data migration and integration may or may not support case sensitivity. To overcome that, IDs can be safely converted to 18-character case-insensitive alp...
stackexchange_codegolf
Consider an \$n \times n\$ grid and a circle of radius \$r \leq \sqrt{2} n\$ with its center in the top left. In each square there is an integer from the range -3 to 3, inclusive. For a given radius, there is a set of squares in the grid which are not at least half covered by a circle of radius \$r\$ but are at least ...
stackexchange_codegolf
Challenge Given a positive integer N, output the sum of the first N reciprocals as an exact fraction, which is represented as a pair of integers in a consistent order representing numerator and denominator. Rules Output must be exact. Output should be as a pair of integers in a consistent order representing numerator ...
stackexchange_codegolf
Given an input of a string consisting of any message from our site chatroom taken from the list described and linked below, output either a truthy or a falsy value attempting to predict whether that message was starred or not in 50 bytes or less. You may use any truthy or falsy values, but they must be identical (i.e. ...
stackexchange_codegolf
if you have a range of numbers with values missing, eg l=[1,2,9,10,99], you can always use modulus and subtraction to make all the numbers in the list cover a smaller range, for example: l%99%6=[1,2,3,4,0]. your task is to take in a list of numbers and output an equation which will map them to unique numbers in the ran...
stackexchange_codegolf
Challenge The challenge is simple: print a snake. You will get the length of the snake as input. A snake of length 2 looks like this: ==(:)- A snake of length 7 looks like this: =======(:)- In other words, the length of a snake is how many equal signs are before the head. Usage Let's say I made a C++ implementation a...
stackexchange_codegolf
There are 8 Australian states and territories, each with a 2 or 3 letter abbreviation: ACT: Australian Capital Territory NSW: New South Wales NT: Northern Territory QLD: Queensland SA: South Australia TAS: Tasmania VIC: Victoria WA: Western Australia Your task is to write a function/program which takes a valid Austr...
stackexchange_codegolf
This time, you are working on a regex. Your regex is meant to approximately full-match the base-10 representations of primes \$0 \le p < 1000\$, while ignoring any non-numeric string or composite in the range. You can full-match 2, 53 or 419, but not 0, 82 or example. The approximately is important -- a minimum of 900 ...
stackexchange_codegolf
Challenge Given a string describing a cutting rule and another string, cut parts out of the second string using the rule described by the first string. Both strings will consist of letters a-z or A-Z, whichever one you choose (they don't have to be represented the same way). The way the second string is to be modified ...
stackexchange_codegolf
I suspect Gomoku may be one of the simplest games to implement in code. https://en.wikipedia.org/wiki/Gomoku The game is this: players BLACK and WHITE take turns putting down black and white stones. Black traditionally goes first. If, when a player puts down their stone, they now have 5 in a row of their color, they wi...
stackexchange_codegolf
Output the infinite list of pairs of integers (a, b), where both \$ a > 1 \$ and \$ b > 1 \$, ordered by the value of \$ a^b \$. When there are multiple pairs where \$ a^b \$ is equal, they should be ordered lexicographically. For example, \$ 2^4 = 4^2 = 16 \$, but (2, 4) should come before (4, 2), because it is lexico...
stackexchange_codegolf
Taking in Input Define a function f as follows: IF x < 0: f(x) = -√|x| ELSE: f(x) = √x In your programs/functions, each point (x, y) given as input will correspond to the point (f(x), f(y)). For example, if the points (4, -2) and (-1, 5) are given as input, your program will be dealing with the points (2, -√2)...
stackexchange_codegolf
Consider the following sequence: 0 1 3 2 5 4 8 6 7 12 9 10 11 17 13 14 15 16 23 ... Looks pretty pattern-less, right? Here's how it works. Starting with 0, jump up n integers, with n starting at 1. That's the next number in the sequence. Then, append any numbers "skipped" and that haven't been seen yet in ascending or...
stackexchange_codegolf
Task Find all the non-negative integers up to and including a given non-zero positive integer n, that are prime and the count of 1's and 0's in their binary representation (having no leading zeroes) are prime too. Here are the first five such primes, 17, 19, 37, 41, 79 10001, 10011, 100101, 101001, 1001111 Clarific...
stackexchange_codegolf
This is a very simple challenge. The joke language InterpretMe consists of one command; *, which causes the program to take input of an InterpretMe program and execute it. An InterpretMe program will interpret as many InterpretMe programs as there are * in input. Your goal is to create a program that interprets Inte...
stackexchange_codegolf
This contest is officially over. The Blue Team won! I autoran two sets of 50 battles and amazingly, Blue won all 100 of them. Looking at the stats, it is clear that the cooperative entries of PhiNotPi and Sp3000 were the real heroes. Great job you two! In fact, if you disqualify every other member of the Blue Team, the...
stackexchange_codegolf
Connecting Dots We define a type of question on the test, connecting the dots Question parameters There are two parameters. Suppose they are 5 and 4. The second one must be less than or equal to the first one. Thus, the question will look like this: * * * * * * * * * Possible answer...
stackexchange_codegolf
Inspired by Sygmei's question, I'm interested in finding out what languages can "do this properly". Your task is to write a "for loop" function / macro / instruction. The arguments should be: an initializer a test an increment a body All of these are "pieces of code" and should be able to access variables in the con...
stackexchange_codegolf
Given the battery level L in the range 0-5, your code should draw the following ASCII art. When L=0: ############ # ### # ### # ### ############ When L=1: ############ ### ### ### ### ### ### ############ When L=2: ############ ##### ### ##### ### ##### #...
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
Back in 2018, there has been introduced new law in Poland to ban trading on sundays, but certain exceptions have been made (listed below). The task today is to determine, can one trade on the sunday provided by the user (according to these rules). Rules You can trade only if one of the following is satisfied: The day ...
stackexchange_codegolf
Arturo is a bytecode-compiled/interpreted, garbage-collected general-purpose language filling a role similar to JavaScript, Python and Ruby. It is centered around the concept of blocks, which hold code just as easily as data. It uses fixed-arity prefix syntax and emphasizes the procedural and functional paradigms. What...
stackexchange_codegolf
Inspired by this 3Blue1Brown video Given a square matrix \$ M \$, compute its matrix exponential \$ \exp(M) \$, which is defined, using an extension of the Maclaurin series for \$ e^x \$, as $$ \exp(M) = \sum_{r=0}^\infty \frac {M^r} {r!} = M^0 + M^1 + \frac 1 2 M^2 + \frac 1 6 M^3 + \cdots + \frac 1 {n!} M^n + \cdots ...
stackexchange_codegolf
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
Write a function or program that, when given a list of names, outputs or returns a list where duplicates of given names have a unique shortened version of their surname. Input: A list of names, where a name is defined by a given name and a last name separated by a space. Names are non-empty strings containing only upp...
stackexchange_codegolf
In this challenge, your task is to write a program that takes in an image and returns the most dominant color in it. Dominant color here means the color with which most of the image is covered (see the test cases for a better understanding). Input An image's path. You'll have to load that image in your program. You ca...
stackexchange_codegolf
Challenge: You Are The Teacher Everyone knows that simple task of receiving a grade, and telling if the student: is approved, will attend the summer school, or failed. In this challenge, you must write a program that does that, but using the maximum of one if statement (also ternary operators count as if). The grad...
stackexchange_codegolf
Write a program or function that takes in an eight byte string containing one of each of the characters ()[]{}<> arranged in any way such that the four respective bracket types match. For example, ]<([){}> is invalid input because the square brackets don't match (though all the others do). Print or return an integer fr...
stackexchange_codegolf
You may have heard of the "Hacker Logo", also called the "Hacker Emblem". It looks like this: This is a pattern from a mathematical simulation called the Game of Life. The glider is the simplest Life pattern that moves, and the most instantly recognizable of all Life patterns. The challenge The challenge is pretty sim...
stackexchange_codegolf
You may have seen Jacob's Ladder in children's science museums. If you're not familiar with what they look like, there are several images and video examples on the Wikimedia Commons. The challenge today is to create an animated ASCII version of the electrical gadget. In the end, it should look something like this: La...
stackexchange_codegolf
Your task is to take as input a single string (or list of characters, list of code points, etc.) and return the length of the longest substring with no character appearing more than once. Aside: This challenge is similar to Longest Non-Repeating Substring, but without the source restriction ranking submissions by their...
stackexchange_codegolf
Given the signal level L in the range 0-4. Your program should draw the following ASCII art. When L=0: .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... .... When L=1: .... ...
stackexchange_codegolf
Looking at the following hackerrank problem: https://www.hackerrank.com/challenges/flatland-space-stations You are given a number n where cities can be at indices 0 to n-1 and also given an unsorted list of indices of cities where there are stations. The goal is to find the maximum distance from a city to a station. Fo...
stackexchange_codegolf
Given infinite different integers, order them into a sequence \$a_1, a_2, a_3, ...\$ such that \$a_i>a_{i+1}\$ iff \$i\$ is even(or odd, as long as it's constant for all possible inputs and all \$i\$). In other word, make the sequence go alternately up and down (or down first, as long as it's constant). Examples: ℤ => ...
stackexchange_codegolf
Background (feel free to skip) Ordinals are the abstract representation of well-orders. A well-order of a set is a total order, which basically means that every element in the set can be compared against any other element in the set, and one of them is either smaller or larger. Also there are no cycles. The crucial dif...
stackexchange_codegolf
The Challenge Given a list of integers, the "bittiest" number among them is the one with the most bits on - that is, the largest amount of bits set to 1 in its 32-bit two's complement representation. Write a function (or a program) that takes as input a list of integers between \$ -2^{31} \$ and \$ 2^{31}-1 \$ (the ran...
stackexchange_codegolf
Inspired by this OEIS entry. Background A saturated domino covering is a placement of dominoes over an area such that the dominoes are completely inside the area, the dominoes entirely cover the given area, the dominoes may overlap, and removal of any domino reveals an uncovered cell (thus failing to satisfy condition...
stackexchange_codegolf
Input A calendar year from 927 to 2022. Output You can use any three distinguishable outputs. As an example, “K” (short for King) or “Q” (short for Queen) depending on which of the two England had in that year. If there was both a King and Queen in that year you can output either. If there was no King or Queen for th...
stackexchange_codegolf