instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Your task is to print the following ASCII Art: _ _ _______ _ | | | | (_______) _ | | | |__ | | ____ ____ ____ _ _ _____ ____ ___| |_ ____ ____| | | __)| |/ _ | _ \| _ \| | | | | ___) / _ |/___)...
stackexchange_codegolf
We already have a challenge for computing the GCD of two Gaussian integers, but that challenge explicitly allows to choose any of the four possible values. Your task now is to bring the Gaussian integer computed by the GCD in the following normal form: The result differs from the original number by a factor of 1,i,-1 ...
stackexchange_codegolf
Given a ruler length in inches and fractions of an inch, and a granularity in fractions of an inch, output the values of all marks on the ruler, starting from 0, in ascending order. Input ruler length will be a mixed fraction (integer and proper fraction) Input granularity will be a proper fraction in the form 1/(2ⁿ), ...
stackexchange_codegolf
In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules: You may only output bytes in the printable ASCII range (0x20 to 0x7E, inclusive), or newlines (0x0A or 0x0D). Your code must not be a...
stackexchange_codegolf
Inspired by the fact that a few related challenges to this could be answered by Vyxal in 0 Bytes using a special flag combination. Given only one input integer \$n\$, calculate \$f(n,n)\$ where $$ f(x,y)= \begin{cases} x & \text{if } y=0 \\ f(\left(\sum_{k=1}^xk\right),\text{ }y-1) & \text{otherwise} \end{cases} $$ If ...
stackexchange_codegolf
The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of words in the string. In this case, output is 5, as it's the most often length of words in the string. Definition of an alphabetical word (for this challenge): a string th...
stackexchange_codegolf
This challenge is inspired by Mathematics is fact. Programming is not. The mathematical notation for a factorial, or a fact is an exclamation mark !. The exclamation mark is also a common symbol for not in many programming languages. Challenge: Take a string, containing numerals, and the characters: + ! as input and o...
stackexchange_codegolf
The task is to write code that can find small logical formulae for sums of bits. The overall challenge is for your code to find the smallest possible propositional logical formula to check if the sum of y binary 0/1 variables equals some value x. Let us call the variables x1, x2, x3, x4 etc. Your expression should be...
stackexchange_codegolf
Challenge Display to the screen or write to stdout this exactly: ** ** **** **** **** **** **** **** **** ********** ********** ********** Winning This is code-golf, so the shortest submission (in bytes) wins.
stackexchange_codegolf
Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (A______). Easy enough right? Well here's the catch, your code must also output a second separate sequence when the name of the sequence in the code is changed to the name of the second sequence. Input Out...
stackexchange_codegolf
I'm looking for a program such that, given a finite list of strings, can find short regexes to match exactly all of them and nothing else. Since there are multiple languages that express regexes differently, there can correspondingly be multiple regex generators. Each answer must discuss regex generation in one langaug...
stackexchange_codegolf
Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder: To add 17282 and 1342, you proceed as follows: place the larger (value wise, not number of digits) number above the smaller number and match up the digits 17282 1342 draw the plus sign (+) to the left of th...
stackexchange_codegolf
Introduction Everyone knows the FizzBuzz sequence. It goes something like this: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz . . . In case you don't know, if the number is divisible by 3, it's Fizz. If it is divisible by 5, it's Buzz. If it is divisible by both, it's FizzBuzz. If it is not divisible by bo...
stackexchange_codegolf
Have you been shooting gallery? We are recently. In our shooting gallery cans and aluminum cans from under various drinks hang and stand. More precisely, they hung and stood. From our shots, banks dangled from side to side on a rope, were torn off, rang, crumpled. This is not for you to shoot from your fingers. Each ...
stackexchange_codegolf
INTRODUCTION I like Karma Fields : he's a music producer that creates original music tracks. His artwork also matches up really well his style. He has a logo witch I find really interessing : GOAL Your goal will be to reproduce that logo, graphically or in ASCII. Edit @NahuelFouilleul managed to provide a readable asc...
stackexchange_codegolf
Thunno 2 is a stack-based golfing language with around 400 commands (achieved through overloads) created by me, The Thonnu. It seems like a good idea to share some tips for golfing in Thunno 2. Please, one tip per answer, and no tips like “remove comments and whitespace”. Links: Tutorial List of commands Attempt This...
stackexchange_codegolf
When I was a kid, there was a "really cool" shortcut to count to 100: 1, 2, miss a few, 99, 100 Output the exact string above, in the fewest characters possible, without using these characters: 0, 1, 2, 9
stackexchange_codegolf
Tab completion is a useful feature that auto-completes partially written commands. You're going to be implementing it. For example, if the available commands were ['apply','apple','apple pie','eat'], then a would complete to appl, as all of the commands that start with a also start with appl. Input/Output You need to...
stackexchange_codegolf
King of the Torus! Your job is to conquer the torus, but wait, there are multiple other players banded together in teams facing you! You will need to use your wit's to conquer the torus. There are three teams: red, blue and green. Teams are self-assigned arbitrarily. If the teams are even you may join the team of your ...
stackexchange_codegolf
In this challenge, you'll print out the SBCS of Jelly, a popular golfing language. Its code page looks like this: _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _A _B _C _D _E _F 0_ ¡ ¢ £ ¤ ¥ ¦ © ¬ ® µ ½ ¿ € Æ Ç Ð 1_ Ñ × Ø Œ Þ ß æ ç ð ı ȷ ñ ÷ ø œ þ 2_   ! " # $ % & ' ( ) * + , - . / 3_ 0 1 2 3 4 5 6 7 8 9 : ; < = > ? 4...
stackexchange_codegolf
This challenge is pretty simple: Your task is to draw a schematic of a (simplified) memory array. You will be given two (positive) integers n,m and the task is to draw the n:2^n decoder connected to the memory array with d data lines. The addressing will be in the order of gray codes, to check if the sequence is correc...
stackexchange_codegolf
Using FTP's ASCII mode to transfer binary files is a bad idea. It is likely to corrupt your data. Badly. Let's simulate this corruption! Your task is to write a program which takes a file as input and outputs the corrupted version of the file. Because how exactly your file gets corrupted is dependent on both the FTP cl...
stackexchange_codegolf
Inspired by this challenge. Goal: Given a pre-configured switchboard and a list of indexes, invert the switches at the given indexes. A switchboard is made up of some number of switches (v or ^) wrapped in -'s and arranged into rows of varying length. Here is an example switchboard: -v-^-v- -^-v- -v-^-v- To invert/fli...
stackexchange_codegolf
I'm sure you're all familiar with Z̃͗̇̚͟Ḁ̬̹̈̊̂̏̚L̜̼͊ͣ̈́̿̚G̱̮ͩ̃͑̆ͤ̂̚Õ̷͇͉̺̜̲ͩ́ͪͬͦ͐ ̪̀ͤͨ͛̍̈͢ĝ̭͇̻̊ͮ̾͂e̬̤͔̩̋ͮ̊̈ͭ̓̃n͖͎̘̭̯̳͎͒͂̏̃̾ͯe͕̖̋ͧ͑ͪ̑r̛ͩa̴͕̥̺̺̫̾ͭ͂ͥ̄ͧ͆t͍̻̘̆o͓̥ͤͫ̃̈̂r̹̤͇̰̻̯̐ͮ̈́ͦ͂͞. If not, you can play with the classical generator a bit. Zalgo text is unicode text that started as English text and had a bunch of combining ...
stackexchange_codegolf
Your task is to turn a square root like this: √12 into a form like this: 2√3 For our purpose, we only need to output the left number here: 2 Test cases 4 -> 2 9 -> 3 12 -> 2 13 -> 1 108-> 6 Specifications You may assume for the input that \$n>0\$. \$n\$ has to be as large as possible. If the number is already a ...
stackexchange_codegolf
From the subreddit r/SpeedOfLobsters: Edit the text of an image to create a new phrase This meme format/style is pretty self-explanatory. Simply have a browse through the subreddit if you need more examples. However, when coming up with ideas, it can be quite difficult to decide exactly which letters to keep and whic...
stackexchange_codegolf
Your task is to write a computer program such that when it is cut up into lines (split on the newline character) every arrangement of the lines will output a different number between 1 and n! (where n is the total number of lines). No number should be output by two different arrangements and every arrangement should o...
stackexchange_codegolf
(related) A Pythagorean Triple is a list (a, b, c) that satisfies the equation a2 + b2 = c2. A Primitive Pythagorean Triple (PPT) is one where a, b, and c are all coprime (i.e., the only common divisor between the three elements is 1). For example, the (3, 4, 5) right triangle is a famous Primitive Pythagorean Triple. ...
stackexchange_codegolf
Programs often list outcome statistics, such as this: 54% of participants received an award 69% of participants got a promotion 85% of participants increased their salary These percentages are the result of dividing a/x, where both a and x are whole numbers, and the result is rounded to the nearest hundredth. Your ta...
stackexchange_codegolf
Input: An integer n Output: A string A * B Example 12 Possible 2 divisible numbers: 12 * 1, 6 * 2, 4 * 3 12-1 = 11 6-2 = 4 4-3 = 1 4 and 3 has the minimal absolute difference of 1 Therefore, Output: 4 * 3 Order of the numbers does not matter This challenge idea was taken from a puzzle in Clash of Code in https://www...
stackexchange_codegolf
I just had a genius idea for making the work-life easier - a countdown to a specific date which only counts workdays. The basic task is to create a countdown to a specific date which only includes the workdays in the countdown. As workday counts Monday, Tuesday, Wednesday, Thursday and Friday. The Input should be a sp...
stackexchange_codegolf
Write the shortest program or function that will determine if an input is a valid Go type. Spec This challenge will use the following simplified subset of Go types. For more information, see the Golang specification. "Primitive" types: bool int,uint,float(32|64),complex(64|128),byte,rune string *T where T is any ty...
stackexchange_codegolf
A loaded question is something like 'Have you stopped swearing?' in which both yes and no answers mean that I have swore, meaning it is impossible to answer the question if I haven't swore. However, the constructed language Lojban has a word na'i, which means there is something wrong with what you just said. Your input...
stackexchange_codegolf
Sandbox The major scale (or Ionian scale) is one of the most commonly used musical scales, especially in Western music. It is one of the diatonic scales. Like many musical scales, it is made up of seven notes: the eighth duplicates the first at double its frequency so that it is called a higher octave of the same note....
stackexchange_codegolf
Your submission must take a list of numbers (in whatever list format your language supports, or using multiple function / command-line parameters) or a string of numbers separated by any character that is not 0123456789. In one language, it must add all of them and output the sum. In another language, it must output th...
stackexchange_codegolf
This seems almost trivial, but since after some effort I was not able to beat the literal solution in J, I thought it might make a decent challenge (though, to be clear, this is not a J-specific challenge). Title says it all. You simply need to write a program, or function (taking no arguments) that returns or prints:...
stackexchange_codegolf
In my language Pyramid Scheme, there is a slightly funny construct: the empty triangle: ^ - When given no arguments, it returns 0. To generate 1 using this construct, we could use this: ^ /!\ ^--- - This simply passes 0 to the negation function. We can continue negating this result: ^ /!\ ---^ /!\ ^--- - ...
stackexchange_codegolf
A family of sets is called laminar if for any two sets \$A\$ and \$B\$ in the family one of the following is true: \$ A \subseteq B \$ \$ A \supseteq B \$ \$ A \cap B = \emptyset \$ Or less mathematical: A laminar set is a list of lists that satisfies the following condition: If two elements of the top level list hav...
stackexchange_codegolf
Given a lower case string. Ex: s = 'abcdefghijklmnopqrstuvwxyz' The goal is to make every other vowel uppercase. Desired output here: abcdEfghijklmnOpqrstuvwxyz As you can see, from aeiou, \$`e`\$ and \$`o`\$ get uppercased. For aeiou, the desired output is: aEiOu There are only lowercase characters in the strings i...
stackexchange_codegolf
Mahjong is a tabletop game played using tiles. It features three "number" suits (pins, sous, mans, represented as p, s and m) from 1 to 9, and one "honor" suit z of seven distinct tiles. Note that contrary to western card games, tiles are not unique. To complete a hand and win, the 13 tiles in your hand are combined w...
stackexchange_codegolf
Let's say I have this string: s = "Code Golf! I love Code Golf. It is the best." I want to replace all the vowels with repeated "aeiou". Notes: Uppercase vowels should be replaced by an uppercase letter, and lowercase vowels should be replaced by a lowercase letter. Consonants (all alphabet characters except for "ae...
stackexchange_codegolf
Create a program that outputs Hello, World! The winner is the source code that is the biggest, subject to the constraint that it is irreducible For this challenge, irreducible means there does not exist a program that outputs Hello, World! that can be constructed by removing characters from the original program. For ex...
stackexchange_codegolf
Befunge is a 2-dimensional programming language, with an instruction pointer (IP). In Befunge-98, the ; character tells the IP to skip characters up until the next ; (Let us call it skipping mode when the IP is skipping characters). Here is an example: "This part is read into the stack" ; this part is not ; @ I would ...
stackexchange_codegolf
The Challenge GIFs are the most common image format for animation, and are used pretty heavily in today's social media. For the purpose of this challenge, I'm going to redefine what a GIF can be. This challenge will require you to take in a 3D array containing some sort of representation of a 2D 'image' and iterate thr...
stackexchange_codegolf
I was told that using the cmp function can be very useful in code-golf. But unfortunately, Python 3 doesn't have a cmp function. So what's the shortest equivalent of cmp that works in python 3?
stackexchange_codegolf
Write a program or function that takes two inputs: A text message The dictionary of English language, as it appears in this Github file (containing about 60000 words) and outputs the number of spelling errors in the message (see below for definition and test cases). You can receive the dictionary as a parameter to yo...
stackexchange_codegolf
Background A magic square is an n×n matrix consisting of one of each of the integers from \$1\$ to \$n^2\$ where every row, column, and diagonal sum to the same value. For example, a 3×3 magic square is as follows: 4 9 2 3 5 7 8 1 6 Here, each row, column, and diagonal sum to the magic sum of 15, which can be calculat...
stackexchange_codegolf
This challenge is inspired by Fortran's idiosyncratic implicit typing rules. Your task will be to determine the data type of the object GOD according to the implicit typing rules explained below. Background Fortran 77 has six data types: CHARACTER, COMPLEX, DOUBLE PRECISION, INTEGER, LOGICAL, and REAL. Any object not e...
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
Given a "T" shape on an x * y number grid, with length W on the top bar and H on the stem of the T, with the bottom of the T on the square numbered n: calculate the total of all of the numbers in the T shape. W must be an odd number and all must be positive integers. Here are some examples of valid T's on a 9*9 grid: ...
stackexchange_codegolf
https://www.youtube.com/watch?v=6vAhPeqlODg Ok—jig's up—this one's only related to smash in name, but it'll give you something to burn your time with while you wait 'til December 7th Given a color string s of form #rgb(in hex, so #000000 to #ffffff, dont worry about the three digit ones: #123) you must average the rgb ...
stackexchange_codegolf
I was seen multiple shortest "Hello World!" program, but this is the longest program. The Rules Each submission must be a full program. This must be non-interpreted language (for example, JavaScript, Python, HTML, etc.) Target OS must be Windows, Mac, Linux or MS-DOS. The challenge Writing a longest Hello World prog...
stackexchange_codegolf
Recently I've been playing a game called Alcazar. It is a board puzzle game where your goal is to enter from one door, pass through all squares, and exit through another door. The only rules are: Enter once, leave once; Pass through all squares; Do not pass through a square more than once The image below shows an exa...
stackexchange_codegolf
Because of this, you need a better way of working out if a phrase is an acronym of a word. You also think it would be worthwhile to see if the phrase and word in question are recursive acronyms. Your task: Given a word and then a phrase separated by a line, output if the phrase is an acronym and then if it is a recursi...
stackexchange_codegolf
This wasn't originally intended for code-golf, just as a little debugging routine to roughly visualize something "goofy" going on in a model of some (irrelevant here) physical process. But when I saw how surprisingly short it was, compared to my expectations, I just wondered if it can be further shortened. And that's p...
stackexchange_codegolf
Given an input of a series of characters representing movements on a hexagonal grid, output the final coordinates of the "pointer." Our hexagons will be numbered like so (imagine a rectangular grid with every odd-numbered column shifted downwards slightly): _____ _____ _____ _____ / \ ...
stackexchange_codegolf
Make a Windows style Loading bar by the following instructions. (notice that this is different than Loading... Forever) Your output should start by [.... ]. Every tick, you should wait 100 ms, then move each dots by one character right. if the dot is on the tenth character, move it to the first. Notice that you s...
stackexchange_codegolf
The task is simple, given an integer n of how many lines the next n lines is and, a multi-line input, output the resulting 90 degree tilted grid in a clockwise formation. E.g. Input: 2 c d o e Output: o c e d I/O format: Input will have spaces in between them Input always contains alphabetical characters except the ...
stackexchange_codegolf
Introduction: Every workday I read the newspaper in the morning while eating breakfast, and also do some of the puzzles at the back. When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one. The word-searches in the newspaper have two columns of words, and afte...
stackexchange_codegolf
This is a cops-and-robbers challenge, the robbers thread can be found here. Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (A______) and outputs a second separate sequence when the name of the sequence in the code is changed to the name of the second s...
stackexchange_codegolf
Chef Avillez is about to cook us some really nice meal. He is just waiting for us to give him some ingredients and to request a meal. Task Given a list of ingredients (strings matching /[a-z]+/) and a requested meal (string matching /[a-z][a-z ]*/) output the integer amount of meals Chef Avillez can make. Algorithm Eac...
stackexchange_codegolf
Pseudo-Quantum Bogosort Quantum Bogosort is as follows: Quantumly randomise the list, such that there is no way of knowing what order the list is in until it is observed. This will divide the universe into O(n!) universes; however, the division has no cost, as it happens constantly anyway. If the list is not sorted, ...
stackexchange_codegolf
In this question I asked you to guess an anagram quine based on its output. However it looks like we don't have a question asking to golf an anagram quine yet. So your task will be to make the shortest anagram quine that you can. What is an anagram quine? An anagram quine is a non empty program that prints an anagram...
stackexchange_codegolf
Given an ordered list of numbers (possibly with leading zeros), arrange the numbers vertically, then let all zeros drop all the way to the bottom and all overhangs drop to the bottom-most open slot. Output the resulting integers, removing leading zeros. Worked Example Say we were given the following as input: ['0000312...
stackexchange_codegolf
You should write a program or function that given an N by N equally spaced square grid and a solid inscribed circle outputs or returns the number of grid squares which are overlapped partially or fully by the solid circle. 0-sized overlaps (i.e. when the circle only touches a line) are not counted. (These overlaps occu...
stackexchange_codegolf
What general tips do you have for golfing in QBasic? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to QBasic (e.g. "remove comments" is not an answer). Tips pertaining to the QB64 emulator are also welcome. It has some extra features that aren't in Micros...
stackexchange_codegolf
The gambler's fallacy is a cognitive bias where we mistakenly expect things that have occurred often to be less likely to occur in the future and things that have not occurred in a while to be more likely to happen soon. Your task is to implement a specific version of this. Challenge Explanation Write a function that r...
stackexchange_codegolf
Consider this nested array [[1,2,4],[1,2,3],[2,3]] In each subarray in which 1 appears, a 2 appears. You might say that 1's presence is dependent on 2's presence. The converse is not true, as 2 appears in a subarray without 1. Additionally, 3 is dependent on 2, and 4 is dependent on 1 and 2. Task Given a list of lists ...
stackexchange_codegolf
Prime Wednesdays Your task is to count the number of Wednesdays that fall on a prime day of the month in a particular year. For instance, 7-13-16 is a prime Wednesday. For consistency use the Gregorian calendar for all dates. Input The input to your program/function will be a year (eg 2016) and is flexible. The year wi...
stackexchange_codegolf
The Mel calendar is used in the fictional world of Kaldia. Your goal is to convert dates into the Mel calendar. This calendar has 13 months of 28 days each, plus 1 or 2 extra days after the last month. A year that is divisible by 4 but not by 100, or divisible by 400 has 366 days, and other years have 365 (i.e. our lea...
stackexchange_codegolf
Given a universe of \$v\$ elements, a Kirkman triple system is a set of \$(v-1)/2\$ classes each having \$v/3\$ blocks each having three elements, so that every pair of elements appears in exactly one block all classes are partitions of the universe. Kirkman's schoolgirl problem corresponds to the \$v=15\$ case. Fif...
stackexchange_codegolf
Background Recognizing primality seems like a poor fit for (artificial) neural networks. However, the universal approximation theorem states that neural networks can approximate any continuous function, so in particular it should be possible to represent any finitely-supported function one desires. So let's try to re...
stackexchange_codegolf
Bi-directional translator The challenge is to create a translator that can translate a [a-zA-Z ] string into another string according to the mappings below. The translator should also be able to translate translated text back into its normal form (hence bi-directional). Case doesn't have to be maintained and can be eit...
stackexchange_codegolf
Key links: Troll question Chat room Game Controller Interface Dwarf league table <script src="https://ajfaraday.github.io/Thud/dist/data/tables.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><table> <thead> <tr> <th>Client</th> <th>Wins</th><th>Loses</th> <th>S...
stackexchange_codegolf
A screen consists of some LED segments like such: The screen can be split into several(maybe one) component. Each component is a segment like above, with varying lengths. These components can be used to display any amount, including 0, of digits, as long as the component is large enough. Every digit except 1 needs two...
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
You should write a program or function which takes a non-negative integer k and a sorted integer list Las input and outputs or returns a smoothed list M. M is created from the ascending list L by inserting at most k integer elements while keeping the list sorted. The inserted integers should be chosen in a way that the...
stackexchange_codegolf
Given a positive number \$n\$ we call another (not same as n) positive number \$m\$ good if we insert same digits in both n and m and the resulting fractional value is same. $$m/n = m_{\text{transformed}}/n_{\text{transformed}}$$ $$or$$ $$m*n_{\text{transformed}} = m_{\text{transformed}}*n$$ Clarifications: No leading...
stackexchange_codegolf
Background The monkeys need your help again organizing their defense and have asked you, Benjamin the code monkey, to create a program that will list all tower upgrade options as they appear in your insta-monkey collection. Each tower has three unique upgrade "paths", called "top", "middle", and "bottom", each having a...
stackexchange_codegolf
Given the name of an HTTP status code, such as OK or Continue, output or return the corresponding number. Your code is limited to 200 bytes, and the winner is the answer that correctly finds the number for the most status codes. For this challenge, the status codes your program should handle are: 100 Continue 101 Switc...
stackexchange_codegolf
You have to decompose a positive integer/fraction as a product of powers of factorials of prime numbers. For example 22 = (11!)^1 × (7!)^(−1) × (5!)^(−1) × (3!)^(−1) × (2!)^1 10/9 = (5!)^1 × (3!)^(−3) × (2!)^1 Use this special notation: prime number#power to denote each term, e.g. (11!)^4 is denoted as 11#4. Output...
stackexchange_codegolf
Inspired by a tweet by Nathan W. Pyle There is, now, a standard method of converting your boring, normal human name into a mysterious, ethereal Ghost Name™️. Ably described by Mr Pyle... Use your first name: a - add “t” after it e - add “boo” after it h - becomes “s” n - add “oo” after it r - add “eee” after it...
stackexchange_codegolf
Consider the problem of N queen on an (NxN) chessboard. Two queens are said to attack each other if they are on the same row, column, or diagonal. Implements backtracking algorithm to solve the problem i.e. place N non-attacking queens on the board.
stackexchange_codegolf
Input Name of a stackexchange site or any way to uniquely identify the site. Output The hour of the day that had the largest number of answers posted over the previous 24 hours. E.g. 14:00-15:00 GMT. You can take the input and give output in any easily human readable format. Your code can access the Internet but only t...
stackexchange_codegolf
Given a string of ASCII letters (upper and/or lower case), output the raw MathJax required to display that string bifurcating at each character, into superscripts and subscripts. For example, the inputs cat and horse would result in outputs which MathJax renders as the following, respectively: Note that only one inpu...
stackexchange_codegolf
Swap encoding is an encoding method where you iterate through a string, reversing sections of it between pairs of identical characters. The basic algorithm For each character in the string: Check: Does the string contain the character again, after the instance you found? If so, then modify the string by reversing the s...
stackexchange_codegolf
Write a program or function to produce the following output in the correct order. EDIT: The symbols are not mathematical! The numbers just represent unique data and the + and - could be any two arbitrary symbols. Take an non-negative integer input n. The first line is always -, even for n=0. If the current line is -, ...
stackexchange_codegolf
Parenthetical names Your challenge is to build a program that puts parentheses around the 'title' part of names. For example, Sonic the Hedgehog is converted to Sonic (the Hedgehog). Rules: Around every the that passes the following rules, an opening parentheses will be added before the the and a corresponding closing...
stackexchange_codegolf
For a given number n, output an strictly decreasing array whose sum is n and its lexicographical order is the smallest for any possible outputs Smallest lexicographical order means that for or sum n=9 the following strictly decreasing arrays are possible: [[9],[8,1],[7,2],[6,3],[5,4],[6,2,1],[5,3,1],[4,3,2]]. Putting t...
stackexchange_codegolf
Write a program or function that takes in a string and outputs a count of each modern English alphabet letter in the string, case-insensitive. Input: A string consisting of printable ASCII characters (code points 32-126). Output: A list of pairs, where each pair consists of a letter and its count in the string. The lis...
stackexchange_codegolf
Suppose an infinite tiling of hexagons composed of |/\ characters. / \ / \ / \ / \ | | | | | \ / \ / \ / \ / etc. | | | | \ / \ / \ / Given input n > 0, output a triangular portion of that tiling as depicted in the below examples, anchored with a _ in the middle of a hexagon: n=1 \_/ n=2 \/ \/ ...
stackexchange_codegolf
Today, November 11, 2015, is Veterans Day in the United States. "Taps" is the bugle call played at U.S. military funerals: ("Taps" on SoundCloud from vtmiller) It is a simple melody, only twenty-four notes long and using only four different notes. Here is the sheet music: (source) Challenge Write a program or funct...
stackexchange_codegolf
Brain-Flak is a stack-based esoteric language with eight commands: () Evaluates to 1 <> Switch active stack; evaluates to 0 [] Evaluates to height of current stack {} Pop current stack; evaluates to the popped number (...) Execute block and push the result; evaluates as result <...> Execute block; eva...
stackexchange_codegolf
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. Output how many letters would be used if all the numbers from 1 to 1000 (one thousand) inclusive were written out in words. NOTE: Do not count spaces or hyphens. For example, 342 (th...
stackexchange_codegolf
Imagine you are sitting at a park. Suddenly your car gets hijacked and being driven in different directions. Here are the directions, arrows show which direction goes towards where: South | V East-> <-West ^ | North After being driven, the car stops. Now you have to find out ho...
stackexchange_codegolf
A menger sponge is a fractal made out of cubes within cubes within cubes... If you start with a cube, on each face there are 9 squares. The middle square becomes empty (or 0). The other 8 squares iterate this process. They each get split up into 9 squares and the middle square face is taken out. The goal today is to ge...
stackexchange_codegolf
This is a rock paper scissors competition. Algorithms will face each other in 100 rounds of rock paper scissors. Except that the algorithms will also be able to read the source code of each other! Leaderboard 1. Chaos Bot (by Aiden4) - 27 Points, 168 bytes 2. Anti-99%-of-posts (by Lyxal) - 24 Points, 489 bytes 3. Psued...
stackexchange_codegolf
Shrink each word in a string of group of strings to single letters delineated by spaces or punctuation. Example I'm a little teapot, short and stout. Here is my handle, here is my spout. When I get all steamed up - hear me shout! Tip me over and pour me out. becomes I' a l t, s a s. H i m h, h i m s. W I g a s u -...
stackexchange_codegolf
Your goal is to write a program that prints a number. The bigger the number, the more points you'll get. But be careful! Code length is both limited and heavily weighted in the scoring function. Your printed number will be divided by the cube of the number of bytes you used for your solution. So, let's say you printed ...
stackexchange_codegolf
Given a non-negative integer N, output the smallest odd positive integer that is a strong pseudoprime to all of the first N prime bases. This is OEIS sequence A014233. Test Cases (one-indexed) 1 2047 2 1373653 3 25326001 4 3215031751 5 2152302898747 6 3474749660383 7 3415500717...
stackexchange_codegolf