text
stringlengths
180
608k
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. Closed 7 years ago. **Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently ...
[Question] [ As you probably know, there is a [war going on in Ukraine](https://en.wikipedia.org/wiki/2022_Russian_invasion_of_Ukraine). I noticed that it seems nobody has posted a Ukrainian flag challenge yet, so I thought I'd do it myself in support of Ukraine. ## The Challenge Here is the flag: [![Flag of Ukrain...
[Question] [ Me thinks there aren't enough easy questions on here that beginners can attempt! The challenge: Given a random input string of 1's and 0's such as: ``` 10101110101010010100010001010110101001010 ``` Write the shortest code that outputs the bit-wise inverse like so: ``` 0101000101010110101110111010100101...
[Question] [ Duolingo, the language learning app, has a lot of things going for it, but there is one major issue that drives me crazy. It tells me how many days in a row I've used the app with a message like **You're on a 7 day streak!** Setting aside hyphenation and whether the number should be spelled out, this w...
[Question] [ Given a number N, output the [sign](https://en.wikipedia.org/wiki/Sign_function) of N: * If N is positive, output 1 * If N is negative, output -1 * If N is 0, output 0 N will be an integer within the representable range of integers in your chosen language. ## The Catalogue The Stack Snippet at the bott...
[Question] [ At the end of your interview, the Evil Interviewer tells you, "We make all of our applicants take a short coding test, to see if they really know what they are talking about. Don't worry; it's easy. And if you create a working program, I'll offer you the job immediately." He gestures for you to sit dow...
[Question] [ Consider a non-empty string of correctly balanced parentheses: ``` (()(()())()((())))(()) ``` We can imagine that each pair of parentheses represents a ring in a collapsed [telescopic construction](http://en.wikipedia.org/wiki/Telescoping_(mechanics)). So let's extend the telescope: ``` ( ...
[Question] [ # Cops section The robbers section can be found [here](https://codegolf.stackexchange.com/q/88981/34388). Thanks to **FryAmTheEggman**, **Peter Taylor**, **Nathan Merrill**, **xnor**, **Dennis**, **Laikoni** and **Mego** for their contributions. --- ### Challenge Your task is to write 2 different progr...
[Question] [ We say a string is *non-discriminating* if each of the string's characters appears the same number of times and at least twice. ### Examples * `"aa!1 1 !a !1"` is *non-discriminating* because each of the characters , `!`, `a` and `1` appear three times. * `"abbaabb"` is **not** *non-discriminating* bec...
[Question] [ Fibonacci + FizzBuzz = Fibo Nacci! --- # Your challenge is to create a Fibo Nacci program! * A Fibo Nacci program outputs the first **100** Fibonacci numbers (starting from 1). * If the Fibonacci number is divisible by both 2 **and** 3 (i.e. it is divisible by 6), then output FiboNacci instead of the n...
[Question] [ ## Warm up: Regex, Paper, Scissors This is the challenge I originally wanted to post, before realising that some very short solution exist. Nevertheless, it can be an interesting problem to think about in preparation for the actual challenge below. Write three regexes **R**, **P** and **S** such that t...
[Question] [ # This is the PPCG Prime **624 digits long** ``` 77777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777711111111111111111111111111111111111111111111111111111111111111111111111111111118888888811888888881...
[Question] [ This challenge is straightforward, but hopefully, there are plenty of avenues you can approach it: **You need to print/return a valid JSON *object* of at least 15 characters, not counting unessential whitespace.** Your program should work without any input. In the interest of clarity, a JSON object sta...
[Question] [ According to [this XKCD comic](https://xkcd.com/314/), there is a formula to determine whether or not the age gap in a relationship is "creepy". This formula is defined as: ``` (Age/2) + 7 ``` being the minimum age of people you can date. Therefore a relationship is creepy if either of the people in sa...
[Question] [ For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run...
[Question] [ ## Challenge Given the number of an XKCD comic, output the title text of that comic (the mouseover text). However, the program must throw an error when given the numbers `859` or `404`. ## Rules The number given will always be an existing comic (except `404`). Your program must not throw an error for ...
[Question] [ # Challenge Create a function or program that, when given an integer `size`, does the following: If `size` is equal to 1, output ``` H H HHH H H ``` If `size` is greater than 1, output ``` X X XXX X X ``` where `X` is the output of the program/function for `size - 1` (If you prefer, you may have the ba...
[Question] [ **Final results are here !** # Introduction In 2042, the world has become overpopulated. Globalization, overcrowding, new lifestyles and a global lack of hygiene has caused a new pandemic to spread. During those hard times, state leaders have to manage the situation. You can't let your population be de...
[Question] [ Inspired by [vi.sualize.us](http://vi.sualize.us/a_simple_closed_mona_lisa_space-filling_curve_kaplan_and_bosch_generative_art_picture_jqWC.html) ### Goal The input is a grayscale image and the output is a black and white image. The output image consists of just one closed curve (loop) that is not allo...
[Question] [ For example, the gate `A and B` is a logic gate with 2 inputs and 1 output. There are exactly 16 of them, because: * each logic gate takes two inputs, which can be truthy or falsey, giving us 4 possible inputs * of the 4 possible inputs, each can have an output of truthy and falsey * therefore, there a...
[Question] [ What general tips can you give for golfing in Ruby? I'm looking for ideas that can be applied to code golf problems in general that are specific to Ruby. (For example, "Remove comments" would not be an answer.) Please post one tip per answer. [Answer] * The numbers 100 to 126 can be written as `?d...
[Question] [ [Conway's Game of Life](http://en.wikipedia.org/wiki/Conways_Game_of_Life) is the classic example of cellular automation. The cells form a square grid and each has two states: alive or dead. On each turn, each cell simultaneously updates according to its state and those of its eight neighbours: * A liv...
[Question] [ Given two string inputs of "Rock", "Paper", or "Scissors", determine the outcome of the [RPS round](https://en.wikipedia.org/wiki/Rock%E2%80%93paper%E2%80%93scissors). Output 1 if the first player wins, -1 if the second player wins, or 0 for a tie. ``` Rock Rock -> 0 Rock Paper -> -1 Rock Scissors -> 1...
[Question] [ As [George Orwell](https://en.wikipedia.org/wiki/George_Orwell) wrote in [*1984*](https://en.wikipedia.org/wiki/Nineteen_Eighty-Four): > > [War is peace > Freedom is slavery > Ignorance is strength](http://www.sparknotes.com/lit/1984/quotes.html) > > > Write a program or function that takes in ...
[Question] [ As we all should know, [there's a HTTP status code **418: I'm a teapot**](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#418). Your mission, should you choose to accept it, is to use your creativitea and write the smallest possible server that responds with the above status code to any and ever...
[Question] [ I came across [SVGCaptcha](http://svgcaptcha.com/ "SVGCaptcha - generate captcha in svg"), and immediately knew it was a bad idea. I would like you to show just how bad an idea this is by extracting the validation code from the SVG images that code produces. --- An example image looks like this: [![8...
[Question] [ > > *Note: There is not been a vanilla parity test challenge yet (There is a C/C++ one but that disallows the ability to use languages other than C/C++, and other non-vanilla ones are mostly closed too), So I am posting one.* > > > Given a positive integer, output its parity (i.e. if the number is ...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/22469/edit). Closed 7 years ago. [Improve this question](/p...
[Question] [ In a language of your choice, write a program that *exactly* outputs the characters `Hello world!` followed by a newline. The code: * should not use any character more than twice (alphanumeric, symbol, whitespace...anything) * should not use any external resources * should not use any user input * shou...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. Closed 7 years ago. **Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently ...
[Question] [ # Preamble [Integers](https://en.wikipedia.org/wiki/Integer) are always either [even or odd](https://en.wikipedia.org/wiki/Parity_(mathematics)). Even integers are divisible by two, odd integers are not. When you add two integers you can infer whether the result will be even or odd based on whether the...
[Question] [ ### Introduction The Enigma was one of the first electro-mechanical rotor cipher machines used in World War II. That means that after a single letter is coded, it would change the key for the next letter. This was considered *unbreakable* by the Germans, due to the enormous key space. Even brute-forcin...
[Question] [ **Locked**. This question and its answers are [locked](/help/locked-posts) because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions. # Winners (decided 14/09/14) [Winning answer](https://codegolf.stackexchange.com/a/37290/31300) by...
[Question] [ ### Task Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half). The program/function must terminate within 10 seconds and return (by any means and in any format) two values: the total elapsed time, and the total execute...
[Question] [ Given no input, your task is to generate the following: ``` a b c d e f g h i j k l m n o p q r s t ...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/9359/edit). Closed 6 years ago. [Improve this question](/posts/9359/edit) Wr...
[Question] [ Anybody can make the output of a program bigger by adding characters, so let's do the exact opposite. Write a full program, an *inner* function or a snippet for a REPL environment in a language of your choice that satisfies the following criteria: 1. Your code must be at least 1 character long. 2. Runn...
[Question] [ > > "Baby Shark" is a children's song about a family of sharks. Having long been popular as a campfire song, it has been popularized since the mid-2000s by social media, online video and radio. - [Wikipedia](https://en.wikipedia.org/wiki/Baby_Shark) > > > Write program that takes no input, and writ...
[Question] [ **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 ...
[Question] [ # Task Given a string of English names of digits “collapsed” together, like this: ``` zeronineoneoneeighttwoseventhreesixfourtwofive ``` Split the string back into digits: ``` zero nine one one eight two seven three six four two five ``` # Rules * The input is always a string. It always consists of one...
[Question] [ [Dennis](https://codegolf.stackexchange.com/users/12012/dennis) puts in a huge amount of effort for this community, including as [moderator](https://codegolf.stackexchange.com/election), [language designer](https://github.com/dennismitchell), and provider of [TIO](https://tryitonline.net/). Unfortunate...
[Question] [ Ever fancied creating cool twitter hashtags such as *#brexit* or *#brangelina*? this golf is for you. --- Write a program that accepts two strings A & B as input and merges them according to the following algorithm: 1. let `n` be the number of vowels groups in A (e.g. `britain` has 2 vowels groups : `i...
[Question] [ ## Task Create a program or a function that is valid in multiple programming languages, and when compiled/interpreted as a different language outputs "Hello, World!" in a different natural language. For example, a valid solution might output `Hello World!` (English) when compiled and run as C, `Hallo W...
[Question] [ # Scenario One of your friends is struggling on a homework assignment. He needs a simple program which prints the first 404 natural numbers: ``` 1 2 3 4 5 6 7 8 9 10 11 ... 401 402 403 404 ``` Your challenge is simple: write this program for him. However, your connection is terrible, so 1 random charac...
[Question] [ The 9 Billion Names of God is a short story by Arthur C. Clarke. It's about a group of Tibetan monks whose order is devoted to writing down all the possible names of God, written in their own alphabet. Essentially, they are devoted to writing every possible permutation of their alphabet, restricted by ...
[Question] [ # dary! In events entirely unrelated to [what will hopefully happen to me](https://codegolf.stackexchange.com/help/badges/27/legendary) in the next couple of days, I task you to write code that does the following: 1. Print ``` Legen... wait for it... ``` immediately, with a trailing newline. 2. Wait un...
[Question] [ After spending a while on Stack Exchange, I can recognise most sites in the Hot Network Questions by their little icon (which is also their [favicon](http://en.wikipedia.org/wiki/Favicon)), but certainly not all of them. Let's write a program which can! You're to write code which determines the site, g...
[Question] [ The challenge is simple: Print the last, middle, and first character of your program's source code, in that order. The middle character is defined as follows, assuming a source length of `n` characters, and 1-indexing: * If `n` is even, print the `n/2`-th and `n/2 + 1`-th character. (`abcdef == cd`) * ...
[Question] [ What general tips do you have for golfing in C#? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C# (e.g. "remove comments" is not an answer). Please post one tip per answer. -- borrowed from marcog's idea ;) [Answer] Instead of usi...
[Question] [ ## Challenge I need help building a brick wall! Throw together some code for me using no input and produce the following output wall shown below: ``` _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|...
[Question] [ Inspired by [a bug](https://tio.run/##S9ZNT07@/z9TJ8s6TSM5I7FIq1izujwjMydVA8RKyy/SyLI1M7XOsrE0tM7S1tbUKra1zbIvKMrMK0nTUNMqBgpZQXlKCkqa1gWlJcUaSkBGbe3/3MTMPA2gIRpKUZER4WGhIcFBgQH@fr4@3l6eHu5uri7OTo4glf8B) in a solution to [this challenge](https://codegolf.stackexchange.com/q/141372/61563), your challeng...
[Question] [ Draw the Biohazard symbol in an arbitrary colour on a distinctly coloured background. The specific proportions were published in the June 27th 1974 issue of the [Federal Register](https://en.wikipedia.org/wiki/Federal_Register) of the US Government. ### Details * As output, writing to a file (raster an...
[Question] [ Our closest star, the sun, is quite fidgety. The times it rises and sets depend on where you are, and whether it is winter or not. We would like to be able to deduce if the sun is shining outside without having to leave the comforts of our basements - which is why we need an up-to-date sun map (a.k.a. ...
[Question] [ COBOL is a very old language, at the time of writing it is 58 years old. It is so old, in fact, that it has a very interesting quirk: the first six characters of each line are comments. Why is this, you ask? Well, those 6 characters were intended to be used as line numbers, back in the day where progra...
[Question] [ > > **Note**: This challenge is now closed. Any future cops' submission will not be considered for the accepted answer. This is to ensure that no one can post a very simple regex in the future that only remains uncracked because no one is interested in the challenge any more. > > > ## The Cops' Cha...
[Question] [ ## Intro The challenge is to create a program/function that prints the intersection of its own source code and a given string input. This is code golf and to be more precise: * Let `I` be the input set + `{"a","b","c"}` * Let `S` be the source code set + `{"b","f"}` * Then the intersection is what th...
[Question] [ Write a program or function that takes in a string only containing the characters `^` and `v` (you can assume there will be no other characters). Read from left to right this string represents the sequence of mouse clicks a single user made while viewing a [Stack Exchange](https://stackexchange.com/) q...
[Question] [ [T](https://codegolf.stackexchange.com/questions/154548/fryer-simulator#comment-377507)he brethren from the order of St Golfus the Concise have a tradition of reciting a short prayer whenever they see someone make the [sign of the cross](https://en.wikipedia.org/wiki/Sign_of_the_cross). Due to the high...
[Question] [ *Inspiration*: in 1939, a man named Ernest Vincent Wright wrote a novel called [Gadsby](http://en.wikipedia.org/wiki/Gadsby_(novel)) without using the letter 'e'. Your task is to write a set of (up to 5) programs in any language (which has a text-based syntax\*) to output all 26 letters of the alphabet...
[Question] [ Write a program that produces an output such that: 1. At least three distinct characters appear. 2. The number of occurrences of each character is a multiple of 3. For example, `A TEA AT TEE` is a valid output since each of the 4 distinct characters, `A`, `E`, `T` and `(space)`, occurs 3 times. Of cour...
[Question] [ Recently, I've seen Hare Krishna people with their mantra on the emblem and I've found it may be quite interesting to code golf. # The challenge Write the [Hare Krishna mantra](https://en.wikipedia.org/wiki/Hare_Krishna_(mantra)), i.e.: ``` Hare Krishna Hare Krishna Krishna Krishna Hare Hare Hare Rama ...
[Question] [ I recently created a new language called `;#` (pronounced "Semicolon Hash") which only has two commands: `;` add one to the accumulator `#` modulo the accumulator by 127, convert to ASCII character and output **without** a newline. After this, reset the accumulator to 0. Yes, 127 is correct. Any other ...
[Question] [ Our task is to, for each letter of the (English) alphabet, write a program that prints the alphabet, in a language whose *name* starts with that letter. **Input:** *none* **Output:** ``` abcdefghijklmnopqrstuvwxyz ``` *uppercase and trailing newline optional* **Rules**: * The scoring metric is the leng...
[Question] [ *Thanks to @KritixiLithos for [helping me out](http://chat.stackexchange.com/transcript/message/35483773#35483773) with this challenge!* --- [V](https://github.com/DJMcMayhem/V) is a programming language that I wrote so that I could use and extend vim for code-golf challenges. [The very first commit](h...
[Question] [ Two words are *[isomorphs](http://www.questrel.com/records.html#spelling_structure_entire_word_isomorph_or_matching_letter_pattern)* if they have the same pattern of letter repetitions. For example, both `ESTATE` and `DUELED` have pattern `abcdca` ``` ESTATE DUELED abcdca ``` because letters 1 and 6 ar...
[Question] [ An integer is binary-heavy if its binary representation contains more `1`s than `0`s while ignoring leading zeroes. For example 1 is binary-heavy, as its binary representation is simply `1`, however 4 is not binary heavy, as its binary representation is `100`. In the event of a tie (for example 2, with...
[Question] [ [π(*n*)](https://oeis.org/A000720) is the number of primes less than or equal to *n*. **Input:** a natural number, *n*. **Output:** π(n). **Scoring:** This is a [fastest-code](/questions/tagged/fastest-code "show questions tagged 'fastest-code'") challenge. Score will be the sum of times for the score...
[Question] [ Rock-and-roll founding father [Chuck Berry](https://en.wikipedia.org/wiki/Chuck_Berry) sadly passed away today. Consider the [chorus](https://genius.com/Chuck-berry-johnny-b-goode-lyrics) of his [famous](http://www.rollingstone.com/music/lists/the-500-greatest-songs-of-all-time-20110407/chuck-berry-joh...
[Question] [ Write a program or function that takes in a positive integer and prints or returns a stack of that many ASCII-art [turtles](https://en.wikipedia.org/wiki/Turtles_all_the_way_down), where each turtle is larger than the one above it. Specifically, if the input is `1`, the output should be: ``` __ /,,\o ...
[Question] [ The other day we were writing sentences with my daughter with a fridge magnet letter. While we were able to make some(`I love cat`), we didn't have enough letters to make the others (`I love you too`) due to an insufficient amount of letters `o` (4) I then found out that while one set included 3 `e` le...
[Question] [ 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](http://www.eeemo.net/) a bit. Zalgo text is unicode text that started as ...
[Question] [ # The Background Future In the year 2017, you and your opponent will face off in a futuristic gun battle where only one may survive. Are *you* experienced enough to defeat your opponent? Now is the time to polish your guns skills in your favorite programming language and fight against all odds! ## Tour...
[Question] [ I'd like to propose a different kind of golfing challenge to this community: (Artificial) *Neural Networks* are very popular machine learning models that can be designed and trained to approximate any given (usually unknown) function. They're often used to solve highly complex problems that we don't kn...
[Question] [ This challenge is a tribute to [PPCG](https://codegolf.stackexchange.com/) user [Dennis](https://codegolf.stackexchange.com/users/12012/dennis) for winning the robbers' part of [The Programming Language Quiz](https://codegolf.stackexchange.com/q/54807/26997). Looking at [Dennis' PPCG profile page](http...
[Question] [ I've heard that your code can run faster if you indent it in reverse, so that the compiler can process it like a tree design pattern from the very top of the "branches" down. This helps because gravity will speed up the time it takes for your code to be compiled, and the data structure efficiency is im...
[Question] [ **Challenge:** The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing `bytes`. **BUT WAIT**..... there is one restriction: * Your source code can not include any of the digits from your byte count * So i...
[Question] [ *This is the cop's thread of a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") challenge. You can view the robber's thread [here](https://codegolf.stackexchange.com/questions/207560)* A pretty common beginner style question is to print some string, but ...
[Question] [ If you like this, consider participating in: * The [Official Dyalog APL 2016 Year Game](https://codegolf.stackexchange.com/q/70361/43319) * The monthly [Dyalog APL 2017 Code Golf Challenge](http://www.dyalog.com/2017-code-golf-challenge.htm) --- Make 12 **snippets/expressions**, in the same language, t...
[Question] [ I am interested in seeing programs which don't ask for any input, print a **googol** copies of some nonempty string, no less, no more, and then stop. A [googol](https://en.wikipedia.org/wiki/Googol) is defined as \$10^{100}\$, i.e., 1 followed by a hundred 0's in decimal. Example output: ``` 1111111111...
[Question] [ As a programmer, you've probably heard of forward slashes and backward slashes. But have you heard of downslashes? That's when you take a bunch of slashes, connect their ends and draw them going down. For today's challenge, you must write a program or function that takes a string consisting purely of s...
[Question] [ About a year ago on Dec 31, 2015, I had the idea that: > > [We should make a time capsule string. Everybody gets to add one character and next new years we'll see who can make the best program out of all the characters with the esolangs that exist then.](https://chat.stackexchange.com/transcript/messa...
[Question] [ Consider these five ASCII art sea creatures: 1. Standard fish: `><>` or `<><` 2. Speedy fish: `>><>` or `<><<` 3. Sturdy fish: `><>>` or `<<><` 4. Stretchy fish: `><<<>` or `<>>><` 5. Crab: `,<..>,` Write a program that accepts an arbitrary string of the characters `<>,.`. If there is a way to interpre...
[Question] [ A repost of [this](https://codegolf.stackexchange.com/questions/54807/the-programming-language-quiz) challenge. [Meta discussion](https://codegolf.meta.stackexchange.com/questions/14272/can-we-revive-the-programming-language-quiz). [Sandbox post](https://codegolf.meta.stackexchange.com/a/14390/66833). ...
[Question] [ In the card game [Magic: the Gathering](https://en.wikipedia.org/wiki/Magic:_The_Gathering) there are five different colours, which represent loose affiliations of cards, White (`W`), Blue (`U`), Black (`B`), Red (`R`) and Green (`G`). These are often arranged in a pentagon as follows: ``` W G U R...
[Question] [ No, I don't mean \$\phi = 1.618...\$ and \$π = 3.14159...\$. I mean the *functions*. * [\$\phi(x)\$](https://en.wikipedia.org/wiki/Euler%27s_totient_function) is the number of integers less than or equal to \$x\$ that are relatively prime to \$x\$. * [\$π(x)\$](https://en.wikipedia.org/wiki/Prime-cou...
[Question] [ In this [code-challenge](/questions/tagged/code-challenge "show questions tagged 'code-challenge'") you will write a hash function in 140 bytes1 or less of source code. The hash function must take an ASCII string as input, and return a 24-bit unsigned integer ([0, 224-1]) as output. Your hash function ...
[Question] [ > > Every positive integer can be expressed as the sum of at most three palindromic positive integers in any base *b*≥5.   [Cilleruelo et al., 2017](https://arxiv.org/abs/1602.06208) > > > A positive integer is *palindromic* in a given base if its representation in that base, without leading zeros,...
[Question] [ Using [Algodoo](http://www.algodoo.com/) and Paint I made these six 300×300 monochromatic images of four convenient shapes: ![Image 1](https://i.stack.imgur.com/Oa2O1.png) ![Image 2](https://i.stack.imgur.com/C6IKR.png) ![Image 3](https://i.stack.imgur.com/YZfc6.png) This class of images has the follow...
[Question] [ What if we have a corridor comprised of two parallel mirrors? ``` | | | | | | | | | | | | | | | | | | | | ``` Now, we shine a laser down it... ``` | \ | | \ | | \ | | \ | | \ | |...
[Question] [ Your challenge is to write a program that outputs the color of a given square from the chessboard. This is how a chessboard looks: [![enter image description here](https://i.stack.imgur.com/YxP53.gif)](https://i.stack.imgur.com/YxP53.gif) You can see that the square **a1** is dark, and **h1** is a ligh...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/32386/edit). Closed 6 years ago. [Improve this question](/posts/32386/edit) ...
[Question] [ ...will you help me immortalize it? [![enter image description here](https://i.stack.imgur.com/5KcWXm.png)](https://i.stack.imgur.com/5KcWXm.png) I've had this pillow a few years now, and apparently it's time to get rid of it. Can you please write a function or program, that I can bring with me and use...
[Question] [ In this challenge, you must take multiline ASCII art as input, such as: ``` OOOOOO OOOOOO OOOOOO OOOOOOO OOOOOO OOOOOO OO OOOOOOO OO OO OO OO OO OO OO OO OO OO OO OO OO OO OO OO OOOOO OO OOO OO OO OO OOOOO OO OO ...
[Question] [ Your task is to write a program that executes in as many languages as possible, with as few characters as you can. To avoid trivial solutions, the program must print the name of the language it was run in. ## Scoring Your program has to work in at least 5 languages. A program's score is given as: $$\fr...
[Question] [ Following the interest in [this question](https://stackoverflow.com/questions/6166546/sorting-algorithms-for-data-of-known-statistical-distribution), I thought it would be interesting to make answers a bit more objective and quantitative by proposing a contest. The idea is simple: I have generated a bi...
[Question] [ What general tips do you have for golfing in Bash? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Bash (e.g. "remove comments" is not an answer). Please post one tip per answer. [Answer] ***Undocumented***, but works in every versi...
[Question] [ I'm looking for tips for golfing in the R statistical language. R is perhaps an unconventional choice for Golf. However, it does certain things very compactly (sequences, randomness, vectors, and lists), many of the built-in functions have [very short names](https://stackoverflow.com/questions/6979630/...
[Question] [ The challenge: output this exact ASCII art of a spiderweb in a window: ``` _______________________________ |\_____________________________/| || \ | / || || \ /|\ / || || /\'.__.' : '.__.'/\ || || __.' \ | / '.__ || ||'. /\'---':'---'/\ ...
[Question] [ Write a program that is a polyglot in three languages that plays [rock–paper–scissors](https://en.wikipedia.org/wiki/Rock%E2%80%93paper%E2%80%93scissors). The input for any version of the program is always one of the strings `rock` or `paper` or `scissors`. In the first language the program must output...
[Question] [ **Backstory:** > > You enjoy your new programming job at a mega-multi-corporation. However, you aren't allowed to browse the web since your computer only has a CLI. They also run sweeps of all employees' hard drives, so you can't simply download a large CLI web browser. You decide to make a simple tex...