instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Air balloons need a gas that is lighter than air. However, hydrogen is flammable, while helium is not sustainable, so we need a replacement! You must write code that determines whether any given gas is lighter than air. Input: a molecular chemical formula of a gas (ASCII) Output: true if the gas is lighter than air; f...
stackexchange_codegolf
Background Variable declaration statement in C consists of three parts: the name of the variable, its base type, and the type modifier(s). There are three kinds of type modifiers: Pointer * (prefix) Array [N] (postfix) Function () (postfix) You can specify a list of function arguments inside the parens, but for the s...
stackexchange_codegolf
This is a problem on Luogu OJ. I decided to post it here because on Luogu OJ, many people, including me and my friend, are interested about how to solve this problem within the fewest characters. Your task is to output the following ASCII-art: ************ ####....#. #..###.....
stackexchange_codegolf
Challenge You will be given an input represented by x, which is a string containing at least 3 characters. It will consist only of the standard numeric characters, 0 through 9. Your job is to find and output how many right triangles can be formed with the given numbers. Rules Numbers must be kept in the order they wer...
stackexchange_codegolf
Snaking Number Challenge I wonder how many snaking numbers there are between 1 and 50,000? Snaking Numbers, in this game, are numbers which can be typed out on a traditional numberpad (format below) by moving one key up, down, left, or right. 7 8 9 4 5 6 1 2 3 0 For example, if you start with the number 5, you could...
stackexchange_codegolf
Rules: In this game you start at the top of a rectangular grid of size N x M made up of walls and open spaces. The input is N lines of M characters, where a . specifies an open space and a x specifies a wall. Your program should output the smallest number K such that there exists a path from the top left corner to the ...
stackexchange_codegolf
Given a positive integer as input, your task is to output a truthy value if the number is divisible by the double of the sum of its digits, and a falsy value otherwise (OEIS A134516). In other words: (sum_of_digits)*2 | number Instead of truthy / falsy values for the true and false cases, you may instead specify any ...
stackexchange_codegolf
Follow the Path I got directions to my friend's house, but it looks like his map might have some mistakes. He's expecting me soon, so I need some short code to figure out if I can get there. The Challenge The code should, when given an ASCII representation of a path as input, traverse from the start to the end, and out...
stackexchange_codegolf
Background Fibonacci trees \$T_n\$ are a sequence of rooted binary trees of height \$n-1\$. They are defined as follows: \$T_0\$ has no nodes. \$T_1\$ has a single node (the root). The root node of \$T_{n+2}\$ has \$T_{n+1}\$ as its left subtree and \$T_n\$ as its right subtree. T0 T1 T2 T3 T4 O ...
stackexchange_codegolf
Introduction Every number can be represented as ASCII. For example, \$0\$ comes in ASCII is \$48\$, \$1\$ is \$49\$, and so on. Using this method of translating numbers to other numbers, it is possible to infinitely expand a number, by replacing all its digits with their ASCII values and doing the same for the result. ...
stackexchange_codegolf
I've invented an SQL-like language. Let's call it SelectQL. You can't INSERT anything, you can only SELECT, and I don't have the time for an interpreter. How about you help? The Challenge Write a full program or a function that takes in a database of tables and a valid SelectQL SELECT string, interprets the string, and...
stackexchange_codegolf
Challenge Design a compression algorithm specialized for compressing ASCII mazes. You will need to create both a compression algorithm and a decompression algorithm. Your score will be based on the size of your compressed mazes. Mazes These mazes are made primarily of the characters (floors), +, -, |, and # (walls), a...
stackexchange_codegolf
You've received a coded message from your ally that you know is encoded with the VIC cipher. As you know that the VIC cipher is notoriously convoluted, you want to write a program that will decode the VIC cipher but is small enough to hide from the enemy if you are captured, and thus uses as few bytes as possible. Your...
stackexchange_codegolf
The challenge is simplistic, given an input time as a string in any one of the following formats: hh, hh:mm or hh:mm:ss with 0 ≤ hh ≤ 23, 0 ≤ mm ≤ 59 and 0 ≤ ss ≤ 59. Output what time it currently is using the following symbols: AA LABEL FOR CHARACTER CODE POINT HEXADECIMAL == ==================== ==========...
stackexchange_codegolf
In graph theory a tree is just any graph with no cycles. But in computer science we often use rooted trees. Rooted trees are like trees except they have one specific node as the "root", and all computation is done from the root. The depth of a rooted tree is the smallest number, \$n\$, such that any node of the tree ...
stackexchange_codegolf
Given an input string and a wrapping string, find the location of the first input string char in the wrapping string and replace it with the wrapping string char 1 step to the right of that, find the second char in the wrapping string and replace it with the char 2 steps to the right, find the third and replace it with...
stackexchange_codegolf
This is the cops' thread. The robbers' thread goes here. Write a program or function consisting only of printable ASCII characters (that excludes tab and newline) that outputs at least 5 printable ASCII characters in ascending order (from space to tilde / 32 to 126). Characters can be outputted several times, as long a...
stackexchange_codegolf
This is the companion thread to the main Recover the mutated source code (link) challenge. If you have successfully cracked a cop's answer, post your solution as an answer to this question. As a reminder, here are the robber rules from the main challenge again: The robber will attempt to change the cop's program (whic...
stackexchange_codegolf
Inputs: Two single digits (let's call them m and n) and two chars (let's call them a and b) in your input format of choice. Output: For the walkthrough, pretend m=2, n=5, a='a', b='b'. Your output will be a string built from your four inputs. Let's call the string result, with value "". First, concatenate a onto result...
stackexchange_codegolf
Description : Given a string as input, check if it is a valid ordinal number in English or not. If it is valid return truthy value otherwise return falsy value. (Suggested by @Arnauld. Thanks . Also by @JoKing) For users who want to know about ordinal numbers go here : https://www.mathsisfun.com/numbers/cardinal-ordina...
stackexchange_codegolf
Write a function or program that accepts one character (or a string of length 1) as input, and outputs the number of times that character occurs inside the code. This program must be a Proper Quine, only in the sense that it cannot, for example, read itself as a file, etc. Input can be any character, printable or not...
stackexchange_codegolf
Take as input two strings \$A\$ and \$B\$. Output a string \$C\$ that is \$A\$ but with two characters swapped such that the Levenshtein distance \$d(C,B)\$ is as small as possible. You must swap two characters and you cannot swap a character with itself, although you may swap two identical characters in different po...
stackexchange_codegolf
Goal Given a deal result from Duplicate Contract Bridge, calculate the deal score. Basically the same as iBug's question, which was deleted. I figured out this scoring system while trying to answer that question. Input Input is a deal result, and whether or not the declaring side is vulnerable. The deal result is a str...
stackexchange_codegolf
Introduction You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies x*x+y*y=1. Because Cryptographers1 are also weird, they love finite fields and sometimes finite rings (it is not like they have much choice though), so let's comb...
stackexchange_codegolf
What general tips do you have for golfing in MathGolf? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to MathGolf (for tips which can be applied to loads of programming languages, look at the general tips).
stackexchange_codegolf
In the video game Minecraft, the player can obtain experience points (XP) from various activities. In the game, these are provided as XP "orbs" of various sizes, each of which give the player various amounts of XP. The possible orbs are shown in the image below, along with the smallest and largest amount of XP that orb...
stackexchange_codegolf
Create a program that calculates my reading speed! The challenge Write a program which takes some text as input and waits for a start signal from the user to display the input. When to user gives a second end signal, the program should output the reading speed of the user, which is defined as the number of words in the...
stackexchange_codegolf
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
A simple graph is toroidal if it can be drawn on the surface of a torus without any edges intersecting. Your task is to take a simple undirected graph via any reasonable method (adjacency matrix, edge vertex sets, etc.) and decide whether or not it is a toroidal graph. You should output one of two distinct values for...
stackexchange_codegolf
Your task is to build a bridge to connect two cliffs given an input d, the distance apart. d will always be even However, the bridge needs columns to hold it up. Each column can hold a max of 6 spaces on each side. For this example: ________ ________ | | A | ...
stackexchange_codegolf
What is the shortest selector (by character count) to select ALL html elements on a web page, without using asterisk (*)? Some examples are the following: a,:not(a) /*9 chars*/ :nth-child(n) /*12 chars*/ :link,:not(:link) /*17 chars*/
stackexchange_codegolf
As if this challenge could be any more Pythonesque in spirit... No prior knowledge of Markov chains or encryption techniques is required. You are a spy who needs to obtain some crucial information from the British security service M1S. The agents of M1S are well aware that their Wi-Fi signals can be intercepted, their ...
stackexchange_codegolf
Given an integer n, return the number of ways that n can be written as a list of prime numbers. For example, 2323 can be written as (2,3,23), (23,23) or (2,3,2,3) or (23,2,3), so you would output 4. If it can not be written in this way, you should output 0. A prime number such as 019 or 00000037 is a valid prime for th...
stackexchange_codegolf
I'm writing a program that takes a number from input (call it x), loops from 0 to (x - 1) (let's call our iterator y) and prints \$y^x+x\$ for each y. After the loop, it then prints "SUM: N" (without a newline) where the N is the sum of the all of the previously printed values. How can I make the code I already have sh...
stackexchange_codegolf
The challenge: compute the day of the week from a MM-DD representation of a day in this year (2021). However, you have to write your program in the following subset of Python: (I chose Python because it's popular and easy to understand even to the people who doesn't know the language. Obviously you can use another prog...
stackexchange_codegolf
Help! My Completely Automated Lights From Darks Separator V3001.01 broke! :( Guidelines Task Write a program that will take an input of an array (or a list in some languages) of any amount of strings that are either the letter L or the letter D (representing lights or darks) and output an array that contains two arra...
stackexchange_codegolf
This is a King of the Hill challenge in a round robin. It's a battle to find the best gunman of the west! To be able to compete in this contest you need to make two functions. The first one sets the attributes of your gunman and the second is the main logic function for the gunman. Attribute Function function () { ...
stackexchange_codegolf
Given two contiguous shapes of the same area, determine the optimal way to divide the first shape into a minimum number of contiguous segments such that they can be rearranged to form the second shape. In other words, find the minimum number of segments required that can form both of the shapes. "Contiguous" means that...
stackexchange_codegolf
OEIS sequence A020872 counts the number of restricted forests on the Möbius ladder Mn. The Challenge The challenge is to write a program that takes an integer as an input n > 1 and returns A020872(n), the number of restricted forests on the Möbius ladder Mn. This is code-golf, so shortest code wins. (An ulterior motiv...
stackexchange_codegolf
Inspired by this question. Given a list containing numbers, print: The sum and product of the numbers in the list The average and median The differences between each term in the list (e.g. [1,2,3] -> [1,1]: 1+1=2, 2+1=3) The list, sorted ascending The minimum and maximum of the list The standard deviation of the list ...
stackexchange_codegolf
Let's define fn(k) as the sum of the first k terms of the natural numbers [1, ∞) where each number is repeated n times. k | 0 1 2 3 4 5 6 7 8 9 --------+------------------------------------------------- f_1(k) | 0 1 3 6 10 15 21 28 36 45 deltas | +1 +2 +3 ...
stackexchange_codegolf
Challenge Find the shortest regex that validates, i.e. matches, every possible date in the Proleptic Gregorian calendar (which also applies to all dates before its first adoption in 1582) and does not match any invalid date. Output Output is therefore truthy or falsey. Input Input is in any of 3 expanded ISO 8601 d...
stackexchange_codegolf
Your task is to output a spaceship of size n with shooters/guns and n bullets of character - (with spaces in between each bullet) for each gun Rules If n is odd, you must output the guns every even numbered row If n is even, you must output the guns every odd numbered row All rows with guns must have n+1 # character...
stackexchange_codegolf
You are the captain of a world-famous wrestling team. An Olympic-grade match is coming up, and you are determined not to let your team down. You also happen to be a competent programmer, so you are going to write a program to help your team win! You have access to the strength ratings for each of your own team wrestler...
stackexchange_codegolf
Input An integer n in the range 100 to 10^18 and an integer k in the range 1 to 18, inclusive. The swap operation A swap chooses two digits at different positions and exchanges their positions, as long as the swap does not result in a leading zero. For example if we start with the integer 12345 we can perform one swap ...
stackexchange_codegolf
Given infinite different integers, order them into a sequence \$a_1, a_2, a_3, ...\$ such that \$a_i>a_{i+1}\$ iff \$i\$ is even(or odd, as long as it's constant for all possible inputs and all \$i\$). In other word, make the sequence go alternately up and down (or down first, as long as it's constant). Examples: ℤ => ...
stackexchange_codegolf
For this problem you are given an \$n \times n\$ matrix of integers. The task is to find a pentagon in the matrix with maximum sum. The pentagon must include part (or all) of the x and y axes as two of its sides starting from the top left cell. All the sides except one must be horizontal or vertical. The remaining si...
stackexchange_codegolf
Objective Given an expression involving ternary values, evaluate it into a ternary value. Ternary Values The three truth values in question are the values of Haskell's Ordering, namely LT, EQ, and GT. They stand for "less-than", "equal-to", and "greater-than", respectively. Furthermore, they themselves have an order; L...
stackexchange_codegolf
Write a script, program or function which takes one input of type string and outputs or returns some sort of indication wether the input string was 'hi whats up' (without the apostrophes) or not. You can for example return true if it was and false if it wasn't. Or print something to the screen, like 1 or 0. It just has...
stackexchange_codegolf
Manually summing a Cubically cube's faces is tedious and time-consuming, sorta like writing code in Cubically itself. In Most efficient cubifier, I asked you to translate ASCII to Cubically source. One of the answers there uses a cube initialization sequence and then modifies the resulting cube based on the sums of the...
stackexchange_codegolf
Mr Seckington is a mobile grocer. He drives his van door-to-door selling his produce all around the nearby villages. Mr Seckington needs a method to weigh the produce he is selling so he knows how much to charge his customers. Because space is at such a premium on his van, he uses an interesting sequence of weights ...
stackexchange_codegolf
kolmogorov-complexity is one of the tags on this site, representing challenges that test how much code is needed to output a given fixed result (usually a piece of text). The info page for this tag lists the string 4c1j5b2p0cv4w1x8rx2y39umgw5q85s7uraqbjfd as an example of a string with a high Kolmogorov complexity, sta...
stackexchange_codegolf
It seems that many people would like to have this, so it's now a sequel to this challenge! Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number. Task: Given a prime power pn > 1, return the power n. Testcases: input output 9 2 16 4 343 ...
stackexchange_codegolf
Problem Assume you have a single 7-segment display without a decimal point, so 7 "lines" that can be labelled A through G as seen here. This display will only show the numbers from 0 to 9 as usual, like so: Any time this display changes from one number to another, some of its lights will have to change their state fr...
stackexchange_codegolf
Imagine a very simple language. It has just 2 syntax features: () indicates a block scope, and any word consisting only of 1 or more lower case ASCII letters, which indicates a identifier. There are no keywords. In this language, the value of identifiers is not important except when they appear multiple times. Thus for...
stackexchange_codegolf
This was inspired by Print a Negative of your Code and Golf a mutual quine. Consider a rectangle of characters, that meet the following restrictions: Consists solely of printable ASCII characters Dimensions both greater than 1 Each row and each column contains at least one space. Each row and each column contains at ...
stackexchange_codegolf
Challenge Create the image of a progress pride flag. Output Dimensions Rules Your program must create the image and not just load it from a website The colours can be just your language's default if it is very difficult / impossible to load RGB values, else they should be: red: (255,0,0), orange: (255,140,0), yello...
stackexchange_codegolf
"Let's face it, aligned images are like little gifts from Heaven. Welcome, but unexpected." - Geobits +10000 reputation to whoever wins this challenge. Rules: 1) You are to generate a program. 2) Input will be an image, however whether it is passed as a file or a list of numbers is up to you. 3) Output will be a file w...
stackexchange_codegolf
Santa's Shortest Path Problem Trying to be as time-efficient as possible Santa needs to plan his trips carefully. Given a 5X5 grid representing a map of villages it is your task to be Santa's flight controller. Show santa the shortest and therefor fastest route to fly his sleigh and give him a list of coördinates (or d...
stackexchange_codegolf
Since this is a answer-chaining challenge, you might want to sort answers by oldest. Your task is simple: Choose any printable ASCII character that's not chosen in the previous answers. And then, you need to print your chosen character in your program to standard output. (You can ONLY print your chosen character, with...
stackexchange_codegolf
Task When running the program must show the season according to the host computer's current time. Rules The output must be either: Spring, Winter, Summer or Autumn. The capitalization does not matter. The output must not contain anything else the the season names stated above. A season is 3 months and january is in th...
stackexchange_codegolf
Your task is to write 2 functions/programs. They may share code. The first function must, given a string and a character, output a new string that does not contain that character. The second function must, given the string from the previous function and the excluded character, reconstruct the original string. All input...
stackexchange_codegolf
We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if n teens have m torches with them, but each group needs at least one torch? Example: Three teens with torches (X) and two without ...
stackexchange_codegolf
In Fewest (distinct) characters for Turing Completeness, the goal is to find the minimum number of characters which make a language Turing Complete...in other words, allow it to do any computation possible with any other language. In this challenge, we'll be doing somewhat of the opposite, and finding the minimum numbe...
stackexchange_codegolf
The Corpus are a fictional faction from the popular video game Warframe who have a somewhat interesting language. Whilst other factions in the game such as the Grineer have some logic behind their language, the Corpus is simply a lossy substitution of the English language. All Corpus words are the same as their English...
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
Warning The answers to this challenge test for a specific version of the patch that helps stop WannaCrypt/WannaCry attacks. Depending on your operating system, you may have a different patch. The best way to protect yourself is to make sure your PC is fully up to date and be careful when opening attachments and web lin...
stackexchange_codegolf
Objective Given a vertex figure consisting of regular convex polygons, determine whether it represents a convex uniform polyhedron. What is a uniform polyhedron? A uniform polyhedron is a polyhedron whose faces are regular polygons, while having the same vertex figure for each vertices. Generally a uniform polyhedron c...
stackexchange_codegolf
A big part of radio communication is the NATO Phonetic Alphabet, which encodes letters as words to make them easier to understand over comms. Your job, if you wish to accept it, is to print them one by one. You must print this exact string to stdout: A: Alfa B: Bravo C: Charlie D: Delta E: Echo F: Foxtrot G: Golf H: Ho...
stackexchange_codegolf
Semiperfect numbers A semiperfect/pseudoperfect number is an integer equal to the sum of a part of or all of its divisors (excluding itself). Numbers which are equal to the sum of all of their divisors are perfect. Divisors of 6 : 1,2,3 6 = 1+2+3 -> semiperfect (perfect) Divisors of 28 : 1,2,4,7,14 28 = 14+...
stackexchange_codegolf
The Hamming distance between two strings is the number of positions they differ at. You are given a set of binary strings. The task is to find the length of the shortest route that visits all of them at least once and ends where it started, in a metric space where the distance between two strings is the Hamming distanc...
stackexchange_codegolf
The challenge is make a digital clock that exhibits ascii numbers in a 24-hour format like: _ _ _ _ |_| |_| . |_| |_| |_| |_| . |_| |_| or _ _ _ _| _| . |_| |_ |_ _| . | _| and updates the screen every 1 minute (or every 1 second, for praticity reasons). It must reset to 00:00 after 23:5...
stackexchange_codegolf
Full width text is text that has a space after every character, including the last one. For instance, the first sentence of this question becomes: F u l l w i d t h t e x t i s t e x t t h a t h a s a s p a c e a f t e r e v e r y c h a r a c t e r , i n c l u d i n g t h e l a s t o n e ....
stackexchange_codegolf
Your task is to fill the bucket with numbers upto a given input. Rules Numbers occupy the leftmost position then rightmost, then leftmost and so on. After overflow, the numbers start to gather around the bucket in a similar manner. They occupy position diagonally. The examples should make it clear what the expected out...
stackexchange_codegolf
Input Two positive integers a > b Output The smallest integer c >= a so that c can be factored into two parts with one part an integer power of two (that is at least two) and the other part no larger than b. Examples If b = 100 and a = 101 , then the output should be 102 as 102 is 2 times 51. For the same b, if a = 201...
stackexchange_codegolf
The task Write a program or function whose input is a list/array X of integers, and whose output is a list of sets of integers Y, such that for each element e in each set Y[i], X[e] = i, and such that the total number of elements in the sets in Y equals the number of elements in X. (This is basically the same operation...
stackexchange_codegolf
In the absurdist play Rosencrantz and Guildenstern are Dead, the two main characters Rosencrantz and Guildenstern(or are they?) are always mixing up which of them is who—or sometimes which of their own body parts is which—because of a perceived lack of individual identity. Wouldn't it be absurd if they even shuffled ar...
stackexchange_codegolf
Figuring out whether a given number is prime, while not very complicated, is kind of hard. But making a guess doesn't need to be. Seeing whether a number is a multiple of 2 or 5 is easy - you can just look at the last digit. Multiples of 3 isn't much harder, just add up the digits and see if you end up with a multiple ...
stackexchange_codegolf
Task Given a list of nodes representing a binary tree of positive integers serialized depth-first, return a list of nodes representing the same tree serialized breadth-first. To represent an absent child, you may use null, 0, 'X', Nothing, [], or any other value that is distinct from your representation of a node's val...
stackexchange_codegolf
Objective Simulate an edge-triggered D Flip-Flop. What is D Flip-Flop? A D flip-flop is an electronic digital device that outputs an inputted data (abbr. D) with synchronization to a clock (abbr. CLK). Usually CLK is a uniform pulse, but in this challenge, CLK may be not uniform. Input A bitstring with length \$n\$ wil...
stackexchange_codegolf
Note: as this question has been marked as a duplicate, I have accepted an answer. However, I will still check this question if users can find a shorter way of doing it, and accept that answer. Given two numbers (which are multiples of 0.5) representing heads-percentage and tails-percentage from a series of coin-flippin...
stackexchange_codegolf
Today (March 15) is the Ides of March, best known for being the date that Julius Caesar was assassinated. What's “Ides”? Well, the ancient Romans didn't simply number the days of month from 1 to 31 like we do. Instead, they had a more complex system of counting backwards to the Kalends, Nones, or Ides. Challenge Writ...
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
Challenge For a given positive integer \$n\$: Repeat the following until \$n < 10\$ (until \$n\$ contains one digit). Extract the last digit. If the extracted digit is even (including 0) multiply the rest of the integer by \$2\$ and add \$1\$ ( \$2n+1\$ ). Then go back to step 1 else move to step 4. Divide the rest of...
stackexchange_codegolf
Camel Up Cup 2k18 In this challenge, we will be playing the semi-popular board game Camel Up. Camel Up! is a board game that has players betting on camels to win rounds, win the game or lose the game, set traps to influence movement or move a camel. Each of these decisions rewards you with the chance of getting some mo...
stackexchange_codegolf
Based on the interpretation user @ThePirateBay made from the first version of my own challenge Output diagonal positions of me squared now I challenge you to make ASCII art that draws diagonal lines based on a square character matrix based on a given number n. Input A number n. Output A square matrix of size n^2 which...
stackexchange_codegolf
Python is the fastest-growing major programming language today. It is the most wanted language for the third year in a row, meaning that developers who do not yet use it say they want to learn it.[1] The reason for Python's popularity is its many versions.[citation needed] There are in fact 116 versions of Python, incl...
stackexchange_codegolf
Imagine you place a knight chess piece on a phone dial pad. This chess piece moves from keys to keys in an uppercase "L" shape: two steps horizontally followed by one vertically, or one step horizontally then two vertically: +-+ |1| 2 3 +-+ `-------v | +-+ 4 | 5 |6| | +-+ | ...
stackexchange_codegolf
The Challenge Output a list of years that starts with the current year and ends 120 years ago. The birth year of every living human would be included in this list. Details The list should be in descending order. Every built-in function to manipulate arrays and/or lists is allowed. Shortest code in bytes wins. When run ...
stackexchange_codegolf
Challenge You will create a function which takes a matrix filled with letters from the alphabet and determine if a 2x2 square composed of vowels exists. If a 2x2 square of vowels is found, your function should return the top-left position (row-column) of the square. If no 2x2 square of vowels exists, then return the ...
stackexchange_codegolf
WinAli is a model assembler for Windows. It emulates a real CPU and is meant to help students learning and understanding the Assembly language. German Wikipedia article: http://de.wikipedia.org/wiki/WinAli (there is no english article at the moment) In case you want to test your produced output: Link to Google Drive (t...
stackexchange_codegolf
Write a program that takes as its input a string consisting of printable characters (ASCII 20-7E) and an integer n in [2,16] and performs the following modification to the string. Each character in the string is converted to its ASCII code (the examples given are in hexadecimal, though base 10 is also acceptable). The...
stackexchange_codegolf
Given an atomic number in the inclusive range [1,118], write the shortest program/function that outputs one of {2,8,18} if the element with that atomic number follows the duplet, octet, or 18-electron rule, respectively. Notes The Octet/Duplet/18-electron rule is a rule of thumb that describes how many electrons is ne...
stackexchange_codegolf
The cool stuff The following rosace can help calculate numbers modulo 7. In order to do that, you must start at 0 and turn clockwise a number of steps given by the first digit. Then, for each successive digit, follow the arrow and then turn clockwise the number of steps given by that digit. Here is how you proceed for...
stackexchange_codegolf
The word BANANA appears exactly once in this word search: B A N A A N B B A B A N A B A N A N A B N N A A N N B A A A N N N A A N N N B A A N N N B A N A N A A B A N A N B A N A N B B A The word search above contains only one occurrence of the word BANANA looking up, down, left, right, or diagonally, but it has lot of...
stackexchange_codegolf
For a given positive integer, try to find out the smallest possible rotation resulted by rotating it 0 or more bits. For example, when the given number is 177, whose binary representation is \$10110001_{(2)}\$: \$ 10110001_{(2)}=177 \$ \$ 01100011_{(2)}=99 \$ \$ 11000110_{(2)}=198 \$ \$ 10001101_{(2)}=141 \$ \$ 00011...
stackexchange_codegolf
Rules You will start with only two elements: Points \$A\$ and \$B\$ such that \$A \neq B\$. These points occupy a plane that is infinite in all directions. At any step in the process you may do any of the three following actions: Draw a line that passes through two points. Draw a circle centered at one point such tha...
stackexchange_codegolf
Titin is a protein found in muscle tissue. It is a pretty big protein, and its full chemical name is giant as well. Comprising 189819 characters, the full name of titin would take about 3.5 hours to pronounce. Your task is to output this entire name! Details The full name can be found here: Gist (this file does not inc...
stackexchange_codegolf
Working on something in probability theory, I stumbled across another combinatorical exercise. These are always fun to solve, searching for intelligent approaches. Of course, one can use brute force for the following task, but this challenge is restricted complexity, so this is not allowed. Task Given an integer Input ...
stackexchange_codegolf
You may or may not remember Xeyes, a demo program that came with (and, as far as I know, still comes with) the X window system. Its purpose was to draw a pair of eyes that followed your mouse cursor: Your challenge is to recreate Xeyes with ASCII art. Write a program or function that draws two ASCII art eyes (specifie...
stackexchange_codegolf