instruction stringlengths 34 53.1k |
|---|
One of the things that makes contract bridge very interesting is its highly complicated "artificial" meta game. This system of scoring hands is a small part of it.
Bridge is a trick-taking card game. Each player gets a hand of 13 cards, and the game starts with the bidding. The bidding determines how the rest of the ga... |
Imagine a "wire" that has n spaces. Imagine further that there are "electrons" in that wire. These electrons only live for one unit of time. Any spaces in the wire that are adjacent to exactly one electron become an electron. In Game of Life terminology, this is B1/S.
For example, this is a wire of length 10, with peri... |
In the vein of large number challenges I thought this one might be interesting.
In this challenge, we will be using the Residue Number System (RNS) to perform addition, subtraction, and multiplication on large integers.
What is the RNS
The RNS is one of many ways that people have developed to identify integers. In th... |
Sometimes when I'm bored, I take some text and fill the "holes" in the letters. But isn't filling the holes the most boring thing you can do? I think we should automate it, so we could use our time better.
Standard code-golf rules apply.
Input
A string containing sequence of alphanumeric characters (a-z, A-Z, 0-9) and ... |
ADFGX cipher encryption
The ADFGX cipher was used by the German army in WWI. Write a program to encipher with it!
It works as follows:
Create a 5x5 Polybius square with a mixed alphabet. The polybias square is labled A D F G X along the top and left.
Generate the pairs, so A in its non-mixed position is AA, B is AD an... |
Art stolen from What size is the digit?
7-segment digits can be represented in ASCII using _| characters. Here are the digits 0-9:
_ _ _ _ _ _ _ _
| | | _| _| |_| |_ |_ | |_| |_|
|_| | |_ _| | _| |_| | |_| _|
Your job is to parse the art into normal numbers.
Notes on numbers
Each digit ... |
You're given two numbers a and b in base 31 numeral system and number k with no more than 10000 decimal digits. It is known that b is divisor of a. The task is to find last k 31-based-digits of quotient a/b.
The solution with fastest proved asymptotics in length of max(a,b) wins. I'll put a bound of 10^5 on length of a... |
In Skyrim, the player character can use powerful magic shouts (Thu'ums) to achieve their goals. Every shout consists of three words, however, the player can use the first one or two words to achieve the same effect with less power but at a shorter cooldown.
Given a lowercase ASCII Thu'um phrase without punctuation or s... |
It's weekend and what are the cool guys doing on weekends? Drinking of course! But you know what's not so cool? Drinking and driving. So you decide to write a program that tells you how loaded you are and when you are gonna be able to drive again without getting pulled over by the cops and loosing your license.
The Cha... |
In this code golf, you need to get the closest number from another one in a list.
The output may be the closest number to the input.
Example:
value: (Input) 5 --- [1,2,3] --- 3
And, the program may work with negative numbers.
Example:
value: (Input) 0 --- [-1,3,5] --- -1
value: (Input) 2 --- [1, 5, 3] --- 1 (Because... |
Challenges
You need to do a program that outputs the input string to hexadecimal!
For each character in the input string, convert it's ascii value to hexadecimal and output it out.
Example
Something = 536f6d657468696e67
Of course, this is code golf, so the shorter code wins!
|
You need to make a program, that when giving a list and a string, searches on the list for items that contains the string.
Examples:
Input: th [thing, awesome, potato, example]
Output: thing (Because it starts with "th")
Input: ing [thing, potato]
Output: thing (Because it ends with "ing")
Input: tat [thing, potato]
... |
To check whether a decimal number is divisible by 7:
Erase the last digit. Multiply it by 2 and subtract from what is left. If the result is divisible by 7, the original number is divisible by 7.
(also described e.g. here)
This rule is good for manual divisibility check. For example:
Is 2016 divisible by 7?
Subtract... |
You are an employee at the hip new grocery store Half Foods, and it's the day before Thanksgiving Christmas Easter. Since the store will be packed with customers rushing to get their foodstuffs, the store needs a traffic manager to send everyone to the appropriate lines. Being lazy, you'd like to automate this so that ... |
You are given a table that represents the rankings of S subjects according to a number C of different criteria. The purpose is to
compute an overall ranking according to a weighted sum of the C ranking criteria,
using one of those criteria (i.e. columns), T, as tie-breaker.
The rankings are a S×C table of positive in... |
Disclaimer: This challenge is extremely scientifically inaccurate.
;)
Given an input of a list of molecules, output what the result would be if they
were to all combine via dehydration synthesis, if possible.
For the purposes of this challenge, although this description is inaccurate, a
dehydration reaction
between two... |
The Juggler sequence is described as follows. Beginning with an input \$a_1\$, the next term is defined by the recurrence relation
$$a_{k+1} = \begin{cases}
\left\lfloor a_k ^ \frac 1 2 \right\rfloor,\text{ if } a_k \text{ is even} \\
\left\lfloor a_k ^ \frac 3 2 \right\rfloor,\text{ if } a_k \text{ is odd} \\
\end{cas... |
Given an m by n chocolate bar, m,n positive, output the number of ways to break the bar into mn 1 by 1 pieces where each break occurs on a gridline.
Order is important. Pieces are also distinguishable, so the two pieces on either end of a 1 by 3 chocolate bar are not equivalent.
For instance, for a 2 by 2 block we have... |
This is code-golf.
In this challenge, we will be writing programs/functions that solve "Knights and Knaves" puzzles.
Background
You find yourself on an island ... etc. ... every person on the island except for you is either a knight or a knave.
Knights can only make true statements.
Knaves can only make false statemen... |
I have this code :
tr ' ' '\n'|sort -n|head -1
The code is pretty simple, it takes a list of integer in the standard input stream (like 5 9 8 7 5 2 -12 -30), it sort the integers and display only the first integer. But i need to ouput 0 if the given list is empty. And i can't find a short way to that. I have a solutio... |
The original "Blue Eyes" puzzle is given here (and below).
A group of people with assorted eye colors live on an island. They are
all perfect logicians -- if a conclusion can be logically deduced,
they will do it instantly. No one knows the color of their eyes. Every
night at midnight, a ferry stops at the islan... |
Most people can't easily do modulus (or work out if a number is divisible by another number) in their heads because long division is harder than addition, subtraction and multiplication. The following method describes a way to calculate modulus in your head, as long as you can remember just a few different numbers. Thi... |
Consider an array x such as [1 5 3 4] and a number n, for example 2. Write all length-n sliding subarrays: [1 5], [5 3], [3 4]. Let the minimax of the array be defined as the minimum of the maxima of the sliding blocks. So in this case it would be the minimum of 5, 5, 4, which is 4.
Challenge
Given an array x and a pos... |
Introduction
Compute is a esoteric joke language.
From the esolangs entry:
Compute has no required syntax and has the power to solve any and all
problems. It is smart enough to interpret any human language (English,
Spanish, Latin, etc), any programming language (C++, Java, brainfuck,
etc), or any kind of data you can... |
A 1-up quine is a program which is very similar to a quine. The one major difference is that instead of printing itself once, when n copies of the program are concatenated, the result prints the original program n+1 times.
Example
If your program is Abc123:
Abc123 -> Abc123Abc123
Abc123Abc123 -> Abc123Abc123Abc123
... |
We have a Brainf*** to TinyBF converter, but not the other way around, so here's one.
Rules:
Your interpreter must take a valid TinyBF program, on one line, and it must output the corresponding BrainF*** program, on one line, with optional trailing whitespace/newline. No leading whitespace is allowed
The input may or ... |
I love BATCH, despite its shocking lack of functional commands, despite even due to its lack of non-integer support. Why? Because this works:
SET var=SET
%var% i=0
This would evaluate to:
SET var=SET
SET i=0
Fantastic, isn't it? I've used this technique in a BATCH program before, because it saves bytes!
Your challeng... |
For each integer n, 0 or higher, output the lowest power of 2 that has two identical sub-strings of n digits in decimal, and the two indices where the digit sub-strings start (0-based).
n Output Proof (don't output this)
0 => 0 [0 1] (_1 & 1_)
1 => 16 [0 4] (65536 & 65536)
1 =... |
Challenge
Your task is to output the time (in 12 hour time) in ascii art.
All characters that will be used are as follows:
___ __ ___ ____ _ _ _____ __ ______
/ _ \ /_ | |__ \ |___ \ | || | | ____| / / |____ |
| | | | | | ) | __) | | || |_ | |__ / /_ / /
| | | | | ... |
Question: can you design a Builder Pattern API which verifies at compile time that every field is set exactly once?
To be eligible, the size of the compiler output should not be exponential in the number of fields. The best solution will be the shortest implementation for a class of 22 fields.
Example of a possible su... |
Introduction
I think everyone agrees that nice pictures have to have a nice frame. But most challenges on this site about ASCII-Art just want the raw picture and don't care about it's preservation.
Wouldn't it be nice if we had a program that takes some ASCII-Art and surrounds it with a nice frame?
The Challenge
Write ... |
Introduction
This is how a chessboard looks like.
You can see that a1 is a dark square. However, b1 is a light square.
The Task
The challenge is, given dark, light or both, output all the dark, light or all squares with a separator (like a whitespace or a newline). The order of all the squares does not matter.
Test ca... |
In this quine variant, your program must output its source code transposed across the diagonal from the top left to the bottom right. For example:
your program
on
four lines
outputs
yof
ono
u u
r r
p l
r i
o n
g e
r s
a
m
The whitespace in the output is not arbitrary. Spaces appear in two situations... |
The challenge is to identify the missing number in a string of undelimited integers.
You are given a string of digits (valid input will match the regular expression ^[1-9][0-9]+$). The string represents a sequence of integers. For example, 1234567891011. All numbers in the sequence are in the range from 1 and 214748... |
Given an input of a string with bytes that may be in either binary, octal, or
hex, output the string's ASCII equivalent.
Input will be provided in the following format, for example:
501200100001147
which represents
0x50 0o120 0b01000011 0x47
which is equivalent (in ASCII) to
PPCG
Binary, octal, and hex will always b... |
Given an input string containing only letters and numbers, write a program or function that prints the possible printable ASCII characters (Hex 20-7E) that correspond with the string's value in bases 8, 10, and 16 (where possible). The characters must be written in increasing order in terms of the bases with which they... |
Write a program or function that given a string (or your language's equivalent), determine if the string is a word, or not, and output a truthy or falsy value.
(This is not a duplicate of Is this even a word? The incorrect words are generated in a very different way that I believe makes this a completely different chal... |
Challenge
Given a natural number, output it in the ASCII form of Agrippa's number system.
Description
I like odd alphabets and numeral systems. My favorite numeral system is one given by Heinrich Cornelius Agrippa. It gives a succinct way to write numbers in the range [0,9999], where single digits are written as follow... |
Consider a 1-dimensional, real-valued vector x that represents observations of some process measured at equally spaced intervals over time. We call x a time series.
Let n denote the length of x and x̄ denote the arithmetic mean of x. The sample autocovariance function is defined as
for all -n < h < n. This measures t... |
Output the provided table of English pronouns exactly, in as few bytes as possible.
Code rules
The code will take no input
The table is tab-delimited
Each line begins with a single tab \t if there is no row heading
Each line ends in a single newline \n (not \r\n), including the last line
There are four tabs between "P... |
Write some code that takes a single string as input and outputs MSB-set aligned ASCII.
Only ASCII characters less than 128 (0x80) will be in the input. The output format is generated as follows:
For each character convert it to its binary representation, remove the MSB (always 0 in the input) and then add a delimiter-... |
I'm reproducing the second part of the first day of Advent of Code, with permission from the creator.
Santa is trying to deliver presents in a large apartment building, but he can't find the right floor - the directions he got are a little confusing. He starts on the ground floor (floor 0) and then follows the instruct... |
The goal is really simple. Receiving a string as input, parse all the HTML entities that correspond to the following characters (including their uppercase variants):
áàãâäéèêëíìîïóòõôöúùûüýÿ
Parsing rules:
Each entity starts with & and ends with ;
The first character after the & will be the modified character (letter... |
Task
Given an image with a line on it, produce or display an image with the line extended till the edge of image. The line is black and the background is white. The image size is 100x100 The image comes in any reasonable format (e.g. jpg, png, ppm, bmp).
Line format
I'm using a simplified version of Bresenham's line al... |
Introduction
Nine Mens's Morris (also called Mills) is a board game for two players which is played on the following board (image taken from the linked Wikipedia-page):
Each player has 9 men, colored black and white. The concrete rules are not important for this challenge, but check out the Wikipedia-page if you are i... |
The Background
Imagine the English alphabet written out in a row in capital letters -- ABCDEFGHIJKLMNOPQRSTUVWXYZ. Suppose we have a special variable-width lens such that, when placed over the row, it shows a certain "window" of the alphabet, with letters outside the lens hidden from view. Additionally, this lens has a... |
Background
Imagine for a moment that you have a mind-numbingly boring job.
Every morning, you are given a collection of tasks that you should work on that day.
Each task has a certain duration, and once started, it must be completed in one go.
Your boss will not tolerate idling, so if there are tasks that you could sti... |
In many fonts (specifically in the Consolas font), 5 out of the 10 decimal digits have "holes" in them. We will call these holy digits:
46890
The 5 unholy digits are thus:
12357
An integer may thus be classified as "holy" if it only contains holy digits, and "unholy" otherwise. Because - is unholy, no negative intege... |
On Github, there is a list of the 10,000 most common passwords. I've also generated my own list of random passwords.
Your job is to identify the difference between the two lists (with 100% accuracy).
Therefore, your program needs to accept a string, and return:
A truthy value if the password is on the common password... |
Given an input of a list of integers representing dates, output an ASCII art
timeline like the following:
<----------------------------->
A B C D E
The above timeline is the output for input [1990, 1996, 1999, 2011, 2016].
Note several things about the timeline:
The first line of output is a less ... |
Do While False
At work today one of my colleagues was describing the use-case for do while(false). The person he was talking to thought that
this was silly and that simple if statements would be much better. We then proceeded to waste half of our day discussing the best
manner to write something equivalent to:
do
{
... |
Given two arbitrarily precise decimal numbers 0 ≤ x < y ≤ 1, compute the shortest (in digits) binary number b such that x ≤ b < y.
Output the binary digits of b after the binary point as an array or a string of zeroes and ones. Note that the empty array means 0.0, by virtue of deleting trailing zeroes. This also makes ... |
I define the method of combining a sequence to mean that every number in the sequence is concatenated as a string, then that result is made an integer.
[1, 2, 3] -> 123
For every finite sequence of at least 3 consecutive integers, missing exactly one element in the sequence, and this missing element may not be the fir... |
Challenge
Implement binary search on a list of length 256 with no branches.
Specification
Input an integer X and a strictly increasing list of integers
Output is the greatest element of the list that is less than or equal to X
The output will always exist
List will always have exactly 256 elements and be strictly incr... |
Your objective is to write a program that takes an input, and, when chained together N times, performs "sequential multiplication". What is sequential multiplication, you may ask? It's a sequence with a seed a defined as thus:
f(0) = a
f(n+1) = f(n)*(f(n)-1)
So, let a = 5. Thus, f(0) = 5, f(1) = f(0)*(f(0)-1) = 5*4 = ... |
ROT-128 is a variant of ROT-13, where instead of cycling through the 26 letters, you cycle through the 256 possible bytes. Your task is to create a program that outputs the ROT-128 of its own source. The outputted program must also be a valid program and output the original program.
Scoring
This is code golf, so leas... |
Introduction
Let's observe the following string:
ABCDEFGHIJKLMNOP
If we swap the ends of the string, which are these:
ABCDEFGHIJKLMNOP
^^ ^^
We get the following result:
BACDEFGHIJKLMNPO
After that, we delete the ends of the string, which in this case are B and O. The result is:
ACDEFGHIJKLMNP
If we repe... |
You are provided a set of arbitary, unique, 2d, integer Cartesian coordinates:
e.g. [(0,0), (0,1), (1,0)]
Find the longest path possible from this set of coordinates, with the restriction that a coordinate can be "visited" only once. (And you don't "come back" to the coordinate you started at).
Important:
You cannot "p... |
The first programming language I was exposed to was Sinclair BASIC. Like many BASIC dialects, it requires all source code lines to be numbered.
As a result, use of the GO TO command was idiomatic and jumps execution to the given line number (no labels).
Also there is a related GO SUB command which can be used as a rud... |
Inspired by Project Euler #17, this is your challenge. Write a full program or function that takes a number as input, then print or return how many letters it would take to count up to and including that number in English (starting at one). You do not include spaces, commas, or hyphens, but you should include the word ... |
Given a non-flat list of integers, output a list of lists containing the integers in each nesting level, starting with the least-nested level, with the values in their original order in the input list when read left-to-right. If two or more lists are at the same nesting level in the input list, they should be combined ... |
Given an input of a list of positive integers with some replaced with 0,
output the list with the missing numbers that were changed to 0 replaced.
Characteristics of the input list:
The list will always have a length of at least 2.
Let us define the input list as a and the "original list" (that is, the
list before num... |
Write a program or function that takes in a non-negative integer N from stdin or as a function argument. It must print or return a string of a hollow ASCII-art square whose sides are each made with N copies of the number N.
Specifically:
If N is 0, no copies of N are used, so there should be no output (or only a single... |
It's simple: Make a proper quine where if you remove any character, it's still a quine.
The difference between this and a radiation hardened quine is that if your program is AB, in a radiation hardened quine A would output AB, but here, A would output A.
Code golf, all standard rules, standard loopholes apply, no cheat... |
Have you ever wondered, when doing shopping, how to pack your products into 2 bags you're carrying so that a total weight would be distributed among them as evenly as possible?
Your task is to write a function, that takes a list of positive numbers (lets say integers for simplicity) as an input. It should return two li... |
I like patterns in time. My favorite is when the time lines up. For example, all of these line up:
3:45
12:34
23:45
3:21
6:54
This is because each digit in the hour/minute is increasing/decreasing by one each time.
Your task is to take the current time and check if it "lines up" in this pattern in a program. (You will... |
A histogram is an array of integers that counts the number of times a symbol occurs. For example, for the string "aaabbbabbdebabbbebebdbaaabbabaaaaeebeaabaaba" a histogram is a: 18, b: 18, c: 0, d: 2, e: 6, or [18, 18, 0, 2, 6] in short.
If we were to pick a random character out of this string, what would the chance be... |
The Inspiration
The Challenge
I'm tired of seeing the same old-same old clock in my top-right-hand corner of my screen. It's time for a new clock. While the clock clock sated my lack of interesting clock for a little while, it simply will do no longer. Your job: make a better, more interesting clock.
The Rules
Make a c... |
Introduction
The middle-square method is used for the generation of pseudorandom numbers. However, this is not a good method in practice, since its period is usually very short and has some severe weaknesses. How does this work? Let's take an example:
For the seed, we pick 123456:
Seed 123456
The seed squared (see... |
We've all heard of the Knight's Tour puzzle: find a route for a knight that passes through all the squares on a chess board. But let's be honest, it's a little bit boring. So, let's give the knight a bit of a challenge.
Task
Write a program that takes the knight through all the squares on an arbitrary-sized, arbitrary-... |
I noticed that my car's odometer was at 101101 when I got to work today. Which is a cool number because it's binary (and a palindrome, but that's not important). Now, I want to know when the next time I'll have a binary odometer reading. I can't read the odometer while I'm driving, because that would be dangerous, so i... |
This challenge is simple, given a decimal number, convert to binary, and calculate the sum of the sub-strings of the binary number, whose length is shorter than the original number. Here is an example:
Input:
11
Binary:
11 -> 1011
Substrings:
101 = 5
011 = 3
10 = 2
01 = 1
11 = 3
1 = 1
0 = 0
1... |
Given an input of a list of slices of a string, output the original string.
Each slice will be given as a list of length 2, containing the start position
of the slice (an integer ≥0) and the slice itself. If your language does not
support arrays of arbitrary types, you may also take this as a struct or
similar, or simp... |
If you've ever learned about primes in math class, you've probably have had to, at one point, determine if a number is prime. You've probably messed up while you were still learning them, for example, mistaking 39 for a prime. Well, not to worry, as 39 is a semiprime, i.e., that it is the product of two primes.
Similar... |
Input description
A string (for best results, all characters should be printable and be the same width).
Output description
A character star following the pattern:
0 0 0
1 1 1
222
0123210
222
1 1 1
0 0 0
where 0, 1 ... are subsequent characters of the string. The output does not necessarily have to be ... |
Introduction
You are probably familiar with the "puts on sunglasses" emoticon-meme:
(•_•)
( •_•)>⌐■-■
(⌐■_■)
In this challenge, your task is to take the first line as input, and output the last one, effectively putting sunglasses on that little button-eyed person.
To make the task a bit more difficult, the characters ... |
Taxicab Numbers or OEIS A011541 are the least numbers that are able to be represented as \$n\$ different sums of two positive cubed integers, for successive \$n\$.
You'll need to print out the \$n\$th taxicab number. This should work for any \$n\$ in theory.
However, as only 6 taxicab numbers have been discovered so fa... |
A lipogram is a block of words that omits a particular symbol. Right now, I am avoiding our fifth symbol of 26 that commonly show up. You should know by now what I am omitting. If not, look up "lipogram" and you will know.
Your Task
With a char, a blank, and a following string (blanks may show up in this; with only ASC... |
Inspired by Draw a timeline.
Given a timeline of events, output the date for each event.
A timeline will be given in the form
2000
--AF-C-------E--D---B--
Where the first line shows a known point in time. The known year is always the character below the first digit of the known year
You may assume:
On the timelin... |
Given a number > 0, output the sum with all digits (1 .. n) concatenated and reversed and add them up. For example, with n = 6:
The numbers 1 to 6 concatenated:
123456
Reversed:
654321
Adding them up together will result in: 777777. Another example is n = 11:
1 2 3 4 5 6 7 8 9 10 11 > 1234567891011
and
11 10 9 8 7 6... |
Challenge
You will be given a positive integer n as input. Output should be a pyramid-like sandpile built on the rules specified below:
Each integer "falls" downward from the same initial starting point, like sand falling into a conal-shape.
Numbers greater than the number directly below it when it hits the sandpile ... |
Related: Program my microwave oven and Generate lazy values.
My colleague is so lazy that he doesn't even bother to move his finger when programming the microwave oven. (This is actually true!)
Help him find the microwave input that gives the time closest to what he wants, but where all digits are the same. If two inpu... |
Related: Program my microwave oven. Inspired by Generate lazy microwave input.
The lazy value of the non-negative integer N is the smallest of the integers that are closest to N while all their digits are identical.
Return (by any means) the lazy value of a given (by any means) N.
N ≤ the largest integer that your lang... |
While bored in high-school (when I was half my current age...), I found that \$f(x) = x^{x^{-1}}\$ had some interesting properties, including e.g. that the maximum \$f\$ for \$0 ≤ x\$ is \$f(e)\$, and that the binding energy per nucleon of an isotope can be approximated as \$6 × f(x ÷ 21)\$...
Anyway, write the shortes... |
Write a function or program which, given a number of lines and columns, generates a corresponding tabular environment for LaTeX with no data in it.
Table format and tabular Environment
Here is an example of a table with 2 rows and 4 columns:
As you can see, we do not count the first row nor do we count the first colum... |
Sliding doors have varying prices based on the width of the doors. The different prices are as follows:
60 - 80 cm: ¤150
81 - 100 cm: ¤200
101 - 120 cm: ¤220
When buying a closet you would obviously want to minimize the cost, so your task is to find the width of the doors that minimizes the total cost based on the... |
Inspired by Copied from this question at Stack Overflow.
Given a matrix A, create a matrix B such that the columns of A are arranged in a block-diagonal fashion. For example, given
1 2 3
4 5 6
the output would be
1 0 0
4 0 0
0 2 0
0 5 0
0 0 3
0 0 6
Rules
Input and output may be in the form of 2D arrays, nested arrays... |
I hope this picture looks familiar to you.
It's one of Pacman's ghosts in his "vulnerable" state, after Pacman has eaten a power pill.
The challenge
Picture our ghost in a little frame, using ASCII art. At normal scale (more about this later), each square in the above image should correspond to one character, and the ... |
A friend of yours has given you directions to the best restaurant in town. It's a series of left and right turns. Unfortunately, they forgot to mention for how long you need to go straight ahead between those turns. Luckily you have a street map with all the restaurants on it. Maybe you can figure out which restaurant ... |
The SAS programming language is a clunky, archaic language dating back to 1966 that's still in use today. The original compiler was written in PL/I, and indeed much of the syntax derives from PL/I. SAS also has a preprocessor macro language which derives from that of PL/I as well. In this challenge, you'll be interpret... |
Context
Straw Poll is a website that is meant for the creation of simple/informal polls. Provided with a list of options, the user can select their choice(s), and the votes are tallied up. There's two very important features of a Straw Poll:
It is possible to view the current results before voting
It is often possib... |
As we learned from The Holy Numbers, there are 5 holy digits (0, 4, 6, 8, 9), and positive integers consisting solely of those digits are holy. Additionally, the holiness of a number is the sum of the holes in the number (+2 for every 0 or 8, and +1 otherwise).
Now, there is an additional property to take into consider... |
In almost every row nowadays, the people tends to order themselves as militaries would do.
Challenge
Suppose 4 people where:
person 1 has priority against person 2, 3 and 4,
person 2 has priority against person 3 and 4,
person 3 has priority against person 4,
person 4 has the lowest priority.
Then, when ordering thos... |
The task
This is a simple challenge.
Your input is a single non-empty string, containing only digits 0123456789 and hashes #.
It will contain exactly one run of digits, which encodes a nonnegative integer and may wrap around the end of the string, and at least one #.
The integer may have leading zeroes.
For example, ##... |
While Rust is very, very rarely competitive in code golfing competitions (Java is often shorter), it can still be fun to golf in. What are some tricks for making Rust code shorter?
Please post only one tip in each answer.
|
Note: This challenge has been changed to eliminate the strict whitespace manipulation requirements that made this challenge low-quality. Some rules regarding whitespace have been changed.
I'm rather good at mental math, particularly adding positive integers in my head. Here is my method for adding the numbers together... |
Totally not inspired by Visualize long division with ASCII art ;)
Your job is to show long hand addition with ASCII art. You solve longhand addition by adding up the columns right to left, placing the value of the ones place in the result, and carrying the tens place over to the top of the next column.
Input
Input can ... |
A struggling manufacturer named Tennessee Instrumental is desperate to get into the calculator business. Problem is, they don't have any software engineers on payroll, and the deadline is coming up fast.
It's your job to help TI configure a basic calculus-ready calculator that can simplify expressions input as strings... |
It's become somewhat of a tradition in PPCG that some users temporarily change their names by an anagram (a new name formed by reordering the letters of the old).
Sometimes it gets difficult to find out who is who. I could use a program or function to tell if two phrases are anagrams of each other.
The challenge
The pr... |
Welcome to BBC Casting. We need a program that we can use to select a new actor to play The Doctor on Doctor Who. In the spirit of the show, your program will perform a regeneration from one actor's name to the next.
We will test your program by running through the 13 names of actors who have already played The Doctor ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.