instruction
stringlengths
34
53.1k
As you all know, today is election day! Your task today is to print out a ballot, given an input. If the input is Hillary Clinton, print: Hillary Clinton ===-----===> Donald Trump === ===> ____________ === ===> However, if the input is Donald Trump, print: Hillary Clinton === ===> Donald Trum...
Introduction The perimeter density matrix is an infinite binary matrix M defined as follows. Consider a (1-based) index (x, y), and denote by M[x, y] the rectangular sub-matrix spanned by the corner (1, 1) and (x, y). Suppose that all values of M[x, y] except Mx, y, the value at index (x, y), have already been determin...
Consider a date formatted in YYYY-MM-DD. You can use the joker * at the end of the date string. E.g. 2016-07-2* describes all the dates from 2016-07-20 to 2016-07-29. Now, consider a period represented by a start date and an end date. The algorithm must find the smallest possible list of dates representing the period....
This challenge has two threads. This is the cops' thread. The robbers' thread is located here. Your challenge is to choose an OEIS sequence and write two full programs in two different languages that produces that nth item in the sequence when given an n via STDIN, or an other forms of standard input, where n is any p...
This is the robbers' thread of this challenge The cops will choose an OEIS sequence and write two full programs in two different languages that produces that nth item in the sequence when given an n via STDIN. The two programs must be anagrams of each other, meaning each can be rearranged from the other's letters. The...
An emirp is a non-palindromic prime which, when reversed, is also prime. The list of base 10 emirps can be found on OEIS. The first six are: 13, 17, 31, 37, 71, 73 However, due to the reversal rule, emirps are different in each base. For example, the first six binary emirps are: Bin | 1011, 1101, 10111, 11101, 1010...
A cruise control has 3 different options to move the handle to set the speed you want to drive with. Towards you: Adds 1 speed. Upwards: Increases speed to the next multiple of 10 (e.g. 20-->30, 32-->40) Downwards: Decreases speed to the next multiple of 10 (e.g. 20-->10, 32-->30) Input 2 integers: the first is the ...
An orthogonal matrix is a square matrix with real entries whose columns and rows are orthogonal unit vectors (i.e., orthonormal vectors). This means that M^T M = I, where I is the identity matrix and ^T signifies matrix transposition. Note that this is orthogonal not "special orthogonal" so the determinant of M can be...
Solve a Tron Game Tron is a great game, and if you haven't played it the internet has MANY online versions available. A fun challenge is to try to write an AI that plays Tron, which is normally much better than any human, thanks to their frame perfect dodging. Even with their perfect dodging of walls, they still get th...
I apologize if this isn't fit for this site but it is a puzzle, not all that practical, so I thought it would fit. Take this code: string s = ""; Console.WriteLine(ReferenceEquals(s, string.Empty)); This will print out true because "" is interned by the JITter at some early point and literals are reused from the inter...
Let's define the "unwrapped size" function u of a nested list l (containing only lists) by the following rules: If l is empty, then u(l) is 1. If l is non-empty, u(l) is equal to the sum of the unwrapped sizes of every element in l, plus one. Your task is to write a program (or function) that takes a list as input an...
Given the equation of a polynomial and an x-coordinate find the rate of change of the point at that x-coord on the curve. A polynomial is in the form: axn + axn-1 + ... + ax1 + a, where a ϵ Q and n ϵ W. For this challenge, n can also be 0 if you don't want to have to deal with special cases (constants) where there is n...
Let's define a 2-quine as a program that prints its source code two times. For example, if the program ABC printed ABCABC, it would be a 2-quine. Let's define a 3-quine as a program that prints its source code three times. For example, if the program ABC printed ABCABCABC, it would be a 3-quine. Let's define a n-quine...
Introduction Consider two arrays of the same length, say A = [0,1,0,2] and B = [-1,1,2,2]. Suppose we know that their contents are equivalent in some sense, item by item: 0 is equivalent to -1, 1 is equivalent to 1, 0 is equivalent to 2, and 2 is equivalent to 2. Equivalence is transitive: -1 and 0 are equivalent, an...
Are you feeling jealousy towards Mathematica, Matlab et al. for their intricate plotting capabilities? If you answered yes, this challenge is for you! Challenge Given, via parameters or standard input, a list of numbers list and a positive integer h for the height of the plot, write a program/function/snippet that prin...
The Challenge I was looking into small code examples for a specific language as a small tutorial and came accross a simplified Blackjack that should be implemented. In this Challenge you will have to implement a full Blackjack game, with 5 Decks. The Game You are playing against a Dealer and he has 5 Decks of Poker pla...
This challenge is based upon three sequences, below are their formulae: Recamán's sequence: a1 = 0; for n > 0, an = an-1 - n if positive and not already in the sequence, otherwise an = an-1 + n Fibonacci sequence: an = (Φn – (–Φ)–n) / √5 where Φ denotes the golden ratio, and a1 = 0 Triangular numbers s...
Today, November 11th, is known as Remembrance Day, Armistice Day, or Veterans Day (depending upon the country), and is a day of reflection and gratitude for members of the military and their service, specifically started to reflect the end of European hostilities in the first World War. Let us reflect on that with a si...
This is the cops' thread. For the robbers' thread, click here. Cops' Task First, write a quine in a language of your choosing. Next, scramble the quine. Make sure to do this well as the robbers will be trying to unscramble it and find the original source code! Note that the scrambled code does not need to work. Post a...
This is the robbers' thread. For the cops' thread, click here. Cops' Task For the cops' thread, click here. Robbers' Task Find an uncracked submission on the cops' thread. (A submission may only be cracked once.) Unscramble the code to find a working quine. Post an answer on the robbers' thread. Include the language, ...
Challenge: Write a lossless encoder/decoder that is able to compress its own source code. Usage: progname encode Encodes data provided on the standard input, writes the encoded representation of the data to the standard output. progname decode Decodes data produced by progname encode. Reads the encoded data from the s...
You are a taxicab driver in San Francisco. As is typical of taxicab drivers, you are navigating a grid where the only valid directions you can move are the left, right, up, and down. However, San Fransisco is very hilly so the distance between two adjacent intersections is not necessarily the same. More specifically, t...
Identify whether an IP address is internal, global, link-local, or reserved. Input should be an IPv4 address in decimal octets separated by periods. Output should be 0 for link-local (RFC 3927), 1 for internal (RFC 1918), 2 for global IPs (Internet), and 3 for otherwise reserved addresses. All these address types are d...
Balancing Act A see-saw (supposedly from the French 'ci-ça', meaning 'this-that') forms a third of the holy trinity of playground equipment, along with the similarly ubiquitous slide and swing. A see-saw is in perfect balance if, and only if, the sum of the moments on each side are equivalent. A see-saw can therefore b...
Note: This challenge is finished. Submissions are still welcome but can not win. This is the cops' thread. The robbers' thread goes here. Write a code that outputs the integer 1. If you add, remove or substitute a single character (of your choosing), the code should output the integer 2. Change one more character (th...
This is the robbers' thread. The cops' thread goes here. Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made. The winner will be the robber that crac...
Steganographic Squares Your job is to take in a string, and generate an NxN image that represents this string. You must also write the algorithm that takes in the image and turns it back into a string as well. The scoring will be will include the byte count of both algorithms: "Encryption" Algorithm + "Decryption" Algo...
A sestina is a format of poem that follows an interesting pattern that we can generate. It has six stanzas of six lines each, where the last words of each line in the first stanza make up the line endings in each successive stanza, rotated in a set pattern. (There's also a three-line stanza at the end, but we won't wor...
Why don't you grow up? In the past week a meme involving the young actor Aaron Bailey became trending in most Brazilian social networks. Entitled "why don't you grow up" it consists in repeating a sentence replacing its vowels with is (it's a bit more complicated than that, I'll explain below). As I want to be a cool g...
Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C. Program B, when run in language B produces Program A, and running program B in language A produces program C. Program C, when run in language A or language B, prints "Wrong language!". Prog...
The challenge Simply write a program that outputs its own source code. Nothing more than a regular quine. The problem We don't have a computer so we have to run the program on a programmable logic device (such as an FPGA, a CPLD, a gate array ...). The rules Any device available on the market (such as a printer connec...
Given an input of a list of words, output the words with their letters arranged diagonally: p r o p g u r z a a z m n l m d e i c s n o g d g e o l f (The above should be the output for the input programming puzzles and code golf.) To be precise, each word starts on the first co...
Introduction In mathematics, a polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional figurate numbers. The number 10, for example, can be arranged as a triangle: * ** *** **** But 10 cannot...
My Downgoat avatar has several distinct features These features can however also apply to any other animal. Specification Given an image of an animal (technically can be anything), you must apply the Downgoat properties to it. Border pixels are the outer most pixels of the image. The background color is defined as th...
Out Steganograph Me As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them. The Challenge Your goal is to write a function or program that when given a string as an input, outputs an image. Then, in a seprate program/function, accept that same image...
The challenge here is to accurately depict the flower of life (which is a sacred geometrical figure according to some) in the language of your choice. The design consists an arrangement of circles and partial circles of radius 1 as shown whose centres arranged on a triangular grid of pitch 1, plus one larger circle of...
Hearts is a trick-taking card game for 4 players. Each trick is taken by the player who played the highest card of the leading suit. At the end of each hand, the players incur a penalty score depending on the penalty cards they have taken; the task is to determine the scores under Microsoft Hearts rules. Input Input is...
Briefing You are a bot, in a 2D grid that extends infinitely in all four directions, north, south, east and west. When given a number, you must move the bot so that you get to the target number. Here's how the grid works: You can move in 4 directions: north, south, east or west. Once you move off a cell, you are not al...
It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words! Walking words Walking words are words which will respond to certain characters. For the purpose of this challenge the trigger characters are [u, d, r, l] from up down right left. Whenever you encounter su...
In this challenge, you are going to create a Fellowship with the goal of defeating all other fellowships in battle. A fellowship (team) consists of 3 characters. Each character moves independently of the rest of their team, but they will need to work together when fighting your enemy. Teams will face each other head t...
The Art of Word Shaping Given a binary matrix and a string of letters, replace all 1's in the matrix, moving from top to bottom and from left to right within each row, with the letters of the string. Once the letters have been formed into the shape of the matrix, print the matrix, replacing 0's with spaces. It's probab...
A monotonic subsequence is a sequence of numbers \$a_1, a_2, ..., a_n\$ such that $$a_1 \le a_2 \le ... \le a_n \\ \text{or} \\ a_1 \ge a_2 \ge ... \ge a_n$$ [1, 3, 3, 7, 9, 13, 13, 100] is a monotonic (non-decreasing) subsequence, as well as [9, 4, 4, 3, 0, -10, -12] (this one is non-increasing), but [1, 3, 6, 9, 8] i...
Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly. For example, let's check the number 100. 1003 is 1000000. The set of digits in 100 is {0, 1}. The set of digits in 1000000 is {0, 1}. Therefore, 100 should give a truthy value. Test case...
Input: Firstly An array of three cards representing the cards played by each player formatted like [JD][TH][9S] Representing Jack of Diamonds, 10 of Hearts, and Nine of Spades. As you always sit across from your team-mate in Euchre, the second element represents your team mate's play. Here, the TH. Secondly A Single ...
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places. In traditional compass notation, a string is made up of only 2 of these characters (like NNW or ESE). Here you must also accept strings that contain all 4 (like WNNNSE). Using only 2 symbols allows hu...
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list: AAA BBBB CCCC DDDD EEEEE FFFFF GGG H H A A ...
There is a helicopter flying 500 meters from the ground. It can fly up 100 meters, which takes 1.0 secs. Or if it doesn't fly up it will fall 200 meters, which also takes 1.0 secs - This means if the instruction is anything other than "Fly" the helicopter falls. Build a program that takes input of a list of instruction...
(randomly inspired by this question) Let's make a drawing from some pipes | and hyphens -. Choosing a subset, if chosen carefully, you can form a rectangular box or block shape (meaning that the corners are formed by |- or -|). For this challenge, we're concerned only with identifying the corners -- the vertical and ho...
Poker hands are ranked from best to worst as follows: Straight flush - five cards of sequential rank, all of the same suit Four of a kind - four cards of the same rank and one card of another rank Full house - three cards of one rank and two cards of another rank Flush - five cards all of the same suit Straight - five...
I need help making a brick road to go beside my brick wall! \ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__ __\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \_...
Task Your goal, should you choose to accept it, is to write a program, that, given an input string (or array of characters), outputs every possible permutation of the letters in that string. I'm finicky with my output, so it should be sorted alphabetically, with no duplicates. Example: Input: buzz Output: buzz bzuz bzz...
There's something (well, many things ) that really annoys me. It is when dictionaries (English, not Pythonic) use the defining word itself to define the word, also called circular definitions. Example: reticence: the quality of being reticent -- Apple Dictionary Circular definition: a definition that is circular --...
This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a lot easier than this one here This Challenge Given a bunch of rectangles, figure out whether or not they fill a rectang...
Introduction I have a room full of magic mirrors. They are mysterious artifacts that can duplicate any item, except another magic mirror. More explicitly, a duplicate version of the item will appear on the other side of the mirror, at the same distance. However, if there is another magic mirror in the way on either sid...
A "Giza number", also colloquially known as a Timmy Number is any number where the digits represent a pyramid (A134810). For example, "12321" is a giza number because it can be visualized like this: 3 2 2 1 1 However, something like "123321" is not a Giza number because there are two digits at the top of the py...
Problem The goal is as the title says to find the \$n\$th prime such that \$\text{the prime}-1\$ is divisible by \$n\$. Explanation Here is an example so you understand the question, this is not necessarily the way it ought to be solved. It merely as a way to explain the question given \$3\$ as an input we would first ...
Introduction: I think we all know it, and it has probably been translated in loads of different languages: the "Head, Shoulders, Knees and Toes" children song: Head, shoulders, knees and toes, knees and toes Head, shoulders, knees and toes, knees and toes And eyes and ears and mouth and nose Head, shoulders, kne...
And in particular the second law: the entropy of an isolated system undergoing an irreversible process increases with time. For this challenge, An "isolated system" will be taken to be a program or function (abbreviated as "program" from now on); The "irreversible process" will be execution of code; The passing of "ti...
Input: Two integers n and k given in any form that is convenient for your code Output A random non-decreasing sequence of k integers, each in the range 1 to n. The sample should be chosen uniformly from all non-decreasing sequences of k integers with integers in the range 1 to n. The output can be in any reasonable f...
In mathematics, matrix multiplication or the matrix product is a binary operation that produces a matrix from two matrices. The definition is motivated by linear equations and linear transformations on vectors, which have numerous applications in applied mathematics, physics, and engineering. In more detail, if A is an...
Input A dictionary with string keys and string values. Output The 'inversedict' of this dictionary. How to make an inversedict An inversedict is a dictionary with string keys and string array values. The keys are the values from the original dictionary, and the values are the keys from the original dictionary with th...
A stochastic matrix is a matrix of probabilities used in the context of Markov chains. A right stochastic matrix is a matrix where each row sums to 1. A left stochastic matrix is a matrix where each column sums to 1. A doubly stochastic matrix is a matrix where each row and each column sums to 1. In this challenge, we ...
Given only a straightedge and compass, inscribe a rhombus inside the given rectangle, sharing two opposite points. Input Input is the dimensions of the rectangle. In the example shown, that would be 125, 50. You can take input in whatever way is most convenient (as two integers, list, strings, etc). The larger dimensi...
A Hilbert Curve is a type of space-filling curve, and it basically maps a line to a plane. Each point in the line corresponds to just one point in the plane, and each point in the plane corresponds to just one point on the line. Shown are iterations 0 through 4 of the Hilbert Curve: Iterations 0 up to 4: The objec...
For today's fractal challenge, draw at least 5 iterations of Sierpinski's triangle! (Shown below is Sierpinski's trinagle) The resolution of the image must be sufficent that the smallest triangles are at least one pixel in size, and all triangles should be approximately equillateral - pixel art that draws a right-tria...
How well do you know the site? Let's find out. This is a cops-and-robbers challenge. Robber's thread. As a cop, you need to: Find a non-deleted, non-closed challenge on this site to answer. The challenge cannot have the following tags: cops-and-robbers, popularity-contest, code-trolling, underhanded, busy-beaver, k...
How well do you know the site? Let's find out. This is a cops-and-robbers challenge. Cop's thread. As a robber, you need to: Find a non-deleted, non-closed challenge that matches a cop's submission. The challenge cannot have the following tags: cops-and-robbers, popularity-contest, code-trolling, underhanded, busy-...
Introduction The Sierpinski Arrowhead Curve is a curve that's limit is Sierpinski's Triangle. It first starts like this: _ / \ Then, each line is replaced with a rotated version of the first one: _ / \ \ / _/ \_ Next: _ / \ \ / _/ \_ / \ \_ _/ _ \ / _ / \_/ \_/ \ Your task Given a ...
Given a non-empty string, keep removing the first and last characters until you get to one or two characters. For example, if the string was abcde, your program should print: abcde bcd c However, if it was abcdef, it should stop at two characters: abcdef bcde cd Trailing newlines and trailing spaces at the end ...
Inspired by Find the “unwrapped size” of a list. Define the Recursive Size, RS, of a list containing no lists as its length (number of items contained) and the Recursive Size of a list containing any lists as the sum of its length and the Recursive Size of those lists. Challenge Write a program or function that outputs...
Let me tell you about a simple number system. (which I made up just for this challenge) This system contains the functions (), [], {}, and <>. 1. () When () is given no arguments, it evaluates to 0. When () is given one or more arguments, it evaluates to the sum of the arguments. 2. [] When [] is given no arguments, it...
Thanksgiving in the United States is coming up on November 24th. Many people will have a large dinner with their families, traditionally including turkey and many side dishes. This typically means the family members must coordinate who's going to bring each of the various dishes. In this challenge, the goal is to write...
Once I wrote a JavaScript program that would take as input a string and a character and would remove all characters except for the first one and the character given as input, one by one. For example, computing this with inputs codegolf.stackexchange.com and e for the character yields: codegolf.stackexchange.com cdegolf...
Challenge Implement a program that given three strings a, b, and c, substitutes all instances of the substring b in a with c. In other words, implement Ruby's String#gsub with strings instead of regexes (a.gsub b, c). Rules Standard loopholes apply. You may not use a builtin that performs this exact task. This is code...
This challenge is inspired by this other challenge, which you may want to read first for some context. However, a competitive answer is likely to look very different, so after reading some posts on Meta I decided it was best posted as a separate question. The goal here is to write a polyglot program; that is, a program...
Background We already have a challenge about throwing SIGSEGV, so why not a challenge about throwing SIGILL? What is SIGILL? SIGILL is the signal for an illegal instruction at the processor, which happens very rarely. The default action after receiving SIGILL is terminating the program and writing a core dump. The sign...
Many old Game Boy games often required string input from the user. However, there was no keyboard. This was handled by presenting the user with a "keyboard screen" like so: The 'character pointer' would begin on letter A. The user would navigate to each desired character with the D-Pad's four buttons (UP, DOWN, LEFT a...
I'm new to Japanese Mahjong and have trouble calculating the scores. Please help me write a program to calculate it. Introduction (aka you can skip this boring part) Mahjong is a popular tile game in Asia. Different rules have evolved and systematically established in various regions. Japan, being an isolated island st...
You task for today: draw a dragon curve! In case you don't know what a Dragon Curve is, here is an introductory ViHart video (Really cool, please watch!) Your task: draw a dragon curve, iterated at least 9 times. You don't have to show iterations 1 through 9, you just have to show the final curve produced after complet...
Brief Problem Explanation Write a program to find the minimum distance between two points traveling only on rays emanating from the origin and circles centered on the origin. Explanation of Premise Now let's imagine we are on a plane, and on this plane we are only allowed to travel in special ways. We are allowed to tr...
Write a program that outputs as many characters as possible, with two conditions: The program must be 256 bytes or shorter The program must almost surely eventually halt. In other words, the only thing not permitted in response to this question is an infinite loop. For the purposes of this problem, any built-in psudo...
Background This question is similar to this one. I have provided all of the information needed below. If you are familiar with the other challenge then note that we are ranking all defenses instead of seeing the effectiveness of a single attack. This is important because it means that the tables are inverses of each ot...
Definitions: A line is a possibly empty sequence of characters terminated by a “newline character.” A “newline character” is a character that cannot be a component of the aforementioned character sequence. A line number comment is a character sequence that does not alter the meaning of source code in the programming l...
The Challenge Given a CSV input, output a proper unicode table using box characters. Formatting The table will be formatted using the following rules: Column width will be equal to the longest value of that column All table data will be left justified Each table will assume the first csv row to be the header The table...
What's great about golfing is not having to deal with errors. Except this time you won't get off so lightly! I need to do some arithmetic with certain limitations, and I wan't to know what goes wrong if anything. Challenge Given a list of signed integer values [n1..n11], give the following result or the first error tha...
Challenge description Let's start with some definitions: a relation is a set of ordered pairs of elements (in this challenge, we'll be using integers) For instance, [(1, 2), (5, 1), (-9, 12), (0, 0), (3, 2)] is a relation. a relation is called transitive if for any two pairs of elements (a, b) and (b, c) in this rel...
Let's take a look on a typical loop, which usually performs 8 iterations: for (int x=0; x<8; ++x); You have to make it infinite! It's a popularity-contest for all languages that support such form of for loop. So solution with highest score (upvotes minus downvotes) wins. If your language has the other form of for loo...
Remember those brute-force programs to crack password that show every combination they are trying? More precisely, at one point, the n first characters are fixed (they have been guessed successfully), and every possible character for the remaining ones is being tested. You've probably seen some in movies, or in some so...
Introduction A disk is a linear container with blocks indexed 0 through size-1. A file is a named list of block indexes used by that file. An example filesystem is expressed like this: 15 ALPHA=3,5 BETA=11,10,7 "The disk has 15 blocks, the first block of file ALPHA is the disk block at index 3..." The disk map could b...
Your challenge is to create a regex that matches every string permutation of itself, and nothing else. The match must also be case-sensitive. So, for example, if your regex is: ABC It should match (and only match) these strings: ABC ACB BAC BCA CAB CBA It shouldn't match things like: AABC (contains an extra A) ABCD (...
Output a full formal poof of such statements such as 1+2=3, 2+2=2*(1+1) etc. Introuction If you know Peano Arithmetic you can probably skip this section. Here's how we define the Natural Numbers: (Axiom 1) 0 is a number (Axiom 2) If `x` is a number, the `S(x)`, the successor of `x`, is a number. Hence, for example S(S...
You are a traveller crossing the desert between two towns. You cannot carry enough water to get across without stopping. This is a variation of a classic puzzle. The Rules A desert looks like this: a WxH grid of mostly empty space. The space marked S is where you start, E is where you want to end, and a square marked w...
Generate a cipher given a number and string Your task is simple. Given a string s and a number 0 <= n <= 9 as inputs, insert a pseudo-random printable ASCII character between each character of the string n times. Such that for each character of s there are n random characters between them. Spaces should be trimmed. Inp...
Wikipedia says about Polar Coordinates: In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference point and an angle from a reference direction. This seems perfect for describing hexagonal grids. Take the following he...
Goal: A tree can be represented as a nested list: the list elements represent nodes, and a node is a pair of the node name and node children. Your program takes as input a nested list of pairs, and should output a pretty tree. Examples: Here are four example test cases below ["stump",[]] ["trunk",[["branch",[["leaf...
Today we're going to build a pyramid out of letters! Here's an example letter pyramid for the first 5 letters: Write the first 5 letters with a space between, first ascending and then descending. A B C D E D C B A Do the same thing for the first four letters on the line above, but with two extra leading spaces: A B...
Summary Implement FizzBuzz in Python, with the fewest possible tokens. Challenge Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print...
I love /usr/share/dict/words; it's so handy! I use it for all my programs, whenever I can! You're going to take advantage of this ever so useful file to use, by testing a word's individuality. Input A word; defined in this challenge as any string of characters /usr/share/dict/words in some format; you may hard code i...
This challenge is based on the game Layerz. Given, on stdin or as a function argument, a 2D rectangular array of cells where each cell contains either a blank (you may choose to use 0s instead of blanks at no penalty), a 1, a 2, a 3, or a 4; find a way to divide it into valid regions (as defined below) such that each n...
The challenge is to calculate the digit sum of the factorial of a number. Example Input: 10 Output: 27 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27 You can expect the input to be an integer above 0. Output can be of any type, but the answer sh...