instruction stringlengths 34 53.1k |
|---|
Challenge: write a single script file foo.cmd which can be invoked from the vanilla Windows cmd.exe prompt (not PowerShell, not in administrator mode), to execute arbitrary Windows-specific code...
> .\foo.cmd
Hello Windows!
...but also be invoked unaltered from a typical POSIX-compliant (Linux/OSX) shell prompt (ba... |
Input
Two dates, each comprising of a month (Dec or Jan) and a day (01-31). These will be given as 4 integers (12 01 01 01, for example), in any reasonable format you choose (leading zeroes, no leading zeroes, list, individual inputs, list of lists, etc.). The first date is supposed to represent today's date.
Output
I... |
In Dungeons & Dragons, almost everything is decided by rolling a die. Typically, if the roll is greater than or equal to a specified value, your attempt at doing whatever you wanted to do succeeds, and fails otherwise. Most commonly, a 20-sided die (aka d20) is used to roll.
Other times, the skill challenge system is u... |
Introduction
If you're not familiar with Hexagony, it's an esoteric language created by Martin Büttner. The thing is that this language accepts multiple forms for the program. The following programs are all equivalent:
abcdefg
and
a b
c d e
f g
So basically, the code has been rolled up into a regular hexagon. But n... |
Apply an indefinite integral to a given string. The only rules you will be using are defined as such:
∫cx^(n)dx = (c/(n+1))x^(n+1) + C, n ≠ -1
c, C, and n are all constants.
Specifications:
You must be able to integrate polynomials with any of the possible features:
A coefficient, possibly a fraction in the format ... |
Center The Text!
In this challenge you will be centering various lines.
Examples
Foo
barbaz
Foo
barbaz
Hello
World
Hello
World
Programming Puzzles
&
Code Golf
Programming Puzzles
&
Code Golf
Specifications
Each input line will always have at least one non-whitespace character, you may assume the on... |
Let's play Russian Roulette!
Normally, this would be a race to write the shortest MOD 6 program, but that's not very realistic, as the chance of winning decreases with each click. Here are the rules:
Emulate a real six-shooter:
A single bullet is placed into one of the six chambers, and the barrel is spun once, onl... |
The cofactor matrix is the transpose of the Adjugate Matrix. The elements of this matrix are the cofactors of the original matrix.
The cofactor (i.e. the element of the cofactor matrix at row i and column j) is the determinant of the submatrix formed by deleting the ith row and jth column from the original matrix, mul... |
Your task is to program a robot so that it reaches the hole in the ground on each of the maps within reasonable time. If the robot reaches the hole, it falls down into it and thus victory is assured, even if the program never stops running.
Since the robot has to be programmed by manually punching in ones and zeroes, y... |
In this code golf, you will have to determine the direction of the shortest shot that hits exactly n cushions before falling into a pocket.
The billiard table is a 6 pocket pool table with the following characteristics:
Dimensions are variable (a x b)
No friction : the ball will roll forever until it falls into a pock... |
Duolingo, the language learning app, has a lot of things going for it, but there is one major issue that drives me crazy. It tells me how many days in a row I've used the app with a message like You're on a 7 day streak! Setting aside hyphenation and whether the number should be spelled out, this works fine for most nu... |
The nth Motzkin Number is the number of paths from (0, 0) to (n, 0) where each step is of the form (1, -1), (1, 0) or (1, 1), and the path never goes below y = 0.
Here's an illustration of these paths for n = 1, 2, 3, 4, from the above link:
The desired sequence is OEIS A001006. OEIS has some other characterizations o... |
Your task is to output a single number; the number of ISO weeks that a given date range intersects. To quote Wikipedia: An average year is exactly 52.1775 weeks long, but this is not about the average.
Input consists of two space-separated ISO dates:
0047-12-24 2013-06-01
The end date is never before the start date. W... |
Drawing the Sierpinski triangle has been done to death. There's other interesting things we can do with it though. If we squint hard enough at the triangle, we can view upside-down triangles as nodes of a fractal graph. Let's find our way around that graph!
First, let's assign a number to each node. The largest upside-... |
Introduction
In base 10, the Champernowne constant is defined by concatenating representations of successive integers. In base 10: 0.1234567891011121314151617... and so on.
You can see that the first appearence of 15 starts at the 20th decimal:
Position
00000000011111111112222222222333333333344444444445555555555666... |
This is inspired by one of Downgoat's questions in Sandbox, where I suggested that he include April 31 as Pi day for people who use day/month format, only for him to inform me that there is no April 31!
Given a date string in month/day format that might be invalid, output the correct date using rollover. (First rollove... |
In this challenge you will be converting a mixed number to an improper fraction.
Because improper fractions use fewer numbers, your code will need to be as short as possible.
Examples
4 1/2
9/2
12 2/4
50/4
0 0/2
0/2
11 23/44
507/44
Specification
You may assume the denominator of the input will never be 0. The inpu... |
In this challenge posed by xnor, we were asked to implement XOR multiplication. In this challenge the goal is to find the first n XOR primes. XOR primes are very similar to regular primes as you can see by the following definitions:
Definition of Prime Number: A positive number greater than 1 which cannot be formed thr... |
If you like this, consider participating in:
The Official Dyalog APL 2016 Year Game
The monthly Dyalog APL 2017 Code Golf Challenge
Make 12 snippets/expressions, in the same language, that result in the numbers 0 through 10, and 42 respectively, but without writing any literal numeric, string, or character data.
Bui... |
Because there are not enough simple code-golf challenges:
Create an optionally unnamed program or function that, given (by any means) an integer 1 ≤ N ≤ 10000, outputs your language's True value with a pseudo-random probability of 1/N, False otherwise.
Please note that the requirement for naming has been removed. Feel ... |
Let's map some strings to 2d space, fractal style. Your task is to compute a Hilbert curve and lay a string along it.
Task
The task is to take the single-line input string, and lay it out along a Hilbert curve big enough to contain it, but no bigger. Try to make the byte count as low as possible; this is code-golf aft... |
Santa's Decision:
In this challenge, you will help Santa Claus decide whether somebody on their list has been naughty or nice, and subsequently get coal or toys.
But unfortunately, Santa is unorganised, in some of his entries, the naughty, nice and name fields are in the wrong order.
Input
Input will come in the follo... |
Challenge
You just bought a brand new chair! Problem is, you have no idea how to control it so you'll need to write a program to do it for you.
You can only sit in the unadjusted chair for so long. So your code will need to be as short as possible.
Examples
5,3,2,2,1
O
|
|
| _
| |
|_|_
|
|
O
3,5,2,3,5
O
| _... |
What general tips do you have for golfing in Prolog? I am looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Prolog (e.g. one letter variables is not specific to Prolog to reduce the size of programs).
Please indicate in your tips if it is specific to an imple... |
Yes, how much, not how many...
As we all know, a large present is far better than a small one. Therefore, the value of the presents should always be measured in total volume, not number of presents, weight, or even combined price.
As it's frowned upon to compare the amount of presents one gets, you don't want a long s... |
Background
Due to some unfortunate accident during coding you are now teleported and stranded on an alien planet. You really hope that the locals will be helpful and point to the general direction of how to get home, but before trying to talk to them you want to decipher their language. Fortunately it looks like the al... |
A Caesar shift is probably something we're all familiar with.
(You might be even doing it as a homework task. If so, please don't copy these answers, your teacher almost certainly doesn't want anything like the answers here.)
Just in case you aren't, a Caesar shift is a very simple form of cipher. It takes a string to... |
"Counter" is a language I've created for the purpose of this question.
Rules
Commands are read from left to right from the first character.
Each command may be executed as it is read, or you may execute all commands together at the end.
In case of an error, all commands up till the error must be executed.
A program is... |
Draw a program or function that will write to STDOUT n times (each for one step) a string that contains a dot . at the location of the walker. The program also needs to write a line every s seconds (or wait s seconds after each line).
A random walk is a mathematical formalization of a path that consists of a succession... |
You will be given two pieces of input: a string in run-length encoded format defining the running track, and a capital letter representing the lane to start from. For example, the string "3a4A6b5B" expands to "aaaAAAAbbbbbbBBBBB". You then use the expanded string to create a track, as such:
A) aaaAAAA
B) bbbbbbBBBBB
... |
2013 has the prime factorization 3*11*61. 2014 has the prime factorization 2*19*53. An interesting property regarding these factorizations is that there exist distinct primes in the factorizations of 2013 and 2014 that sum to the same number: 11+61=19+53=72.
Write a program or function that takes as its input two posit... |
Write an interpreter for 2B
I like David Catt's esoteric language 2B, having memory stored in a tape where each cell is a seperate tape of bytes (the 'subtape'). Write an interpreter for it!
Language Specification
Official specification can be found here. In this specification, " means a number in the range 0-9 (0 is i... |
In his xkcd about the ISO 8601 standard date format Randall snuck in a rather curious alternative notation:
The large numbers are all the digits that appear in the current date in their usual order, and the small numbers are 1-based indices of the occurrences of that digit. So the above example represents 2013-02-27.
... |
In his xkcd about the ISO 8601 standard date format Randall snuck in a rather curious alternative notation:
The large numbers are all the digits that appear in the current date in their usual order, and the small numbers are 1-based indices of the occurrences of that digit. So the above example represents 2013-02-27.
... |
In this challenge, you will receive an input, convert it to hexadecimal, make a couple changes, and output the result.
Because they are only 16 characters in hexadecimal, your code will need to be as short as possible.
Examples
Examples are separated by a blank line. First line is input, second line shows the steps, t... |
Task
Given input N, generate and output an NxN grid where each row, column and the two diagonals contain the numbers 1 to N (or 0 to N−1 if that's easier).
Input
The input is a positive integer N. It represents the number of columns and rows in the grid. For this problem, you can assume N will be a reasonable size, 4 ≤... |
Introduction
Santa has too many names to process, and needs your help! He needs you to write a program or a function, which outputs nice, naughty, very naughty or very very naughty. To determine how nice or naughty someone is, Santa had developed an algorithm:
Nice (division, math):
First of all, we obtain a number fro... |
The Cheela (from the book Dragon's Egg by Robert L. Forward) are creatures that live on the surface of a neutron star. Their body is flat and circular with twelve eyes on the perimeter, so they naturally use a base-12 numbering system.
Among the Cheela, care of the hatchlings and education of the young are tasks carrie... |
Here in California, we're in a drought so we need to know how much water we have left so we can conserve as much water as possible.
Because water is limited supply, your code will need to be as short as possible.
Examples
| |
| |
|~~~|
|___|
Output: 0.5
|~~~~~|
| |
| |
|_____|
Output: 1
| |
|__|
Outpu... |
https://en.wikipedia.org/wiki/Losing_chess
This is basically Chess Tournament, but for antichess ;)
Antichess is one of the many chess variants that have been invented. The goal is to lose all your pieces (this may seem a little odd, but it's called antichess for a reason).
The rules
The rules of antichess are very si... |
A double precision representation of a decimal can only guarantee an accuracy of 15 decimal places, thus pi is approximated as:
3.141592653589793
You can see that the digit 3 is in positions 1, 10, 16, the digit 1 is in positions 2, 4 etc.
Challenge
Your task is to create a program or function that creates a random d... |
Everyone knows that cats go meow, but what many don't realise is that caaaats go meeeeoooow. In fact, the length of the vowel sounds that the cat makes are dependant on the length of the vowel with which you address it.
In the same way, cows go moo, but coooows go moooooooo
Challenge
You are to write a program that tak... |
Description
Write a function f(m, G) that accepts as its arguments a mapping m, and a set/list of distinct, non-negative integers G.
m should map pairs of integers in G to new integers in G. (G, m) is guaranteed to form a finite abelian group, but any element of G may be the identity.
There is an important theorem that... |
Obviously, code golfing is all about making the most of the least code. Who really cares what the actual output is?
While we have had a challenge for highest input-to-output ratio, this is a call for most finite and deterministic output with given code lengths. Ironically, this challenge is then not code-golf.
Rules:
... |
For once, I was doing some real work, updating old code, and bumped into an expression that is equivalent to what would be written as πx + ex in good old-fashioned math. I thought it would be possible to write it shorter than it was written in the language I work with (APL), and therefore present this very simple chall... |
Inspired by this wonderful (based on the number of views and votes) challenge, which, in my humble opinion, has way too few answers.
Given (by any means) a list of strings, return (by any means) a set of letters that, when removed from the given strings, leaves the total length of (what remains of) the strings as small... |
A simple code golf challenge similar to an already existing, but more complex one:
Wait for user to press enter.
Wait for user to press enter again.
Print the elapsed time between the 1. and 2.
Wait an equal amount of time
Print the actual elapsed time of 4.
Order of 3. and 4. is not important. Notice that the second... |
The task here is to read from a Golly .rle or plaintext file (your choice) whose filename is provided (on STDIN or as a command line argument) and identify and count the common patterns in the grid encoded therein.
Alternatively, you may choose to have the contents of the file provided directly over STDIN instead.
Your... |
Objective Write a full program that outputs (to STDOUT or closest alternative) an arbitrary string of text, no more than 64 characters long. Simple enough, right? Well, here's the catch: You may not use any characters that were present in the previous answer's output. That's right, none of them.
Thus, you are trying to... |
An linear discrete convolution is an operation that turns two vectors of numbers into a third vector of numbers by multiplying elements inside-out. Formally, for two vectors a and b with elements 0 to n - 1, the discrete linear convolution of a and b can be computed with this loop:
for i = 0 to 2*n - 2
c[i] = 0;
... |
Introduction
A pentagonal number (A000326) is generated by the formula Pn= 0.5×(3n2-n). Or you can just count the amount of dots used:
You can use the formula, or the gif above to find the first few pentagonal numbers:
1, 5, 12, 22, 35, 51, 70, 92, 117, 145, 176, 210, 247, 287, 330, 376, 425, 477, etc...
Next, we nee... |
Challenge
In this challenge, you will be writing the first program, p1, of an infinite sequence of programs, in which running pn outputs/generates program pn+1. When concatenating the first n >= 2 programs, the sequence should output n.
Example
Let's say the first 4 programs are:
p1 p2 p3 p4
If I were to run p1, it sh... |
I didn't check the sandbox before posting this challenge - it looks like this challenge was proposed by Cᴏɴᴏʀ O'Bʀɪᴇɴ.
Given an integer input, write a program that prints the "four is a magic number" riddle
Four is the magic number
Five is four and four is the magic number
Six is three and three is five and five is fo... |
Colonies of bacteria labelled 1 through 9 live on a segment of equally-spaced cells, with empty cells indicated by 0
0 0 2 0 0 0 1 2 0 0 3 3 0 0
Every second, each colony spreads to adjacent empty cells. If two colonies reach an empty cell at the same time, the larger-labeled colony takes it.
t=0: 0 0 2 0 0 0 1 2 0 0... |
The challenge is simple:
Write a function or program that takes an input x, and outputs the lower case alphabet if x is part of the lower case alphabet, outputs the upper case alphabet if x is part of the upper case alphabet and outputs just x if it's not part of either.
Rules:
The input can be function argument or fr... |
This challenge consists of two parts. The winner will be the solution with the lowest total byte count. The same language must be used for both challenges.
Part 1:
Write a function or program that takes a sentence with only valid words as input, and outputs a list of the used characters, the number of times each letter... |
In an effort to level the playing field between languages with built-in date libraries and those without, let's work with a fictional calendar. The Forgotten Realms are a (the?) campaign setting for Dungeons & Dragons. Of course, each have their own calendar.
The Calendar of Harptos
Conveniently, a year in the Forgott... |
You must do a program that reads a file given in first argument and print it's content to STDOUT and number the lines on the file, the numbers should be followed by a space.
For instance, assuming that your program is named cat, we could write
./cat "myfile.txt" (or execute it with its interpreter)
With myfile.txt:
Hel... |
The idea of this challenge is to find all the words from a dictionary on a grid of letters. Your input should come from stdin or function arg and will come in the following format:
[your dictionary as a list of space sep words]
[a grid of letters]
Example:
The cool car
looc
thea
jopr
Rules for finding a match
A matc... |
Given a deck consisting of N copies of cards with integer values [1,M] for a total of N*M cards, compute the probability that a card with the value of 1 is adjacent to a card with the value of 2.
Your solution may be exact or approximated, and it does not need to be the same for every run given the same inputs. The giv... |
Introduction
Imagine that line of chars is in fact two rows. Upper row - dots - represents hours (24 hour system), while lower - commas - represents minutes. One character can represent hour, minute or both - whenever it's possible.
At first probably you'd have to convert minutes since midnight to hours and minutes.
... |
Trump needs the wall constructed and you are going to do it! To most efficiently build his wall I have created a simple, repeatable pattern for you to use:
__ __
| |_| |
___| |___
- - - -
- - - - - - -
- - - - - - - -
———————————————
Trump will tell you how many wall segments he needs... |
When making a Dungeons & Dragons character, an alternative to rolling ability scores is to assign them within a power budget called point buy. Higher ability scores cost more points, especially towards the upper end: a score of 8 is free, and raising a score by 1 costs 1 point, except raising to 15 or 16 costs 2 points... |
While there are many edit distance questions, such as this one, there isn't a simple question to write a program that calculates the Levenshtein distance.
Some Exposition
The Levenshtein edit distance between two strings is the minimum possible number of insertions, deletions, or substitutions to convert one word into ... |
The Binary Sierpinski Triangle sequence is the sequence of numbers whose binary representations give the rows of the Binary Sierpinski Triangle, which is given by starting with a 1 in an infinite row of zeroes, then repeatedly replacing every pair of bits with the xor of those bits, like so:
f(0)= 1 ... |
This challenge is based on Downgoat's Adjust your chair.
Challenge
You just adjusted your new chair! It fits you perfectly. However, the wheel is squeaky and you know the repair people will change the adjustment. Problem is, you don't have a ruler, so you'll have to write a program to measure it for you.
The repair pe... |
Introduction
Of course, we've got a lot of sequence challenges, so here is another one.
The Kimberling sequence (A007063) goes as following:
1, 3, 5, 4, 10, 7, 15, 8, 20, 9, 18, 24, 31, 14, 28, 22, ...
This is produced by shuffling the normal iteration:
[1] 2 3 4 5 6 7 8
The first term of the sequence is 1. Aft... |
Overview
Run-length encoding — sequences in which the same data value occurs in many consecutive data elements are stored as a single data value and count
When using run-length encoding:
Input: ABBBCCACB
Output: 1A3B2C1A1C1B
This sample has an output that is larger than the input.
Instead, it can be simplified for... |
Introduction
As ToonAlfrink says: "Me thinks there aren't enough easy questions on here that beginners can attempt!". So the task is very simple. Given a string, output a truthy or falsy value whether the name is official or not.
A name is "official" if it is a single title-case word, that is:
If the first letter is c... |
If you've ever played Spacewar!, you know it was a fun game. If you haven't, know this: it was (and is) one of the very first and most important computer games. And it's still fun! The clone I grew up on is this one, which is, apparently and unfortunately, Windows only. So I recreated it!
The KotH is hosted here: PPCG... |
In this challenge, you are passed two things:
A string length, N
A list of strings, L, each with an assigned point value. Any string that is not passed in has a point value of 0
You need to construct a string of length N such that the sum of all substring points is as large as possible.
For example:
5 [("ABC", 3), (... |
Many important topics in abstract algebra involve a binary function acting on a set. A number of properties of such functions have been defined in the investigation of such topics.
Your challenge will be to determine whether a given binary function on a given domain possesses five of these properties.
Properties
Closur... |
Given a string input, your task is to write a program that prints a truthy value to STDOUT or equivalent if the input contains "2016" anywhere in it without using any built-in contains, match, replace, split or other functions that use patterns or regexes.
A truthy value also must be printed if the input contains "2016... |
Paper stars are a big thing in my family at christmas, so I thought a virtual one would be cool.
Below is an image of a regular dodecahedron (from https://en.wikipedia.org/wiki/Dodecahedron, attributed to the author mentioned there.)
The process of stellation (wikipedia) when applied to a polyhedron involves extending... |
Santa needs some help determining how many elves he will need to help him deliver gifts to each house.
Coal is considerably heavier than presents, so santa will need three elves for every naughty person in the house. Only two elves are needed to help santa carry presents.
On santa's map, a house is represented by a *, ... |
Quipus are an ancient device used by the Inca in the Precolumbian era to record numbers in a base ten positional system of knots on a cord, which works as follows:
Each cluster of knots is a digit, and there are three main types of knots: simple overhand knots; "long knots", consisting of an overhand knot with one or ... |
It's almost Christmas, so Santa has to plan his route. You're helping him, for reasons unknown.
Santa needs help planning the route and wants you to give him a solution, but since you're all ungrateful and unwilling to give to the man who has given you so much, so have decided to give him a program with as few bytes as... |
Introduction:
Before the task, here is what every element does on the map:
Plain land (X): This does nothing.
Destroyed land (-): This is the same as plain land, but destroyed by a bomb.
The active bomb (!): On a map, this will destroy everything in a 3x3 square:
XXXXX XXXXX
XXXXX ... |
Recently I've been writing a new language, to avoid needing to handle order of operations, I simply parenthesize each expression properly to avoid this entirely.
Because parenthesis are at char-codes 40-41, your code will need to be as short as possible.
Examples
1+2*3
(1+(2*3))
2*(3+4)
(2*(3+4))
2*3/4+3
(((2*3)/4)... |
The goal of this challenge is to compute one kind of numerology digit from strings containing characters and numbers.
The input may be through any convenient method (standard input, arguments, separated file).
The input may contain any printable ASCII chars, but only alphanumerical (A-Z, a-z, and 0-9) have to be consi... |
Background
Inspired by this Unix.SE question (and of course my own answer).
When an IP address is specified for an interface, it is often given in this dotted-decimal form:
a.b.c.d e.f.g.h
where a.b.c.d is the actual address and e.f.g.h is the netmask.
The netmask, when represented in binary, is basically a bunch of 1... |
Donald Trump is very impressed with the work of the people on this site. He saw how amazing of a job you did helping Ben Carson, so he even hired you to build his wall. He thinks you're terrific. Now he needs your help again. While he has successfully built his wall, now he needs the Mexican government to pay for it. H... |
The aim is simple: given the string of resistance values, draw the part of "electrical circuit" of those resistors. Examples follow.
Input: 3. Output:
--3--
Input: 1,2,3. Output:
--1----2----3--
Next, the resistors can be joined parallel (by 2 or 3 resistors per join), but the required depth of parallel joins is on... |
First of all ... I would like to wish everyone a Merry Christmas (sorry if I am a day late for your timezone).
To celebrate the occasion, we are going to draw a snowflake. Because the year is 2015 and Christmas is on the 25th (for a large portion of persons), we will draw a Pentaflake. The Pentaflake is a simple fracta... |
In this challenge you and your friends are debating on which case is better, uppercase or lowercase? To find out, you write a program to do this for you.
Because esolangs scare your friends, and verbose code scares you, your code will need to be as short as possible.
Examples
PrOgRaMiNgPuZzLeS & CoDe GoLf
0.52 upperca... |
The goal of this challenge is to create a program that outputs a string depending on the time of year.
Output
If the date is December 25, output:
Merry Christmas!
If the date is December 31 or January 1, output:
Have a Happy New Year!
If the date is between December 25 and December 31 (exclusive), output:
Happy Hold... |
Objective
Write the shortest program possible that adds semicolons to the end of all lines of code in a file unless:
it already has a semicolon at the end
the line is blank.
Must be a complete program.
Bonuses
Write the program so it won't produce any compiler errors when running the program on a C Header File.
|
Your challenge is to determine whether the given input is an integer, a string, or a decimal.
Rules
A string is any input that is not an integer or a float
An integer must contain only numeric characters and must not start with a zero
A decimal is any input that contains the period (.) and the period is surrounded by ... |
A fountain is arrangement of coins in rows so that each coin touches two coins in the row below it, or is in the bottom row, and the bottom row is connected. Here's a 21 coin fountain:
Your challenge is to count how many different fountains can be made with a given number of coins.
You will be given as input a positi... |
This is the cops' thread. The robbers' thread goes here.
Write a program or function consisting only of printable ASCII characters (that excludes tab and newline) that outputs at least 5 printable ASCII characters in ascending order (from space to tilde / 32 to 126). Characters can be outputted several times, as long a... |
This is the robbers' thread. The cops' thread goes here.
In the cops thread, the task was to create a program that outputs printable ASCII characters in ascending order. The robbers task is to unscramble the code the cops used to produce this output.
The cracked code doesn't have to be identical, as long as it has the ... |
Introduction
Number theory is full of wonders, in the form of unexpected connections. Here's one of them.
Two integers are co-prime if they have no factors in common other than 1. Given a number \$N\$, consider all integers from 1 to \$N\$. Draw two such integers at random (all integers have the same probability of bei... |
Normally, challenges are scored in bytes, or sometimes Levenshtein distance, but for this one we're using keyboard distance -- the number of keys between the keys used to type the program (use the above keyboard as the definitive reference). For example, the distance between A and F is 3, because the path is A=>S=>D=>... |
Introduction
I Ching is an ancient divination text and the oldest of the Chinese classics. It uses a type of divination called cleromancy, which produces apparently random numbers.
The basic unit of the Zhou yi is the hexagram (卦 guà), a figure composed of six stacked horizontal lines (爻 yáo). Each line is either broke... |
Introduction
XOR is a digital logic gate that implements an exclusive or. Most of the times, this is shown as ^. The four possible outcomes in binary:
0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0
This can also be seen as addition modulo 2 in binary. In decimal, we need to convert the decimal to binary, 35 = 100011 and 25 =... |
Some background
In math, a group is a tuple \$(G, *)\$ where \$G\$ is a set and \$*\$ is an operation on \$G\$ such that for any two elements \$x, y \in G, x * y \in G\$.
For some \$x,y,z\in G\$, basic group axioms are as follows:
\$G\$ is closed under \$*\$, i.e. \$x * y \in G\$
The operation \$*\$ is associative, i.... |
Inspired by this xkcd
You work for Shazam and they have a project for you. Some customers are complaining about their app taking up too much space on their phone, so they want you to code a lite version of the app. Unfortunately, your existing code can only understand the word "na", and you have to ship soon. That's o... |
You're designing a new esoteric programming language and
one feature you've decided to add is a dynamic memory allocator. Your language specifies a special dedicated virtual address space for the user's program space. This is separate from the address space used by the memory allocator for any internal state.
To help r... |
The challenge is simple: given two parameters, x and y, output y staircases with x steps. For example:
f(3,1) - 1 staircase with 3 steps.
_
_|
_|
f(5,2) - 2 staircases with 5 steps.
_ _
_| _|
_| _|
_| _|
_| _|
Make sure you output the staircases just like,... |
Recently I've been having some trouble with the new TeaScript interpreter. The biggest problem is identifying whether or not a string contains any special characters.
Challenge
A special character is defined as a character with codepoint 160 to 255. You will be given an input which is a string of characters with codep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.