instruction stringlengths 34 53.1k |
|---|
Classic code golf challenge. Write the most obscure Perl program to print "Just another Perl hacker". Here's the Wikipedia article on it. Bonus points if it fits in 3 lines / 70 characters each.
|
Recreate '99 bottles of beers on the wall'.
The desired output is this:
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.
98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.
97 bott... |
Task
Read a string of characters and produce the ROT13 of it. All characters besides [a-zA-Z] should be output verbatim. Each letter in the output may be in any case you wish (you do not have to preserve it).
ROT13 is a simple substitution cipher where each letter of the alphabet is rotated by 13 places (it doesn't mat... |
Hamming numbers are numbers which evenly divide a power of 60. Equivalently, their prime factors are all \$ \le 5 \$.
Given a positive integer, print that many Hamming numbers, in order.
Rules:
Input will be a positive integer \$n \le 1,000,000 \$
Output should be the first \$n\$ terms of https://oeis.org/A051037
Exec... |
In chess, a queen can move as far as as the board extends horizontally, vertically, or diagonally.
Given a NxN sized chessboard, print out how many possible positions N queens can be placed on the board and not be able to hit each other in 1 move.
|
You are provided with a function Rand5(). This function returns perfectly random (equal distribution) integers between 1 and 5.
Provide the function Rand7(), which uses Rand5() to produce perfectly random integers between 1 and 7.
|
Challenge
Write the shortest program or function to calculate the Luhn Algorithm for verifying (credit card) numbers.
Luhn algorithm explained
From RosettaCode, this algorithm for the purposes of this challenge is specified as such, with the example input of 49927398716:
Reverse the digits, make an array:
6, 1, 7, ... |
The Fizz Buzz problem is a very basic problem to solve that is used by some to weed out interviewees that don't know how to program. The problem is:
Set N = [0,100]
Set F = x in N where x % 3 == 0
Set B = x in N where x % 5 == 0
Set FB = F intersect B
For all N:
if x in F: print fizz
if x in B: print buzz
if x ... |
Let's suppose there is a finite unknown number n (n can be very large, does not necessarily fit 64-bits; think of BigInteger in Java or long in Python) and a function cmp(x) that returns true if x <= n.
Write a program to determine n in minimum number of calls to cmp.
|
Given the time in 24 hour format (2359 = 11:59pm) return the angle between the minute and hour hands on a standard clock (on the face plane, so don't just output 0).
Angles are to be returned in the unit of your choice, should be the smallest possible, and should be a positive number (negative angle converted to a posi... |
The task is to find a way to draw a horizontal line in an array of 16-bit integers.
We're assuming a 256x192 pixel array with 16 pixels per word. A line is a contiguous run of set (1) bits. Lines can start in the middle of any word, overlap any other words, and end in any word; they may also start and end in the same ... |
From AZSPCS:
Suppose you have a deck containing n cards. Each card contains a number from 1 to n, and each number appears on exactly one card. You look at the number on the top card -- let's says it's k -- and then reverse the order of the top k cards. You continue this procedure -- reading the top number and then reve... |
What general tips do you have for golfing in Python? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Python (e.g. "remove comments" is not an answer).
Please post one tip per answer.
|
Using your language of choice, golf a quine.
A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.
No cheating -- that means that you can't just read the source file and print it. Also, in many languages, an empty file is also a quine: that isn't c... |
Define a function, s, which takes a number and returns the square root.
No use of library functions, such as Java's Math.sqrt() or PHP's built in sqrt(), allowed.
|
Write the shortest program in your favourite language to interpret a brainfuck program. The program is read from a file. Input and output are standard input and standard output.
Cell size: 8bit unsigned. Overflow is undefined.
Array size: 30000 bytes (not circled)
Bad commands are not part of the input
Comments begin ... |
The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first few terms:
1 1 2 3 5 8 13 21 34 55 89 ...
Write the shortest code that either:
Generates the Fibonacci sequence without... |
Create the shortest possible obfuscated FizzBuzz implementation.
To be considered obfuscated, it should satisfy at least one of the following:
Does not contain any of the words "Fizz", "Buzz", or "FizzBuzz"
Does not contain the numbers 3, 5, or 15.
Use any of the above in a misleading way.
Remember: The goal is to be... |
You and your brother have inherited a rectanglar block of land. This block of land's corners are read in from stdio as TLX,TLY,TRX,TRY,BLX,BLY,BRX,BRY (all decimal numbers without units, T=Top, L=Left, B=Bottom, R=Right)
Unfortunately the city has seen fit to appropriate a small rectanglar section from inside your you ... |
Write the shortest code for finding the sum of primes between \$a\$ and \$b\$ (inclusive).
Input
\$a\$ and \$b\$ can be taken from command line or stdin (space seperated)
Assume \$1 \le a \le b \le 10^8\$
Output
Just print the sum with a newline character.
Bonus Points
If the program accepts multiple ranges (print o... |
Write the shortest code that traverses a tree, breadth-first.
Input
any way you like
Output
a list of "names" of the nodes in correct order.
|
EDIT: In the interest of increasing the complexity, i've added more to the challenge.
In mathematics, a vampire number (or
true vampire number) is a composite
natural number v, with an even number
of digits n, that can be factored into
two integers x and y each with n/2
digits and not both with trailing
ze... |
What is the shortest function (implemented in C) that will return a random draw from a Poisson distribution (given the mean or λ parameter)?
int random_poisson(double lambda);
|
Write the shortest program to transform the standard input into Morse code. Characters not in the table should be printed as they are.
|
What general tips do you have for golfing in C++?
I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C++ (e.g. "remove comments" is not an answer). Please post one tip per answer.
(Tips that apply to C as well can be found in Tips for golfing in C - but not... |
The task of this challenge is as following:
Write a program that reads a file of reasonable size (let's say <16 MB) from stdin or anywhere else (however you like, but must not be hardcoded), and put's the compressed output onto stdout. The output must be a valid gzip compressed file and if the compressed file runs thro... |
Write a program/script that decompresses and passes any compressed data appended at the end of the binary/file as standard input to a program specified as arguments.
$ gzip --to-stdout input >> your_solution
$ your_solution program args...
should have the same effects as:
$ program args... < input
|
Write a program to take a graph (from either standard input or a file, your choice) and find a shortest path in the graph.
Graphs are specified using the following format:
A---S F--T
| / \ |
| / 5 0
|/ \|
D----3--E
A-Z: nodes in the graph
-|/\: edges in the graph
0-9: weights on the edges
<space>:... |
Write a short program for 196-algorithm.
The algorithm starts from an integer, then adds its reverse to it until a palindrome is reached.
e.g.
input = 5280
5280 + 0825 = 6105
6105 + 5016 = 11121
11121 + 12111 = 23232
output = 23232
Input
an integer, which is not a lyrchrel number (that is, it does eventually yield a p... |
What general tips do you have for golfing in C#? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to C# (e.g. "remove comments" is not an answer). Please post one tip per answer.
-- borrowed from marcog's idea ;)
|
The shortest code that finds all unique "sub-palindromes" of a string, that is: any substring with length > 1 that is a palindrome.
eg.1
input: "12131331"
output: "33", "121", "131", "313", "1331"
eg.2
input: "3333"
output: "33", "333", "3333"
|
Find a way to output a large integer with few characters. Solutions will be scored based on the magnitude of the number and shortness of code.
EDIT: Let's impose a time limit of a minute on sensible hardware, where sensible is a PC you can buy off the shelves.
|
Task description:
Draw a cube in ASCII art in roughly a cabinet projection.
Monospaced fonts often have characters that are about twice as high as they are wide. Since the input is the length of the vertical lines (excluding the corners), horizontal lines are drawn with twice as many characters so that the resulting im... |
What general tips do you have for golfing in Windows PowerShell? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PowerShell (e.g. "remove comments" is not an answer). Please post one tip per answer.
—taken nearly verbatim from marcog's question.
|
Can you recommend any freely available books about code golfing in general and especially in Java and C++?
|
Problem: Slot Machine Hacker from Facebook Hacker Cup 2011 Round 1B
Goal: Shortest code in your favourite language using stdin/stdout. You cannot assume getRandomNumber is defined, i.e. your solution has to include a potentially golfed version as a function or in some other way.
Reference solution: on SO [I chose mine,... |
Given two positive numbers \$x\$ and \$n\$ with \$x<2^n\$, write the shortest possible function to compute \$x^{-1} \mod 2^n\$. In other words, find \$y\$ such that \$xy=1 \mod 2^n\$.
Your function must complete in a reasonable time for at least \$n=64\$, so exhaustive search will not work.
If the inverse does not exi... |
You must evaluate a string written in Reverse Polish notation and output the result.
The program must accept an input and return the output. For programming languages that do not have functions to receive input/output, you can assume functions like readLine/print.
You are not allowed to use any kind of "eval" in the pr... |
Requirements:
Take an input on stdin including new lines / carriage returns of unlimited length (only bounded by system memory; that is, there is no inherent limit in the program.)
Output the reverse of the input on stdout.
Example:
Input:
Quick brown fox
He jumped over the lazy dog
Output:
god yzal eht revo depmuj ... |
Write a program that generates and prints a random maze using the algorithm of your choice. The maze should be different for multiple runs of the program. Height and width are given as command line arguments. Use | for vertical wall, - for horizontal wall and + for corner. The maze is bounded by walls and the entrances... |
Following this popular question, present your solution which prints the numbers 1 to 1000 (all of them, not the string "1 to 1000" verbatim or something funny) in C++ without using any semi-colons. Unlike the original question, you may use conditionals and loops.
Solutions not requiring any compiler flags are preferred... |
You are given an encrypted string, encrypted using a very simple substitution cipher.
Problem
You do not know what the cipher is but you do know the ciphertext is English and that the most frequent letters in English are etaoinshrdlucmfwypvbgkqjxz in that order. The only allowed characters are uppercase letters and sp... |
A friend sent me this puzzle. I'm pretty sure solving it will require some programming. Can anyone crack it? The original is here in case of encoding issues in the past below.
Did you know that...
List of prime numbers include 2 as only even number, but not 1 which is equally not divisible by any other number than itse... |
Write a program to play the popular English nursery rhyme.
(This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. Attribution: Helix84 at the English language Wikipedia; Blahedo at the English language Wikipedia.)
Some Wikipedia articles that may be useful:
Twinkle Twinkle Lit... |
The challenge is to write an interpreter for the untyped lambda calculus in as few characters as possible. We define the untyped lambda calculus as follows:
Syntax
There are the following three kinds of expressions:
A lambda expression has the form (λ x. e) where x could be any legal variable name and e any legal expr... |
Your task is to implement a floor function in as few bytes as possible.
A floor function is a function that takes a real number and returns the largest integer less than or equal to the input.
Your program should support both positive and negative inputs. Since it is provably impossible to support all real numbers you... |
From Quine central:
Write a quine that takes as input the name of a language and outputs the same thing implemented in the input language.
The source article has something you can work from, but as the author says this is much harder. Obviously you only need to support a limited set of languages. The choice is yours th... |
I am referring to Project Euler #12. Write the solution in any language you want, but consume the least amount of memory while executing. Running time is not measure in this case.
The sequence of triangle numbers is
generated by adding the natural
numbers. So the 7th triangle number
would be 1 + 2 + 3 + 4 + 5 +... |
Create the shortest possible obfuscated program that displays the text "Hello World".
In order to be considered an obfuscated program, it must meet at least two of the following requirements:
Does not contain the characters: h, l, w and d in any case
Does not contain the characters: e, o, r, 0, and 1 in any case ... |
Produce a program to correctly number a crossword grid.
Input
The input will be the name of a file representing the crossword
grid. The input filename may be passed as an argument, on the
standard input, or by other conventional means other than
hardcoding.
Grid file format: A text file. The first line consists of two ... |
Implement the binary search algorithm as used to identify the source code revision that breaks a computer software program. Your tool should take two arguments specifying the earliest and latest numbered revision to search (both positive integers), and you have two options for making comparisons:
Execute the shell com... |
Let's suppose you have a complete binary tree (i.e. each internal node has exactly two non empty descendants). Each node contains a nonzero integer. You are given the task of encoding and decoding the tree into/from a list of integers.
The tree is stored internally something like:
struct node {
int data;
struct nod... |
Write a function which, given the first 12 digits of an ISBN-13 code, will calculate the entire ISBN via calculating and appending an appropriate check digit.
Your function's input is a string containing the first 12 digits of the ISBN. Its output is a string containing all 13 digits.
Formal specification
Write a funct... |
Implement the shortest Sudoku solver.
Sudoku Puzzle:
| 1 2 3 | 4 5 6 | 7 8 9
-+-----------------------
A| 3 | 1 |
B| 6 | | 5
C| 5 | | 9 8 3
-+-----------------------
D| 8 | 6 | 3 2
E| | 5 |
F| 9 3 | 8 | 6
-+-----------------------
G| 7 1 4 | | 9
H| ... |
What general tips can you give for golfing in Ruby?
I'm looking for ideas that can be applied to code golf problems in general that are specific to Ruby. (For example, "Remove comments" would not be an answer.)
Please post one tip per answer.
|
Write the shortest function to convert an IP address into it's integer representation and output it as an integer.
To change an IPv4 address to it's integer representation, the following calculation is required:
Break the IP address into it's four octets.
(Octet1 * 16777216) + (Octet2 * 65536) + (Octet3 * 256) + (Octe... |
This is a follow up of Print a maze question. If you like this question, please add more maze generation algorithms ;).
For this task you'll have to implement a game engine for one player who must find the treasure in a maze and get out of the dungeon.
The engine starts by reading the maze from standard input followed ... |
Implement the shortest Sudoku solver using guessing. Since I have received a few request I have added this as an alternative question for those wishing to implement a brute force sudoku solver.
Sudoku Puzzle:
| 1 2 3 | 4 5 6 | 7 8 9
-+-----------------------
A| 3 | 1 |
B| 6 | | 5
C| 5 | |... |
Is solving Sudoku too hard? Even the brute force version? Here's a coding exercise that's a little easier. I hope. :-P
Write the shortest function to implement bogosort. In specific, your function should:
Take an array (or your language's equivalent) as input
Check if its elements are in sorted order; if so, return th... |
Write the shortest program to forecast the weather for the next 7 days
The input (from stdin) is the weekday and the season
The output (to stdout) is seven lines weekday and the temperature in centigrade
The weekdays begin on the input weekday
The temperatures are random numbers with the range depending on the season
... |
Assuming A=1, B=2... Z=26, and the value of a word is the sum of these letter values, it is possible to split some words into two pieces such that they have equal values.
For example, "wordsplit" can be broken into two pieces like so: ordsl wpit, because o+r+d+s+l = w+p+i+t.
This was a challenge given to us by my compu... |
The smallest code that gives the area between the curve p(x) = a0 + a1*x + a2*x2 + ..., the line y = 0, the line x = 0 and the line x = C
(i.e. something like this:
)
You can assume that p(x) >= 0 for x < C (bonus points if your code works for negative values of p(x)).
Input
C, a0, a1, ...
Output
a real number - the ar... |
About Code-Bowling:
In golf, you try to get the lowest score (smallest application, most elegant, etc). In Bowling, you try to get the highest score. So if you follow, the goal of a Code-Bowling challenge is to make the biggest, most bastardized, hardest to maintain piece of code that still meets the requirements of t... |
Task description:
Write a program as short as possible to draw a radial gradient in ASCII art. The size of the output grid is predefined. The center point and the characters to be used for the gradient are provided as input to the program.
The gradient will be 70×25 character cells in size with the following specificat... |
The basics:
You'll need to provide a nine-level word guessing game in the fewest characters possible (in your language of choice).
The metrics:
Provide a word-list
(one word per line, seperated by a
newline) (e.g.
/usr/share/dict/words or similar could do). It's fine to
pipe a filename or the wordlist
itself into your... |
Create the shortest regular expression that will roughly match a URL in text when run in JavaScript
Example:
"some text exampley.com".match(/your regular expression goes here/);
The regular expression needs to
capture all valid URLS that are for http and https.
not worry about not matching for URL looking strings t... |
Implement a function of pattern and string to be matched, return true if the pattern matches the WHOLE string, otherwise false.
Our glob pattern syntax is:
? matches any one character
+ matches one or more characters
* matches zero or more characters
\ escapes
Rules:
No eval, no converting into regular expression, n... |
This is based on a talk on compilers I listened to a while back, but I, unfortunately, can't remember when or where.
Create the shortest compiler in any language that can compile itself. Target any reasonable ISA (68K, x86, MIPS, ARM, SPARC, IBM BAL, etc.) that doesn't have a "compile-program" instruction (this may ex... |
Write a program that determines whether its input is valid JSON.
Input: ASCII text: [\x00-\x7F]*
Note: if ASCII is problematic, feel free to use another encoding, but indicate it in your post.
Output: Valid or Invalid. Trailing newline may be omitted.
Example:
$ echo '{"key": "value"}' | ./json-validate
Valid
$ ... |
I'm a mentor at RubyLearning and one of the exercises we give to our students is the "Deaf Grandma" exercise from Chris Pine's book "Learn to Program". Here's the description:
Write a Deaf Grandma program. Whatever you say to grandma (whatever
you type in), she should respond with:
"Huh?! Speak up, sonny!", unless... |
So before you read some basic computer science concepts.
A binary tree is a dynamically allocated structure (usually used for ordered storage).
Because of its nature traversal of binary trees is usually recursive;
This is because linear traversal (via a loop) is not natural when there are two avenues of looping.
Recu... |
Write the shortest code to find the remainder when an input number N is divided by 2^M. You cannot use /,* and % operator.
Input Specification
Number of test cases followed by a pair of integers on each line.
Sample Input
1
150 6
Sample Output
22
Limits
1<T<1000
1<N<2^31
1<B<31
Time Limit
1 Sec
|
Implement a division algorithm in your favourite language which handles integer division. It need only handle positive numbers - but bonus points if it handles negative and mixed-sign division, too. Results are rounded down for fractional results.
The program may not contain the /, \, div or similar operators. It must ... |
Given two numbers \$N\$ and \$x\$, find the number of \$x\$-digit numbers whose product of digits is \$N\$
\$N <10^6\$ and \$x <12\$
Sample Input (N x):
8 3
Sample Output:
10
|
Some numbers can be represented as perfect powers of other numbers. A number x can be represented as x = base^power for some integer base and power.
Given an integer x you have to find the largest value of power, such that base is also an integer.
Sample Input:
9
Sample Output:
2
|
From SO.
You are given an array with positive and negative integers. Write a function to change the elements order in the array such that negative integers are at the beginning, the positive integers are at the end and two integers that have the same sign don't change order.
Example:
Input 1,7,-5,9,-12,15
Output -5,-1... |
Write a program to calculate the first 500 digits of pi, meeting the rules below:
It must be less than 500 characters in length.
It cannot include "pi", "math.pi" or similar pi constants, nor may it call a library function to calculate pi.
It may not use the digits "3", "1" and "4" consecutively.
It must execute in a ... |
Given five points on a straight line such that their pairwise distances are 1,2,4, ..., 14,18,20 (after ordering), find the respective positions of the five points (relative to the furthest point on the left).
|
Write a function that takes two arguments: a number k and a list l, and that returns another list r such that r[i] = min(l[i-k+1:i]).
Examples
Input k=2, l=1,2,3,4,5,6
Ouput r=1,1,2,3,4,5
Input k=3, l=-1,9,7,-9,8,3,5,0,12,1,2,3,-1,-2,-3
Ouput r=-1,-1,-1,-9,-9,-9,3,0,0,0,1,1,-1,-2,-3
Constraints: O(len(l)) time comple... |
Write the shortest function to convert an integer into a numeric representation given a radix between 2 and 62. e.g.:
to_string(351837066319, 31) => "codegolf"
|
A friend has an add-on card in their computer which generates a perfectly random number from 1 to 5 inclusive. Unfortunately, they spilt cola on it somehow, and it now generates only 2's for all numbers from 1 to 4. Luckily the randomness is preserved, but 2 has a probability of 80% and 5 has a probability of 20%, and ... |
Challenge
Your task is to write a program or function which, given a positive integer \$N\$, finds all positive integers less than or equal to \$N\$ that can be expressed as a perfect power in more than one way.
Definition
A perfect power is defined as a number \$i\$ found by \$m^k\$, where:
\$m\$ and \$i\$ are positi... |
You must write a program to evaluate a string that would be entered into a calculator.
The program must accept input and output the correct answer. For languages that do not have standard input/output functions, you may assume the functions readLine and print.
Requirements
Does not use any kind of "eval" functions
Ca... |
Write the shortest possible assembly-language quine.
Use any ISA you want, unless it has a print-quine instruction or equivalent. Examples include x86, MIPS, SPARC, MMIX, IBM BAL, MIX, VAX, JVM, ARM, etc.
You may link against the C standard library's _printf function (or the Java equivalent for JVM bytecode) for I/O.
... |
Based on a comment by George Edison to this question, write the smallest self-interpreting interpreter.
You may use the language of your choosing.
Empty languages do not count. Your program must be at least two characters long.
The program does not need to interpret the entire language, just a Turing-complete subset ... |
The challenge
The shortest code by character count to help Robot find kitten in the fewest steps possible.
Golfers, this is a time of crisis - Kitten gone missing and it's Robot's job to find it! Robot needs to reach Kitten in the shortest path possible. However, there are a lot of obstacles in Robot's way, and he need... |
Write the shortest code that traverses a tree, depth-first.
Input
Any programmatical structure found in your language of choice: lists, tuples, queues etc.
Output
A list of "names" of the nodes in correct order as shown in Depth-first search article at Wikipedia.
Requirement:
A node should be able to contain an infinit... |
Create the shortest program or function that finds the factorial of a non-negative integer.
The factorial, represented with ! is defined as such
$$n!:=\begin{cases}1 & n=0\\n\cdot(n-1)!&n>0\end{cases}$$
In plain English the factorial of 0 is 1 and the factorial of n, where n is larger than 0 is n times the factorial of... |
You must write a program that evaluates a string that would be entered into an advanced calculator.
The program must accept input using stdin and output the correct answer. For languages that do no have functions to accept stdin, you may assume the functions readLine and print to handle these tasks.
Requirements:
Doe... |
Write a program which takes an input (which may or may not be prime), and lists the immediate prime following and preceding it.
Example input:
1259
Example output:
1249 1277
Shortest program wins. Must execute within 10 seconds on a modern desktop PC. Inputs will be limited to 10,000 maximum.
|
The program will be provided as the first argument, stdin should be used for all
read requests by the program and stdout for all write requests. It can be
assumed that the program is less than 80 characters wide and less than 25 lines
high.
~ should push -1 if there is nothing to read.
Any pop off the bottom of the l... |
A program should take an input on stdin, and guess what a word might be. It should run as a session. One example session is shown below. Characters are fed to it, with a * for a letter not revealed; it should remember letters already revealed. It shows possible words in a list if the total number words found is less th... |
Implement a function that takes a list that consists of 0, 1 or 2, the list is called "pattern". Your job is to return all possible lists that match the pattern.
0 matches 0
1 matches 1
2 matches 0 and 1
Examples:
f([0, 1, 1]) == [[0, 1, 1]]
f([0, 2, 0, 2]) == [[0, 0, 0, 0], [0, 1, 0, 0], [0, 1, 0, 1], [0, 0, 0, 1]]
... |
You are writing a program for an automatic cash register. The user needs change with the least number of coins used. Write a program which takes an amount (say $1.53) and gives change in US denominations - in this instance: 1 x one dollar note, 1 x fifty cents and 3 x one cent. The shortest program shall be the winner.... |
Write the fastest (best big-O) and smallest multiplication algorithm for positive integers, without using multiplication operators. You are only allowed addition, subtraction, logical functions (AND, OR, XOR, NOT), bit shift, bit rotate, bit flip/set/clear and bit test. Your program should be capable of multiplying 16-... |
A whole program to find the prime factors of a given number. The number will be given on standard input.
|
The Vigenère cipher was a simple polyalphabetic cipher that basically applied one of several Caesar ciphers, according to a key. Basically the letters in the key indicate which shifted alphabet to use. To that end there was a simple tool, called the Vigenère square:
Here each row is a separate alphabet, starting with ... |
My apologies for the wordiness. We had fun with it at work in our internal golfing, but it required a few emails for clarification, so I hope I captured most of that the first time.
PROBLEM
Given a “simulated” snowfall snapshot (as a string, stdin or parameter to your function/method), report on 4 values: minimum depth... |
This is a word puzzle.
Your program should accept two words on the standard input.
Word one is the start word. Word two is the end word.
From the start word you have to reach the end word changing/add/remove one letter at a time. After each modification it must form a new valid word. Added letters are added to the begi... |
Given an integer 1 ≤ N ≤ 1,000,000 as input, output the last non-zero digit of N!, where ! is the factorial (the product of all numbers from 1 to N, inclusive). This is OEIS sequence A008904.
Your program needs finish within 10 seconds on a reasonable machine for any valid input.
Test Cases
1 => 1
2 => 2
3 => 6
4 => 4... |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 5