instruction
stringlengths
34
53.1k
Or maybe it's not really a labyrinth, but still. Rules: Input is a two-line string, consisting of *, 1, x and X. That string is a labyrinth to walk through. The lines have the equal length. You could take the input as a string with , (comma) or any convenient separator between these two lines. Or you could take both l...
0. DEFINITIONS A sequence is a list of numbers. A series is the sum of a list of numbers. The set of natural numbers contains all "non-negative integers greater than zero". A divisor (in this context) of a natural number j is a natural number i, such that j÷i is also a natural number. 1. PREAMBLE A couple of other que...
Power Grid Resource Costs Introduction In the board game Power Grid, an integral part of the game is the act of buying resources to fuel your power stations. There are four types of resource used in the game (five, if you include renewable energy, but obviously you can't buy resources for that). These are Coal, Oil, Ga...
A Latin square is a square that has no repeated symbols in the rows or columns:. 13420 21304 32041 04213 40132 And as many Sudoku players know, you don't need all of the numbers to deduce the remaining numbers. Your challenge is to compress a Latin square into as few bytes as possible. You need to provide one or two...
Your task is to create a program or function that generates a zipper with a length of 10 lines. Each line of the zipper is represented by two dashes --: -- -- -- -- -- -- -- -- -- -- The program/function will take a percentage (divisible by 10) as input, and the output will be the zipper "unzipped" (dashes separated) ...
Write a program that, given any 'n' number of strings of 'm' length, returns 'm' number of 'n'-length strings, with this condition: Every new string should contains the letters at the same index of the others strings For example, the first output string must contain the first letter of all the input strings, the second...
You must write a program or function. The input is a 'map' of numbers. You can choose to take the map as either a string with new line characters (\n) or a 2D array of strings. All maps are 5 characters by 5 characters, and the characters are always either digits greater than 0 or spaces. Here is an example of a map...
Input: An array containing three integers: 0, 1 and 2 in any order (i.e. [2, 0, 1]) And a string of length >= 2 only containing alphabetic letters (both lower- and uppercase) and digits (i.e. a1B2c3) Output: Based on the array we sort and output the string. How does this work? The array indicates the order precedenc...
In this challenge, you will be given a text block, and you need to perform reflection on the text. Input: A string to be reflected. The text may not be supplied as an array whose elements are the lines of text. For example, "ab\ncd" and ['a','b','\n','c','d'] are allowed, but ['ab','cd'] or [['a','b'],['c','d']] are n...
Your goal is to output the strictly increasing sequence of consecutive, identical digits of pi (π). Each term in the sequence must be one digit longer than the previous. So 3 (0th digit of pi) is the first time a run of digits occurs (length 1). The next to occur is 33 (digits 24 and 25 of pi). Of course, this sequence...
In this question Tom learned that, in general, there are many motivations to choose to include case sensitivity in his programming language, because the possible combinations for a variable name are much more than what's possible with a case insensitive programming language for a name of the same length. But, as a more...
Your task is pretty simple, calculate the n-th element of A190810. Elements of A190810 are calculated according to these rules: The first element is 1 The sequence is increasing If x occurs in the sequence, then 2x+1 and 3x-1 also do You can use 1-based or 0-based indexing, but if you use 0-based indexing, please say...
Dropbox recently released Lepton (GitHub), a method that losslessly compresses JPEG images round-trip, saving an average of 22%. Because of the pigeonhole principle, any general compression algorithm cannot be guaranteed to result in a smaller file (general because it doesn't apply to inputs constrained to a specific ...
Stock Time Machine You've gained access to a dataset, tomorrowStocks, which contains the stock prices from your favorite business on the NASDAQ. This dataset is a container indexed by minutes past opening. Each index contains the price of the stock at that time. // Assume the stock market opens at 9:30AM EDT // tomorro...
For this challenge, you will be given an absolute path, and a "new" path (which can be absolute or relative), and you need to return the final path. For example, if your current directory was /var/tmp/test: my_dir or my_dir/ should return /var/tmp/test/my_dir ../../my_dir should return /var/my_dir /my_dir/./ should re...
Background The Italian definite article (corresponding to English the) has seven different forms: l', il, lo, gli, i, la, le. Which one to use depends on three variables: Gender: masculine / feminine. Number: singular / plural. Initial letter of the subsequent word: vowel / consonant type A / consonant type B. Vowel...
Goal The goal of this challenge is: given a string as input, remove duplicate pairs of letters, if the second item in the pair is of opposite capitalization. (i.e. uppercase becomes lowercase and vice-versa). Pairs should be replaced from left to right. For example, aAa should become aa and not aA. Inputs & outputs: I...
GolfScript automatically coerces values, according to the following ‘priority’ sequence: integer → array → string → block (listed from lowest to highest.) This means that "1"7+ leaves the string "17" on the stack (and not 8), because strings have a higher priority than integers. [To those GolfScript veterans – apolog...
Given a directory (such as C:/), given from stdin or read from a file, produce a directory tree, with each file/folder indented based on its depth. Example If I have a C:/ drive which only contains two folders foo and bar, and bar is empty while foo contains baz.txt, then running with input C:/ produces: C:/ bar/ ...
Task Define a mod-fold as a function of the form f(x) = x % a1 % a2 % … % ak, where the ai are positive integers and k ≥ 0. (Here, % is the left-associative modulo operator.) Given a list of n integers y0, …, yn−1, determine if there exists a mod-fold f so that each yi = f(i). You may choose and fix any two outputs Y ...
Write a program which outputs the square root of a given number in the shortest time possible. Rules It may not use any builtins or powering with non-integers. Input format as a function argument as a command line argument as a direct input on stdin or a window Your entry hasn't to be a complete program, it may be ...
Introduction We all know and love our Fibonacci sequence and have seen a myriad of challenge on it here already. However, we're still lacking a very simple case which this answer is going to provide: Reversed fibonacci! So given F_n your job is to find n. Specification Input Your input will be a non-negative integer, w...
Background The Copeland–Erdős constant is the concatenation of "0." with the base 10 representations of the prime numbers in order. Its value is 0.23571113171923293137414... See also OEIS A033308. Copeland and Erdős proved that this is a normal number. This implies that every natural number can be found at some point ...
What could be the shortest code for filtering the following array in Javascript without any library? My code is: filtered_obj = _.where(obj, { name: "Alpha" }); This uses a JS library called underscore. Test case: objs = [{'id':1,'name':'Alpha'},{'id':2,'name':'Beta'}, {'id':3,'name':'Gamma'},{'id':4,'name':'Eta'}, ...
In this code golf challenge, you will verify hashtags! #What_your_code_should_do Input is a string. Output a truthy value if it is a valid hashtag, and a falsy value otherwise. We define a string as a valid Hashtag if ... It starts with a hash (#). It doesn't have a number right after the hashtag (e.g. #2016USElection...
In the most common contemporary graphical desktop interfaces, when you perform double-click in a text, the word around your cursor in the text will be selected.† For example, let | be your cursor in abc de|f ghi. Then, when you double click, the substring def will be selected. Input/Output You receive two inputs: a st...
Write a program or function that prints or returns a string of the alphanumeric characters plus underscore, in any order. To be precise, the following characters need to be output, and no more: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_ When printing to stdout, an optional trailing newline after y...
I'm new here. I tried seeing if this challenge was introduced before. Found a close call one counting the number of cycles, but didn;t find one for listing them. So I'm writing this one. Sorry if I'm repeating... Anyway, I'm looking for the shortest function to return all close cycles in a shuffled list of indices. For...
Your task is to take an input n and output element n of the Rummy Sequence, a sequence which I made (looking on OEIS will not help you). Definition Each element of the Rummy Sequence is a set of truthy or falsey values. Ex.: [true, false]. The steps to producing a member of the Rummy Sequence are quite simple: Start o...
A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array 2 5 4 9 3 4 Now, we arrange these in a diagonal column: 2 5 4 9 3 4 Now, we fill in the nex...
A binary recurrence sequence is a recursively-defined sequence of the following form: $$F(1) = a_1 \\ \vdots \\ F(y) = a_y \\ F(n) = \alpha F(n-x) + \beta F(n-y), n > y$$ This is a generalization of the Fibonacci (\$x = 1, y = 2, a = [1, 1], \alpha = 1, \beta = 1\$) sequence and the Lucas (\$x = 1, y = 2, a = [2, 1], \...
In this challenge, given a list of ghosts from Pac-Man, you must output which ghosts are missing. You must do it in as few bytes as you can Input Input will consist of a string or list, which will include a number ghosts, which could include: Blinky Inky Pinky Clyde However, input may also include Pac-Man (with that ...
The text of the children's book Polar Bear, Polar Bear, What Do You Hear? has a very simple pattern. You might use the text to teach introductory programming concepts. My son was quickly bored by this idea, so I decided to play some golf with it instead. The Challenge In your programming language of choice, write the...
Presented in honor of APL as an interactive tool turning 50 this year Background Ken [Iverson] presented his paper Formalism in Programming Languages in August 1963 at a Working Conference on Mechanical Language Structures, Princeton, N.J. The list of conferees is full of famous and soon-to-be famous names, and a few ...
Summary Given a list of integers, return the index each integer would end up at when sorted. For example, if the list was [0,8,-1,5,8], you should return [1,3,0,2,4]. Note that the two 8s maintain their order relative to each other (the sort is stable). Put another way: For each element in the list, return the number...
This should be a simple challenge. Given a number \$n \ge 0\$, output the super-logarithm (or the \$\log^*\$, log-star, or iterated logarithm, which are equivalent since \$n\$ is never negative for this challenge.) of \$n\$. $$\log^*(n) = \begin{cases} 0 & \text{ if } n \le 1 \\ 1 + \log^*(\log(n)) & \text{ if } n > 1...
Lets Play Kick The Can! Although Moogie is the current winner, if anyone can take his crown they are encouraged to do so Kick the can is a children's game. Involving one defender, and multiple attackers. Today it is no longer such a game! Your job is to write a bot that plays it, to win, king-of-the-hill style! https:/...
Introduction When you are given a boring text, you just want to get it over with as quick as possible. Let's observe the following text: Ens colligi timenda etc priorem judicem. De quascunque ii at contingere repugnaret explicetur intellectu. Adjuvetis hoc fortassis suspicari opportune obversari vix eam? Dei praemia ...
Inspired by this StackOverflow post. Introduction Bob's job is to create spreadsheets and organize them. The way he organizes them is known to very few except for Bob, but he creates a list of each of the spreadsheets that fall under the same group. There's a bunch of data in the spreadsheet he creates, but there's o...
Your task is to create a program or function that takes, as input, a natural number (n) between 1 and 25 (inclusive) and prints an isometric representation of a slide and ladder with n number of rungs. Ladder and slide specifications The ladder is always oriented on the left and the slide on the right. We're viewing it...
In this optimization challenge you will write a program that sorts a single array by only comparing elements through asking the user on stdout to input comparison results on stdin. The below protocol is line-based, so everytime you print to stdout or read from stdin it is assumed a newline follows. Throughout the quest...
This is Pascal's Braid: 1 4 15 56 209 780 2911 10864 40545 151316 564719 1 3 11 41 153 571 2131 7953 29681 110771 413403 1542841 1 4 15 56 209 780 2911 10864 40545 151316 564719 I totally made that up. Blaise Pascal didn't have a braid as...
Validating a CPR number A Danish CPR number (Person Identification Number) is date of birth followed by 4 digits (the last one being a control digit): DDMMYY-XXXX The final digit validates the CPR number using Modulo 11 by satisfying the following equation: where the are the ten digits of the complete ID number, and ...
In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated: $$\large{L=\{a^n b^n:n\in\mathbb{Z}^+\}}$$ mainly because this language can not be processed with finite-state automata. This expression mean "Languag...
The Post's Correspondence Problem (PCP) gives you a list of pairs of strings, P_1 ... P_n. Your task is to find a k, and some sequence of k indices such that fst(P_i1) ... fst(P_ik) = snd(P_i1) ... snd(P_ik) We're trying to find some sequence of the pairs where the word we build from the first part is equal to the word...
In this question, we will only focus on losing weight by doing exercise, although there are still many ways to lose weight. Different sports burn different amount of calories. For example, playing billiards for an hour can burn 102 calories[1], while playing basketball for 15 minutes can already burn 119 calories [1], ...
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet: Print all Integers from 1 to 10 inclusive in ascending order to standard output. Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of th...
Task Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd. You may write a program or a function and use any of the our standard methods of receiving input and providing output. The output should be a truthy or a falsy v...
The specification of the "estimated" sign used by the European Union Directive (U+212e in Unicode, which you may not simply print for this challenge) is quite precise. To copy some restrictions from this question: Render the symbol to file or screen using vector or raster graphics. If your output is rasterised, your i...
Stackylogic is a programming language I made up in a previous challenge: Run Stackylogic. Read that post for full details and examples, but here is how it works paraphrased: Stackylogic takes 0's and 1's for input and outputs a single 0 or 1 upon completion. A program consists of lines that only contain the characte...
Introduction Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2]. Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array: [3, 2, 4, 1, 1, 5, 1, 2] ^ The element at the first index is 3, so we now take a substring of length three with the sam...
In this challenge, You have to bring ASCII art (which are usually 2D) to 3D! How? like this, X X DD X D D X X DD to... X X DD X X DD D X X DDDD X XDDD X X DD Then How do we do that? Given the ascii art and N, repeat this N times. for every character (we will call this A): let B be the character which is ex...
Introduction and Motivation I'm mainly active on Cryptography.SE and as such have already stumbled across the question: "How the hell am I supposed tools like cado-nfs to do stuff!?". They are super-complicated tools for a super-complicated task: Factoring large integers and computing large-scale discrete logarithms. N...
The goal of this challenge is to implement a digital low-pass filter. You are free to implement any type of digital filter you want, however whatever results produced must pass the validation script below. Here's a general description of what the validation script expects: When an FFT is taken of the filtered signal, ...
Gears transfer different amount of speeds, depending on the size of the meshed gear. Jack has a machine, that rotates a Gear Train. but you don't know the speed of the last gear. Luckily, You are a great code golfer, so you can help him! So, What should I do? Each gear is represented by 2 numbers, the radius of the in...
Almost all digital camera sensors are organized in a grid of photosensors. Each photo sensor is sensitive for one of the primary colors: red, green and blue. The way those photo sensors are organized is called the Bayer filter, after its inventor, Bryce Bayer of Eastman Kodak. After an image is taken, four photo sensor...
Task Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean. One possible algorithm Discard the lowest and highest quarters of the data points. Calculate the average (sum divided by count) of the remaining data points. Note: If the dataset...
The goal of this challenge is to collect selected items in a list and move them to a certain location in the list. As a visual example, take the input values (represented by black boxed integers) and a corresponding list of truthy values where true denotes the item is selected (represented by blue boxes, where T is tru...
A lot of languages have built-in ways to get rid of duplicates, or "deduplicate" or "uniquify" a list or string. A less common task is to "detriplicate" a string. That is, for every character that appears, the first two occurrences are kept. Here is an example where the characters that should be deleted are labelled wi...
One day you awake only to find yourself caught in an array. You try to just walk out of there, taking one index at the time, but it seems there are other rules: The array is completely filled with natural numbers. If you find yourself on an index n, you go to the index array[n], except: If you find yourself on an inde...
Your task is to output a Magical 8 Trapezium: 1 × 8 + 1 = 9 12 × 8 + 2 = 98 123 × 8 + 3 = 987 1234 × 8 + 4 = 9876 12345 × 8 + 5 = 98765 123456 × 8 + 6 = 987654 1234567 × 8 + 7 = 9876543 12345678 × 8 + 8 = 98765432 123456789 × 8 + 9 = 987654321 Output in your chosen language in the ...
The code lock for my garage has 5 buttons, labeled "1 2", "3 4", "5 6", "7 8", and "9 0". To open the garage door, you have to enter the correct 4-digit PIN. As you can see, every button represents two numbers. Thus some PINs, like "1357" and "2367", are essentially identical because they require the same sequence of b...
The challenge is to detect missing integer sequences of files or directories. You have a directory filled with files/directories that are named as integers. The files/directories are generated from multiple threads yet the job did not complete - there are therefore gaps in the sequence. The input is two integers a sta...
Task Your task is to convert strings like this: abc^d+ef^g + hijk^l - M^NO^P (Ag^+) To strings like this: d g l N P + abc +ef + hijk - M O (Ag ) Which is an approximation to abcd+efg + hijkl - MNOP (Ag+) In words, raise the characters directly next to carets to the upper line, one character for on...
Definition The chain rule with two functions state that: D[f(g(x))] = f'(g(x)) * g'(x) Or, alternatively: D[f1(f2(x))] = f1'(f2(x)) * f2'(x) The chain rule with three functions state that: D[f(g(h(x)))] = f'(g(h(x))) * g'(h(x)) * h'(x) Or, alternatively: D[f1(f2(f3(x)))] = f1'(f2(f3(x))) * f2'(f3(x)) * f3'(x) Et ce...
Usually, it is said that "Doing X without Y" can be a trap to beginners writing challenges (source). However, I am cocky and think that I can definitely make an X without any Ys. Randomly. Oh yes, this will be good. Challenge: Given an odd integer n greater than or equal to 1, output an ex of side length n made of rand...
Given an input of an integer \$n ≥ 2\$, output a list of its divisors sorted by the exponents in their prime factorizations, in ascending order, ordering first by the largest prime, then by the second largest, and so on. As an example, take the integer \$72\$, which is \$2^3\cdot3^2\$. It has the divisors 1 3^0 · 2...
Input: A Date (containing dd, MM and yyyy). A date-object, or three separate integers are also valid as input. Output: Each part (dd, MM and yyyy) individually reverted and than rounded to the nearest valid date. For example (in the format dd-MM-yyyy): 21-10-2016 becomes 12-01-6102 Challenge rules: Only dd, MM, yyyy i...
From Wikipedia: The number e is an important mathematical constant that is the base of the natural logarithm. It is approximately equal to 2.71828, and is the limit of (1 + 1/n)n as n approaches infinity. Challenge Calculate the number e to 15 digits after the decimal point. This means that your output must start wi...
If you don't know what the Tower of Hanoi is, I'll explain it briefly: There are three rods and some discs each of which has a different size. In the beginning all discs are on the first tower, in sorted order: The biggest one is at the bottom, the smallest at the top. The goal is to bring all the discs over to the thi...
Your goal in this code golf is to compile all the Stack Exchange sites' favicons. Getting the Domains The domains you will be using will be: *.stackexchange.com stackexchange.com stackoverflow.com superuser.com serverfault.com askubuntu.com mathoverflow.net stackapps.com stackauth.com Everything but stackexchange.co...
Write a program or function that outputs an L if run on a little endian architecture or a B if run on a big endian architecture. Lower case output l or b is also acceptable. There is no input. Scoring is code golf, so the code with the fewest bytes wins. Edit: As per the comments below, I am clarifying that the entry m...
Prime Wednesdays Your task is to count the number of Wednesdays that fall on a prime day of the month in a particular year. For instance, 7-13-16 is a prime Wednesday. For consistency use the Gregorian calendar for all dates. Input The input to your program/function will be a year (eg 2016) and is flexible. The year wi...
CAPTCHA Modified by Evil Mathematician I accidentally incurred the wrath of an eccentric passive-aggressive mathematician. As part of his demented idea of payback, he modified the CAPTCHA system on my favorite website. Up until now, it would just ask a moderately challenging math question, like 3+2^4, and I would simpl...
Number to String Instructions Convert a signed 32-bit integer to a string (base-10 preferably) without any string formatting calls (or built in type coercion that will directly convert a number to a string). Negative numbers must include leading -. Score Calculation Shortest byte length; Tie breaker by efficiency (exec...
Everyone knows how to add numbers by hand, right?––Well, I hope so, but for anyone who needs a quick reminder: To add 17282 and 1342, you proceed as follows: place the larger (value wise, not number of digits) number above the smaller number and match up the digits 17282 1342 draw the plus sign (+) to the left of th...
Pokerface Introduction Leo enjoys playing poker, but his job at Tech Inc. is too demanding for him to learn how to play well. Leo, being a computer scientist, is not discouraged. He decides to take more time than it would have taken to just learn poker, and use it to write a poker bot to help him play better. But now L...
A collection of positive integers d_1 d_2 ... d_k is a factorisation of a positive integer n if d_1 * d_2 * ... * d_k = n Each positive integer has a unique prime factorisation, but in general they also have factorisations in which some of the terms are composite. E.g. 12 = 6 * 2 = 4 * 3 = 3 * 2 * 2 Write a program, ...
The coin change problem is very well documented. Given an infinite supply of coins of denominations x_1 to x_m you need to find the number of combinations which add up to y. For example, given x = {1,2,3} and y = 4 we have four combinations: {1,1,1,1} {1,1,2} {1,3} {2,2} Introduction There are several variations of t...
In the spirit of Patch the Image, here's a similar challenge but with text. Challenge Bit rot has afflicted your precious text! Given a paragraph composed of ASCII characters, with a rectangular hole somewhere in it, your program should try to fill in the hole with appropriate text, so that the paragraph blends as best...
An algebraic curve is a certain "1D subset" of the "2D-plane" that can be described as set of zeros {(x,y) in R^2 : f(x,y)=0 }of a polynomial f. Here we consider the 2D-plane as the real plane R^2 such that we can easily imagine what such a curve could look like, basically a thing you can draw with a pencil. Examples: ...
Definition a(1) = 1 a(2) = 1 a(n) = a(n-a(n-1)) + a(n-a(n-2)) for n > 2 where n is an integer Task Given positive integer n, generate a(n). Testcases n a(n) 1 1 2 1 3 2 4 3 5 3 6 4 7 5 8 5 9 6 10 6 11 6 12 8 13 8 14 8 15 10 16 9 17 10 18 11 19 11 20 12 Reference Obligatory OEIS A005185
Executive summary Given input representing two vectors and their respective "weights", produce output that also represents the weighted sum of those vectors. Challenge The input will consist of one or more lines of the following characters: exactly one occurrence of the digit 0, which represents the origin in a two-di...
Your goal in this code-golf is to pick a random character from a string. If a character appears X times, and there are Y characters, then the chance of that character being picked will be X/Y. Input The program takes a string as an input. Output Your program outputs a character. Examples xyz: x, y, or z xxX: x, x, or ...
Definition Fibonacci sequence F(n), on the positive integers, are defined as such: 1. F(1) = 1 2. F(2) = 1 3. F(n) = F(n-1) + F(n-2), where n is an integer and n > 2 The Fibonacci-orial of a positive integer is the product of [F(1), F(2), ..., F(n)]. Task Given positive integer n, find the Fibonacci-orial of n. Specs ...
What are Fibonacci networks? In 1202, an Italian mathematician known as Fibonacci posed the following problem: "A male and a female rabbit are born at the beginning of the year. We assume the following conditions: 1.After reaching the age of two months, each pair produces a mixed pair, (one male, one female), and then...
Definition Wolstenholme's theorem states that: where a and b are positive integers and p is prime, and the big parentheses thingy is Binomial coefficient. Task To verify that, you will be given three inputs: a, b, p, where a and b are positive integers and p is prime. Compute: where a and b are positive integers an...
The Tabula Recta (sometimes called a 'Vigenere Table'), was created by Johannes Trithemius, and has been used in several ciphers, including all variants of Bellaso's Vigenere cipher and the Trithemius cipher. It looks like this: ABCDEFGHIJKLMNOPQRSTUVWXYZ BCDEFGHIJKLMNOPQRSTUVWXYZA CDEFGHIJKLMNOPQRSTUVWXYZAB DEFGHIJKLM...
Origins tl;dw (too lazy, didn't write): thought of it right before I fell asleep Challenge Breaking a number is defined as the following steps: Take a number or a parseable data type as input in any allowed way. Duplicate the first digit (64 -> 664) Subtract 4 from the last digit (664 -> 660) If the subtraction gets...
The goal of this challenge is given a finite directed acyclic graph (DAG), determine if the graph is a transitive reduction. A brief explanation of what a DAG and transitive reductions are: A DAG is a graph with directed edges (i.e. you can only travel in one direction on that edge) such that given any starting node on...
Inspired by George Gibson's Print a Tabula Recta. You are to print/output this exact text: ABCDEFGHIJKLMNOPQRSTUVWXYZ BBCDEFGHIJKLMNOPQRSTUVWXYZ CCCDEFGHIJKLMNOPQRSTUVWXYZ DDDDEFGHIJKLMNOPQRSTUVWXYZ EEEEEFGHIJKLMNOPQRSTUVWXYZ FFFFFFGHIJKLMNOPQRSTUVWXYZ GGGGGGGHIJKLMNOPQRSTUVWXYZ HHHHHHHHIJKLMNOPQRSTUVWXYZ IIIIIIIIIJKLM...
Definition According to Wikipedia: The Cooke and Wheatstone telegraph was an early electrical telegraph system dating from the 1830s invented by English inventor William Fothergill Cooke and English scientist Charles Wheatstone. It was the first telegraph system to be put into commercial service. The receiver consiste...
I recently found out about the Fishing language, and it is now a favorite of mine. However, I'm finding it difficult to do anything cool with it, including code golf. Are there any tips for golfing with Fishing to use the least characters? And any string manipulation tricks would be cool, as I am finding that difficult...
Challenge The challenge is simple: print a snake. You will get the length of the snake as input. A snake of length 2 looks like this: ==(:)- A snake of length 7 looks like this: =======(:)- In other words, the length of a snake is how many equal signs are before the head. Usage Let's say I made a C++ implementation a...
According to Alexa rankings, the top 10 websites are: google.com youtube.com facebook.com baidu.com yahoo.com wikipedia.org amazon.com twitter.com qq.com google.co.in Being the top 10 visited websites, these are probably also the top 10 misspelled websites [Citation Needed]. Your task Your goal is to write a program o...
Definition The infinite spiral used in this question has 0 on the position (0,0), and continues like this: 16-15-14-13-12 | | 17 4--3--2 11 | | | | 18 5 0--1 10 | | | 19 6--7--8--9 | 20--21... It is to be interpreted as a Cartesian plane. For example, 1 is on the position (1,0), and 2 i...
Well, although this challenge turned out to be a huge success, it also turned out to be very trivial to solve. Therefore, for those of looking for more of a challenge, I created a sequel to this challenge in which you must now count the number of unique rectangles. Check it out! Now, for those of you looking to solve ...
Challenge Create a new file and write the string Hello World to it. Restrictions Your challenge must write to a file on disk, in the file system. The file may not be a log file generated during normal operation of the interpreter. The file must contain only the string Hello World. It is allowed to contain a trailing n...
Input: An integer. Output: First convert the integer to it's equivalent Roman Numeral. Then convert each capital letter of that Roman Numeral to their ASCII/UNICODE decimal value. And output the sum of those. Example: 1991 -> MCMXCI -> 77+67+77+88+67+73 -> 449 ^ input ^ output Roman Nu...
Definition From the description on OEIS A006345: To find a(n), consider either a 1 or a 2. For each, find the longest repeated suffix, that is, for each of a(n)=1,2, find the longest sequence s with the property that the sequence a(1),...,a(n) ends with ss. Use the digit that results in the shorter such suffix. a(1) =...