instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
My friend and I were working on a lab in our AP Computer Science class and decided to code golf one one the problems since we still had half the class free after we finished. Here is the question: Given a number n, is n divisible by each of its digits? For example, 128 will pass this test- it is divisible by 1,2, and...
stackexchange_codegolf
Imagine you have two lights. These lights blink on and off at a specific rate: Light 0: Delay 0ms and then blink every 1000ms Light 1: Delay 500ms and then blink every 1000ms Let's simulate these lights for the first 2000ms: 0ms: Light 0 on 500ms: Light 1 on 1000ms: Light 0 off 1500ms: Light 1 off 2000ms: Light 0 ...
stackexchange_codegolf
Challenge Premise I've got multiple pretty numbers all in a row. Each is a decimal digit. 0s are weakly attracted to 0s, 1s are attracted to 1s a little more strongly and so on until 9. I don't know why — it must be something I ate. As a result, a sort of two-way sideways sedimentation occurs until the higher values ar...
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
Tom is going to implement a new programming language of his invention. But before actually starting working on it, he wants to know whether his language should be case sensitive or not. On one hand, case insensitivity seems more easy to implement to him, but he worries that it could cause a lack in the possibilities o...
stackexchange_codegolf
I personally love quines, but they all seem to be so... static. So why not create a quine that can do more. Challenge The challenge here is to create a quine that without any sort of input is a normal quine. Then if it receives a different input, it outputs a different quine in a different language. (basically like a p...
stackexchange_codegolf
Challenge Given a string of any length which contains only digits from 0 to 9, replace each consecutive run of the digit 0 with its length. Test Cases 1234500362000440 → 1234523623441 123450036200044 → 123452362344 000000000000 → 12 0123456789 → 1123456789 1234567890 → 1234567891 123456789 → 123456789 010203004050 → 1...
stackexchange_codegolf
Originally the Multiplicative digital root Challenge Basically do what the title says Method Given a positive integer 1 <= N <= 100000000 through one of our standard input methods, multiply every digit together, ignoring zeroes. Ex: Take a number, say 361218402: 3 * 6 = 18 18 * 1 = 18 18 * 2 = 36 36 * 1 = 36 36 * 8 =...
stackexchange_codegolf
For each character in your program, the program with that character removed must produce a number smaller than the program with the next character removed. Your base program isn't required to do anything, and may be invalid. An example submission could be abcd, where bcd outputs 1, acd outputs 4, abd outputs 5, and abc...
stackexchange_codegolf
Given 2 random circle sections, return how many times they intersect. Rules/clarifications are as below. You are provided 10 total values, The center (x,y) of the circle section Angles of the circle (i.e. (0,90) would be a quarter circle "facing" the top-right corner. The radius of the circle section The circle s...
stackexchange_codegolf
Inspired by this challenge (or, more specifically, by misreading it), I've come up with the following challenge: Given an input string S, reverse the order of all uppercase characters, and all lowercase characters. Leave all non-letter characters in place. For instance: Note that the uppercase W (the first uppercase l...
stackexchange_codegolf
Today's problem is easy. You're given two strings A and B of equal length consisting of only the characters ( and ). Check whether after any number of operations you can make both strings balanced or not. The only operation allowed is swapping A[i] and B[i], where i is an arbitrary index. Here is the definition of a ba...
stackexchange_codegolf
Background It was a normal presentation that I were in as a audience, until the presenter gave a math problem about repeat taking 2 number out of a list a replacing them with average, claiming that there will be something special about it, and our math teacher, sitting at the end of classroom, exciting rushed to me, an...
stackexchange_codegolf
Challenge: Given a checkerboard, output the smallest amount of moves it would take (assuming black does not move at all) to king a red piece, if possible. Rules: Red's side will always be on the bottom, however their pieces may start in any row (even the king's row they need to get to). Black pieces are stationary, me...
stackexchange_codegolf
This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/args. But again, The tricky part is that if I rot-13 your source code, the output must be returned rot-19. Your co...
stackexchange_codegolf
Generator functions This gives the context for why this challenge came to life. Feel free to ignore. Generator functions are a nice way of encoding the solution to a problem of combinatorics. You just write some polynomials, multiply them and then your solution is the coefficient of one of the terms. For example, how m...
stackexchange_codegolf
A store is having a big sale. If your price reaches $199 or more, you can reduce it by $100. You can buy each product only once. Here's an example list of products: (in order to simplify, the names of the products are represented by letters) +------+-------+ | name | price | +------+-------+ | A | 26.9 | | B | 2...
stackexchange_codegolf
Given a number as input, print out its collective sum What is a collective sum? Consider the number 13214, the input Looping through each of the digits starting from the left, we will be able to obtain its collective sum. 1 means look at the first digit, and add it to the sum, sum = 1 3 means look at the "first 3 digit...
stackexchange_codegolf
Your task is to write a program that performs case conversion from plain text, and other case formats, into one of the specified formats below. Inputs will be either plain lowercase text, or one of the detailed cases below. You must remove non-alphabetic characters except (space), _ (underscore) and - (hyphen), then ...
stackexchange_codegolf
You're given a tree, which in computer science tradition, has the root at the top and leaves at the bottom. The leaf nodes are labelled with numbers. Your goal is to take the special leaf marked -1 and move it up to be the new root. [3, [[16], -1], [4]] --> [[[[4], 3], [16]]] You can imagine rotating the special lea...
stackexchange_codegolf
Given a 2-dimensional jagged array and a fill value, pad the array in both dimensions with the fill value to ensure that it is square and not jagged (i.e., all rows are the same length, and that length is the same as the number of rows). The fill values should always be added to the "edges", which may be the start or t...
stackexchange_codegolf
Given a PPCG user's user ID, calculate how much times is their Each SE site reputation is from average reputation in the Stack exchange sites they have made accounts. Let me explain, If someone's total network reputation (Total reputation in the stack exchange sites he has participated) is 10k, and if he has participat...
stackexchange_codegolf
Your code-golf challenge is to find all occurences of a word in the 3d matrix. There is no restriction on I/O format. In the samples below, the word is presented, then a blank line, then the 2-dimensional layers from top to bottom, and the output, for each line, consists of a coordinate and a direction (x, then y, then...
stackexchange_codegolf
Aliens have arrived, and they aren't friendly. Turns out, they've been in the process of converting all matter in the universe into compute capability so they can have more fun in their VR simulations. Our solar system is the last bit of space they haven't converted yet, and they're about to remedy this oversight. Howe...
stackexchange_codegolf
Every day, every minute, ... every microsecond, many decisions are made by your computer. In high-level languages, these typically take the form of statements like if, while and for, but at the most basic level there exist machine language instructions called branch/jump instructions. Modern processors queue instructio...
stackexchange_codegolf
Given an input string, output that string with all vowels a, e, i, o and u swapped at random between each other. For example, in the string this is a test, there are 4 vowels: [i, i, a, e]. A valid shuffling of those vowels could be [a, i, e, i] therefore yielding the output thas is e tist. About shuffling All shuffles...
stackexchange_codegolf
Toki Pona is a constructed language with 137ish words, designed to constrain the speaker to expressing ideas in a simple and straightforward manner, reducing ideas to more essential forms. Often, people attempt to avoid directly expressing numeric quantities in Toki Pona, opting to express them in more practical terms....
stackexchange_codegolf
Recently I read the novel "The Solitude of Prime Numbers" where the main characters are somewhat compared to twin prime numbers ("always together, but never touching"). A twin prime is a prime number that is either \$\require{cancel}2\$ less or \$2\$ more than another prime number —for example, the twin prime pair \$(...
stackexchange_codegolf
This challenge is based on some new findings related to the Collatz conjecture and designed somewhat in the spirit of a collaborative polymath project. Solving the full conjecture is regarded as extremely difficult or maybe impossible by math/number theory experts, but this simpler task is quite doable and there is man...
stackexchange_codegolf
Given a square of text representing a spiral of characters, rotate it! The spiral starts at the center and moves counterclockwise to the outer edge, starting to the left of center: 987 216 345 This translates to the string 123456789. Rotation is done to the left, so if you rotate it one position, it will be 234567891....
stackexchange_codegolf
Problem Given an input a where a is a truthy/falsy value output the exact impossible cube below if truthy and the exact normal cube below if falsey. Input truthy: ___________________________________ / _______________________________ /| / / _____________________________/ / | / / /| | ...
stackexchange_codegolf
Challenge A repdigit is a non-negative integer whose digits are all equal. Create a function or complete program that takes a single integer as input and outputs a truthy value if the input number is a repdigit in base 10 and falsy value otherwise. The input is guaranteed to be a positive integer. You may take and use ...
stackexchange_codegolf
The challenge Write a function that returns the nth element of an array even if its out of bound. function safeGet(index, arr) { const safeIndex = ??? return arr[safeIndex] } const arr = ["a", "b", "c"]; safeGet(0, arr) // "a" safeGet(1, arr) // "b" safeGet(2, arr) // "c" safeGet(3, arr) // "a" go back to the be...
stackexchange_codegolf
As of 13/03/2018 16:45 UTC, the winner is answer #345, by Khuldraeseth na'Barya. This means the contest is officially over, but feel free to continue posting answers, just so long as they follow the rules. As well, just a quick shout out to the top three answerers in terms of numbers of answers: 1. NieDzejkob - 41 ans...
stackexchange_codegolf
All variables in this question are integer valued. Input 4 integers w, x, y, z. They can be positive or negative and will be less than 1048576 in absolute value. Output The general solution to the equation. \$ aw+bx+cy+dz = 0 \$. The variables \$a, b, c, d\$ must all be integer values. Output format Your output should ...
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
Let's say we have a n × n lattice; we can then divide the lattice into two sections by drawing a line through the lattice. Everything to one side of the line is in one set and everything else in another. How many ways can we divide the lattice in the manner? For example lets take a 2 × 2 lattice: . . . . We can make ...
stackexchange_codegolf
As in this challenge, the task is to generate the vertices of a polyhedron. The polyhedron here is the one obtained by dividing a regular icosahedron's triangular faces into smaller triangles so that each edge is divided into \$b\$ segments (denoted \$\{3,5+\}_{b,0}\$ here) and projecting onto the unit sphere. Your pro...
stackexchange_codegolf
The Task I guess everybody loves automatic code generation and saving some time during work. You have to create a lot of classes and members during the day and you don't want to create all those getters manually. The task is to write a program or function, that generates getters for all class members automatically for ...
stackexchange_codegolf
Related: Deck Names Friends or Foes Paying for Spells The Magic: the Gathering card game has five colours of magical mana: white (W), blue (U), black (B), red (R), and green (G). Cards can be any of the \$2^5=32\$ subsets of these colours. Hereafter 'colours' refer just to the initials W, U, B, R, G. The order that the...
stackexchange_codegolf
Briefing You are a bot, in a 2D grid that extends infinitely in all four directions, north, south, east and west. When given a number, you must move the bot so that you get to the target number. Here's how the grid works: You can move in 4 directions: north, south, east or west. Once you move off a cell, you are not al...
stackexchange_codegolf
Your challenge is to write a polyglot that works in different versions of your language. When run, it will always output the language version. Rules Your program should work in at least two versions of your language. Your program's output should only be the version number. No extraneous data. Your program may use what...
stackexchange_codegolf
Objective Create a function to reverse string concatenation Input Two strings (alphanumeric + spaces), where one should be subtracted for the other. You can assume that the string to be subtracted will never be larger than the other one. Output The result from the subtraction Subtraction You should remove one strin...
stackexchange_codegolf
Task Given a winning Wordle play results (clues), the target ("secret") word and a list of words, output a possible sequence of words leading to such results. The words in the list will be distinct and so should be the output. You may assume that for given inputs a solution exists. If there is more than one, you may ou...
stackexchange_codegolf
Introduction Suppose I have a list of integers, say L = [-1,2,2,1,2,7,1,4]. I like having balance in my life, so I'm happy to see it has as many odd elements as even elements. What's more, it also has an equal number of elements in all modulo classes of 3 that it has elements in: [-1,2,2,1,2,7,1,4] 0 mod 3: 1 ...
stackexchange_codegolf
EDIT (Jan 19, 2022, 18:00 UTC): This challenge is now over. The winner is Citty with this Pyth answer. Congratulations! This is an answer-chaining challenge where each answer must take an integer \$N\$ as input and return the 1-indexed ID of the answer which was written by the user whose ID is \$N\$. You may want to s...
stackexchange_codegolf
Task similar to this one. Take a string of ASCII characters and convert it to base-3 equivalents separated by a space. For example: Hello, world! Should be converted to 02200 10202 11000 11000 11010 01122 01012 11102 11010 11020 11000 10201 01020 The output should only contain numbers with the same number of digits. ...
stackexchange_codegolf
Description of the problem Imagine a quarter of an infinite chessboard, as in a square grid, extending up and right, so that you can see the lower left corner. Place a 0 in there. Now for every other cell in position (x,y), you place the smallest non-negative integer that hasn't showed up in the column x or the row y. ...
stackexchange_codegolf
What is the shortest regular expression equivilant to the following? ENERO|GENER|GENNAIO|IANUARI|IANUARII|IONAWR|JAANUARIL|JANAIRU|JANAR|JANNEWARIS|JANUAR|JANUARI|JANUARIE|JANUARO|JANUARY|JANUWALE|JANVIER|JANVYE|JENUWARI The shortest regex, in bytes, wins. If you are worried about what flavor of regex we are using, th...
stackexchange_codegolf
This is my attempt to pair code-shuffleboard with code-golf. You need to write a full program or function that sums all codepoints of the input string. If there is no input, you can output any number, including 0. Rules The input will always be in printable ASCII. The sum of the codepoints of your source must be exact...
stackexchange_codegolf
Write a program that takes in a string and spells that word out using the NATO Phonetic Alphabet. The mapping is as follows: 'A' -> 'Alfa' 'B' -> 'Bravo' 'C' -> 'Charlie' 'D' -> 'Delta' 'E' -> 'Echo' 'F' -> 'Foxtrot' 'G' -> 'Golf' 'H' -> 'Hotel' 'I' -> 'India' 'J' -> 'Juliett' 'K' -> 'Kilo' 'L' -> 'Lima' 'M' -> 'Mike'...
stackexchange_codegolf
The skip-pure numbers are defined with this rule: A(0) = 1 A(1) = 1 A(n) = the smallest positive number not in the sequence such that A(x) + A(x-2) for any x never appears For example, the term A(2) is 2, because 1 has already appeared. The term A(3) is 4, as A(2) + A(0) = 3 and 3 is disallowed by the third line of th...
stackexchange_codegolf
Background A Ruth-Aaron pair is a pair of consecutive positive integers n and n+1 such that the sum of the prime factors (counting repeated prime factors) of each integer are equal. For example, (714,715) is a Ruth-Aaron pair, since 714=2*3*7*17, 715=5*11*13, and 2+3+7+17=5+11+13=29. The name Ruth-Aaron pair was chosen...
stackexchange_codegolf
Task Given two positive integers \$m,n\$, imagine a chessboard of size \$m \times n\$. A chess queen is on the upper-left corner. In how many ways can it reach the lower-right corner, by moving only right, down, or diagonally right-down (possibly moving many steps at once, because it's a queen)? The resulting 2D sequen...
stackexchange_codegolf
Write code to generate a PDF file containing 6 bingo cards. Winner is the one that uses the shortest code and needs no actions except for installing a library and running the code. (No Save As PDF). Rules are as follows. The generated PDF file should display accurately in Adobe's PDF reader, Google Chrome and Moxilla ...
stackexchange_codegolf
Given a string l, find all palindromic substrings p of l (including duplicates and single character strings). Next, rearrange all sub-strings in p into a valid palindrome (there may be multiple correct answers). If it is not possible to rearrange p into a single palindrome, your program may have undefined behavior (err...
stackexchange_codegolf
Douglas Adams was born on March 11, 1952, and died when he was just 49. In honor of this wonderful writer, I challenge you to display 42 in the most creative way possible. You could print it in the log, via some convoluted method, or display it as ASCII art, or anything! Just come up with a creative method of displayin...
stackexchange_codegolf
Your task, should you choose to accept it, is to take two input values \$a\$ and \$b\$, where \$a\$ and \$b\$ are in the set \$\{T, U, F\}\$, and compute and output their logical conjunction in a three-valued logic system. A three valued logical conjunction is this transformation: a b output U U U U F F F ...
stackexchange_codegolf
Given an integer n, print out n * reversed(n) reversed(n) is the number you get when you reverse the digits of n. reverse(512) = 215 reverse(1) = 1 reverse(101) = 101 >>>>>>>> func(5) = 5*5 = 25 func(12) = 12*21 = 252 func(11) = 11*11 = 121 func(659) = 659*956 = 630004 Shortest code wins! Leaderboard var QU...
stackexchange_codegolf
I assume everyone here is familiar with the Caesar Cipher that shifts letters to a certain index. https://en.wikipedia.org/wiki/Caesar_cipher for those who still needs introduction. But, we can all agree that plain Caesar is unfun and way too easy. So here's a version that also shifts characters around. This version fi...
stackexchange_codegolf
In Emoji Math, a user created module for the video game Keep Talking And Nobody Explodes, numbers are written as strings of emoticons, where each emoticon represents a base 10 digit. Below is the conversion table between digits and emoticons. Digit | Emoticon 0 | :) 1 | =( 2 | (: 3 | )= ...
stackexchange_codegolf
The primorial \$p_n\#\$ is the product of the first \$n\$ primes. The sequence begins \$2, 6, 30, 210, 2310\$. A Fortunate number, \$F_n\$, is the smallest integer \$m > 1\$ such that \$p_n\# + m\$ is prime. For example \$F_7 = 19\$ as: $$p_7\# = 2\times3\times5\times7\times11\times13\times17 = 510510$$ Adding each num...
stackexchange_codegolf
Inspired and looted from this dice challenge by Arnauld Input You are given a 5x1 or 1x5 (your choice) dice matrix which consist of binary 3x3 sub-matrices. Goal Given a valid dice matrix, you are to score it using the rules of 6,5,4 which are as follows: If the roll contains 6,5,4, add the other two dice together and...
stackexchange_codegolf
In set theory, a set is an unordered group of unique elements. A pure set is either the empty set \$\{\}\$ or a set containing only pure sets, like \$\{\{\},\{\{\}\}\}\$. Your challenge is to write a program that enumerates all pure sets, in some order of your choice. Standard sequence rules apply - you may: Output al...
stackexchange_codegolf
Challenge Given two strings in any default I/O format, do the following: NOTE: The challenge will refer to the first string as the "data" and the second referred to as the "program". Change the program to an infinite string which is just the program repeated infinitely (e.g. 10 --> 1010101010...). The challenge will r...
stackexchange_codegolf
As the majority of nations using the Euro have the , as the decimal separator, you must use it also. The task is to output all the values of the Euro coins and notes in ascending order. You must also put the trailing ,00 on the integer values. 0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,0...
stackexchange_codegolf
The Home Prime of an integer \$n\$ is the value obtained by repeatedly factoring and concatenating \$n\$'s prime factors (in ascending order, including repeats) until reaching a fixed point (a prime). For example, the Home Prime (\$\text{HP}(n)\$) of \$10\$ is \$773\$ as: $$\begin{align} 10 & = 2 \times 5 \to 25 \\ 25 ...
stackexchange_codegolf
SVG is an XML vector graphics markup language embeddable in web content. Your tips should be at least somewhat specific to SVG. Please post one tip per answer.
stackexchange_codegolf
Your challenge is to output a Base64-encoded version of your source code, and optionally a line break. You must output the correct padding, if any. Standard quine rules apply, shortest answer wins. It must be a valid RFC 4648 encoded base64 string, with no linebreaks (except optionally a trailing newline). Test cases: ...
stackexchange_codegolf
Introduction Time is a really simple concept. Seconds pass, one after the other, all the same. But humans love making it hard. This Stackoverflow question has gathered many answers and even though they are surprisingly long and complex, most of them will still fail for certain inputs. Can you format a number of seconds...
stackexchange_codegolf
Background This is a follow up question to the question: Will the Hydra finally die? As before a dangerous A Medusa have released a dangerous Hydra which is revived unless the exact number of heads it have is removed. The knights can remove a certain number of heads with each type of attack, and each attack causes a sp...
stackexchange_codegolf
Context At Hogwarts School of Witchcraft and Wizardry, students are sorted into 4 houses, Gryffindor, Ravenclaw, Slytherin and Hufflepuff. This sorting is done by a magical hat, called the Sorting Hat. Task Your task is to code a sorting hat. In other words, you should create some deterministic rule that, given the nam...
stackexchange_codegolf
The task in this challenge is to put elements of an array into time bins. The input will be a non-decreasing array of positive integers representing the time of events, and an integer which represents the size of each bin. Let us start with an example. We call the input array A and the output array O. `A = [1,1,1,2,7,...
stackexchange_codegolf
Given \$x\$ distinguishable balls (say they have different colors), sample with replacement repeatedly until all the balls that have been seen, have been seen at least twice. Challenge The input is the integer value \$x \geq 2\$. The challenge is to compute the probability that you would have seen all the balls when yo...
stackexchange_codegolf
Challenge Your challenge is simple, calculate the depth of each matching brackets in the given input e.g. (()()(()))->[[1,1,[1]]], and output it in the form of a list/array/string representation Explanation: For every bracket in the input, you have to count how many nested brackets there are for that part of the input ...
stackexchange_codegolf
Idea from the doubler challenge, this may be more difficult. The program should output a positive integer or decimal point value higher than 0. If I duplicate the source code, the output should halve the original integer or decimal point value. But the trickier part is: If I duplicate your code any integer value \$n\$ ...
stackexchange_codegolf
Given a number, find an expression in words equaling that number, with a length of that number. Thus, to an input of 15, you might output sixteen minus one, which has fifteen characters (not counting spaces). If multiple solutions exist, print whichever you want. If none exist, print impossible Use only the operators p...
stackexchange_codegolf
The optimal matrix (for the rather narrow scope of this challenge) is obtained by "zipping" the elements from the corresponding rows and columns of a square matrix and getting the maximum of each pair. For instance, given the following matrix: 4 5 6 1 7 2 7 3 0 You can combine it with its transpose to get: [[[4,5,6],[...
stackexchange_codegolf
Given a positive integer n, do the following (and output every stage): start with a list containing n copies of n. do the following n times: at the ith step, gradually decrement the ith entry of the list until it reaches i So, for example, if the given n is 4, then you start with [4,4,4,4], and then at the first step...
stackexchange_codegolf
Based on this challenge. In the rhythm game osu!, the difficulty modifier "Double-time" actually only increases the speed by 50%. Your task, is to write a program that outputs a positive even integer (higher than 0), and when each byte/character (your choice which) in your source code is duplicated, it should output th...
stackexchange_codegolf
Given a positive integer n >= 1, output the first n rows of the following structure: # # # ### # # # # # ## ## ##### # # # # # # # # # # ### # ## ## ## # ## ### ### ####### The n-th 1-indexed row is the binary representation of n, mirrored without copying the last character, with # in place of 1 a...
stackexchange_codegolf
Originally sandboxed by @xnor Left-or-right is a very simple language @xnor made up. Its expressions are made of arrows < (left), > (right), and parentheses. The goal is to evaluate an expression to either < or >. An expression A<B picks the left item A, while A>B picks the right one B. Think of < and > as arrows point...
stackexchange_codegolf
Task: Consider the problem: "given a chessboard with one square missing, cut it into 21 L-triominoes". There is a well-known constructive proof that this can be done for any square chessboard size that is a power of two. It works by splitting the chessboard into a smaller chessboard with the hole in it and one big trio...
stackexchange_codegolf
I have a chocolate bar and I need help eating it so you'll be writing a program just to do that. Explanation The first line is the input. Examples are separated by an empty line. 7 ____ __|__| |__|__| |__|__| |__|__| 6 _______ |__|__| |__|__| |__|__| 5 ____ __|__| |__|__| |__|__| 0 1 ____ |__| Spec ...
stackexchange_codegolf
I think is about time to do another Pokemon challenge! Even if Pokémon Go is not as mainstream as it used to be... The task. Just draw a MISSINGNO. MISSINGNO is an unofficial Pokémon species found in the video games Pokémon Red and Blue. IGN has noted MISSINGNO appearance in Pokémon Red and Blue as one of the most fam...
stackexchange_codegolf
Animate the text in your terminal The goal The goal is to "animate" the string "Hello world" in your output so that each character gets capitalised after each other. Your program can exit after each letter has been capitalised. For example; # Iteration 1 Hello world # Iteration 2 hEllo world # Iteration 3 heLlo worl...
stackexchange_codegolf
Does your language have a maximum recursion depth (MRD)? Let's say your language has MRD=500 Write a code that finds the recursion depth and outputs the exact value For the case above your program (or function) should output 500 Code-Golf Shortest answer wins!
stackexchange_codegolf
This is inspired by an 05AB1E answer by Magic Octupus Urn. Given two arguments, a positive integer and a string/list of characters: Translate the number to base-n, where n is the length of the string. For each character, replace every appearance of the index of that character in the base-n number with that character. ...
stackexchange_codegolf
Your task is to build the largest program you can that uses exactly one GOTO, without which the entire program (or at least a huge chunk of it) must be completely restructured. The score is counted as the number of statements in your code that change places or are newly introduced (removing statements doesn't add to y...
stackexchange_codegolf
This challenge was originally posted on codidact. You are a low-level censor working for the Ministry of Media Accuracy. Part of your job is to make sure that certain words don't appear in publications. Every morning you get a fresh stack of next week's newspapers and its your job to comb through them and fix any of ...
stackexchange_codegolf
You probably do know that the different reputation levels on Stack Exchange are formatted differently when seen from the questions page / a post. There're all the rep-formatting rules: if a user has 1 to 999 (one to three digits) rep, it's left as-is. if a user has 1000 to 9999 rep (four digits), it receives the comma...
stackexchange_codegolf
This is not just another challenge asking you to color random maps... In this challenge, you are asked to write a program that is actually used in the formal proof of the Four Color Theorem. First I shall describe the challenge without any background or motivation, for the impatient. A chromogram is a list made of the ...
stackexchange_codegolf
The idea is simple. You've to create a "visualised" letter-replacement, by providing 3 strings (input can be comma separated, separate inputs, or as an array). The first segment is the word you want to correct, and the second segment is the letters you want to replace, and the third segment is the replacement for the l...
stackexchange_codegolf
I'm currently working with a branchless language which does not have native Less-Than, Greater-Than or Equal-To functions. I do however have min, max and abs functions and standard arithmetic (+, -, / and *) available to me. I'd like to create these three functions (as L(a, b), G(a, b) and E(a, b) respectively, which w...
stackexchange_codegolf
Given a variable a (non array) or (any[]) convert to (any[]) function example(s: string | string[]) { const e = Array.isArray(s) ? s: [s] return e } Is Array.isArray(s) ? s: [s] the shortest way?
stackexchange_codegolf
Final results available Introduction After my previous KOTH with heavy themes (fantasy war, worldwide pandemic...), I'm back with a new lighthearted game. This time, you are facing off in a "board game-like" situation. A pile of upside down coins is placed at the center of a really big table, and you are determined to ...
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
In the burial place of King Silo of Asturias there is an inscription that reads SILO PRINCEPS FECIT (King Silo made this). The first letter is found in the very middle, and from there one reads by going in any non-diagonal direction radiating outward. The final letter is found on all four corners. In this challenge,...
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
The task Most Casio calculators featured a variable M, which has 3 operators related to it: M, M+, and M- M, as you can expect, returns the value stored in the variable. M+ takes the number on the left and add it to M. M- does the same thing as M+, but subtract instead. To make the challenge just a bit more difficult, ...
stackexchange_codegolf