instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
An 'Even string' is any string where the parity of the ASCII values of the characters is always alternating. For example, the string EvenSt-ring$! is an even-string because the ASCII values of the characters are: 69 118 101 110 83 116 45 114 105 110 103 36 33 And the parities of these numbers are: Odd Even Odd Even Od...
stackexchange_codegolf
The challenge Your task is to animate Adve the Adventurer moving through a creepy (i.e. Halloween) maze. Adve is a •; he's character fluid, though, so he does not mind being represented by a different character. To animate Adve, you print out each frame; a frame is the map with his current location in it. Adve moves on...
stackexchange_codegolf
Each character in this 64 by 64 block of text has been chosen randomly and uniformly from the 95 printable ASCII characters. /rq$:Zy5*g'$DeGXX2o8y "{@Cg:FR9qih}xh >5$DsF1Fs5Ao~smFp;.RJbV )U c4\(|Sx*V$10G9xO:NjHKasem%,\9[pPm@&kTaN~HC[;9`lgqlAH(7dt0a-5}LJ[ &sifw9V-.PLRoD~F'dJYA^Q)L#h>$9h!B4b&ceKp8~HndzDm#1/ySydrf5T8[Y%4 ...
stackexchange_codegolf
Objective Mimic Haskell's reads :: ReadS (). Or in other words, parse nested parentheses. Since the target type is () (the type with one possible value), "parsing" means discarding a leading nested parentheses. Valid Input "Nested parentheses" means (), (()), ((())), and so on. That is, leading nonzero (s and trailing ...
stackexchange_codegolf
An old test for programmers, taken from here (Note: in italian). Along a road (denoted by '_'), there is a Magical Piper (denoted by 'P') and several mice (represented by the two characters 'o' and '~', that denote respectively the head and the tail of the small rodents). Write a program that prints how many mice are g...
stackexchange_codegolf
This is the robbers' thread to a cops-and-robbers challenge. Click the link to find the cops' thread. In the cops' thread of this challenge, answerers will be writing programs which output two numbers, \$x\$ and \$y\$. As robbers, your goal will be to crack their submissions. To do this, you find a program in the ...
stackexchange_codegolf
Challenge: Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal places. The size of the ASCII-art root also depends on \$A\$ and \$B\$. Example: \$a=123\$, \$b=1234\$ ____ 123 /123...
stackexchange_codegolf
Just because the reverse and palindrome were not too challenging individually :) Write a program (full program or function) that satisfies the following: given a string input, the program as-is outputs the input string unchanged. the program reversed outputs the input string reversed. the program palindromized outputs...
stackexchange_codegolf
Goal: Write a complete program or function which takes a formula in propositional logic (henceforth referred to as a logical expression or expression) and outputs that formula in conjunctive normal form. There are two constants, ⊤ and ⊥ representing true and false, a unary operator ¬ representing negation, and binary o...
stackexchange_codegolf
Your task: given an integer n, output an embedded triangle to the nth depth. Standard methods of input and output, input in any convenient format, output should be as a string. Examples are 0-indexed, you can use 1-indexed if you want. Standard loopholes apply The left and right sides of each figure is 2^n, when 0 inde...
stackexchange_codegolf
Here's a deceptively challenging geometry puzzle for you! Given a circle A, and n other circles B[n], find the total area contained within A that is not within any circle of B. Your code should be as short as possible. Input Your input should contain the following information: A floating-point number to represent the ...
stackexchange_codegolf
Your task, is simply to multiply 2 integers given in input, separated by a ",". The catch is, you cannot use the multiplication operator "*", even if it is being used differently, or any loops whatsoever This is code-golf, so shortest code wins! Test cases: i dont know if you even need it! lol 1,0 -> 0 5,6 -> 30 3920,5...
stackexchange_codegolf
Note: This is #2 in a series of array challenges. For the previous challenge, click here. Separating Nested Lists To separate values in a nested list, flatten it, and then wrap each value so it is at the same nested depth as before. That is to say, this list: [1, [2, 3], [4, 4, [5, 2], 1]] Would become: [1, [2], [3]...
stackexchange_codegolf
Create your smallest web server in your preferred language! Requirements Must respond to atleast 1 type of request (get,post,patch,delete), with a specified string. Smallest implementation wins! *String can be empty You may use any library you want My personal record for this was 56B in node require('express')().use((r...
stackexchange_codegolf
Let's have a list of positive integers [6,1,9,3,7,4,6,3,2,7,6,6] this will represent a river. We would like to skip a stone across this river. We can throw the stone as far as we want and whatever number it lands on it will skip that many places. So if we start by throwing it 2 spaces, it will land on the 1 skip fo...
stackexchange_codegolf
Challenge Your task is to write a program which, once a second (including immediately when your program is started), prints the elapsed time from the time your program was started. Rules Time must be printed in hh:mm:ss format. (leading zeros for single-digit values) The time stamps must be separated by CR, LF, or CRL...
stackexchange_codegolf
Our boolean operators are AND, OR, XOR, NAND, NOR, XNOR and, in conjunction with one of those operators, NOT. Our numbers are \$1\$ and \$0\$. The challenge is to write a program or function that calculates the results of the input. Input A string, array or other input format of your choice; containing alternating numb...
stackexchange_codegolf
I was asked by OEIS contributor Andrew Howroyd to post a Code Golf Challenge to extend OEIS sequence A049021. Would be super great to get a couple more terms for [...] A049021. Kind of thing [...] team golf would excel at. As I found out the hard way with the help of user202729, the definition of A049021 is... slippe...
stackexchange_codegolf
Related, but very different. In the examples below, \$A\$ and \$B\$ will be \$2\times2\$ matrices, and the matrices are one-indexed. A Kronecker product has the following properties: A⊗B = A(1,1)*B A(1,2)*B A(2,1)*B A(2,2)*B = A(1,1)*B(1,1) A(1,1)*B(1,2) A(1,2)*B(1,1) A(1,2)*B(1,2) A(...
stackexchange_codegolf
Challenge: Given an integer \$n\$, guaranteed to be \$\geq2\$ and a power of 2, we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of \$n\$ by \$n\$; the second \$\frac{n}{2}\$ by \$\frac{n}{2}\$; the third \$\frac{n}{4}\$ by \$\frac{n}{4}\$; etc.; until the fi...
stackexchange_codegolf
An old test for programmers, taken from here (Note: in italian). Along a road (denoted by '_'), there is a Magical Piper (denoted by 'P') and several mice (represented by the two characters 'o' and '~', that denote respectively the head and the tail of the small rodents). Write a program that prints how many mice are g...
stackexchange_codegolf
Challenge This coding challenge is to figure out how many rounds the cat can live. In a \$4\times4\$ matrix, there are a number of mice and exactly 1 cat. Example: $$ \begin{array} {|r|r|}\hline & & & ⬜ \\ \hline ⬜ & & ⬜ & ⬜ \\ \hline ⬜ & ⬜ & ⬜ & \\ \hline & & & \\ \hline \end{array} $$ But in each square of t...
stackexchange_codegolf
Introduction Fischer random chess, also known as Chess960 for the 960 valid starting boards, is a variant of chess where each player's pieces are randomly shuffled at the start. As a reminder, each player gets 8 pawns, two rooks, two knights, two bishops, one queen, and one king. For this challenge, you don't need to k...
stackexchange_codegolf
The problem is to create a string of the same character repeated 100 times. One potential solution in JavaScript is: var i = 100, s = ''; while(i--) s += "Z"; Shortest code wins.
stackexchange_codegolf
There was a discussion going on in TNB once about the best temperature scale, and we agreed on something: Take the average of all four main temperature scales! That is, Celsius, Kelvin, Fahrenheit, and Rankine (Sorry Réaumur). So, now the issue is, most people don't use this system. So, I need a program to convert back...
stackexchange_codegolf
Background Suppose that there are 2*n people to be married, and suppose further that each person is attracted to exactly n other people under the constraints that: Attraction is symmetric; i.e. if person A is attracted to person B, then person B is attracted to person A. Attraction is antitransitive; i.e. if person A ...
stackexchange_codegolf
Challenge You have a Chinese Checkers board looking like this: board = [ [''], ['', ''], ['', '', ''], ['', '', '', '', '', '', ''], ['', '', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', '', ''], ['', '', '', '', '', '', ''], ['', '', ''], ...
stackexchange_codegolf
Although related challenges have been asked, this one is different to warrant its own question. Challenge Given a positive integer, return the longest sequence of consecutive positive odd integers whose sum is the given integer. If no such sequence exists, you may report an error in whatever way makes sense for your l...
stackexchange_codegolf
Input A string. Output The sum of all integers in the line. Constraints 1≤Length of line≤500 Sample test Case Input the 5is 108 seCONd4 a Output 117 Explanation Sum is: 5+108+4=117
stackexchange_codegolf
Grid: +---------------+---------------+---------------+---------------+---------------+ | id: 20 | id: 19 | id: 18 | id: 17 | id: 16 | | pos: (-2, -2) | pos: (-1, -2) | pos: (0, -2) | pos: (1, -2) | pos: (2, -2) | +---------------+---------------+---------------+---------------+---...
stackexchange_codegolf
Given an integer array. You have to check whether it is possible to divide the array in two parts such that the sum of elements of one part is equal to the sum of the element of the other part.If it is possible print "YES" otherwise "NO". Sample Input 4 3 5 5 3 Sample Output YES Explanation Array can be divided in tw...
stackexchange_codegolf
Skittles are colored candy where there are 5 distinct flavors; grape, green apple, lemon, orange, and strawberry represented by (p)urple, (g)reen, (y)ellow, (o)range, and (r)ed respectively. I used to eat skittles by sorting all the different colors, then eating them in sequence. After getting a few weird looks in the ...
stackexchange_codegolf
Today I installed MonoGame and ran the test application, which creates a basic colored window. I was surprised to see that the process was using 32.2 MiB of memory, and I thought it could be improved. Your challenge is to write a program that creates a 640 by 480 window displaying only black pixels. Whatever program u...
stackexchange_codegolf
Write the shortest possible program to remove all partial matched duplicates from a list and only retain the longest lines. Sort order does not matter. For following inputs, the intent is to search for the string reminder followed by a number and retain the longest unique reminder + number lines. Some rules reminder i...
stackexchange_codegolf
I recently saw this language in a challenge and it's awesome. Does anyone have some tips for code-golfing in it? Your tips should be at least somewhat specific to MarioLANG. Please post one tip per answer.
stackexchange_codegolf
Background A maximal domino placement (MDP) on a rectangular grid is a non-overlapping placement of zero or more dominoes, so that no more dominoes can be added without overlapping some existing domino. Alternatively, it can be thought of as a tiling using dominoes and monominoes (single square pieces) so that no two m...
stackexchange_codegolf
Your goal is to input any arbitrary text, such as: This is some text And output that text formatted as code for posts (SE-flavored Markdown) and comments (mini-Markdown) on Stack Exchange, such as: `This is some text` `This is some text` However, it gets trickier. Consider the input: Perl has a variable called $` Th...
stackexchange_codegolf
Given an input string, write a program that outputs the total number of lines and curves it has. The Challenge Take input from STDIN, or any other input method. Output to STDOUT, or any other output method, the total number of lines and curves contained in the string, in that order, based on the below table in the cod...
stackexchange_codegolf
Task description In number theory, the Carmichael function λ takes a positive integer n and returns the least positive integer k so that the k-th power of each integer coprime to n equals 1 modulo n. Given a positive integer n, your solution must compute λ(n). The shortest code in bytes wins. Your program should theore...
stackexchange_codegolf
As you most probably now, there are 2339 solutions to pentomino puzzle in a 6x10 grid. There are different labeling schemes for the 12 pentominoes, two of them are shown on the image below: Image credit: Wikipedia For the purposes of the current task we will say that a normalized pentomino solution is a solution that ...
stackexchange_codegolf
Balanced ternary is a modified version of ternary (base 3), using the three digits 1,0 and -1 (written as T) to represent numbers. The balanced ternary representation of -n can be obtained by replacing 1 with T and T with 1 in the balanced ternary representation of n. Examples: 1 // decimal: 1 T // decimal: -1 ...
stackexchange_codegolf
In probability theory, the normal (or Gaussian) distribution is a very common continuous probability distribution. Normal distributions are important in statistics and are often used in the natural and social sciences to represent real-valued random variables whose distributions are not known. The challenge Your chal...
stackexchange_codegolf
This originally came from Give the best Chaitin incompleteness bound, but I realized that there was a fragment of this problem which still potentially gives a good coding challenge. First Order Logic With Equality First, I will need to fix an encoding of first order formulas ('For all x there exists y such that ...'). ...
stackexchange_codegolf
Specifically, this references JavaScript, a programming language that happens to be one you can run on StackExchange/StackOverflow. However, you may use any programming language to do this challenge. This is not actual JS golfing, but merely a "code-golfable" challenge. Actual complete parsing of JS is not needed. An e...
stackexchange_codegolf
A recent SO question asks for a convenient one-liner to generate a list of numbers and their negative counterparts in Python. Given two integers \$1≤a≤b\$, generate all the integers \$x\$ such that \$a≤|x|≤b\$. The result may be printed or returned in any order or structure, as putting the result into a list and sortin...
stackexchange_codegolf
Task: Given an integer input, figure out whether or not it is a Cyclops Number. What is a Cyclops number, you may ask? Well, it's a number whose binary representation only has one 0 in the center! Test Cases: Input | Output | Binary | Explanation -------------------------------------- 0 | truthy | 0 | only ...
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
Given text, remove leading and trailing whitespace (spaces, tabs, and newlines). Alternate title: Implement your own string trimming. Input ASCII text (printable + spaces, tabs (\t), and newlines (\n)), in whatever format you would like. Carriage returns (\r) are outside of the scope of the input. Output The same text ...
stackexchange_codegolf
In the IRC protocol, raw messages look similar to this: command arg1 arg2 :arg3 with spaces :arg4 with spaces :arg5 In a shell environment (e.g. bash), that would be equivalent to: command arg1 arg2 "arg3 with spaces" "arg4 with spaces" arg5 The format specification is as follows: Raw messages will only contain prin...
stackexchange_codegolf
Based on a recent question in StackOverflow Write a program/function that takes in one ARRAY/list and returns the number of pair-values which sums up to a given TOTAL. Explaining TOTAL=4, ARRAY=[1,3,7,1,-3] => RESULT=2 The result was 2 because 1 + 3 and 7 + -3 are valid pairs which sums up to TOTAL=4. When one pair i...
stackexchange_codegolf
Input An array A of integers of length 100,000. The array will contain only integers in the range 0 to 1e7. Output The convolution of A with itself. As this will be of length 199999 you should time just the convolution calculation however, not the time to print out the answer. Example in Python import numpy as np from...
stackexchange_codegolf
The challenge Make 2 programs which convert decimal to and from base 94, or a bidirectional program. Base 94? Base 94 is like any other base, but instead of 0 to 9 and letters, it uses ASCII characters 33 to 126. Not 127 because chr(127) is DEL. Not 32 because that's a space. Examples 0 - ! or empty string 1 - " 93 - ~...
stackexchange_codegolf
...or "snakes but not too long". Inspired by this challenge and this comment. Task Write a program or a function that takes no input and outputs its own source code formatted as a snake according to the rules below: If your code has any whitespace, it will not be output; it will just be skipped. There will be one char...
stackexchange_codegolf
A jigsaw puzzle consists of (usually rectangular-ish) pieces. On each side of a piece, there is either an edge or a connector (a term I made up). A connector is either a tab sticking out (outie) or a slot facing inwards (innie). Two pieces can be joined if the outie tab can fit into the innie slot. The goal is to assem...
stackexchange_codegolf
I have been going to puzzling.se, and people over there write stuff in rot13 a lot, sot this gave me an idea: Write a program that takes 2 inputs, a string and integer: the message to encode or decode how far to shift You can input in a function call, and output in any legal way twist: it must work with any printable...
stackexchange_codegolf
Premise: Your reputation is in Stack-Exchange Form if it can be represented by decomposing your medal counts (gold, silver, and bronze counted separately) into their base-10 digits and joining them in any given order, with a few caveats. While decomposing, each Gold medal digit is worth three digits. Silver is worth...
stackexchange_codegolf
The Problem You must write a program that, when the Konami Code is typed in during runtime, prints the string "+30 lives" and sounds a noise of your choice from the computer's speaker. Definition The "Konami Code" is defined as UUDDLRLRBA followed by pressing the enter key. The Rules You may choose to use the up arrow...
stackexchange_codegolf
We're back! And this time with an objective scoring criteria! This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :) Your Task Define two functions combine and separate with respective types Str...
stackexchange_codegolf
Letter dice are common in word games. It can be fun to try to spell funny words with boggle dice, for instance. If you grab a handful of dice, chances are you won't be able to spell certain words. This challenge is a generalization of that idea. Challenge Given a list of dice which each have at least 1 face and a word,...
stackexchange_codegolf
Not a dupe to this. That question asks specifically for counting up forever, while this question allows many other approaches. Write a program or function which, given infinite time and memory, would print an infinite non-periodic output. Clarifications 'Infinite' means the solution keeps outputting something without ...
stackexchange_codegolf
What is the best BrainFuck code (in terms of code size) to print 'A' 1000 times ? My approach is: set 'A' to p[0] set 255 to p[1] to display 255 'A', 3 times set 235 to p[1] to display 235 'A' This is not effective but I cannot find a way to use tow counters simultaneously like a multiplication Is there a better appr...
stackexchange_codegolf
There already have been multiple challenges about carryless multiplication, this challenge will work with the same calculation rules. You task is given a quadratic polynomial ax²+bx+c, to find an integer r such that a*r*r+b*r+c is zero, with + meaning exclusive or and * being carryless multiplication (use xor to add up...
stackexchange_codegolf
According to some controversial story, the odrer of ltteres in a wrod deos not mttaer much for raednig, as lnog as the frist and lsat lteter macth with the orignial wrod. So, for fun, what would be the shortest function to randomize letter order in a word while keeping the first and the last letter in place? Here's my ...
stackexchange_codegolf
Create the shortest program/function/whatever that splits an inputted string along un-nested commas. A comma is considered nested if it is either within parentheses, brackets, or braces. Input and output Output should be a list or a string joined with linebreaks. The input may contain any characters. All testcases wil...
stackexchange_codegolf
Challenge Your goal is to find the furthest point on a graph (from a provided start node). Your code doesn't need to handle cycles in the graph properly, but it might pose a fun challenge. For this question, you can assume the graph is actually a tree. Input data Input can be provided in any suitable format for the lan...
stackexchange_codegolf
Normally, I'd open with some flavor text here about being bored and/or lazy but looking through the stack-exchange-api questions that would be far from original. So instead I'm going to open with a meta and self-referential flavor text describing this lack of originality that then describes itself and how meta and self...
stackexchange_codegolf
Part of Advent of Code Golf 2021 event. See the linked meta post for details. Related to AoC2020 Day 20, Part 1. (This day is a dreaded one for many of you, I know :P) Obligatory final "but you're not Bubbler" explanation. As the train carries you to the destination, you've got some spare time. You open the travel boo...
stackexchange_codegolf
Task The input consists of a JSON object, where every value is an object (eventually empty), representing a directory structure. The output must be a list of the corresponding root-to-leaf paths. Inspired by this comment on StackOverflow. Input specifications You can assume that that the input always contains a JSON ...
stackexchange_codegolf
Powerful numbers are positive integers such that, when expressed as a prime factorisation: $$a = p_1^{e_1} \times p_2^{e_2} \times p_3^{e_3} \cdots \times p_k^{e_k}$$ all exponents \$e_1, e_2, ...\$ are greater than or equal to \$2\$. Note that the exponents do not include zero exponents, as exampled by \$200 = 2^3 \ti...
stackexchange_codegolf
This code-golf challenge will give you an integer n, and ask you to count the number of positive integer sequences \$S = (a_1, a_2, \dots, a_t)\$ such that \$a_1 + a_2 + \cdots + a_t = n\$, and \$\displaystyle \sqrt{a_1+\sqrt{a_2 + \cdots + \stackrel{\vdots}{\sqrt{a_t}}}} \$ is an integer. Example If n = 14, then the...
stackexchange_codegolf
What am I? As a plant cell, your program/function/etc. must undergo photosynthesis: When the input is 6CO2+6H2O+light in any order, output C6H12O6+6O2 in any order. It does not have to be the same for each arrangement of the input. When the input is just r, replicate (i.e. output your own code). quine rules apply. Whe...
stackexchange_codegolf
Your task In your language of choice: create a program that outputs 1 This 1 may either be a string or value equivalent to the number one. The shifting catch If you take the unicode codepoint (or whatever codepoint encoding your languages uses if not UTF) for each character in your program, and shift each of those valu...
stackexchange_codegolf
Below on the left is a picture of a sorting network that can sort 4 inputs. On the right you can see it sorting the input 3,2,4,1. A sorting network of size n consists of a set of n horizontal wires where two wires can be connected by a vertical wire. The inputs to a sorting network move from the left to the right on ...
stackexchange_codegolf
The Animal-Alphabetical Sequence is an infinite string of letters built accordingly to the following procedure: Start with the letter A; Replace each letter with the name of the animal starting with such letter in the table below; Go back to step 2. For instance, the first four steps of the procedure give: A ADD...
stackexchange_codegolf
Purpose The idea is to provide the code necessary to map a 32-bit integer to/from a pronouncable word of 9 characters maximum. That could be useful, for example, to make a serial number easier to remember, or type in a form. Both the method for translating an integer to the corresponding word and for translating back a...
stackexchange_codegolf
Given a dictionary file (a text file containing a word or phrase on each line, with possible punctuation but no numbers; lines are alphabetized), you must output each combination of words where one letter can be removed from a word to make another; the removed letter should be encased in parentheses. For example, the i...
stackexchange_codegolf
Background A staircase polyomino is a polyomino made of unit squares whose shape resembles a staircase. More formally, a staircase polyomino of size \$n\$ is defined as follows: A staircase polyomino of size 1 is a single unit square. A staircase polyomino of size \$n\$ is the same as that of size \$n-1\$ with a horiz...
stackexchange_codegolf
Typically, polyglots are constructed in such a manner that each language can ignore parts of the code that are present for other languages, by wrapping them in string literals, using comment syntax, or other similar tricks. Your goal is to write a polyglot where the output for each language is the code from the polyglo...
stackexchange_codegolf
Design a function or program that, when run normally, outputs the triangular numbers. However, when any single character is deleted, the program/function should not function in the original programming language, but instead produce the triangular numbers in one other programming language. Scoring Your score will be the...
stackexchange_codegolf
Quell is a single-player grid-based puzzle game. Pearls are scattered across a 2D map and the aim is to collect them all by rolling a drop of water over them. For this challenge we will only consider basic maps containing the drop, pearls, walls, and empty spaces. (The full game includes a variety of additional objects...
stackexchange_codegolf
The Challenge For this challenge, you are supposed to determine if a given number is in the Cantor set. So first, let's define the Cantor set. First, start with the numbers between 0 and 1. Any numbers outside this range are not in the Cantor set. Now, let's divide the numbers into three equal parts: [0,1/3], [1/3,2/3]...
stackexchange_codegolf
Inspiration Given a positive integer \$1 \le n \le 9\$, output all positive \$n\$-digit integers \$i\$ for which the following is true: Each digit from \$1\$ to \$n\$ appears exactly once in \$i\$. Therefore, \$i\$'s digits are a permutation of the digits from \$1\$ to \$n\$. \$i\$ is divisible by \$n\$ Removing the r...
stackexchange_codegolf
You are the roughest, toughest, coolest cowboy west of the Mississippi. However, some weird guy on a wacky nerd website decided that it would be cool to plop you into random unfinished landscapes and fight. No matter, you'll still win. However, to help you win those grueling gunfights you'll write home about, it's help...
stackexchange_codegolf
Background Information: What is a Fenwick Tree? With a normal array, it costs \$O(1)\$ to access and modify an element, but \$O(n)\$ to sum \$n\$ elements. Working with a prefix sum array (an array where the \$i\$th value represents the sum of the first \$i\$ values in the underlying data), access and summation are \$O...
stackexchange_codegolf
The purpose of the challenge is to approximately plot the attractor of the logistic map as a function of its parameter r (also called bifurcation diagram), or a subregion of it. The appearance of the graph can be seen in the following image from Wikipedia: Background The logistic map is a mathematical function that ta...
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
For example, let's look at the following ASCII art: /\ - encloses a total of 2 cells - half a cell per slash \/ /\ - encloses 4 cells fully and half of 8 cells, for a total of 8 / \ \ / \/ Your challenge is to write a program that determines (and outputs) the total area enclosed by ASCII art composed only of...
stackexchange_codegolf
Warning: This challenge is only valid for languages with a compiler. Make a program (which is perfectly valid code) that outputs Hello, World, even before runtime. How? Let me explain. Many languages have a compiler. Some operations are made in the compile-time, and others, in runtime. You trick the compiler to outpu...
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
Your function must accept one string and return the opposite The opposite string is a string where all characters go in reverse order, all letters are replaced with the opposite mirror letter from the English alphabet and are changed in case, and all digits are replaced with opposite mirror digits opposite mirror for l...
stackexchange_codegolf
Inspired by Expand exponentation. Knuth's up arrow notation is used for big numbers such as Graham's number. If we look deeper, we can see how it makes big numbers. One arrow means exponentiation. e.g. 2↑3 equals 2^3 = 8. Two or more arrows means repeating the instructions of n-1 arrows. e.g. 2↑↑3 equals 2↑2↑2 equals 2...
stackexchange_codegolf
Pancake sorting is the colloquial term for the mathematical problem of sorting a disordered stack of pancakes in order of size when a spatula can be inserted at any point in the stack and used to flip all pancakes above it. A pancake number P(n) is the minimum number of flips required for n pancakes. 1 In 1979, a you...
stackexchange_codegolf
Sandbox Given a boolean matrix representing my grass field, sheep length \$n\$ and wool thickness \$k\$, you will have to count my sheep. A sheep is a single independent unbroken line of sheep length \$n\$ and thickness \$k\$. #|##|# | # #| | #|# are all valid sheep for \$n=2,k=1.\$ ##|###|## | ## ##|###| ## | ## ...
stackexchange_codegolf
Not exactly sure if it belongs in this site, but I always have trouble thinking of all the certain edge cases in any kind of competitive programming or puzzles. For example, take this kind of problem Find the size of the smallest list of squares that add up to n f(16)-> 1 (16) f(17)-> 2 (16+1) One intuitive approach ...
stackexchange_codegolf
This quite literally came to me in a dream. A common combination padlock design has letters on the dials so you can set the combination to a word. Unfortunately, I can't read, but I can count. Considering I am in a hurry, send the shortest path around the dials to open the 4 letter lock, given the current letters and t...
stackexchange_codegolf
Purpose The idea is to provide the code necessary to map a 32-bit integer to/from a pronouncable word of 9 characters maximum. That could be useful, for example, to make a serial number easier to remember, or type in a form. Both the method for translating an integer to the corresponding word and for translating back a...
stackexchange_codegolf
Im talking about this question, take a look at it if you are a bit confused. Main Task Your task is to output concatenated integers, in decreasing order, but increasing the maximum integer everytime you hit 1 (for this question, 1 will be considered a prime number). While this doesn't sound any different from the first...
stackexchange_codegolf
There are many types of binary operations, which can be categorized by their associative properties and their commutative properties. A binary operation () is associative if the order of operations between operands does not affect the result — i.e. if (a(bc)) = ((ab)c). A binary operation () is commutative if the orde...
stackexchange_codegolf
For the main cops' challenge, click here NOTICE - This challenge is now closed. Any cracks which are posted now will not be counted on the leaderboard and the accepted answer will not change. Challenge Given the original program, its output and the output of the changed program, you have to find out which characters ...
stackexchange_codegolf
2015 was the year of the goat! In this challenge, you will figure out which animal represents the year. To avoid making this challenge to complex you won't need to calculate Chinese new year. Because they are only 12 animals in the Zodiac, your code will need to be as short as possible. Examples Your program must get t...
stackexchange_codegolf