instruction
stringlengths
34
53.1k
Your task, if you choose to accept it, is simple. Objective You must make a program that, when run, prints some (as many as you want) terms in a sequence that you choose. The sequence must be a valid OEIS sequence. The twist is that when you take the characters from your code that make up your sequence, string them tog...
First line is made with ceil(n/2) elements where each element is: <space><odd-number><space> Second line is made with ceil(n/2) elements, but each element is / \ only. You may assume n >= 0 and n <= 10. Examples Input: 3 1 3 / \/ \ Input: 10 1 3 5 7 9 / \/ \/ \/ \/ \ Example in Python 3, 103 bytes: lambda a:p...
Inspired by Display a chain of little mountains with an odd number on the top of it! by @sygmei. Why have a chain of mountains when you can have one massive one? Make a program that takes an input number and prints a mountain with every odd number up to the input number. (Where "south west" means directly below and to ...
EDITS: Added link to the plain-text (multiple strings) test data Added BLANK,EDGE and TIE2 test cases (see Test Data section) (11/25) Updated the JSON test cases (some lines were ill-formatted) (11/24) Renju match gone bad ! (well, technically these guys are playing Go, but who cares) Wikisource TL;DR Take a 15x15 ...
Take a non-nested array as input. Turn it into a matrix by using the following method: Let's say my array is [1, 2, 3, 4, 5] First, I repeat that array 5 times: (the length) [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]] Then, I read it along the diagonals: [[1], [2, 1], [3...
Tamagotchi and Giga Pets were small electronic devices which simulated a little virtual pet. This pet had several stats, like health, hunger, etc. I recently wrote this example: import msvcrt,os,sys;d=m=100;h=s=t=p=0;f=10 while 1: os.system('cls'if os.name=='nt'else'clear');print("health:",d,"\nhunger:",h,"\nsleep:",...
Write a program with the following properties: When run as-is, the program produces no output (i.e. 0 bytes of output). There is a location within the program (of your choice: it could be at the start, end, or somewhere in the middle) with the following property: modifying the program via placing any string there will...
Introduction Today I went fishing alone with my canoe, unfortunately I fell asleep and the stream brought me away, I lost my oars, now it's night and I am lost in the ocean! I can't see the coast so I must be far away! I have my cell phone but is malfunctional because it got wet by the salty water, I can't talk or he...
Task Given a Boolean matrix, find one (or optionally more) subset(s) of rows which have exactly one True in each column. You may use any algorithm, but must support very large matrices, like the last example. One possible algorithm (Knuth's Algorithm X) While there is no requirement to use this algorithm, it may be you...
The Golfer Adventure This is the first challenge ! There will be more challenges later that will require data from the previous challenge :) Chapter 1 : The Vase Let's imagine a minute.. You are a powerful God, your powers are limitless but require one thing : Souls. Each soul is here represented by a byte, each byte y...
Introduction I'm a real big fan of the SBU (Short But Unique) challenges that crop up on PPCG all of the time. The CUSRS is a system designed to refactor strings, a CUSRS function takes 2 parameters and outputs 1 String. Challenge Produce a program, function, lambda or acceptable alternative to do the following: Given ...
Background An unlabelled tree may look like this: o / | \ o o o | / \ o o o To linearize this tree, we first label each node o with it's number of child nodes: 3 / | \ 1 0 2 | / \ 0 0 0 and then write the numbers in a list in a breath-first manner, meaning line by line and left to right: [3...
Your challenge is to write a program or function that hiccups a string. It should take a string as input (via any standard method), then follow these steps: Generate a (not necessarily uniformly) random integer n between 1 and 10, inclusive. Wait n seconds. Print the initial/next n chars of the input, or the rest of t...
...but hey, no need to be strict. Given a non-empty array of strictly positive integers, determine if it is: Monotone strictly decreasing. This means that each entry is strictly less than the previous one. Monotone non-increasing, but not strictly decreasing. This means that each entry is less than or equal to the pre...
A sculptor is tasked to creating icicle sculptures for the new museum in Greenland. He has been given specifications by his boss, which consists of two numbers: [s, m] or size and melt. Size must be an odd number. He was given some photos of real icicles: vvvvv [5, 0] vvv v vvvvvvv [7, 0] vvvvv vvv v vvv...
Your task is to, given an array of signed 32 bit integers, recompile it with its inverse deltas. For example, the list 1 3 4 2 8 holds the deltas: 2 1 -2 6 which are then negated, yielding: -2 -1 2 -6 and recompiled, yielding: 1 -1 -2 0 -6 as the final result. Input/Output You will be given a list/array/...
Challenge Write a full program/function to Demolish a given building at the rate 1 floor per second. INPUT Input is a building through STDIN(or whatever is called in your language) or through an ARGUMENT of a function. t=0 s | |#| {#} |# #| |# # #| |# # #| |# # #| TTTTTTT input consists of : | marks sta...
You will write a simple program that prints exactly 1 2 3 4 5 6 7 8 9 10 to STDOUT, Console, or your language's closest output method. No other visible output should be seen. Any other code executed must be back-end only. This is answer-chaining, so the catch is that you must include the previous answer's source code i...
Let's use the four basic operations, addition +, multiplication *, subtraction - and division / (float, not integer). Stewie's sequence is defined as follows: x = [x(1), x(2)] // Two initial numbers (one indexed) x(3) = x(1) + x(2) x(4) = x(2) * x(3) x(5) = x(3) - x(4) x(6) = x(4) / x(5) x(7) = x(5) + x(6) ... and s...
Given two positive integers X and Y, output any combination of the following three ASCII-art animals such that the output contains exactly X commas (,) and Y periods (.), if it is possible. Koala: 1 comma, 2 periods <.,.> Crab: 2 commas, 2 periods ,<..>, Commapillar: 3 or more commas, 1 period <,,,.> or <,,,,.> or ...
A polyglot is a program that can be run in 2 or more different programming languages. What general tips do you have for making polyglots, or choosing languages that are easy to write polyglots for a specific task? Please post the tips that could be applied in most situations. I.e. they shouldn't work only in polyglots ...
What general tips do you have for golfing in Nim? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Nim (e.g. "remove comments" is not an answer). Please post one tip per answer.
After all the fun we've had with polyglot challenges in the (recent) past, how about a challenge where the output can be in two languages? Your answer needs to accept boolean input b and output the text "true" or "false". The same code needs to output, when run in another language, "waar" or "onwaar" or any other trans...
Introduction A xenodrome in base n is an integer where all of its digits in base n are different. Here are some OEIS sequences of xenodromes. For example, in base 16, FACE, 42 and FEDCBA9876543210 are some xenodromes (Which are 64206, 66 and 18364758544493064720 in base 10), but 11 and DEFACED are not. Challenge Given ...
B-splines are defined using a set of "knots", "control points", and degree. For the purposes of this challenge, the control points are not needed. The knots are simply a list of strictly increasing real values (note that real B-splines may have repeated knots, for the purposes of this challenge assume knots are all uni...
(This is part 1 in a two-part challenge.) Your task is to solve a Hexasweep puzzle. A Hexasweep puzzle is set out on a grid of diamonds arranged in hexagonal shapes, of which the board looks like a hexagon, like so: _____ /\ \ _____/ X\____\_____ /\ \ / XX /\ \ /X \____\/____/X \____\ \ X/...
This is a potato: @@ @@@@ @@@@@@ @@@@@@ @@@@ @@ More generally, a size N potato is defined as the following shape: If N is even, it is 2 centered @ symbols, followed by 4 centered @ symbols, followed by 6 centered @ symbols, all the way up to N centered @ symbols; then, N centered @ symbols, followed by N-2 ce...
Introduction Dobble/SpotIt is a card game, where people have to spot same symbol on pair of cards in shortest time, indicate it and move to next pair. Each card has multiple symbols (8 in normal version), but exactly one is common between each pair of cards. Example from physical copy of game: Challenge Write a progr...
An unspeakable number is a number which is divisible by seven or has seven as one of its digits. A children game is to count skipping unspeakable numbers 1 2 3 4 5 6 ( ) 8 9 10 11 12 13 ( ) 15 16 ( ) 18 ... Cantor's version of the game is the sequence defined by recursively filling in the sequence "1 2 3 4 5 6 ( ) 8.....
Given three sidelengths of a triangle, evaluate its aspect ratio AR given the following formula: where The closer to equilaterality a triangle is, the closer to 1 its aspect ratio is. The aspect ratio is bigger or equal to 1 for valid triangles. Inputs The input is three real positive numbers which can be encapsulate...
Background of Lucas Numbers The French mathematician, Edouard Lucas (1842-1891), who gave the name to the Fibonacci Numbers, found a similar series occurs often when he was investigating Fibonacci number patterns. The Fibonacci rule of adding the latest two to get the next is kept, but here we start from 2 and 1 (in th...
Source: Wikipedia For this challenge, you should write two programs which resemble the figure and ground of the above image, such that one of them prints figure and the other prints ground. Specifically: Write a program which takes no input and prints the string figure. The only allowed whitespace characters in your ...
Your challenge is to make an infinite loading screen, that looks like this: Or, to be more specific: Take no input. Output Loading..., with a trailing space, but no trailing newline. Infinitely cycle through the chars |, /, - and \: every 0.25 seconds, overwrite the last one with the next in the sequence. You can ov...
Write a program that can validate a PNG file. Your program should follow the PNG spec and must validate the PNG signature and the 4 critical chunks: IHDR, IDAT, PLTE and IEND. Your program must not validate the contents of ancillary chunks, except for their CRC checksums. Your program must validate the presence of the ...
Introduction In the game The Witness (possible spoilers ahead) there is a group of puzzles that involve drawing a Tetris piece with your line while making sure that the symbol for the Tetris piece your currently drawing stays contained within the shape you've drawn. For the image above the drawing works because the ...
Write a program or function that alters the file at a user-specified filename via replacing all instances of UNIX line endings with Windows line endings and vice versa. Clarifications: For the purposes of this problem, a UNIX line ending consists of the octet 0A in hexadecimal, except when it is immediately preceded b...
(Inspired while drawing on a dry erase board) Challenge: Given an input string containing characters that represent different colors of dry erase markers on a white board, output the order in which they were drawn, from first to last. Input: A string which contains dry erase marker colors which are represented by alpha...
Challenge Given a rectangular grid of printable ascii characters as a string or through standard input, write a function or program that collapses the non-space characters into a pile on the bottom. The rules: The output has the same dimensions and characters as the input. A non-space character at (row a,column b) can...
Given a nonempty array of positive integers, "increment" it once as follows: If all the array elements are equal, append a 1 to the end of the array. For example: [1] -> [1, 1] [2] -> [2, 1] [1, 1] -> [1, 1, 1] [3, 3, 3, 3, 3] -> [3, 3, 3, 3, 3, 1] Else, increment the first element in the array that is the array's mi...
Take a positive integer X. This number is part of the sequence we are interested in if the sum of all digits of X is a divisor of X, and if the product of all digits of X is a divisor of X. For example, 135 is such a number because 1 + 3 + 5 = 9 which divides 135 = 9 * 15 and 1 * 3 * 5 = 15 which also divides 135. This...
Challenge Create the shortest program that meets the requirements Requirements The code must generate a 5x5 grid of 0s, like so: 00000 00000 00000 00000 00000 The code must accept an input (column, row, character). The grid must change accordingly: Start: 00000 00000 00000 00000 00000 Input: (2,5,*) Output: 0*000 0...
A brace string is defined as a string consisting of the characters *()[] in which braces match correctly: [brace-string] ::= [unit] || [unit] [brace-string] [unit] ::= "" || "*" || "(" [brace-string] ")" || "[" [brace-string] "]" This is a valid brace-string: ((())***[]**)****[(())*]* But these are not: )( **...
What tips do you have for golfing in Wierd? Tips for golfing other languages don't seem to help one golf Wierd programs so I'm looking for ideas that can be applied to code golf problems that are specific to Weird - especially if it helps me reduce the size of this answer at "Hello, World!"
Playing tetris is fun. Watching an AI play tetris is also fun. Some tetris AIs will always ignore the possibility of maneuvering a piece under an overhang, which makes me sad. It means that the programmer said to himself, "What are all the possible places the tile could be at the top of the board, and from each place,...
Write a program which will take for input 2 integer arrays and return a truthy value if there exists an element which is present in both of arrays, or a falsy one otherwise. The obvious solution to this problem would be to iterate through each element in the first array and compare it against each element in the second...
Imagine this, we have an environment with a global scope containing just a single object, called codegolf. This object has a single child called stackexchange, which has a property called com. Accessing this property would look like codegolf.stackexchange.com. The challenge The input of your program/function will be a ...
N children, with no two sharing their exact size, are lined up in some order. Each can only compare heights with their immediate neighbours. When the teacher shouts "raise hands if you are the tallest", they do so if they are taller than both their neighbours, and they do so simultaneously. If only one raises their han...
Year of 2010, an Icelandic Vulcano, concisely named Eyjafjallajökull erupted, resulting in my long-planned flight being canceled. In case this ever happens again, I would really like to know in advance, so please help me build a simple visual alert system ! Input Take the Icelandic Meteorological Office volcanic activ...
You need to produce output that is non-deterministic. In this case, this will be defined to mean that the output will not always be the same result. Rules: A pseudo-random number generator that always has the same seed does not count. You can rely on the program being run at a different (unknown) time each execution. ...
Write a program or function which, given a non-empty sequence of right or left turns, outputs the length of the shortest self-avoiding path on a 2D lattice with those turns. The input should be taken as a string, with each character being R or L for a right or left turn respectively. The output should be an integer, th...
All Aboard the ASCII Train! o O O ___ ___ ___ ___ ___ ___ ___ ___ ___ o | C | | O | | D | | E | | | | G | | O | | L | | F | TS__[O] |___| |___| |___| |___| |___| |___| |___| |___| |___| {======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""...
There’s a famous tricky algorithm for counting the number of set bits in a 32-bit unsigned integer: int popcount(unsigned x) { x = (x & 0x55555555) + ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x & 0x0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F); x = (x & 0x00FF00FF) + ((x >> 8) & 0x...
Write a program which runs forever and allocates more and more memory on the heap the longer it runs, at least until you reach the limit of the operating system on the amount of memory that can be allocated. Many kernels won't actually reserve memory you allocate until you use it for something, so if your program is in...
My homework is to write a Martian essay (see below) between 729 and 810 words, inclusive. Your task is to write a program that will generate the essay. History Around the turn of the 20th century, spiritualist Catherine-Elise Müller allegedly communicated with Martians. During somnambulatory trances, she would write ...
Introduction Suppose we have a network of railroads. Each junction in the network is controlled by a switch, which determines whether an incoming train turns left or right. The switches are configured so that each time a train passes, the switch changes direction: if it was pointing left, it now points right, and vice ...
Write a Java method to check if a given string matches any value in a given enum. Your method will take two parameters, one a string and one an enum, and return true if the string representation of any of the enum's elements matches the given string, or false otherwise. Note that your method should still function norma...
Draw lines between every pair of distinct points for n points arranged in a circle, producing something like the below result. Shortest code (in bytes) wins! Your lines don't have to be transparent, but it looks better that way. The output must be a vector graphic, or be an image at least 600 pixels by 600 pixels (eith...
Alphabetize Integers For a given set of numbers, put them in alphabetical order when they are spelled out (i.e. 1: one, 2: two, 90: ninety, 19: nineteen). Your code should work for the range [-999999, 999999]. Output must have a delimiter between numbers. A space will work, as will a space and a comma as shown in the e...
I like the Hilbert Curve. Your task for this challenge is to take an image (strictly a square image where all the sides are a power of two pixels wide) and unravel it line by line in a zig-zagging fashion and ravel it back up in a pseudo-Hilbert curve. Unraveling To unravel you will start with the pixel in the upper l...
Long time lurker first time poster here. Write a program which takes 3 inputs: X, Y and Z. X = across (columns) Y = down (rows) Z = Location Marker The program should then print a visual grid X across and Y down. This grid will can be made of any character except "+". Each 'location' is given an index number, count...
Introduction A radix tree, also known as compressed trie or compressed prefix tree, is a tree-like data structure for storing a set of strings. The edges of the tree are labeled by nonempty strings, and each node is either terminal or nonterminal. The strings that the tree contains are exactly the labels of all paths f...
Write the shortest program which, when run with no arguments, stdin, or user input, triggers a core dump. Your code must behave this way when run on some common out-of-the-box Linux distribution. Other than installing support for your target language, you may not reconfigure the system to make it more fragile than it i...
Welcome to the grinder. Your task is to make big rocks into small rocks by grinding them. Take an input of a big rock of size n > 3 and grind it. Continue to grind the rocks by dumping them into the grinder until the size of all the rocks are 2. rocks are always grinded into equal even halves. If the result of a grin...
Given a string representing a series of aircraft marshalling hand signals, write a function or program to calculate the final position of an aircraft following these signals. N.B.: Co-ordinates in this challenge are represented as a pair of Cartesian co-ordinates, plus a compass direction heading: (x, y, h) where x is ...
Each term in the squaring sequence, \$x_n\$, is created by taking \$x_{n-1}\$, squaring it, and removing all but the first four digits. The sequence always begins with \$x_1 = 1111\$. Squaring this yields \$1234321\$, so \$x_2 = 1234\$ The first few terms are: 1111 1234 1522 2316 5363 ... The Challenge Your task is t...
The Definition Given an integer x, a version series is a set of digits (base 10) from which any x-length subset of consecutive members is unique compared to all other possible subsets of the same length (a unique "version"). The Task Write a function which, when passed some subset length x, produces a version series, c...
In the IRC protocol, raw messages look similar to this: command arg1 arg2 :arg3 with spaces :arg4 with spaces :arg5 In a shell environment (e.g. bash), that would be equivalent to: command arg1 arg2 "arg3 with spaces" "arg4 with spaces" arg5 The format specification is as follows: Raw messages will only contain prin...
I though this would be a good challenge : http://adventofcode.com/2016/day/1 Task description Given a sequence of rotations and distances following the pattern (L|R)[1-9][0-9]*, give the manhattan distance between the start and the ending points, that is the minimal number of vertical and horizontal moves on a grid. Ex...
For more information, watch this video, and go to A276523 for a related sequence. The Mondrian Puzzle (for an integer n) is the following: Fit non-congruent rectangles into a n*n square grid. What is the smallest difference possible between the largest and the smallest rectangle? For 6, the optimal difference for M(6) ...
Write a regex that works in at least 2 regex flavors (or versions), and match a different string in each flavor (or version) it is running in. The strings to be matched in this challenge are the first words of the Ubuntu code names, which are listed below. Your regex has to match from the top of the list. That is, if y...
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Instead, you click on nearby tiles to reveal the number of adjacent mines. One downside about the game is that it is possible to end up in a scenario where there are multiple valid answers and you may o...
My teacher was more than unhappy with my Martian Homework. I followed all the rules, but she says that what I output was gibberish... when she first looked at it, she was highly suspicious. "All languages should follow Zipf's law blah blah blah"... I didn't even know what Zipf's law was! It turns out Zipf's law states ...
This is a cops and robbers challenge - Robber's Thread Write a program that terminates after exactly 60 seconds (or as close to it as possible). For example: #include <unistd.h> int main(int argc, char **argv){ sleep(60); return 0; } However, your goal is to write this program such that terminating after exact...
Let's create a simple, surjective mapping from positive integers to Gaussian integers, which are complex numbers where the real and imaginary parts are integers. Given a positive integer, for example 4538, express it in binary with no leading 0's: 4538 base 10 = 1000110111010 base 2 Remove any trailing 0's: 1000110111...
This is a cops and robbers challenge - Cop's Thread Each of the cops have been tasked to write a program that terminates after exactly 60 seconds, or as close as possible. For example: #include <unistd.h> int main(int argc, char **argv){ sleep(60); return 0; } Your goal is to take any of the uncracked submissi...
My wires are all tangled! Isn't it annoying when wires get all tangled up? Well, that just happened to me, so I'd like to to help me untangle them! For your convenience, I've disconnected them all from the device, but they're all still connected to the outlet. Your challenge is to figure out how to untangle them! Input...
Given an integer from 1 to 999 inclusive, output a truthy value if it appears horizontally, vertically, or diagonally, either forwards or backwards, anywhere in the 3x3 square of digits 1-9 on a standard number pad: 789 456 123 If the number does not appear, output a falsy value. The exact 65 numbers you need to outpu...
In your favorite programming language, create an application that restarts itself once, after n seconds. You need to find a way to restart after exiting the program. EG: run cmd to do it for you. Make sure it waits an amount of seconds specified by the user before restarting For clarification: You can run a second prog...
Some versions of the standard Android calculator app allow you to press a key, like 'sin' and then the 'del' key to make it 'si'. Probably just a bug which they can't be bothered with removing. The following letters/letter groupings are typable: sin si s cos co c tan ta t ln l log lo e So, 'tasteless' is typable,...
I keep hearing that thinking outside the box is a goal worth achieving, but how can I tell if I'm successfully doing it? To solve this dilemma I have already wrote a Brainwave-to-ASCII-translator which in theory should produce outputs like # +------------+ # | thinking | # | ...
A continuation of Inverse Deltas of an Array Your task is to take an array of signed 32 bit integers, recompile it with its deltas reversed. Example The List, 18 19 17 20 16 has the deltas: 1 -2 3 -4 which, when reversed, yields: -4 3 -2 1 then when recompiled, using yields: 18 14 17 15 16 whi...
Introduction Consider a sequence of integers and one of its subsequences, say A = [4 2 2 4 4 6 5] and B = [2 4 5]. We want to remove the elements of B from A in order, and there are several ways of doing that: A = 4 2 2 4 4 6 5 B = 2 4 5 -> 4 2 4 6 A = 4 2 2 4 4 6 5 B = 2 4 5 -> 4 2 4 6 A = ...
All-pairs shortest paths is a standard pathfinding problem. This is a twist on that. Definitions We are searching for paths on a directed graph. Graphs are defined by square matrices, for example 0 3 2.5 1 0 1 0 -1 0 Write M(r,c) = value in M at row r, column c is the cost to travel from node r to node c. The gra...
Your goal is to create a program. It must take input indefinitely. Here is a sample run (the > shows that the line is the output from the program) 2,6 > 0 5,6 > 0 7,5 > 0 2,7 > 1 Since 2 is connected to 6, which in turn is connected to 5 and then 7, 2 and 7 are hence connected. 5,2 > 1 ... Clarifications Whenever t...
Given a number and either "+" or "*", return an addition or multiplication table with the dimensions of that number. Specifications The input will be formatted as dimension, operation. The program should not return anything if the operation input is not + or *. The program should not return anything if the dimension i...
We've all seen those online "maths hax" that look like this: Think of a number, divide by 2, multiply by 0, add 8. And, by magic, everyone ends up with the number 8! Language Let's define a programming language which uses the syntax of the text above, called "WordMath". WordMath scripts follow this template: Think of...
Binary to decimal converter As far as I can see, we don't have a simple binary to decimal conversion challenge. Write a program or function that takes a positive binary integer and outputs its decimal value. You are not allowed to use any builtin base conversion functions. Integer-to-decimal functions (e.g., a functio...
Introduction and Credit Imagine you're Amazon. Imagine you have a large number of products for which a lot of people have written reviews scoring 1-5 stars. Now you need to give your customers a summary for each product based on the simple product-scoring association. Because you're Amazon, time is money and as such yo...
Display a Digital Clock (I see there are many clock challenges, I have tried to read them all, I'm pretty sure this is unique) Write some code that continuously updates a digital clock displayed in the format h:m:s where h, m, and s can occupy 1 or 2 characters each. The restrictions in simple terms as @BlueEyedBeast p...
Implement this recurrence relation as a function or program that inputs and outputs a non-negative integer: F(0) = 0 F(N) = the smallest integer greater than F(N-1) such that the sum and/or product of its base-10 digits is N N is your program's input and F(N) its output. To be clear, the sum of the digits in a number...
We are putting balls into a fixed number a bins. These bins begin empty. Empty bin (a=4): 0 0 0 0 And one by one we add balls to the bins. 0 0 0 1 or 0 0 1 0 or 0 1 0 0 or 1 0 0 0 We need a quick way to loop over all the possible states the bins take, without duplicates and without missing any and we don't want t...
My wife is very, let's say, particular when it comes to putting ornaments on our Christmas tree. Let's get her some code to help her in this trying time. Input Given an input 2 < n < 10 the height of the tree and 0 < k < n the distinct number of ornaments. Task Decorate the tree starting with 1 and increment to k as we...
Skittles are colored candy where there are 5 distinct flavors; grape, green apple, lemon, orange, and strawberry represented by (p)urple, (g)reen, (y)ellow, (o)range, and (r)ed respectively. I used to eat skittles by sorting all the different colors, then eating them in sequence. After getting a few weird looks in the ...
You're looking at an avenue, and someone has left the trash out! You need to write a program to help fix the problem, by putting the trash into trashcans. The task The avenue is made up of a string of printable ASCII characters, e.g.: [[](dust)[]] car ((paper)vomit) (broken(glass)) [[] (rotten) fence (dirty) Some of t...
This is an answer-chaining challenge in which each answer builds on the previous answer. I recommend sorting the thread by "oldest" in order to be sure about the order in which the posts are made. Note: This has become quite a long-lasting challenge, and posting new answers is fairly difficult. As such, there's now a ...
A pangram is a string that contains every letter a-z of the English alphabet, case-insensitive. (It's OK if the pangram contains more than one copy of a letter, or if it contains non-letter characters in addition to the letters.) Write a program or function whose input is a list of strings, and which outputs one or mor...
Remember the good old days when opening a simple document or web page was painfully slow as it hogged all the meager resources your computer had? And today, doing the same is even slower, despite your processor being hundreds of times faster and having access to thousands of times more memory? To simulate the effect of...
I've been working on this iOS app recently and I encountered a (rather easily solved) problem: How do I determine if my string is comprised only of emojis? Well, that's your job today! Input A string. If the presence of unicode characters is problematic for you then you may use a different reasonable format. Please st...
Question Santa must get to every house in the world to deliver gifts, can you make a program that will calculate the shortest path that Santa could take, and still visit all the cities listed? Specifications The program should accept Santa's starting point as input. That could either be a city or a pair of coordinates....
I was just playing the board game Sorry! with some people, and I realized that I could base a few interesting challenges off of it. This one is pretty simple. You task is simply to output an ascii-art version of a sorry board, placing pieces where I tell you to. Specs First, here is an image of an actual Sorry! board f...