instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
So, now that it's 2015, and a bunch of answers from last year's puzzle are now starting to produce invalid output, it's time for a question involving the number 2015. Except... why? Wouldn't you like it if your date-based answers to last year's problem were to stay valid? Why don't we change our calendar so that it's n...
stackexchange_codegolf
This is a repost of Evolution of “Hello World!”, originally written by user Helka Homba It should not be closed as a duplicated, due to meta consensus here. The original was asked over two years ago and was last active more than six months ago. I have permission from Helka Homba to post this here Since the original, ma...
stackexchange_codegolf
Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index than the second occurrenc...
stackexchange_codegolf
Challenge Suppose you have a list of numbers, and a target value. Find the set of all combinations of your numbers which add up to the target value, returning them as list indices. Input and Output The input will take a list of numbers (not necessarily unique) and a target summation number. The output will be a set of ...
stackexchange_codegolf
Given an xxd hexdump such as this one: 00000000: 1f8b 0808 4920 2258 0003 7069 6c6c 6f77 ....I "X..pillow 00000010: 2e74 7874 00d3 d707 8218 10d0 2799 c545 .txt........'..E 00000020: ba96 41a1 994c 7d60 d650 d53c 44a3 8a22 ..A..L}`.P.<D.." 00000030: cd43 34aa 28d2 3c44 a38a 22cd 4334 aa28 .C4.(.<D..".C4.( 00000040:...
stackexchange_codegolf
Create a program which takes one command-line argument, n, which will be an integer less than 2147483648 (2^31), and then reads a file input.txt and prints the lines of input.txt which contain any substring which is a positive (non-zero) multiple of n. You may choose to ignore multiples greater than 2147483647. Test ca...
stackexchange_codegolf
Introduction During work with BMP (bitmap) generator I face problem of converting number to little endian hex string. Here is function which I create in JavaScript - but wonder how small code can works similarly let liEnd= num => num.toString(16).padStart(8,'0').match(/../g).reverse().join``; console.log(liEnd(304767...
stackexchange_codegolf
A few month back, I made a language called ;# (Semicolon Hash) and it started a little bit of a craze (it even got its own tag, as you can see). But, as with everything, the craze died down, and questions related to it stopped being posted. However, a few people were annoyed at the lack of capability of ;# and this lea...
stackexchange_codegolf
Challenge : Given a string representing a mathematical expression return the result Input : A string representing a mathematical expression : '1 + 2 - 3 * (2/3 * 1)'. Output : The result after performing all operations. Operators : Possible operators + ---> plus - ---> minus * ---> multiplication / -...
stackexchange_codegolf
Introduction Suppose you have a list of lists of integers (or any objects really, but let's stick to integers for simplicity). The lists may be of different lengths, and some of them may be empty. Let's write the lists in a tabular format: [[ 1, 2, 3, 4, 5], [ 6, 7], [ 8, 9, 10, 11], [], [12, 13, 14...
stackexchange_codegolf
This task builds on: Find all reflexicons using roman numerals An autogram is a sentence that lists the count of its own letters. Below is one of the first documented autograms found by Lee Sallows in 1983: This pangram lists four a’s, one b, one c, two d’s, twenty-nine e’s, eight f’s, three g’s, five h’s, eleven i’s,...
stackexchange_codegolf
The question's pretty much described by the title: write a program or function that takes a positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to ...
stackexchange_codegolf
Background The twelve-coin problem is a classic balance puzzle commonly used in job interviews. The puzzle first appeared in 1945 and was posed to my father by my grandfather when he asked to marry my mother! In the puzzle there are twelve coins, one of which is either heavier or lighter than the others (you don't know...
stackexchange_codegolf
The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows: You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made o...
stackexchange_codegolf
A spoonerism is what you get when swap the beginnings of two adjacent words in a sentence. In this challenge, we'll try to find a plausible spoonerism based on one incorrect word. So, given a list of words** and an input word that is NOT in the dictionary, return a string (not necessarily a dictionary word) for which t...
stackexchange_codegolf
The goal of this challenge is given a finite directed acyclic graph (DAG), determine if the graph is a transitive reduction. A brief explanation of what a DAG and transitive reductions are: A DAG is a graph with directed edges (i.e. you can only travel in one direction on that edge) such that given any starting node on...
stackexchange_codegolf
A finite-permutation is a function which takes an \$n\$-tuple and produces an \$n\$-tuple such that every element of the input is present in the output, and the ordering does not rely on the values of the inputs. We can unambiguously represent these permutations with an \$n\$-tuple where each element is the index of wh...
stackexchange_codegolf
Background Character classes are a standard way to indicate a set of characters to match in regular expressions. For example, the class [ab] matches a or b, [a-z] matches any lower case letter, and [^a] matches everything but a. For the purpose of this question, classes can contain: a sequence of characters to match, ...
stackexchange_codegolf
A few month back, I made a language called ;# (Semicolon Hash) and it started a little bit of a craze (it even got its own tag, as you can see). But, as with everything, the craze died down, and questions related to it stopped being posted. However, a few people were annoyed at the lack of capability of ;# and this lea...
stackexchange_codegolf
Code Python 3, 245 bytes E=print def F(): B,C,A=1,1,1;yield 0 while True:yield B;B,C,A=B+C+A+1,C+A+1,A+1 C=int(input()) D=0 for A in range(C): E(end='*'*(C-(C-A)+1));B=A while 0<B:E(end=' '+chr(42+B)*B);B-=1 E();D+=1 for A in F(): if D==0:E(end=str(A));break D-=1 Try it online! What it does? Takes a number from...
stackexchange_codegolf
A lexicographically increasing number is an integer whose digits are in strictly increasing order. Print all lexicographically increasing numbers under 10000. Here are lines of the expected output: 0 1 2 3 4 5 6 7 8 9 12 13 14 15 16 17 18 19 23 24 25 26 27 28 29 34 35 36 37 38 39 45 46 47 48 49 56 57 58 59 67 68 69 78...
stackexchange_codegolf
Given a number x, find the sum of all primes up to that number. The input will always be a positive number, bigger than 2. An upper limit isn't defined, so data types can be ignored. Use whichever you want. This is a code-golf, so the shortest code in bytes wins. Example for 5: 2 + 3 + 5 = 10 Test cases: Input Ou...
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
Given a pattern of squares on a grid, determine if it is possible to create that pattern with non-overlapping dominoes. In case you are not familiar, a domino is a rectangular shape created by joining exactly two squares at their edges. Examples For the pattern on the left, O represents an occupied cell on the grid and...
stackexchange_codegolf
The MMIX architecture is a fairly simple big-endian RISC design. It has a couple of interesting features, one of them is the MXOR instruction, which is what you should implement. The MXOR instruction interprets its arguments (two 64-bit registers) as two 8×8 matrices of bits and performs a matrix multiplication where e...
stackexchange_codegolf
Consider an array of unique integers, with an arbitrary length greater than 2. It is sometimes possible to express elements of the array as the sum of at least two other elements. For example, if our array is [2, 3, 1], we can express 3 as the sum 2+1. However, we can't express either 2 or 1 as the sum of other element...
stackexchange_codegolf
My mom really wants me to eat broccoli, but I hate it and never want to eat it. Mom wants to trick me so she cuts it into small pieces, puts it in a salad and mixes it. Help me find out if the salad contains broccoli! Input: Array of mixed letters of all the ingredients. For a single broccoli ingredient it could be: [c...
stackexchange_codegolf
Given two inputs, you should print or return whether the characters in the first string are - in order - inside the second string. For example, we want to check whether the string hello, taken as the first input, and the sample text (the second input) is abhcedddldddloallllll. This should output a truthy value, as the ...
stackexchange_codegolf
Write a program or function that given a string (or your language's equivalent), determine if the string is a word, or not, and output a truthy or falsy value. (This is not a duplicate of Is this even a word? The incorrect words are generated in a very different way that I believe makes this a completely different chal...
stackexchange_codegolf
Overview Given a 3 line string, figure out if the structure falls to the left, balances, or falls to the right. Input structure You can imagine the structure as metal rod with stuff on top, all being balanced on top of a vertical rod. 1 7 4 a =============== | The first line is the items. Each item's w...
stackexchange_codegolf
This challenge is similar to this other, however I made a restriction (see bold text below) that I think would made it much diffent and (I hope) fun either. The Challenge Write a program or a function in any programming language that takes as input the English name of a positive integer n not exceeding 100 and returns...
stackexchange_codegolf
2019 has come and probably everyone has noticed the peculiarity of this number: it's in fact composed by two sub-numbers (20 and 19) representing a sequence of consecutive descending numbers. Challenge Given a number x, return the length of the maximum sequence of consecutive, descending numbers that can be formed by t...
stackexchange_codegolf
Zeroless numbers are numbers that do not contain 0 as one of their decimal digits. Given an integer K, return the Kth zeroless number. K will be non-negative if you choose 0-indexing, or positive if you choose 1-indexing instead. Note that this is OEIS A052382. This is code golf, so the shortest code in bytes wins. Tes...
stackexchange_codegolf
Challenge You will be given a string as an argument. You need to convert that string to upper case. But you can't use any built in method or function nor any external programs. Rule No use of built in methods or functions or external programs. Only arithmetic, bitwise, logical operators, regex, replace, split, join, A...
stackexchange_codegolf
This is code golf. Fewest bytes wins, only standard libraries, etc. Write code, in any language, to output all possible same-length permutations of all items of an array / list / object in the input format and any order, grouped in whatever way you like. The items can be of ANY type, as allowed by the programming langu...
stackexchange_codegolf
Input: An integer \$n\$, which is guaranteed to be \$\ge3\$. An integer \$d\$, which is one of \$[-1,0,1]\$. Output: A road of size \$n\$, which will be in a north-west direction if \$d=-1\$; a north direction if \$d=0\$; or a north-east direction if \$d=1\$. The road will always be three spaces wide (or five in gene...
stackexchange_codegolf
Above, you can see an image full of different colours. Click here for a hex-dump. One possible way to generate this image is by using a linear gradient rotated 90 degrees, however, this may not be the only way. Your task is to create a self-contained program that takes no input, and outputs an image with the same RGBA...
stackexchange_codegolf
A fixed-point combinator is a higher order function \$\mathrm{fix}\$ that returns the fixed point of its argument function. If the function \$f\$ has one or more fixed points, then $$\mathrm{fix} f=f(\mathrm{fix} f).$$ The combinator \$Y\$ has such properties. Encoded in lambda calculus: $$Y=\lambda f.(\lambda x.f(x x)...
stackexchange_codegolf
Suppose you have 2 languages, A and B. A string s is a semiquine in A and B if it satisfies the following conditions: s is a quine in language A. s is a polyglot in A and B. The output of running s as a B program is a different string s', which is a quine in B. The goal of this challenge is to write a semiquine in tw...
stackexchange_codegolf
In Twitch Plays Pokémon, one of the most annoying obstacles one can face is an ice puzzle, where you must travel from one place to another by sliding all the way in one direction until you either hit a wall or a boulder. Your task is to build a program that will generate a random difficult ice puzzle. Your program will...
stackexchange_codegolf
There are 8 Australian states and territories, each with a 2 or 3 letter abbreviation: ACT: Australian Capital Territory NSW: New South Wales NT: Northern Territory QLD: Queensland SA: South Australia TAS: Tasmania VIC: Victoria WA: Western Australia Your task is to write a function/program which takes a valid Austr...
stackexchange_codegolf
Your input is a list/sequence/vector/array of 5-255 positive integers, not necessarily unique. You may assume whatever input format is most suitable, and that each integer (as well as the quantity of integers) is chosen uniformly at random from the range 5-255. The goal is to output the same list, in the same (or equi...
stackexchange_codegolf
As a big fan of the Lost TV series, I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are: \$ 4, 8, 15, 16, 23, 42\$ (A104101) Using any programming language, write a code that outputs these numbers. Scoring: Shortest answer wins The output must not contain any ...
stackexchange_codegolf
Problem Given a value n, imagine a mountain landscape inscribed in a reference (0, 0) to (2n, 0). There musn't be white spaces between slopes and also the mountain musn't descend below the x axis. The problem to be solved is: given n (which defines the size of the landscape) and the number k of peaks (k always less tha...
stackexchange_codegolf
On Unix-like systems, the ls command lists files. GNU's version of ls also colors them according to their properties and the environment variable LS_COLORS. The main file property that ls bases its colors on is the file's mode. In this challenge, you will determine what keys from LS_COLORS ls should look for a given mo...
stackexchange_codegolf
Minecraft inventory management is hard. You have 17 diamonds, but you need 7 to craft an enchantment table, a pickaxe, and a sword. Do you pick them up and right click 7 times? Or do you right click once and right click twice and take the 7 left? It's so confusing! for those of you who are now confused, don't worry, I'...
stackexchange_codegolf
You are the first engineer in a hot new startup, Lexographical. Our company is making waves by digitizing and indexing all words, real or not. The core of our product... Our secret sauce... Well, that's why we hired you :) Because we're bleeding edge, we're enforcing the latest standards. Even the latest ones aren't go...
stackexchange_codegolf
In the physical world, invisible ink usually becomes invisible when it dries, and is then is readable if it is exposed to heat or chemicals of some kind. The invisible ink in this challenge will be readable when exposed to highlighting. Create a full program or function that takes in text from the console (using a prom...
stackexchange_codegolf
For this challenge, submissions should be a program or function shaped like a right triangle, which produces a right triangle of the same size. What is a right triangle? For this challenge, a right triangle consists of 1 or more lines, each containing a number of characters (assume all non-newline characters are the sa...
stackexchange_codegolf
You are probably familiar with the Cartesian product. It takes two lists and creates a list of all pairs that can be made from an element of the first and an element from the second: \$ \left[1,2\right] \times \left[3,4\right] = \left[(1,3),(1,4),(2,3),(2,4)\right] \$ Here the order of the result is such that the pair...
stackexchange_codegolf
In this challenge you will receive a list of non-negative integers. Each one represents a mushroom with a cap of that radius centered at that location. So a 0 means that it occupies no space at all, a 1 means that its cap only occupies space above it, a 2 means it occupies space above it and one unit to the left and ...
stackexchange_codegolf
Given the Dowker notation of a knot and its crossing signs, calculate its bracket polynomial. Although there are more technical definitions, for this challenge it is enough to think of a knot as something made physically by attaching the two ends of a string together. Since knots exist in three dimensions, when we draw...
stackexchange_codegolf
I've always wanted to surround some text with #s, but I have trouble figuring out what I surrounded so in this challenge you'll be writing a program to do just that Examples Input / Outputs are separated by a newline. ### #a# ### a # #a# # a ### # a # # b c # ####### a b c ABCDHIJ E####GK F# M #L # ...
stackexchange_codegolf
(language-specific challenge) Specification: Language: ECMAScript, any version[1] Challenge: Somewhat like python's itertools.groupBy: Your function Array.group(f) should take as input an "equivalence function" f whose output defines our notion of an "equivalence key" for array elements (like a sort key). The return va...
stackexchange_codegolf
Backstory, skip if you like Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars effortlessly rise above the primitive notion of linearly passing time and add an exhilarating sense of unpredictability to the...
stackexchange_codegolf
The autokey cipher is closely related to the Vigenère cipher (both were invented by Blaise de Vigenère). Decryption involves the encrypted message and the key. For simplicity, let us assume all characters in the message and key are lowercase letters (no spaces, numbers or symbols etc.). How to decrypt the cipher Conve...
stackexchange_codegolf
This challenge is from a game, Keep Talking And Nobody Explodes. This is like one of those toys you played with as a kid where you have to match the pattern that appears, except this one is a knockoff that was probably purchased at a dollar store. – From the manual Objective The Simon Says module consists of 4 colored ...
stackexchange_codegolf
Input is in this format: image fontwidth fontheight rowwidth xoffset yoffset xgap ygap non-existent charstart thetextitself thetextitself: The text that should be rendered from the image. image: The image filename. Implementation may vary; it could be either the filename from your computer, an image URL, or something ...
stackexchange_codegolf
Write a program that starts itself again when finishes. There should be no more than one instance of the program running at same time. Not even for a slightest moment of time. You can ignore any instance that is manually started by user during your cycle. But your code should not do it in your restart cycle. Progra...
stackexchange_codegolf
When I write documentation, comments, etc. I love making ASCII tables. They usually end up looking pretty good, but I always feel that they could look even better - especially since UTF-8/Unicode includes the box drawing characters. However, these characters are very burdensome to use, requiring several key presses to ...
stackexchange_codegolf
I have an issue with my keyboard (more likely an issue with my browser). Some times when I click on a new text field and begin typing all my text comes out backwards. After a very short amount of time (for the purpose of the challenge we will say it is 10 milliseconds) it resumes typing forwards again. It seems that ...
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
Warning: Contains minor Deltarune Chapter 1 Spoilers Within the Forest section of the first chapter of Deltarune, there are a few puzzles that consist of entering playing-card suits in a certain order to move to the next section. Below is an example of such a puzzle: The way to solve the puzzle is to do any of the ...
stackexchange_codegolf
Given a positive input \$n > 0\$, output the amout of two types based on their rarity. The two types are called \$A\$ and \$B\$, we know the followings: \$n\$ is a limited input and the maximum is \$nmax\$ At the start \$B\$ is twice as rare as \$A\$ As the presence of \$A\$ increade the rarity of \$B\$ decreases When...
stackexchange_codegolf
Given two strings a and b, count how many times b occurs as a substring in a, but only when it overlaps with another instance of b. (This means that 1 will never be a valid output, because in order for the substring to be strictly overlapping, there must be at least one other instance for it to overlap with.) Test case...
stackexchange_codegolf
Challenge Your challenge is to make a simple program that takes the [input] and formats it as "Hello, [input]!" Input Either a function call variable or STDIN, this is the name. Can contain any character, UTF-8, and can be empty - would result in Hello,!. Also newlines in the input are fine - On a new line -> Hello, O...
stackexchange_codegolf
Given two lists that contain no duplicate elements a and b, find the crossover between the two lists and output an ASCII-Art Venn Diagram. The Venn Diagram will use a squarified version of the traditional circles for simplicity. Example Given: a = [1, 11, 'Fox', 'Bear', 333, 'Bee'] b = ['1', 333, 'Bee', 'SchwiftyFive'...
stackexchange_codegolf
The 24 Game is a card game. On each cards are four interger numbers. For a player, the goal is to use Addition, Subtraction, Multiplication and Division to end up with 24. The goal of this code golf/puzzle is to write a program that, for four intergers, will state the one or multiple solutions possible with those numbe...
stackexchange_codegolf
Chebyshev Polynomials are a family of orthogonal polynomials that pop up in all kinds of places in math, and they have a lot of quite interesting properties. One characterization of them is that they are the unique polynomials that satisfy \$T_n(\cos(x)) = \cos(nx)\$. Challenge Given an nonnegative integer \$n\$, you s...
stackexchange_codegolf
When writing a programm 1 missing character can ruin everything, wouldn't it be great if the programm told you what was missing ? Task: Create any (non Empty) programm, that takes no input and outputs nothing. That when 1 Character is removed from the programm, outputs that Character. Input: None Output: Output nothing...
stackexchange_codegolf
Backstory Disclaimer: May contain made up information about kangaroos. Kangaroos traverse several stages of development. As they grow older and stronger, they can jump higher and longer, and they can jump more times before they get hungry. In stage 1, the kangaroo is very little and cannot jump at all. Despite this, is...
stackexchange_codegolf
Credit: Marco Verch CC BY 2.0 A two-cube calendar, as shown in the picture, uses two cubes with digits painted on the faces to display the date. For dates in the range 1-9, a leading zero is used ("01", "02", ..., "09"). Now, if you do the math, you might come to the conclusion that these calendars should be impossibl...
stackexchange_codegolf
Given two positive integers, W and H, output an ASCII-art box whose border is made of slashes (/ and \) with W "spikes" on the top and bottom edges, and H "spikes" on the left and right edges. The box's interior is filled with spaces. A "spike" is simply two slashes coming together to form an arrow shape: /\ \/ / ...
stackexchange_codegolf
Introduction Braincopter is an esoteric Brainf*** derivative that encodes a Brainf*** program as an image. As a 2D language, it uses two additional commands; they rotate the instruction pointer (initially pointing right) clockwise and counterclockwise. Braincopter is very similar to Brainloller, except that instead of ...
stackexchange_codegolf
Given a number as input, determine how many significant figures it has. This number will should be taken as a string because you have to do some special formatting. You'll see what I mean soon (I think). A digit is a sig-fig if at least one of the following apply: Non-zero digits are always significant. Any zeros bet...
stackexchange_codegolf
Clem is a minimal stack-based programming language featuring first-class functions. Your objective is to write an interpreter for the Clem language. It should properly execute all examples included in the reference implementation, which is available here. As usual, standard loopholes apply. Smallest entry by byte coun...
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
Your task is to make a program that will take an input of a word of any length, in the Calibri font. This word will be made out of letter characters that are found on a normal QWERTY keyboard. There will be no accents or any other characters (i.e punctuation, numbers etc). So, the original characters are: A B C D E F ...
stackexchange_codegolf
In the Thai calendar the year 2017 corresponds to 2560. The Thai calendar is always 543 years ahead of the Gregorian calendar. Observant coders will note that 2560 is equal to \$2^9 \times 5\$, in other words it has 10 prime factors. This will not happen again for another 896 years! We call a year tenacious if it has e...
stackexchange_codegolf
Write a program that, given any 'n' number of strings of 'm' length, returns 'm' number of 'n'-length strings, with this condition: Every new string should contains the letters at the same index of the others strings For example, the first output string must contain the first letter of all the input strings, the second...
stackexchange_codegolf
Given 4096 16-bit integers, only four of which are unique and others appeared twice (so 2050 different integers exist). Find the four uniques. To time precisely and limit RAM usage, your program will be run on a 12MHz 8051(with 128B RAM). I'll test with a random case generated by some code to test, but we aim at the wo...
stackexchange_codegolf
Codidact post, CGCC Sandbox, Codidact Sandbox Given three positive integers as input, animate an ascii-art polygonal loading symbol on the screen. Intro You will be given three inputs, \$n\$, \$l\$, and \$d\$... \$n\$ (one of \$3\$, \$4\$, \$6\$, or \$8\$), is the number of sides of a polygon: ...
stackexchange_codegolf
Challenge You just entered a room. Here's how it looks (you are the X): |\ /| | \/ | | X | | | |----| You challenge yourself to see if you can reach where you started by following the walls. You go right until you find a wall. Then, you turn clockwise until you are facing parallel to the wall. For example, if you...
stackexchange_codegolf
From here. Every new game is the first day of the month, 12:00 PM UTC. The goal is to create the Stack Overflow logo using ASCII characters. It looks like this. The exact output should look like this: \\ \\ \= \\ \= \\ \= \\ \== \\ ¯¯¯ \== ¯¯¯...
stackexchange_codegolf
A TicTacToe game can be represented by a string denoting the sequence of positions as the players make their move. 0 1 2 3 4 5 6 7 8 Assume X always plays first. So a string of "012345678" denotes the game X O X O X O X O X Notice, the game is already won when Player X marks 6, at that point the game ends, granting...
stackexchange_codegolf
Cops thread Robbers, Write a program in the cop's language using the cop's P string and your own S string, and the amount of each of them specified in the cop's post. Your S string may not exceed the cop's S string in bytes. The program Using only strings P and S, write a program which takes a list of 5 or more non-rep...
stackexchange_codegolf
This is the cop's thread. The robber's thread is here. Write a code that takes an input n and creates a n-by-n "snake matrix". A snake matrix is a matrix that follows this pattern: 3-by-3: 1 2 3 6 5 4 7 8 9 and 4-by-4: 1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13 The exact output format is optiona...
stackexchange_codegolf
Background Perfect shuffle algorithms like Fisher-Yates shuffle don't produce great results when it comes to music playlist shuffling, because it often produces clusters of songs from the same album. In an attempt to solve this problem, Spotify introduced an interesting shuffle algorithm in 2014. At the end of the arti...
stackexchange_codegolf
Description a typeracer is an apps where user could type and evaluate their typing speed and accuracy. Criteria User could type "A quick brown fox jumps over the lazy dog." A visual indicator of each wrong character typed. A visual indicator of what characters to type. A visual indicator of what has been typed A visua...
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
Challenge Train a single perceptron with 2 inputs and 1 output. Step 1: Initialize the weights Step 2: Calculate the output For inputs: [i1, i2, ..., in] and weights: [w1, w2, ..., wn] the output is: i1 * w1 + i2 * w2 + ... + in * wn Step 3: Apply activation function on the output (i.e sigmoid) Step 4: Update the we...
stackexchange_codegolf
Your challenge is to write a program that is a quine, meaning it prints out its own source code. For at least one individual character, when it is removed from the program's source, a single different character is removed from the output. By different, I mean that the character removed from the code is distinct from th...
stackexchange_codegolf
This challenge is about implementing Shm-reduplication, originating in Yiddish, where one takes a word, duplicates it, and replaces the first syllable in the second word with "Shm" in order to indicate that one does not care. Some examples include: "Isn't the baby cute?", "Eh, baby shmaby" "Come buy from my store, we ...
stackexchange_codegolf
Challenge Given a number width, number height, hours and minutes print the time using the following format style: ------ - ------ ------ - - ------ ------ ------ ------ ------ | | | | | | | | | | | | | | | | | ------ ------ ------ ------ ------ | ...
stackexchange_codegolf
Leaderboard 154 Calculator 144 Taxman 138 Statistician 137 Solver 137 RandoAggroLawyer 136 Gambler 134 Turncoat 119 Lawyer 119 BloodyMurder 113 Bandit 79 Challenger 74 Mask 64 Random An archive of the latest match, including the log and all output files, is available. Calculator, by Brilli...
stackexchange_codegolf
I got inspired by this: Print every character your program doesn't have But with the exception that the letters have to be between ASCII 32 to 126. We started fooling around with it at the office with PHP and this is the best we could come up with: <? while($i++<95)if(!strstr(file(__FILE__)[0],$a=chr($i+31)))echo$a; Is...
stackexchange_codegolf
I noticed that it seems nobody has posted a non-ASCII (related) USA flag challenge yet, so what better time than the 4th of July? The Challenge Draw the current (as of 2022) flag of the United States of America. Here is the flag: Specifications Hoist (height) of the flag: A = 1.0 Fly (width) of the flag: B = 1.9 Hoi...
stackexchange_codegolf
Imagine the following 24-hour clock that can be controlled by arrow keys: ╔══╗ ┌──┐ ║00║:│00│ ╚══╝ └──┘ HH mm Pressing the up arrow twice (↑↑) will increase the currently focused hour input: ╔══╗ ┌──┐ ║02║:│00│ ╚══╝ └──┘ HH mm Pressing the right arrow (→) will focus the other input. ┌──┐ ╔══╗ │02│:║00║ └──┘ ╚══...
stackexchange_codegolf
There are some iron particles on a board. We pass a current carrying wire through that board and the particles form circles. Show these circles if input given is the position of the wire. Consider the board to be a grid of size 7x7 (fixed) No extra white spaces are allowed. Input can be 0-indexed or 1-indexed. (0-index...
stackexchange_codegolf
Background Slowsort is an in-place, stable sorting algorithm that has worse-than-polynomial time complexity. The pseudocode for Slowsort looks like this: procedure slowsort(A[], i, j) // Sort array range A[i ... j] in-place. if i ≥ j then return m := floor( (i+j)/2 ) slowsort(A, i, m) ...
stackexchange_codegolf