instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Note this is a question primarily focusing on data-structures Introduction Bacefook wants people to be friendlier! As such, they are implementing a new system to suggest friends! Your task is to help Bacefook to implement their new suggesting system. Specifications: Your program must be a REPL (read-eval-print loop) su...
stackexchange_codegolf
Introduction A childhood game designed to help children learn to count in french in Canadian schools is played as follows: Students go around the room counting up to 11 A number greater than 11 cannot be said A student can say either 1, 2, or 3 numbers If a student says the number 11 then they are removed from the nex...
stackexchange_codegolf
Many important topics in abstract algebra involve a binary function acting on a set. A number of properties of such functions have been defined in the investigation of such topics. Your challenge will be to determine whether a given binary function on a given domain possesses five of these properties. Properties Closur...
stackexchange_codegolf
Inspired by what I'm doing at work right now. Your program should take one parameter, the path to the file It should convert all the windows style newlines (\r\n) to unix style (\n) and write the result back to the file
stackexchange_codegolf
You have to write a program, if its source code is reversed, then it will error. For example, if your source is ABC, then reversing it and writing CBA should crash/throw an error. And ABC itself should be a vaild program (I mean your primary source should be a valid program). Output of the main source code can be empty...
stackexchange_codegolf
Let us take a break from the brain-wrecking questions and answer some of the simpler ones You have recently read something extremely funny, and want to express your laughter to the world! But how can you? Task You have to display the string: Lololololololololololololololololololololololololololololololololololololololo...
stackexchange_codegolf
Write a program or function that takes in a positive integer (via stdin, command line, or function arg) and prints or returns a string of that many of these small triangles tiled together, alternating which way they point: /\ /__\ This sole triangle is the output if the input is 1. If the input is 2, the output is ...
stackexchange_codegolf
It's laundry day, and you have lots of clothes that need to be washed. Wanting to have as much time left over for code golf as possible, you hope to optimize how quickly you wash and dry them all. You have three types of appliances: Washing machines: Take dirty clothes and turn them into wet clothes Dryers: Take wet c...
stackexchange_codegolf
Motivation In this challenge your task was to multiply two strings, this naturally introduces a way to take the square root of a string. How does it work? Given a string (for example pub) the first thing you need to do, is to determine the ASCII code for each character: "pub" -> [112, 117, 98] Next you map these codes...
stackexchange_codegolf
Chess960, a.k.a. Fisher random chess, is a variation of the game of chess. In classic chess the starting positions are always the same. In chess960 they vary. Before each game of chess960 one random number from 0 to 959 is drawn. Both players then arrange their pieces in the same way according to this number from a loo...
stackexchange_codegolf
Your challenge is to golf a program that mimics a data transmission stream. Your program should read input from stdin and output it directly to stdout. To make the problem more interesting, the output stream is 'faulty', and must meet several requirements: There should be a 10% chance that each character is shifted +1...
stackexchange_codegolf
Input: A string (or the closest thing to that in your language) Output: The same string but converted to sentence case Rules: For this challenge, sentence case can be considered "The first letter of each sentence is capitalized. The rest are lowercase." (i.e. proper nouns do not have to be capitalized) If the input do...
stackexchange_codegolf
As you probably know, a Fibonacci Number is one which is the sum of the previous two numbers in the series. A Fibonacci Digit™ is one which is the sum of the two previous digits. For instance, for the series beginning 1,1, the series would be 1,1,2,3,5,8,13,4,7,11,2... The change occurs after the 13, where, instead of ...
stackexchange_codegolf
In this challenge, you play chess without seeing any of your opponent's pieces or moves. Or your own pieces. Or whether your own moves succeeded. You send only a stream of moves, with no feedback. If your move is legal (when it is your turn) it will be played, otherwise it is silently discarded. I/O The only input is t...
stackexchange_codegolf
Let's say I have this string: s = "Code Golf! I love Code Golf. It is the best." I want to replace all the vowels with repeated "aeiou". Notes: Uppercase vowels should be replaced by an uppercase letter, and lowercase vowels should be replaced by a lowercase letter. Consonants (all alphabet characters except for "ae...
stackexchange_codegolf
A theorem in this paper1 states that every integral n-by-n matrix M over the integers with trace M = 0 is a commutator, that means there are two integral matrices A,B of the same size as M such that M = AB - BA. Challenge Given an integral matrix M with trace M = 0 find some integral matrices A,B such that M = AB - BA....
stackexchange_codegolf
The objective of this challenge is to write a program to convert an inputed string of what can be assumed as containing only letters and numbers from as many bases between 2 and 36 as possible, and find the base 10 sum of the results. The input string will be converted to all the bases in which the number would be defi...
stackexchange_codegolf
Given a non-negative integer N, output the smallest odd positive integer that is a strong pseudoprime to all of the first N prime bases. This is OEIS sequence A014233. Test Cases (one-indexed) 1 2047 2 1373653 3 25326001 4 3215031751 5 2152302898747 6 3474749660383 7 3415500717...
stackexchange_codegolf
Task: Your challenge is, given previous submissions and itself as input, output the language that they're written in, in the following format: Say the first program is in Ruby. It must output 1, because Ruby is the 1st language used in this challenge. An example program is: a=gets puts 1 When given itself as input, it...
stackexchange_codegolf
This challenge is very simple. You are given as input a square matrix, represented in any sane way, and you have to output the dot product of the diagonals of the matrix. The diagonals in specific are the diagonal running from top-left to bottom-right and from top-right to bottom-left. Test Cases [[-1, 1], [-2, 1]] ->...
stackexchange_codegolf
If a string T of length K appears K or more times in a string S, then it is potentially communistic. For example, 10 in 10/10 is potentially communistic, for it appears 2 times and is of length 2. Note that these substrings cannot overlap. A communistic transformation is one that takes this string T and moves each cha...
stackexchange_codegolf
Given a base \$k\$ as well as two indices (also passed in base \$k\$, call them \$s\$ and \$e\$) return a list containing a frequency count of all base-\$k\$ digits occurring between \$s\$ and \$e\$ inclusive. For example, upon input \$k = 10, s = 1, e = 10\$, we would return the list \$[0: 1, 1: 2, 2: 1, 3: 1, 4:1, 5:...
stackexchange_codegolf
Give credit to whom credit is due. Objective Given an integer N > 0, out the smallest integers A, B, and C so that: All of A, B, and C are strictly greater than N; 2 divides A; 3 divides B; and 4 divides C. This is a code-golf, so the shortest answer in bytes wins. Test cases N => A, B, C 1 => 2, 3, 4 4 => 6, 6, 8 43...
stackexchange_codegolf
Objective Given a 2D array of any size, write a program or function to shift alternatively the columns and rows Example a b c d e f g h i j k l m n o All elements in the first column shift down one row, the second column shift up one row, the third shift down one row and so on, wrapping when they reach the edge. k g m...
stackexchange_codegolf
This is essentially the inverse of Generate a US License Plate Challenge: Given a string that matches one of the below license plate formats, output all possible states that match that formatting. In the below table 0 stands for a single digit 0 through 9 inclusive, and A stands for a single letter A through Z inclusiv...
stackexchange_codegolf
This challenge is to take an alphabetical string as input and to apply the following conversion: The first of each type of character of the string must stay, and must be immediately followed by an integer representing how many of these characters were in the original string. Any repeating characters must be omitted. Al...
stackexchange_codegolf
We start with a blank 1-indexed sequence: _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,... In the nth step, we fill in every a(n) blanks with the integers greater than 1 starting at the first remaining blank, where a(n) is the nth entry in the sequence. After the first step: 2,_,3,_,4,_,5,_,6,_,7,_,8,_,9,_,10,_,11,...
stackexchange_codegolf
Credits for the challenge idea go to @AndrewPiliser. His original proposal in the sandbox was abandoned and since he has not been active here for several months, I have taken over the challenge. Balanced ternary is a non-standard numeral system. It is like ternary in that the digits increase in value by a factor of 3 a...
stackexchange_codegolf
Maybe some of you already know this game: you have a collection of jelly beans of different colors. For every color, the bean can have different tastes, some are good and some are bad, and you cannot tell them apart. You have to pick a bean of a given color, and pray you have select a good one. So, write the shortest p...
stackexchange_codegolf
Given a base type T, this can be augmented with * or [], each meaning pointer and array. For example, []*T means "array of pointer to T" and *[]T means "pointer to array of T". Let's call * and [] type modifiers. C has a way of ordering these modifiers tied to the evaluation order. []*T in C-style becomes T *[], and *[...
stackexchange_codegolf
Someone I know has no coding experience, but has proposed an algorithm* to determine the character limit of text fields they find online. They copy a string containing the numbers from 1 to 1,000 inclusive, not separated in any way, and they read the last few digits it displays. For example, after pasting, they might s...
stackexchange_codegolf
Input: Two strings without newlines or whitespaces. Output: Both input strings on separate lines, with spaces where necessary† for one of the two strings. And a third line with the characters A, R, M and , representing added, removed, modified, and unchanged. † We add spaces to either the top or bottom input string (if...
stackexchange_codegolf
I was playing around with some numbers and found a sequence that, of course, is on OEIS. It is A005823: Numbers whose ternary expansion contains no 1's. It goes: a(2n) = 3*a(n)+2 a(2n+1) = 3*a(n+1) a(1) = 0 a = 0,2,6,8,18,20,24,26,54.... I wrote a CJam program that generates the first n of these numbers by convertin...
stackexchange_codegolf
Your goal is to write some code that will output the shortest unique decimal sequence for the input fraction. No two fractions with the same denominator may have the same output, although it's possible for fractions with different denominators to have the same representation. Take 2 integers as input, the first is the ...
stackexchange_codegolf
Your input will be a string consisting of small english letters. Your task is to determine the number of distinct permutations of the original string that are a palindrome. The input string has up to 100 letters. In the case of a longer string the result might be very big so the output should be the number of permutati...
stackexchange_codegolf
Sometimes, when I'm really bored (really bored), I like to draw a line segment and draw points on it. First, I draw a line segment of a certain size, which is 2^N for some value of N. The line will be represented by a series of . characters. ................ Then, I plot a point at the left end. Points will be repre...
stackexchange_codegolf
Given two inputs, a number n and a dimension d, generate the nth d-dimensional pyramid number. That was confusing, let me try again. For d = 1, the numbers start 1,2,3,4,5 and is the number of points in a line n points long. For d = 2, the numbers start 1,3,6,10,15 and is the number of points in a triangle with side le...
stackexchange_codegolf
Help! I printed a bunch of rational numbers with no spaces or other delimiters other than the / in the fractions. There is, however, good news! All the numbers are positive. There are no improper fractions, every numerator is less than its denominator and any integers are represented directly, not as fractions. Any non...
stackexchange_codegolf
Following this question: Tut-tut-tut-tut-tut Write a program that writes "tut-tut-tut" without using the characters "t", "u" or "-" in the code itself. This is code golf, shortest code in bytes wins.
stackexchange_codegolf
A lazy physicist has the job to perform the double slit experiment. However, they are lazy and can't be bothered to set up all the equipment themselves and so are going to simulate the effects. They can't program though so are going to need some help. As they are lazy your program should be as short as possible. Given...
stackexchange_codegolf
At the time of writing this puzzle, there are soon to be 269 puzzles related to primes. To celebrate/mourn this event (269 is prime), this challenge will be about exploding primes. In preparation for this task, I've obtained a permit (legal, I assure you) for dynamite charges of military grade, along with enormous dyna...
stackexchange_codegolf
Use any programming language to display numbers between 1 and 99 (including both) in such a way, so that: the numbers are separated by single space, if a number is divisible by 3, it should be in parentheses, if a number is divisible by 4, it should be in square brackets, if a number is divisible by both 3 and 4, it s...
stackexchange_codegolf
Your task Given a numerical string or integer \$\ge 0\$ (which may have leading zeros), convert it to letters using the below rules. Rules Loop through the digits: If the digit is 0 or 1, combine it with the next digit and output that letter of the alphabet (0-indexed). If the digit is 2, combine with the next digit O...
stackexchange_codegolf
This is Hole-3 from The Autumn Tournament of APL CodeGolf. I am the original author of the problem there, and thus allowed to re-post it here. Given: a number of turns (please state if no movements is 0, otherwise we'll assume it is called 1) and a list of one or more starting positions (in any form, e.g. 0 or 1 ind...
stackexchange_codegolf
(Based on this closed challenge, related) Given an integer n > 1, draw a grid composed of the characters: "-" "+" and "|". However, since I want the grid to look nice, the horizontal component should be 2 wide. Trailing spaces for each line are not required. Examples: n = 2 | --+-- | n = 3 | | --+--+-- | ...
stackexchange_codegolf
This is a relatively simple question. I'm trying to golf a Snake game I've written, and I'm trying to work out if there's a way to golf the following conditional assignments which control x and y coordinates of the snake ensuring a wrap around of the play area: if (P<0) { P = T-1; } if (P>T-1) { P = 0; } if (Q<0) {...
stackexchange_codegolf
The original "Blue Eyes" puzzle is given here (and below). A group of people with assorted eye colors live on an island. They are all perfect logicians -- if a conclusion can be logically deduced, they will do it instantly. No one knows the color of their eyes. Every night at midnight, a ferry stops at the islan...
stackexchange_codegolf
Write a program that takes in (via stdin or command line) a string with the recursive form PREFIX[SUFFIXES] where PREFIX may be any string of lowercase letters (a-z), including the empty string, and SUFFIXES may be any sequence of strings with the recursive form PREFIX[SUFFIXES] concatenated together, including the e...
stackexchange_codegolf
A complete deterministic finite automaton is a machine, with some states. Each state in the automaton has, for each character in the alphabet, a pointer to a state (not necessarily a different one). The automaton starts at some state, and then reads a string, character by character. For each character, the automaton mo...
stackexchange_codegolf
Your geologist buddy nearly kicked down your office door as he burst in, eyes wide in excitement, and asked you to come with him to a site he just discovered. On the way he explains that he thinks he literally just struck gold. Only problem is, it's buried deep underground in a cavern with a very unstable roof. It's to...
stackexchange_codegolf
A simple graph is toroidal if it can be drawn on the surface of a torus without any edges intersecting. Your task is to take a simple undirected graph via any reasonable method (adjacency matrix, edge vertex sets, etc.) and decide whether or not it is a toroidal graph. You should output one of two distinct values for...
stackexchange_codegolf
Inspired by both the challenge "Unique is Cheap" by @Laikoni, where the score is based on the challenge itself, as well as the JavaScript (ES6) answer of @ETHproductions for the "Palindrome Compression" challenge, where he uses a pretty cool compression method for the palindrome-flag, upper/lower case indication, and l...
stackexchange_codegolf
Part of Advent of Code Golf 2021 event. See the linked meta post for details. The story continues from AoC2015 Day 5, Part 2. Santa needs help figuring out which strings in his text file are naughty or nice. He has already tried two sets of rules, but they're totally ad-hoc, cumbersome, and janky, so he comes up with ...
stackexchange_codegolf
Objective Given a nonempty unordered list of positive integers, decide whether they can be added, negated, or multiplied to yield a single zero. Each given number must be used exactly once. There is a taboo. Do not multiply zero to anything. Adding zero to anything is OK. Examples Truthy List, Solution [1,1], 1-1 [1,1,...
stackexchange_codegolf
We start with a blank 1-indexed sequence: _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,... In the nth step, we fill in every a(n) blanks with the integers greater than 1 starting at the first remaining blank, where a(n) is the nth entry in the sequence. After the first step: 2,_,3,_,4,_,5,_,6,_,7,_,8,_,9,_,10,_,11,...
stackexchange_codegolf
The input is an array of (at least 3, maximum 20) different integers. Each integer is greater than -1000 and smaller than 1000. Your task is to shrink the numbers by "linearly mapping" them from 0.0 to 1.0. This means the smallest number in the array will be mapped to 0.0, the largest to 1.0. You get the array as a par...
stackexchange_codegolf
In calculus, the derivative of a mathematical function defines the rate at which it changes. The derivative of a function f(x) can be marked as f'(x), and these can sometimes be abbreviated to f and f'. The derivative of the product of two functions fg is f'g + g'f. The derivative of three fgh is f'gh + fg'h + fgh'. In...
stackexchange_codegolf
Story (skip, if you prefer the naked task): You need five skills for an imaginary sport: Speed, strength, endurance, accuracy and tactics. If you achieve a score in each of these disciplines, you can work out how well you have mastered the sport as a whole. But, as your coach always says: concentrate on your strengths,...
stackexchange_codegolf
Introduction You are listening to a car radio. You are pressing seek up/down, moving you to the next frequency some radio station broadcasts on, to avoid all this pointless music and listen to all the ads, or vice versa. If you try to go below the lowest frequency radio can handle, it jumps to the highest (and vice ver...
stackexchange_codegolf
A set of n positive numbers has 2^n subsets. We'll call a set "nice" if none of those subsets have the same sum. {2, 4, 5, 8} is one such nice set. Since none of the subsets has the same sum, we can sort the subsets by sum: [{}, {2}, {4}, {5}, {2, 4}, {2, 5}, {8}, {4, 5}, {2, 8}, {2, 4, 5}, {4, 8}, {5, 8}, {2, 4, 8}, {...
stackexchange_codegolf
Notwen wants to study the kinematics of bodies thrown from big heights in a uniform gravitational field but unfortunately he doesn't have the technical possibility to go to sufficiently high places and observe the objects while falling. But who doesn't want to see advances in science so... Let's help Notwen build a gra...
stackexchange_codegolf
The flag of Tennessee is specified by chapter 498 of the Public Acts of 1905. An oblong flag or banner in length one and two thirds times its width, the large or principal field of same to be of color red, but said flag or banner ending at its free or outer end in a perpendicular bar of blue, of uniform width, running...
stackexchange_codegolf
It's laundry day, and you have lots of clothes that need to be washed. Wanting to have as much time left over for code golf as possible, you hope to optimize how quickly you wash and dry them all. You have three types of appliances: Washing machines: Take dirty clothes and turn them into wet clothes Dryers: Take wet c...
stackexchange_codegolf
Take as input an integer in any reasonable format. Then, output all the proper sub-strings of the base-10 digits of that integer that are powers of two, in any reasonable format. Test cases 10230 -> [1, 2] 13248 -> [32, 1, 2, 4, 8] 333 -> [] 331 -> [1] 32 -> [2] # As 32 is not a proper sub-string, since it is the whole...
stackexchange_codegolf
Given a number n and an upper limit l list the numbers that can be created by multiplying two or more numbers consisting of only sevens of length n or less that are less than l. A161145 is close to this challenge, however, you will NOT be including the 7, 77, 777, 7777, 77777, etc.. Examples n=anything, l<49 would resu...
stackexchange_codegolf
Objective Given a nonempty multiset of Rock, Paper, and Scissors, output the winning figure according to the special rule. Background For a multiplayer RPS, if all three figures come out, usually it's considered a draw. But by that rule, the probability to draw would dramatically increase when there are many and many p...
stackexchange_codegolf
Given a 24 hour time, e.g. 20:48, output the nearest time where each adjacent pair of digits has an absolute difference of 1, e.g. 21:01. That is, each number in the output must differ from the numbers next to it by 1, and the output must be the closest time, forwards or backwards, for which this is true. Time can be c...
stackexchange_codegolf
It's lunch time, I am hungry and I came to your Sushi Bar. You are the Sushi Chef and you have to produce a full program or function to make me some sushi! Credits: Wikipedia Disclaimer: The image is for illustration purposes only and do not necessarily represent the exact product. Although you have limited ingredien...
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
Inspired by Copied from this question at Stack Overflow. Given a matrix A, create a matrix B such that the columns of A are arranged in a block-diagonal fashion. For example, given 1 2 3 4 5 6 the output would be 1 0 0 4 0 0 0 2 0 0 5 0 0 0 3 0 0 6 Rules Input and output may be in the form of 2D arrays, nested arrays...
stackexchange_codegolf
Anyone who is moderately into low level code optimization know about the perils of branching, be it implemented as if-statements, loops or select-statements the possibility of a branch misprediction is a terrible clock-wasting thing. Simple problems can be solved much better with simple arithmetic, so let's do that. Fo...
stackexchange_codegolf
Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values. The challenge is to write the shortest program that takes a polynomial, of degree at most 4, and simply returns how many distinct real roots said polynomial...
stackexchange_codegolf
Fastest code is a scoring method on this site where the goal is to write code that is as fast as possible. From the tag wiki: The winner of a fastest-code challenge is determined by the runtime performance of the submissions. For fairness, all submissions should be benchmarked on the same machine, which usually means ...
stackexchange_codegolf
Sandbox What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then rotated by 0, 120 and 240 degrees respectively, as shown in the following image. A triangle hole may appear in the middle, but that isn't a ...
stackexchange_codegolf
Given a multi-line string as input containing characters "|", "_" and " " (space), count the number of cells it contains. A cell is the following structure of 3 characters by 2 lines: _ |_| That is, an underscore on one line (the characters to its right and left don’t matter), and "|_|" right below it. Two cells can ...
stackexchange_codegolf
Matthias Goergens has a 25,604-character (down from the original 63,993-character) regex to match numbers divisible by 7, but that includes a lot of fluff: redundant parentheses, distribution (xx|xy|yx|yy rather than [xy]{2}) and other issues, though I'm sure a fresh start would be helpful in saving space. How small c...
stackexchange_codegolf
This should be a fairly simple challenge. For an array of numbers, generate an array where for every element all neighbouring elements are added to itself, and return the sum of that array. Here is the transformation which occurs on the input array [1,2,3,4,5] [1,2,3,4,5] => [1+2, 2+1+3, 3+2+4, 4+3+5, 5+4] => [3,6,9,12...
stackexchange_codegolf
Qat is a tool that lets you search for words matching a given pattern, often used by crossword and other word puzzle writers and solvers. In this challenge, you will have to implement a specific part of Qat, namely a subset of the "equation solver". Equations The output of a Qat query depends on the dictionary you use ...
stackexchange_codegolf
A compound word is a word that contains 2 or more words in it. We can do better than that, though. We need you to create 1 (nonsensical) word that contains every word. However, we want this word to be as short as possible. We can use overlapping letters to achieve this. For example, if your word list was ["cat", "at...
stackexchange_codegolf
Introduction I have a room full of magic mirrors. They are mysterious artifacts that can duplicate any item, except another magic mirror. More explicitly, a duplicate version of the item will appear on the other side of the mirror, at the same distance. However, if there is another magic mirror in the way on either sid...
stackexchange_codegolf
You probably know the game mastermind: The player tries to guess a code of 4 slots, with 8 possible colors - no duplicates this time. Let's call those colors A through H, so possible solutions could be ABCD or BCHD. Each time you place a guess, the game master will respond with two information: how many slots you got r...
stackexchange_codegolf
From the Wikipedia article: Location arithmetic (Latin arithmeticæ localis) is the additive (non-positional) binary numeral systems, which John Napier explored as a computation technique in his treatise Rabdology (1617), both symbolically and on a chessboard-like grid. What? Location numerals is a way of writing numb...
stackexchange_codegolf
What? Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work: For each character in the given string. Take the character's ASCII value and subtract it by 48. Multiply the output value by 10. (The output at...
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
Problem Given a positive integer n where n < 100 Output a diamond pattern as follows: Input n=1 /\/\ \/\/ Input n=2: /\ /\ //\\/\/\//\\ \\//\/\/\\// \/ \/ Input n=3: /\ /\ //\\ /\ /\ //\\ ///\\\//\\/\/\//\\///\\\ \\\///\\//\/\/\\//\\\/// \\// \/ \/ \\// \/ ...
stackexchange_codegolf
I have a problem for a cyber club that asks you to print: ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/.-,+*)('&%$#"! Using Brainf**k in 29 bytes or less without using the ',' character. I have a working code: ++++++++++[>++++++>+++++++++<<-]>-->.<[>-.<-] However my loop is too long, sending me 16 bytes over the limi...
stackexchange_codegolf
We had a challenge on Multiplicative Persistence here. As a recap, to get a multiplicative persistence of a number, do these steps: Multiply all the digits of a number (in base \$10\$) Repeat Step 1 until you have a single digit left. Then count the number of iterations. More here on Numberphile: Numberphile "What's...
stackexchange_codegolf
Perhaps something like this is here already, but I couldn't find it. It is not the same as Aligning Lines!. Example: Input: 98.6 $2,750.17 -$23 -86 3,120,487.19 Output: 98.6 $2,750.17 -$23 -86 3,120,487.19 Note that .6 isn't right-padded to .60 or .6 . Input: A list/array of strings (or lines fr...
stackexchange_codegolf
Stolen from @Downgoat with permission The point of this challenge is to (not) settle the debate on the pronunciation of "gif". " The pronunciation of gif is debated and while it's supposed to be (and should be) pronounced jif, it's still commonly disputed. In this challenge you will be given a set of words that have ...
stackexchange_codegolf
Related to: Make a ;# interpreter and Generate ;# code ;# - A Whirlwind Guide This is a simple language with two commands. Its only data structure is an accumulator, which is initialized to 0. ; Increment the accumulator # Calculate the value of the accumulator modulo 127, and print the corresponding ASCII character....
stackexchange_codegolf
My friend made a lisp translator the other day, that is to say it took a string and converted s=>th and S=>Th. It was quite long and I thought that it could be golfed. So the task is to make a program/function that takes an input string, translates it in to lisp and outputs the string Test case Sam and Sally like Sheep...
stackexchange_codegolf
\$BB\$ is the busy beaver function, an uncomputable function. Write a program which when given an integer \$n\$ as input, will output \$BB(n)\$, with at least \$\frac 2 3\$ probability. You can do whatever (return something wrong, infinite loop, explode, etc.) in other cases. To help you compute it, you're given a func...
stackexchange_codegolf
I was in the bus today, and noticed this sign: seated standing wheelchairs max1 37 30 00 max2 36 26 01 max3 34 32 00 The number of seated passengers, standees, and wheelchairs all have to be no larger than some row in the table. (See chat fo...
stackexchange_codegolf
Characters in strings are sometimes represented as their ASCII hexadecimal codes. Printable characters have two hex digits in their representation. Swapping those digits leads to another character, which will be our output. The table of relevant character codes can be found on Wikipedia. Details Take a string as input...
stackexchange_codegolf
Given only a straightedge and compass, inscribe a rhombus inside the given rectangle, sharing two opposite points. Input Input is the dimensions of the rectangle. In the example shown, that would be 125, 50. You can take input in whatever way is most convenient (as two integers, list, strings, etc). The larger dimensi...
stackexchange_codegolf
New Bonus! (See below) The cartography team of U.S. Republican presidential hopeful Ben Carson is having some trouble with their maps (image via Washington Post): The problem is they don't have the Right Tool For The Job™. They need the most compact and reliable program possible, so they never have to worry about maki...
stackexchange_codegolf
Background Many esoteric programming languages don't have numbers built in at literals, so you have to calculate them at runtime; and in many of these cases, the number representation can be quite interesting. We've already had a challenge about representing numbers for Underload. This challenge is about representing n...
stackexchange_codegolf
...counted! You will pass your program a variable which represents a quantity of money in dollars and/or cents and an array of coin values. Your challenge is to output the number of possible combinations of the given array of coin values that would add up to the amount passed to the code. If it is not possible with t...
stackexchange_codegolf
Given a textual representation (case-insensitive full name or 3 character abbreviation) of a month return the number of days in the month. For example, december, DEC, and dec should all return 31. February can have either 28 or 29 days. Assume the input is a month in one of the correct forms.
stackexchange_codegolf
Summary Implement FizzBuzz in Python, with the fewest possible tokens. Challenge Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print...
stackexchange_codegolf