instruction
stringlengths
34
53.1k
I think the question as above is clear, but just in case: Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline. Qualifying programs will be those whose output is longer (in bytes) than the source code of the program, measured in bytes (assuming AS...
Explanation: Last year in math class, on homework we would occasionally get these extremely simple, although equally annoying questions called diamond puzzles. These were basically questions where we would be given a sum, and a product then were asked to find the two numbers which when multiplied give the product, and ...
Time for another Pyth practice. I present here 8 problem statements with a Pyth solution each. These solutions are written by a Pyth beginner. He is quite happy about these solutions, since they are a lot shorter than his Python answers. Your task however is to show him better. Create equivalent but shorter programs. T...
Introduction The Parsons code is just a simple way to describe pitch variations in a piece of music, whether a note is higher or lower than the previous one. Even if you suck at remembering tunes, you can still pretty much remember if a note goes up or down, thus the Parsons code can help you to identify a music using ...
Recently, I made a made a typo and I wrote unicorn instead of unicode, I did what any normal person would do and I made an esolang out of it. In this challenge you will be writing a Unicorn interpreter. Because Unicorn programs are horrible long, you'll have to write a short interpreter to compensate for this. Example ...
In my room, I have this geeky clock (click for full size): Most of these are not difficult to figure out, but the one for 4-o-clock is particularly tricky: Normally, a fraction like 1/2 doesn't make sense in modular arithmetic since only integers are involved. The correct way, then, is to see this as the inverse of 2...
In physics, like electric charges repel, and unlike charges attract. The potential energy between two unit charges separated by a distance d is 1/d for like charges and -1/d for unlike charges. The potential energy of a system of charges is the sum of the potential energies between all pairs of charges. Challenge Deter...
Conceptually, this challenge is really simple. You're given a list of non-negative integers ai. If possible, find a non-negative integer N, such that the list consisting of bi = ai XOR N is sorted. If no such N exists, output should be anything that can't be mistaken for a valid N, e.g. a negative number, nothing at al...
We've had a lot of challenges on differentiation and integration, but none on just solving related rates problems. So in this challenge, you will get a bunch of derivatives (They will be numeric, not in terms of any variables) and have to find another derivative. The input will come in a newline separated list of equat...
In long multiplication, after multiplying the numbers, you are left with the partial products, in this challenge you will output those partial products. Because long multiplication is long, to compensate your code will need to be as short as possible. Examples 34, 53 102, 1700 48, 38 384, 1440 361, 674 1444, 25270, ...
Given a word consisting of lowercase letters only, do the following: For each letter, get the prime factorization of its position in the alphabet. For each prime factor, p, draw a diamond of side length p and stick the letter in the middle of the diamond. The biggest diamond is in the middle, subsequent smaller diamon...
Given an input string, determine the number of regions that a page will be split into. Consider the letter P. It has one enclosed region within the letter. Assume that each letter splits the page by one or more regions (i.e. a box is drawn around the character). Input A string of 0 or more characters. You may assume th...
Input A matrix M represented as two space separated lines of integers. Each line will have the same number of integers and each integer will be either -1 or 1. The number of integers per line will be at most 20. M will therefore be 2 by n where n is the number of integers on each of the two lines. Your code should be...
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-forcing was almost impossible...
If you have ever travelled with kids more than about 20 minutes, you will have no doubt heard cries of "Are we there yet?" and "How much further?" So we play games like "I Spy" to help pass the time as the miles go by. There is a variation on "I Spy" whereby instead of spotting arbitrary named things, you must spot int...
Yes, this is old and probably very simple, but I really want to be mindblown by things that I thought were obvious, so here's the challenge: You're given a positive integer as the input and you need to output the exponents of all of the prime factors up to the highest factor in base 36 ( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a...
In the game Terraria, one of the game mechanics involves building houses so that an NPC can move in. There is a strict set of rules for what counts as a valid house or not. Here is the list of rules: The total area in the house must be at least 60 square tiles, but less than 750. Also, the size of the house including ...
Challenge Here's a simple one. Write a function or program when given a number in base 10 as input, it will return or print that number's value in Hexadecimal. Examples 15 -> F 1000 -> 3E8 256 -> 100 Rules No built-in Hexadecimal functions whatsoever Letters may be lowercase or uppercase You will only need to worry a...
The challenge is to follow (draw) the path: ^n - up by n lines vn - down by n lines >n - right by n character positions <n - left by n characters positions n is an integer, greater than zero (i.e. you can't receive a command like >-2). There're no separators between the commands, the well-formed input looks like th...
It's well known that corrupted JPEG files or NTSC/PAL streams will appear as distorted versions of the true images, or versions covered in random-looking blocks of pixels. Consider the below image (from here): If we run it through this filter (with settings 44, 7, 21, 83, for anyone who wants to reproduce it), it end...
Task Constantly having to check on television, or the time on your computer to see if its 2016 is a tedious task. Being programmers, we should be able to automate this task. Write a program that will output 2016 when the system time hits Friday, January 01, 2016 00:00:00. or rather 1451624400000 ms since midnight Janua...
Anomalous Cancellation (from Wolfram Alpha): Anomalous cancellation is a "canceling" of digits of a and b in the numerator and denominator of a fraction a/b which results in a fraction equal to the original. Note that if there are multiple but differering counts of one or more digits in the numerator and denominator t...
Given an input of a color in #rrggbb hex format, output its RGB complement in the same format. The RGB complement R2G2B2 of any color R1G1B1 is defined as the color with R2 value 255 - R1, B2 value 255 - B1, and G2 value 255 - G1. Hex digits may be either in uppercase (#FFAA20) or lowercase (#ffaa20). The case of the i...
2015 was the year of the goat! In this challenge, you will figure out which animal represents the year. To avoid making this challenge to complex you won't need to calculate Chinese new year. Because they are only 12 animals in the Zodiac, your code will need to be as short as possible. Examples Your program must get t...
In the Bitcoin protocol, 2016 is a very special number. The "difficulty" of finding a hash to create a new block is adjusted every 2,016 blocks to approximate changing once every two weeks. This number was chosen is because the difficulty adjusts itself so that every block takes about 10 minutes to be found, and in two...
Given a decimal in the form of <float>, <precision>, you draw the graphical representation of the decimal part (i.e. fraction) of the float. Examples: Input: 6.75, 4, output: 6||| 7 ---- 6.75 (first number from the input) is the number to explain, 4 (the second number from the input) is the number of dashes below t...
Background The greatest common divisor (gcd for short) is a convenient mathematical function, since it has many useful properties. One of them is Bézout's identity: if d = gcd(a, b), then there exist integers x and y such that d = x*a + y*b. In this challenge, your task is to visualize this property with simple ASCII a...
In this challenge you will need to determine whether it's Pi Day, Pi Minute, or Pi Second. Because Pi is irrational, it wants your code to be as short as possible. Examples No input is provided, your program should use the system time. I've just added it for clarity March 14, 2016 0:00:00 Pi Day December 25, 2015 3:14:...
The Rules Each submission must be a full program or a function. The program must take all instances of the string 2015 from the input (1 string), replace it with <s>2015</s>* (with <s> or <strike>). At the end, if there has been at least one 2015 in the string, you must add a newline and this string: *2016. I'm a year...
Your task is simple. Post a snippet in any language that if the snippet is repeated n times, will output n in decimal, octal, and hexadecimal, in that order, separated in spaces. n is an integer larger than zero. There is no leading zeroes. Shortest answer wins Example If the snippet is ABC then the test case is ABC 1...
Your challenge: You are on the 0th floor of a infinitely tall building. At any floor, you can walk to the window and drop an egg. Your goal is to figure out the highest floor that the egg can withstand without breaking. However, you have a maximum of 3 eggs to use to figure this out, but you need to minimize the numb...
What general tips do you have for golfing in Forth (and its clones)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Forth (e.g. "remove comments" is not an answer).
Task Take a single Unicode character as input. Output a program in the same language that also obeys this specification, but which does not contain the input character. If your program is run with input a, and then the output program is then run with input b, then the program it outputs is ALLOWED to contain character...
Given an input of a "hotel" in ASCII art with a single room marked, output the room number according to certain rules. Here's an example of an ASCII hotel: ## ## ##### ## ##### ###### ## ##### ###### ## ##### ###### ## Here are a few more things about the ASCII hotels: Eac...
Write a function or program than can do simple arithmetic (addition, subtraction, multiplication and division) in both base 10 and base 2. The function will take a mathematical expression as input, and output the correct result in the correct base. The input will be n numbers separated by one or several operators (+ - ...
Some friends and I have played some DSA (a mainly german tabletop RPG much like D&D). I was wondering what the chance on passing rolls are, so you will have to write some code to calculate it. Your character is defined by stats (from 8 to 14) and (TV) Talent values (0 to 21). For now we will use climbing as an example....
Introduction For the ones wondering what Befunge exactly is, it is a two-dimensional stack based language made in 1993 by Chris Pressy. I made 7 brain teasers that need to be solved in Befunge-93. This is quite an experimental challenge, but I thought it's worth a shot :). A full list of all commands used in Befunge-93...
In this challenge, you will be "reversing" the alphabet or swapping a-z with z-a. This is commonly known as the Atbash cypher. Because this transformation makes the output look like some foreign language, your code will need to be as short as possible. Examples abcdefghijklmnopqrstuvwxyz zyxwvutsrqponmlkjihgfedcba Pr...
You are to write a sequence of 10 programs p1 p2 ... p10 that satisfy the following properties: pK prints pK+1 for K from 1 to 9 p10 prints p10 When the first K programs are concatenated, the resulting program p1...pK prints p1...pK. Each program pK must be larger in byte size than the previous program pK-1. All progr...
The challenge Write a function or a program that takes a string composed of one or more subjective personal pronouns, separated by + signs, as an argument. The output must be a single pronoun, that is the result of the relation defined in the next paragraph. Of course, feel free to edit as you wish to correct those gra...
The challenge Well, I think it is quite clear, isn't it? You have to make a function or a program that takes a string as an argument and outputs the corrispondent Yoda-speaking. This is code-golf, so least number of bytes wins. The input The input could be any string without linefeed. You can translate a string if it i...
Your code is going to generate a very simple ASCII-art representation of DNA, forever. It will take two numbers as input in any format you want: as a list, as arguments to a function, on stdin, etc. A floating-point interval I in seconds between 0.0 and 1.0 (inclusive) A zoom level Z as an integer from 1 to 64 (inclus...
Given an input of a Spanish verb in its infinitive form, output the verb conjugated in all 6 forms of the indicative imperfect. To conjugate an infinitive in the imperfect, remove the infinitive ending (-ar, -er, -ir, and sometimes -ír) and add the imperfect endings listed below. There are three irregular verbs in the ...
Consider a sequence based on recurrence relations, f(n) = f(n-1)+f(n-2), starting with f(1) = x1, f(2) = x2. For x1 = 2, x2 = 1, the sequence begins like this: 2 1 3 4 7 11 18 29 47 76 123 199 322 521 843 Concatenating this into a string will give: 213471118294776123199322521843 Now, divide this list i...
You must make the shortest program to always find the optimal solution to a simplified Frogger game on a 9x9 grid. Course Elements: L - Log (Length: 3-4). When you hop on a log, it carries you with it. V - Vehicle (Length: 1-2) Speed (1-2): On the left hand side of the row will be the speed that elements in the row...
Inspired by this SciFi.SE question. Background (with minor spoiler): In the movie The Martian, protagonist Mark Watney uses an ASCII table to look up hexadecimal values of ASCII characters so he can attempt to communicate back to Earth.* Challenge With no input, output the following ASCII table exactly like this: D...
You have been chosen to make a program that creates some pretty ASCII bar charts. Here is the input format: [List of words (they can have spaces)] [an integer >= 0] Bar 3 This is so cool 4 IDK-Why 6 The input will have multiple lines in this format, each one representing one bar in the graph. The output format of a gr...
This challenge was xnor's idea, taken from Digital Trauma's challenge donation thread. Your challenge is to write a program that, as xnor put it, "procedurally generate[s] the splotchy black-and-white marbled pattern on the covers of composition notebooks": Your program can either display it on the screen or save it ...
Inspired by this excellent challenge (from which the bulk of this text is blatantly duct-taped) – and my highschool philosophy project... I define the following operators: Fuzzy Conjunction a ×F b is a × b Fuzzy Division a ÷F b is a ÷ b Fuzzy Negation –F b is 1 – b Fuzzy Disjunction a +F b is –F ((–F a) ×S (–F b) which...
There exists a brain game called Enumerate (which I made, based on Takuzu). Your challenge is to play this game. Task Solve a game of 4x4 Enumerate/Takuzu. Receive a starting grid via STDIN or command line. Output the solved grid via STDOUT or writing to file. Rules A game is characterized by a 4x4 board, made up o...
Your task is to write a program or function that detects accents in UTF-8 input. The catch is that your code must be written entirely in an 8-bit character encoding. The code will output a single integer which is the count of the number of accented letters in the input. Since Unicode is huge, the test input will consis...
As a spin-off to my challenge over at Puzzling, your goal is to output 2016. Rules: You must include the numbers 10 9 8 7 6 5 4 3 2 1 in that order. They can be used as individual integers or concatenated together (like 1098), but the 10 may not be separated into 1 and 0 - no character(s) may be present between the di...
Inspired by the Lego gear ratios challenge by Keith Randall. I, too, plan on building a giant lego robot that will eventually be able to destroy the other robots in the never-before-mentioned competition.* In the process of constructing the robot, I will be using a lot of gear trains to connect different parts of the r...
Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row loses. An interesting fact is that the maximum amount of crosses before someone loses, is equal to 6: X X - X - X - X X ...
The Champernowne constant is a number that is constructed by concatenating the first n numbers, with n tending to infinity. It looks something like this: 0.123456789101112131415161718192021222324252627282930... Now, I will describe to you the Rien number. It can be thought of as a minimization of the Champernowne cons...
Japanese kana characters correspond to a single sound in the Japanese language. With the exception of ん (n), every other kana consists of a consonant part and a vowel part. There is a natural ordering to Japanese kana, a sort of "alphabetical order", which is typically arranged in a 10 by 5 table: | a i u ...
When I was younger, I use to play a word game called Word chain. It was very simple. The first player chooses a word; the next player says another word that starts with the same letter the previous word ended with. This goes on forever until somebody gives up! Trick is, you cannot use the same word twice (unless everyb...
Given any of the following characters (or a newline): `1234567890-=~!@#$%^&*()_+qwertyuiop[]\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:"zxcvbnm,./ZXCVBNM<>? Your program must output the row that it is on the keyboard Because my keyboard is (almost) out of battery, your code must be as short as possible The keyboard your pro...
The purpose of this challenge is to find the general term of a given arithmetic or geometric sequence. Explanation The formula for an arithmetic sequence is as follows an = a1 + (n-1)d where a1 is the first term of the sequence, n is the index of the term, and d is the common difference between the terms. For a geomet...
Introduction In the field of mathematics known as topology, there are things called separation axioms. Intuitively, you have a set X and a collection of subsets of X, which we can think of as properties. The system is well separated, if one can distinguish between all items of X based on their properties. The separatio...
Given an input of four integers x1, y1, x2, and y2, output whether a white king in chess (with coordinates (x1, y1)) could catch a black pawn (with coordinates (x2, y2)) and capture it if the pawn is moving to promote to a queen as fast as possible. The coordinates of the board are as follows: first coordinate...
Consider the Atbash transformation: A|B|C|D|E|F|G|H|I|J|K|L|M Z|Y|X|W|V|U|T|S|R|Q|P|O|N Where A ⇔ Z and L ⇔ O, e.g. There is an interesting property that some words share. When some strings are translated to their atbash-equivalent, said translation is the original word reversed. I call these Atbash Self Palindromes. ...
If you're not familiar, Diceware is a method for creating passwords using an ordinary die from a pair of dice as a hardware random number generator. For the sake of fun, let's ignore anything about the security of computer's random number generators. Write a function or program that prints or returns a single five-cha...
Making a versatile integer printer is nice and all, but writing a single code that prints a lot of different numbers is cumbersome. Wouldn't it be easier to make a script that outputs a number, but also gives you a new script to get the next number? Challenge: Write a code that outputs a single integer N and an executa...
The first Letters, Get Moving! was very popular, but had limited participation. This one will be easier to solve, but hopefully involve some tricks in golfing. You are given a string of only lowercase letters. For each letter, with position in the alphabet m, move it so it becomes the mth letter from the end. If the va...
Your task is to create a program which takes a black-and-white outlined image (example images are below) and fills it in with colour. It is up to you how you section off each region and which colour to fill it with (you could even use an RNG). For example: As you can see I am clearly an artist of a superior calibre wh...
Given a unicode character C (or the first character of a string input), output that character's hex representation. Case does not matter. The output ranges from \u0000 to \u9999. Test cases A => 41 (65_10 === 41_16) ʣ => 2A3 (675_10 === 2A3_16) Ω => 3A9 (937_10 === 3A9_16) 7 => 37 (55_10 === 37_16) (null byte) => 0 (...
Every programmer knows that brackets []{}()<> are really fun. To exacerbate this fun, groups of interwoven brackets can be transformed into cute and fuzzy diagrams. Let's say that you have a string that contains balanced brackets, like [{][<(]})>(()). Step one is to rotate the string 45 degrees clockwise. (In Mathema...
Description Here's a very superstitious hotel elevator in Shanghai:                 It avoids the number 13, because thirteen is unlucky in the Western world, and it avoids the digit 4, because four is unlucky in parts of Asia. What if this hotel was taller? Read a positive even integer n from STDIN, representing the n...
Given the ASCII art of two vectors, find the resultant vector's magnitude and degree. Input This can be received via STDIN, read from a local file, or provided through a function call. Here is an example of a two vector input: ^------> | | | x This represents a change of 4 units north and 7 units east. Every input's ...
There are many puzzles with matches that involve adding, removing, or moving a certain number of matches to create new numbers or shapes. This is like that with a digital clock. Given a valid time on a 12-hour digital clock, output the digit that requires moving the fewest lines to make it so every visible digit on the...
Every programmer knows that rectangles □ are really fun. To exacerbate this fun, these cute and fuzzy diagrams can be transformed into groups of interwoven brackets. This challenge is the inverse of my previous. Let's say you have a group of interlocking rectangles like so: +------------+ | | +--+-+ ...
Actually not inspired neither by Atbash Self Palindromes nor by Generalized Gematria Calculator. Given a string s of length n, output the Revu'a sequence, which is the first character of s, the first two characters of s, ... the first n–2 characters of s, the first n–1 characters of s, the entire s. The string will onl...
You may remember in first or second grade using expanded form to learn about place value of numbers. It's easier to explain with an example, so consider the number 123. In expanded form it is represented as 100 + 20 + 3, which helps a young mind visualize place value. It is reminiscent of how you say it: one hundred (p...
Inspired by this conversation in chat. Your goal in this challenge is to emulate a ninja and count how many deaths he has left. Specs You ninja starts out with 9 deaths left. He also gets an integral starting health as an input. Then, he takes as input a list of events in his life that alter his health. These can be ne...
Based on Chunky vs. Smooth Strings. Squiggles /\_/\/\__/\/\/\/\_/\_/\ are fun to make on a keyboard when you are really bored. But not all squiggles are created equal. Some squiggles are smooth, like \___/, and some are chunky, like /\/\/\/\. Others are just downright broken, like ////_\\\ Inside every squiggle of N...
Given an input of two integers n and m, output an ASCII ladder of length n and size m. This is an ASCII ladder of length 3 and size 3: o---o | | | | | | +---+ | | | | | | +---+ | | | | | | o---o This is an ASCII ladder of length 5 and size 1: o-o | | +-+ | | +-+ | | +-+ | | +-+ | | o-o This is an AS...
7-segment digits can be represented in ASCII using _| characters. Here are the size 1 digits: _ _ _ _ _ _ _ _ | _| _| |_| |_ |_ | |_| |_| | | | |_ _| | _| |_| | |_| _| |_| Larger sizes are formed by making each segment proportionately longer. Here are a couple size 3 digits. ___ ...
A list of positive integers can be visualized as a quantized mountain range where each list entry represents the height of one vertical section of the mountains. For example, the list 1, 2, 2, 3, 4, 3, 5, 3, 2, 1, 2, 3, 3, 3, 2, 2, 1, 3 can become the range x x x xxxxx xxx x xxxxxxxx xxxxxx x x...
This challenge is about printing the abacaba sequence of a specific depth. Here is a diagram of the first 5 sequences (a(N) is the abacaba sequence of depth N, upper/lowercase is just to show the pattern, this is not needed in the output of your program): a(0) = A a(1) = aBa a(2) = abaCaba a(3) = abacabaDabacaba a(4) =...
Hexagonal grids have been become a fairly popular twist for challenges about 2-dimensional data recently. However, it seems that the equally interesting triangular grids have been largely neglected so far. I'd like to rectify that with a rather simple challenge. First, how do we represent a triangular grid? Consider th...
Mr. William Shakespeare wrote plays. A lot of plays. In this tarball containing every single one of his works, each one of his plays is one long file. It needs to be split into Scenes for a stage production. Because actors are impatient, your code needs to be as short as possible. Task: Your task is to write a program ...
The split-complex numbers, also known as "perplex numbers" are similar to the complex numbers. Instead of i^2 = -1, however, we have j^2 = 1; j != +/-1. Each number takes the form of z = x + j*y. In one attempt to limit the complexity of this challenge, I will use the symbol - to represent negation, as there will not...
Introduction In the strategy game Starcraft 2, there are three "races" to choose from: Terran, Zerg, and Protoss. In this challenge we will be focusing on the Protoss and the iconic phrase "You must construct additional pylons!" This message is stated when you run out of supply to build your army. So, to help out the S...
A leaper is a category of fairy chess piece which moves by "jumping." A normal knight is a (1,2)-leaper, meaning each move involves moving a distance of 1 square in an orthogonal direction and 2 squares in the perpendicular direction. .o.o. o...o ..N.. o...o .o.o. There are many different leapers. The (1,3)-leaper is...
[I decided to salvage Ben Reich's question How many unique ways are there to achieve a score in Football? but it ended up being so different that it's only suitable as its own question not spliced into his.] Challenge: Given a number, calculate how many order-independent ways there are to score that number as a winning...
Because rickrolling is the greatest meme on Earth, you [know the rules and so do I] are to write the shortest code that can textually rickroll the unsuspecting reader. Let [you down] there be an input text which contains letters, punctuation, and spaces. Anytime a [lie and hurt you] phrase from the first two stanzas ...
Your challenge is to format a list of words across multiple lines that are no longer than a given number of characters, so that each line contains as many words as possible and no words are unnecessarily cut off. Input The input will be a space-separated list of words and then a number that is at least 4. Output The ou...
While we're on a triangular grids kick, I'd like to point out that there is an equivalent to polyominoes on a triangular grid. They are called polyiamonds, and they are shapes formed by gluing equilateral triangles together along their edges. In this challenge you are going to be deciding which subsets of a triangular ...
I've been working on another stack-based golfing language called Stackgoat. In this challenge you'll be writing a Tokenizer for Stackgoat (or really any general stack-based languages). Examples "PPCG"23+ ["PPCG", '23', '+'] 'a "bc" + ['"a"', '"bc"', '+'] 12 34+-"abc\"de'fg\\" ['12', '34', '+', '-', '"abc\"de'fg\\"']...
Overview Given an image in plain PPM (P3) format as input, for each pixel p in the image, replace each of the following 4 pixels' red, green, and blue with the floored average value of the respective channels of all 4 pixels: p itself The pixel located at p's location when the image is flipped vertically The pixel loc...
Given a number n > 77, write a program or function that finds a set of distinct positive integers such that the sum of the set equals n, and the sum of the reciprocals of the set equals 1. Example for 80: 80 = 2 + 4 + 10 + 15 + 21 + 28    ⟶     1/2 + 1/4 + 1/10 + 1/15 + 1/21 + 1/28 = 1 Your program or function must...
Background Your friend, a linguist, has recorded and analyzed some simple conversation snippets in various languages. Being quite absent-minded, they have forgotten which language each snippet was in. You must help them by creating a program that analyzes the sentence structures and rules out impossible cases. Input Yo...
Here's a deceptively challenging geometry puzzle for you! Given a circle A, and n other circles B[n], find the total area contained within A that is not within any circle of B. Your code should be as short as possible. Input Your input should contain the following information: A floating-point number to represent the ...
What could be more polar opposites than chess and demolition derby. You would think that no one who enjoys one would enjoy the other... until today. Rules The starting position is a standard chess board: RNBQKBNR PPPPPPPP PPPPPPPP RNBQKBNR Looks normal enough, until you find out it's an EVERY PIECE FOR ITSELF, ...
I like ascii art and I get bored a lot, so I found some ascii characters and started to make random things, 8-bit mario castle, mazes, and arches. I found that the arches could easily be stacked in a neat way. ╔═══════╗ ║╔═════╗║ ║║╔═══╗║║ ║║║╔═╗║║║ ╨╨╨╨─╨╨╨╨ Challenge Create a program, function, or any other standard...
Given an input of an integer n and a list of positive integers m1, m2, ..., output a list of integers m1', m2', ... where mx' is defined as the average of mx-n through mx+n. When calculating these averages, ignore indices that are out of bounds (and adjust what you are dividing the sum by accordingly). n will always be...
Write a function or program that outputs Quater-imaginary base displayed as binary digits. The number base is 2i, where i is the square root of -1. See Complex Number for more details on i. Each digit position can go from 0 to 3 (quaternary), as each real and imaginary part is -4 times as large as the previous real and...
Countries own a series of territories on a 1D world. Each country is uniquely identified by a number. Ownership of the territories can be represented by a list as follows: 1 1 2 2 1 3 3 2 4 We define a country's edgemost territories as the two territories closest to either edge. If the above list was zero indexed, cou...
In Salesforce CRM, every object has 15-character alphanumeric ID, which is case-sensitive. If anyone's curious, actually it's base-62 number. However, tools used for data migration and integration may or may not support case sensitivity. To overcome that, IDs can be safely converted to 18-character case-insensitive alp...