instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
What is a Word Signature? The signature of a word are all of it's letters put in order - the signatures of this, hist and hits are all hist. The Challenge Write a program program should ask for an input, then print out the signature of that word. So an example program run might look like this: Give me a string: this T...
stackexchange_codegolf
Powers We define an important power as a number that can be represented as \$ x^y \$ where \$ x ≥ 2 \$ and \$ y ≥ 2 \$. Palindrome We define an important palindrome as a number that is the same written forwards and backward, and is greater than 10. Thus, the last digit must not be 0. Palindromic Power We define a Palin...
stackexchange_codegolf
Goal Write a full program that generates a map showing the local train stations and which train station is the closest to every point on the map. Requirements Input A set of tuples. The first is the (Width,Height) dimensions of the map. The following tuples are the (X,Y) coordinates of each train station. Coordinate...
stackexchange_codegolf
Brainf**k is the most famous esoteric programming language and is the inspiration for hundreds of other esoteric languages. In fact, there are quite a few languages that are so heavily based off of Brainf**k that the only difference is the characters used. Your challenge is to interpret one of these languages. Brainf**...
stackexchange_codegolf
The Goldbach conjecture states that: every even number that is greater than 2 is the sum of two primes. We will consider a Goldbach partition of a number n to be a pair of two primes adding to n. We are concerned with numbers is of increasing Goldbach partition. We measure the size of a number's Goldbach partitions ...
stackexchange_codegolf
There are many magic squares, but there is just one non-trivial magic hexagon, as Dr. James Grime explained, which is the following: 18 17 3 11 1 7 19 9 6 5 2 16 14 8 4 12 15 13 10 As it is done in Hexagony this is easiest written as just one line, by just reading it row by row: 18 17 3 11 1 7 19 9 6 5 2...
stackexchange_codegolf
Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any character more than once across your snippets. Rules You may use the same character multiple times in one (and only one) sni...
stackexchange_codegolf
Given a "T" shape on an x * y number grid, with length W on the top bar and H on the stem of the T, with the bottom of the T on the square numbered n: calculate the total of all of the numbers in the T shape. W must be an odd number and all must be positive integers. Here are some examples of valid T's on a 9*9 grid: ...
stackexchange_codegolf
I have a list, l and a function f. f is not strictly increasing or decreasing. How can I find the item in the list whose f(item) is the smallest? For example, let's say the list is: l = [1, 2, 3, 4] and list(f(x)for x in l) is: [2, 9, 0, 3] f(3) is smaller than f of any of the other ones, so it should print "3". What...
stackexchange_codegolf
What is Typoglycemia? Typoglycemia is a term that refers to the phenomenon where readers are able to understand text even when the letters in the middle of words are jumbled, as long as the first and last letters of each word remain in their correct positions. For example, Aoccdrnig to a rscheearch at Cmabrigde Uinerv...
stackexchange_codegolf
Given string X, convert it to Java Style string, as defined below: Strings may only contain numbers and letters(signs are not allowed) Strings must not start with numbers Strings must start with Capital letter Strings may not contain two capital letters in a raw. As for conversion you may perform the next actions Re...
stackexchange_codegolf
This was written as part of the First Periodic Premier Programming Puzzle Push. The Game A starting and ending word of the same length are provided. The objective of the game is to change one letter in the starting word to form a different valid word, repeating this step until the ending word is reached, using the few...
stackexchange_codegolf
Peano numbers represent nonnegative integers as zero or successors of other Peano numbers. For example, 1 would be represented as Succ(Zero) and 3 would be Succ(Succ(Succ(Zero))). Task Implement the following operations on Peano numbers, at compile time: Addition Subtraction - You will never be required to subtract a ...
stackexchange_codegolf
Given a permutation of the alphabet and an intended "word", determine if the word was guessed in a game of Hangman, where the permutation is the list of guesses. For example, given ASTNORDYUVKFMCLWIHEBQGPJXZ as the permutation, and ASTRONAUT as the word, we know that the word was guessed. Only 2 letters (DY) were wrong...
stackexchange_codegolf
Lets define a non-empty, unsorted and finite matrix with unique numbers as follow: $$N = \begin{Bmatrix} 4&5&7\\1&3&6 \end{Bmatrix}$$ Lets define 4 matrix moves as: ↑* (up): Moves a column up ↓* (down): Moves a column down →* (right): Moves a row to the right ←* (left): Moves a row to the left The asterisk(*) repre...
stackexchange_codegolf
Your task is to print the text Good morning, Green orb!, with every character repeated in place as many times as the most frequent byte in your source (the mode). A trailing newline is permitted and need not be repeated. For example if your source was print p Since p appears twice and every other byte appears once yo...
stackexchange_codegolf
There is a 1x1x1 cube placed on a infinite grid of 1x1 squares. The cube is painted on every side, so it leaves a mark on the grid when it moves. The sides of the cube are colored 6 distinct colors, re-presentable with any 6 distinct values. A 7th value represents a blank space. The cube can roll around the grid. Ever...
stackexchange_codegolf
In this challenge, you are required to shift characters in an inputted string n number of times and output the shifted string Input Input will first contain a string. In the next line, an integer, which denotes n will be present. Output If n is positive, shift the characters in the string to the right n times. If n is...
stackexchange_codegolf
There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever. Your task is to create a program that gives the next word in sequence giv...
stackexchange_codegolf
There are many magic squares, but there is just one non-trivial magic hexagon, as Dr. James Grime explained, which is the following: 18 17 3 11 1 7 19 9 6 5 2 16 14 8 4 12 15 13 10 As it is done in Hexagony this is easiest written as just one line, by just reading it row by row: 18 17 3 11 1 7 19 9 6 5 2...
stackexchange_codegolf
Objective Given a permutation of 4 distinct items, classify the permutation by the normal subgroup(s) it belongs. Input/Output Format You gotta choose the followings as the hyperparameters for your submission: The 4 distinct items. The permutation serving as the identity permutation. The input format is to accept a...
stackexchange_codegolf
Given a non-negative number n, sort the digits of n by their first occurrence in pi. Input can be taken via function cli argument, or STDIN and as a string, char[] or integer. You may output via return value, exit status or STDOUT.
stackexchange_codegolf
Letters of the words want fairness. They decided to appear same number of times in a sentence equally. Example: Priorities Will become: Ppprrioooritttieeesss Each letter appears 3 times, as the most common letter was i, appearing 3 times. It does not matter where you put the repeated letters, as long as they are next...
stackexchange_codegolf
Back in 1965, The Beatles released their hit song 'Eight Days a Week'. In this code-golf challenge we are going to reimagine dates of the 21st century as if there really were eight days a week. Input A Gregorian calendar date between 1 January 2001 and 31 December 2100 inclusive. You may take input in any convenient fo...
stackexchange_codegolf
The Debian Linux distribution (and Debian-based distros, like Ubuntu, Kali and others) uses a package-manager called APT. To install program foo you would type into a terminal sudo apt-get install foo One little Easter Egg of APT is the following apt-get moo Which after typing will produce the following output ...
stackexchange_codegolf
There is a helicopter flying 500 meters from the ground. It can fly up 100 meters, which takes 1.0 secs. Or if it doesn't fly up it will fall 200 meters, which also takes 1.0 secs - This means if the instruction is anything other than "Fly" the helicopter falls. Build a program that takes input of a list of instruction...
stackexchange_codegolf
Steven Gerrard was born on 30th of May 1980. He is now 37 years old. Happy birthday, Steven! To celebrate his anniversary, your goal is to remind him the number of goals he has scored each year in premiere league for Liverpool. He doesn't want to remember the goals scored before or after playing for Liverpool. It is l...
stackexchange_codegolf
One element of the list aa, ab, ba, bb, c has been removed, and the remainder shuffled and joined with no separator. Find the missing element. For example, if the input was aaabbac, this is made by concatenating aa ab ba c, so the output would be bb. Rules Standard I/O rules apply. You must take input as a string (or ...
stackexchange_codegolf
A family of sets is called laminar if for any two sets \$A\$ and \$B\$ in the family one of the following is true: \$ A \subseteq B \$ \$ A \supseteq B \$ \$ A \cap B = \emptyset \$ Or less mathematical: A laminar set is a list of lists that satisfies the following condition: If two elements of the top level list hav...
stackexchange_codegolf
Note that this is similar to my other challenge, but it is widened to be similar to most challenges (input -> truthy/falsey), instead of asking you all to brute force something. If this makes it a dupe, let me know, but I posted it on Sandbox and asked on chat, and didn't get any negative responses. Input Input will be...
stackexchange_codegolf
Duolingo, the language learning app, has a lot of things going for it, but there is one major issue that drives me crazy. It tells me how many days in a row I've used the app with a message like You're on a 7 day streak! Setting aside hyphenation and whether the number should be spelled out, this works fine for most nu...
stackexchange_codegolf
Any general tips for golfing in VB.net? This, similar to Pascal, is a very rarely used language, thus having very few resources online Visual Basic.NET (VB.NET) is a multi-paradigm, managed, type-safe, object-oriented computer programming language. Along with C# and F#, it is one of the main languages targeting the .NE...
stackexchange_codegolf
Leon's story Leon is a professional sling shooter and he comes to a shooting range everyday to practice. A casual target is not a challenge for him anymore so before shooting he first covers the target of radius 1.0 with k rectangle stickers. He then fires n shots that cannot hit the stickers. What's special about Leo...
stackexchange_codegolf
Related: Counting polystrips Background Link-a-Pix is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules: Connect two cells with number N with a line spanning N cells, so that the two cells are at the two ends of the line. The number 1 is considered connected t...
stackexchange_codegolf
It turns out that my toaster is a tad broken. It lost WiFi (You know, it's one of those newfangled smart toasters), and its been going bonkers! Since it no longer works, I've been having to hack into my breakfast's source code and run Plate.bread.toastAs(3); every morning. Will you help? My toaster takes one input: the...
stackexchange_codegolf
Inspired by this question on SO, your task is to produce a program that is valid in (at least) two major versions of your chosen language that produce different output. Rules Any language that has more than one major version can be used. For the purposes of this challenge, I would suggest a "major version" is where ...
stackexchange_codegolf
Here the first 100 numbers of an easy sequence: 0,1,0,2,1,4,3,7,6,11,10,16,15,22,21,29,28,37,36,46,45,56,55,67,66,79,78,92,91,106,105,121,120,137,136,154,153,172,171,191,190,211,210,232,231,254,253,277,276,301,300,326,325,352,351,379,378,407,406,436,435,466,465,497,496,529,528,562,561,596,595,631,630,667,666,704,703,74...
stackexchange_codegolf
Given a positive integer \$n\$ output the integers \$a\$ and \$b\$ (forming reduced fraction \$a/b\$) such that: $$\frac a b = \prod ^n _{k=1} \frac {p^2_k - 1} {p^2_k + 1}$$ Where \$p_k\$ is the \$k\$ th prime number (with \$p_1 = 2\$). Examples: 1 -> 3, 5 2 -> 12, 25 3 -> 144, 325 4 -> 3456, 8125 5 -> 41472...
stackexchange_codegolf
I'm hungry. Let's microwave something. Given a numerical input of between 1 and 4 digits, output the number of seconds that the microwave should run. Details The trick is figuring out if the user is inputting seconds or a combination of seconds and minutes. The ones and the tens places should be interpreted as seconds ...
stackexchange_codegolf
Introduction How much of the English alphabet does a given string use? The previous sentence uses 77%. It has 20 unique letters (howmucftenglisapbdvr), and 20/26 ≃ 0.77. Challenge For an input string, return the percentage of letters of the English alphabet present in the string. The answer can be in percentage or in ...
stackexchange_codegolf
The title says it all; Given a number in the binary (base-2) number system, output the same number expressed in unary (base-1). You should take the binary number as a string (optionally with a separator), list, or equivalent structure of digits, using any number or digit you like for the digits. The unary output can us...
stackexchange_codegolf
Introduction In the game The Witness (possible spoilers ahead) there is a group of puzzles that involve drawing a Tetris piece with your line while making sure that the symbol for the Tetris piece your currently drawing stays contained within the shape you've drawn. For the image above the drawing works because the ...
stackexchange_codegolf
I was playing around with cellular automaton and I found one that had some interesting behavior. Here's how it works: It reads a binary string from left to right, if it encounters a 1 followed by 2 other values it will append a 0 to the result and continue reading. If it encounters a 0 (or there are less than 3 value...
stackexchange_codegolf
Take a 2D region of space divided into axis aligned unit square elements with their centers aligned at integer intervals. An edge is said to be internal if it is shared by two elements, otherwise it is an external edge. Your goal is to find the minimum number of neighboring elements which must be traversed to reach an ...
stackexchange_codegolf
Your input is a ragged list of positive integers and a positive integer. Your task is to find that positive integer and return it's index, or if the positive integer doesn't exist, indicate it's nonexistence. How are indices in ragged lists defined? They are simply lists of indices that when used consecutively to index...
stackexchange_codegolf
Task There is a set of numbers x, such that x^2 divides 7^x-1. Your task is to find these numbers. Given an input of n, the code will print the nth number that follows this rule. Examples 1-index In Out 3 3 9 24 31 1140 The relevant sequence can be found here. Rules Shortest answer will be the winner* Standa...
stackexchange_codegolf
Trigonometry has LOTS of identities. So many that you can expand most functions into sines and cosines of a few values. The task here is to do that in the fewest bytes possible. Identity list Well, the ones we're using here. sin(-x)=-sin(x) sin(π)=0 cos(-x)=cos(x) cos(π)=-1 sin(a+b)=sin(a)*cos(b)+sin(b)*cos(a) cos(a+b)...
stackexchange_codegolf
Sandbox post here. Create a function or program that "Springifies" a string. Input will be a String in Stdin, or closest alternative Input will only contain printable ASCII and/or spaces Output will be to Stdout, or closest alternative A trailing newlines and spaces are acceptable How to springify a String Format th...
stackexchange_codegolf
I have the code: marks = tuple(tuple((input("Enter subject: "), input("Enter marks: "))) for _ in range(int(input("Enter number of tuples: ")))) print(tuple((s[:3].upper(), max(int(m) for t, m in marks if t == s)) for s in set(t for t, m in marks))) #INPUT (("Physics",131),("Chemistry",30),("Physics",100),("Computers"...
stackexchange_codegolf
Your friend isn't too good with computers so as a practical joke someone scrambled the letters (a-z) on his keyboard. When he sit down and tried to type his name looking at the keyboard he realized that the letters are scrambled and asked your help. You are smart so you know that if he types his name and then repeatedl...
stackexchange_codegolf
We say a string is non-discriminating if each of the string's characters appears the same number of times and at least twice. Examples "aa!1 1 !a !1" is non-discriminating because each of the characters , !, a and 1 appear three times. "abbaabb" is not non-discriminating because b appears more often than a. "abc" is ...
stackexchange_codegolf
In order to defend someone’s baffling decision, people often say that that person is going over everyone’s heads and playing “3-dimensional chess”. Now it’s your chance to play 3-dimensional chess! Rules There are many variants of 3D Chess, but for this challenge I’ve made up my own. My version is just like regular che...
stackexchange_codegolf
A struggling manufacturer named Tennessee Instrumental is desperate to get into the calculator business. Problem is, they don't have any software engineers on payroll, and the deadline is coming up fast. It's your job to help TI configure a basic calculus-ready calculator that can simplify expressions input as strings...
stackexchange_codegolf
Introduction Your job is to write a function or program that detects if a number a is less than a number b. But... You are not allowed to use built-in alternatives for equals, less than, greater than, less than or equal to, greater than or equal to, or not equal to operators. (Writing your own implementation is allowed...
stackexchange_codegolf
This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do it without using any of the characters in the string itself! For this challenge we will find out who is the best at prin...
stackexchange_codegolf
Imagine enumerating the elements of rhombi which grow [1],[1,3,1],[1,3,5,3,1],… (only odd numbers such that they align nicely). This would look like as follows, note that you always begin enumerating with 1: 01 1 02 03 04 1 2 3 4 05 06 07 08 09 … 5 10 11 12 ...
stackexchange_codegolf
Inspired by Braille graphics and Build an analog clock. The goal there is to create a tool that use terminal console to draw and animate a clock by using UTF-8 fonts \U2800: ⠀ to \U28FF: ⣿. 00:[⠀] 01:[⠁] 02:[⠂] 03:[⠃] 04:[⠄] 05:[⠅] 06:[⠆] 07:[⠇] 08:[⠈] 09:[⠉] 0A:[⠊] 0B:[⠋] 0C:[⠌] 0D:[⠍] 0E:[⠎] 0F:[⠏] 10:[⠐] 11:[⠑] 12:...
stackexchange_codegolf
Your task is when given a chemical formula as input, output the total number of atoms in the formula. Input A chemical formula in any reasonable format. Each chemical formula has the following: A leading coefficient, which is a number \$N > 1\$. At least 0 groupings of elements surrounded by parentheses. Groupings ca...
stackexchange_codegolf
pannenkoek2012 aims to complete Super Mario 64 with as few presses as possible of the A button, which makes Mario jump. Each "A press" consists of three parts: Pressing the button Holding it for any length of time Releasing it See this video (1:15 - 3:23) for a great explanation that includes the above image. (Howe...
stackexchange_codegolf
Given a list of positive integers, partition the list into two sublists such that the absolute value of the difference of the sums over the two sublists is minimal. The output of the program should be the (non-negative) difference of these sums. Examples: [1,2,3] -> 0 # [1,2], [3] [2,3,5,7,11] -> 0 # [2,5,7], ...
stackexchange_codegolf
Introduction Write a solver for integer linear programming. Challenge Your task is write a solver for integer linear programming (ILP). In ILP, linear inequalities of a set of unknowns (all of which are integers) are given, and the goal is to find the minimum or maximum of a linear function. For example, for the inequa...
stackexchange_codegolf
As part of his answer to Make an Error Quine!, @Falko proposed the following algorithm: How to create your own solution in 2 minutes? Open a new file in an IDE of your choice. Bang your head onto the keyboard in front of you. Compile. Replace the code with the compiler error message. Repeat steps 3 and 4 until the co...
stackexchange_codegolf
Two ambassadors at a UN conference want to speak to each other, but unfortunately each one only speaks one language- and they're not the same language. Fortunately, they have access to several translators, who each understand and speak a few languages. Your task is to determine the shortest chain of translators (since ...
stackexchange_codegolf
Challenge Write a complete program that prints out the time it took to execute a certain part of itself. That part must include a process whose total number of operations (and therefore execution time) is dependent on a user-substituted numeric value - this can be denoted in any way in your code (uppercase N for exampl...
stackexchange_codegolf
Balanced ternary is a modified version of ternary (base 3), using the three digits 1,0 and -1 (written as T) to represent numbers. The balanced ternary representation of -n can be obtained by replacing 1 with T and T with 1 in the balanced ternary representation of n. Examples: 1 // decimal: 1 T // decimal: -1 ...
stackexchange_codegolf
What tips do you have for code-golfing in the V lang? I have been trying to find ways to shorten codegolfs on there but can't find any resources on it. Do you guys have any? Please suggest tips that are at least somewhat specific to the V programming language (e.g. "remove comments" isn't helpful). Please post one tip ...
stackexchange_codegolf
The pyramid begins with the row 1 1. We'll call this row 1. For each subsequent row, start with the previous row and insert the current row number between every adjacent pair of numbers that sums to the current row number. $$ 1\quad1\\ 1\quad\color{red}{2}\quad1\\ 1\quad\color{red}{3}\quad2\quad\color{red}{3}\quad1\\ 1...
stackexchange_codegolf
The Hamming distance between two strings of equal length is the number of positions at which the corresponding symbols are different. Let P be a binary string of length n and T be a binary string of length 2n-1. We can compute the n Hamming distances between P and every n-length substring of T in order from left to ri...
stackexchange_codegolf
The Borromean rings are a curious set of three circles, linked such that the removal of any one of them will unlink the other two: You can make a set for yourself with a couple rubber bands and a binder ring. With more rubber bands, it's easy to make any Brunnian link. Write a program or function that outputs (prints ...
stackexchange_codegolf
Given an unsorted list of unique, positive integers, output the shortest list of the longest possible ranges of sequential integers. INPUT An unsorted list of unique, positive integers e.g. 9 13 3 11 8 4 10 15 Input can be taken from any one of the following: stdin command-line arguments function arguments OUTP...
stackexchange_codegolf
Given a list of non-negative integers the function \$f\$ replaces every integer with the number of identical integers preceding it (not necessarily contiguously). So f [1,1,2,2,1,3,3] = [1,2,1,2,3,1,2] We will say that a list, \$X\$, is in a loop if there is some positive integer \$n\$ such that \$f^n X = X\$. That i...
stackexchange_codegolf
A truck fleet dispatcher is trying to determine which routes are still accessible after heavy rains flood certain highways. During their trips, trucks must follow linear, ordered paths between 26 waypoints labeled A through Z; in other words, they must traverse waypoints in either standard or reverse alphabetical order...
stackexchange_codegolf
The Challenge Given a non-empty string containing only lowercase or uppercase letters and no spaces: Sum up the ASCII values for each character instance in the input string. The sum will be converted to binary. And, the result will be the number of ones in the binary value. Input example: abcDeFAaB Sum up the ASCII...
stackexchange_codegolf
I think the Collatz Conjecture is already well-known. But what if we invert the rules? Start with an integer n >= 1. Repeat the following steps: If n is even, multiply it by 3 and add 1. If n is odd, subtract 1 and divide it by 2. Stop when it reaches 0 Print the iterated numbers. Test cases: 1 => 1, 0 2 ...
stackexchange_codegolf
The player has to keep guessing a number from 1 to 10 until they guess the correct number to win the game. If they make an incorrect guess, they're told if their guess was too low or too high. Each line has to render below the previous line for me to accept the solution as the new code for the game (However, you can st...
stackexchange_codegolf
It's almost Christmas, so Santa has to plan his route. You're helping him, for reasons unknown. Santa needs help planning the route and wants you to give him a solution, but since you're all ungrateful and unwilling to give to the man who has given you so much, so have decided to give him a program with as few bytes as...
stackexchange_codegolf
Introduction Windows 95 used a very simple algorithm for verifying license keys. The scheme of an OEM license key always looked like this: xxxyy-OEM-NNNNNNN-zzzzz The day can be anything within 001-366, and the year cannot be lower than 95 or above 03. xxx represents the day of the year the key was printed on (for exa...
stackexchange_codegolf
Background Three years ago, this guy Tom Murphy got it into his head to extend the idea of a portmanteau to all words in a language and called this a portmantout (portmanteau plus tout [French for all]). Defining English as a list of 108,709 words, he managed to find a sequence of 611,820 letters with the following two...
stackexchange_codegolf
This problem is inspired from shinh's problem. Given an input of positive integer \$n\$, output a smiley triangle (see below) with \$n\$ rows. Detailed rules Can be either a function or a full program. Standard I/O rules applied. RULE CLARIFICATION: Output as exactly a string, rather than an array of strings whose it...
stackexchange_codegolf
NATO phonetic alphabet is a spelling alphabet that associate to each of the 26 letters of the English alphabet one word (table below) that is easy to understand over the radio or telephone. For example, if you want to communicate the word CAT over the telephone, you do the following spelling: CHARLIE ALFA TANGO But wha...
stackexchange_codegolf
I have 2 inputs: 1 single number and some numbers separated by whitespace: 1 1 2 3 4 5 I want to loop over the second input, and I don't need the first input. I did this, which works: input() for x in input().split():somecode() But can I go directly to the second input without doing the input() at the beginning or wi...
stackexchange_codegolf
Background Story Bob was handed the following assignment for his programming class. Please note: this is not the actual challenge. Homework assignment 11: Twin primes Input: an integer n ≥ 8, taken from STDIN. Output: a message to STDOUT, depending on n: If n is not a prime number, output Not prime. If n is a prime n...
stackexchange_codegolf
Back to basics... As a teacher at the local primary (grade?) school, you need a way to teach your class their times tables. At your disposal, you have hundred squares and a load of red pens. You need to also be able to show your class the correct answers quickly. Now, you're clever enough to write a program that can do...
stackexchange_codegolf
So, I have an array ['a', 42, 'b', 42, 'a'] I want to alert users to the fact that 42 and 'a' appear in it twice. some_function(['a', 42, 'b', 42, 'a']) should return ['a', 42] Write some code to extract the duplicates from an array. It should accept an array as input. The array can have multiple types of object. ...
stackexchange_codegolf
Originally from caird coinheringaahing's idea, I (Bubbler) am hosting Advent of Code Golf 2021. On each day from today (Dec 1) until Christmas (Dec 25), a challenge will be posted at UTC midnight, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes ...
stackexchange_codegolf
In this challenge you'll be building a program that grows as it traverses through the ages… Until it's 2017. Challenge Whenever this challenge description says “program”, you can also read “function”. Your submission, when executed, will output a program that is THE LENGTH OF YOUR SUBMISSION + 1 bytes long. When that p...
stackexchange_codegolf
Introduction Let's define a new arithmetical operation, which I call zipper multiplication. To zipper multiply two nonnegative integers, you add leading zeros to make the lengths match, multiply the corresponding base-10 digits of the numbers, add leading zeros to the results to get 2-digit numbers, concatenate them, a...
stackexchange_codegolf
Your task is to take an ASCII art image and output it rotated clockwise by 45 degrees and scaled by a factor of \$\sqrt 2\$. The scaling comes from using a lattice pattern which introduces space between the characters. To explain it visually, a \$3 \times 3\$ block would be processed like so: 123 456 789 becomes 1 ...
stackexchange_codegolf
Part of Advent of Code Golf 2021 event. See the linked meta post for details. The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost). Santa is delivering presents to an infinite two-dimensional grid of houses. The delivery begins delivering a present to the ...
stackexchange_codegolf
In this challenge, you are given a number x. You have to find the minimum number of steps required to reach x from 1. At a particular point, you have two choices: 1) Increment the number by 1. 2) Reverse the integer (remove leading zeros after reversing) Input: n=42 Output: 1>2>3>4>5>6>7>8>9>10>11>12>13>14>41>42 **...
stackexchange_codegolf
Welcome to BBC Casting. We need a program that we can use to select a new actor to play The Doctor on Doctor Who. In the spirit of the show, your program will perform a regeneration from one actor's name to the next. We will test your program by running through the 13 names of actors who have already played The Doctor ...
stackexchange_codegolf
The Hamming distance between two strings is the number of positions they differ at. You are given a set of binary strings. The task is to find the length of the shortest route that visits all of them at least once and ends where it started, in a metric space where the distance between two strings is the Hamming distanc...
stackexchange_codegolf
Write a function or program that takes two words as input and outputs variants of the popular English tongue-twister "How much wood would a woodchuck chuck if a woodchuck could chuck wood?". The output will use the first word four times How much wood would a woodchuck chuck if a woodchuck could chuck wood? and the se...
stackexchange_codegolf
Introduction This challenge is inspired by the Meta Stack Exchange question The longest consecutive days streak; it turns out that the URL https://codegolf.stackexchange.com/users/daily-site-access/[user id], where the last number is your user ID (found in the URL of your profile) contains information about which days ...
stackexchange_codegolf
Your goal is to write a program that prints the string abc in two languages. However, while the full code will print abc in one language (we'll call it Language 1), the other one (Language 2) must print abc if (and only if) every other character is skipped starting from the second character. If the full code is run in ...
stackexchange_codegolf
Your task is to make a program which interprets the language it is run in, but also works in many languages. Let's say you make a Brainfuck-Underload self-interpreglot, as it will be called. Run in Brainfuck, this program should be a Brainfuck interpreter; run in Underload, it should be a Underload interpreter. Your pr...
stackexchange_codegolf
The Venetian election system was... complicated. The Great Council came together and put in an urn the ballots of all the councilors who were older than 30. The youngest councilor went to St Mark's Square and chose the first boy he met who drew from the urn a ballot for each councillor and only those 30 who got the wo...
stackexchange_codegolf
Twisting Words! Given a string and a positive integer. You must twist the string, back and forth. Example Input / Output Input Programming Puzzles & Code Golf 4 Output Prog mmar ing zzuP les oC & de G flo Input The input can be taken in through STDIN, or function argument. The input will consist of a string and a ...
stackexchange_codegolf
Since 2009, Android's version code names have been confectionery-themed. Android 1.5 is Cupcake, Android 1.6 is Donut, Android 2.0 is Eclair, etc.. In fact, the version names are alphabetical! C -> Cupcake D -> Donut E -> Eclair F -> Froyo G -> Gingerbread H -> Honeycomb I -> Ice Cream Sandwich J -> Jellybean K -> Kitk...
stackexchange_codegolf
Interestingly, although there are challenges that work with images, there is no challenge to simply output an image. This is that challenge Goal: output an image in the shortest possible code. Output: Any image output is accepted. Files would be preferable, but most any non-character on the screen will function as an i...
stackexchange_codegolf