instruction stringlengths 34 53.1k |
|---|
The challenge is simple: write a program which takes in some non-empty string \$n\$ consisting of only uppercase and lowercase ASCII letters, and outputs the code for a program (in the same language) which takes in no input and outputs \$n\$. However, the code your program generates must not contain \$n\$ as a substrin... |
Let's introduce a simplified variant of the well known Spider Solitaire.
From Wikipedia:
The main purpose of the game is to remove all cards from the table, assembling them in the tableau before removing them. Initially, 54 cards are dealt to the tableau in ten piles, face down except for the top cards. The tableau pi... |
[The explanations of the algorithm come from here. I recommend reading it for a beautiful description of the algorithm.]
This challenge is to implement the Robinson Schensted correspondence.
Input
A permutation \$\pi\$ of the integers \$\{1, \dots, n\}\$.
Output
A pair of Young Tableaux corresponding to the Robinson S... |
This is an answer-chaining post, so in this challenge every answer (except the first answer) depends on the previous answer.
The goal of this challenge is to output the restricted characters. The restricted characters are the most common n - 1 characters of all answers, if happens to be a tie, then the characters with ... |
Your task is to convert non-empty strings - between strings using the 26 letters, and programs, which are strings of bytes, where each byte has 256 possible values. You should use the same codepage your answer is written in for the possible values of bytes.
You need to do the following to do the conversion:
Convert th... |
Given two natural numbers (less than 100) as input print the sequence of intermediate results obtained when computing the sum of the two numbers using only the following operations1:
n <-> (m+1) for integers nand m satisfying that equation
(a+b)+c <-> a+(b+c) for integers a,b and c (associative law)
You are not allow... |
Provided that the input is a monotone sequence of three or more integers:
Output -2 if the sequence strictly decreases. Example: [7,4,3,2]
Output -1 if the sequence monotone decreases but is neither strict nor constant. Example: [6,5,5]
Output 0 if the sequence is constant. Example: [0,0,0]
Output +1 if the sequenc... |
Your challenge is to output the number of twisted corners given a 2x2 Rubik's Cube scramble.
For the purpose of this challenge, twisted corners are defined as corners where the colour of the top/bottom face before (usually white or yellow) is not facing the top/bottom after the scramble.
Eg. if the cube were to be orie... |
Challenge
Display to the screen or write to stdout this exactly:
**
**
****
****
****
****
****
****
****
**********
**********
**********
Winning
This is code-golf, so the shortest submission (in bytes) wins.
|
This is the inverse of "Encode the date in Christmas Eve format."
Write a program that takes as input the string Christmas, possibly followed by Eve between 1 and 365 times, and outputs the date encoded in YYYY-MM-DD format, or any format from which the year, month, and date can be easily obtained. Assume that the "Ch... |
As in, the 5 speed transmission from the original VW Golf GTI.
Print the transmission pattern in as few bytes as possible.
Yes I know this isn't what it actually looks like but the GTI 5 speed shift knob pattern is a lot worse.
1 3 5
| | |
|--|--|
| | |
2 4 R
|
Write code to generate a PDF file containing 6 bingo cards. Winner is the one that uses the shortest code and needs no actions except for installing a library and running the code. (No Save As PDF). Rules are as follows.
The generated PDF file should display accurately in Adobe's PDF reader, Google Chrome and Moxilla ... |
Your task is to calculate the amount you have to pay for prescribed medication at a pharmacy in Germany. The amount is simply based on the full price of the item, which will be your input. It is a decimal number with exactly two fractional digits (ex. 5.43). You can assume it's strictly positive. Your task is to calcul... |
There have of course been challenges to render ASCII art fonts here and there. This challenge doesn't add anything to those. In contrary, it subtracts from them for a good reason. If you allow all characters,
it's a lot of boring work
the task is mainly about clever compression of the font and short extraction
This o... |
A loaded question is something like 'Have you stopped swearing?' in which both yes and no answers mean that I have swore, meaning it is impossible to answer the question if I haven't swore.
However, the constructed language Lojban has a word na'i, which means there is something wrong with what you just said.
Your input... |
Write a program that accesses Project Gutenberg's KJV Bible, either from a file called pg10.txt in the working directory or in any other way that is typical for the language, takes a Bible verse reference as input, and prints the corresponding verse, with no newlines except optionally one at the end, as output.
The sta... |
What is the shortest sequence of moves that, from the solved state of the cube, creates a pattern that meets the following criteria:
6 colors on each face
at most 2 facelets of the same color
no adjacent facelets of the same color
EDIT: I made up the name of the pattern. I asked this question in 2018 on Mathematics S... |
The Rudin-Shapiro sequence is a sequence of \$1\$s and \$-1\$s defined as follows: \$r_n = (-1)^{u_n}\$, where \$u_n\$ is the number of occurrences of (possibly overlapping) \$11\$ in the binary representation of \$n\$.
For example, \$r_{461} = -1\$, because \$461\$ in binary is \$111001101\$, which contains \$3\$ occu... |
We need to produce a block cipher round function with a 1 bit round key size and a 7 bit message size with the highest level of cryptographic security according to our measure of security.
Introduction
We are going to need new symmetric encryption functions. We are at the point where we cannot improve the performance o... |
Write a program to print or return one of these strings verbatim:
abcdefghijkmnopqrstuvwxyz
ABCDEFGHIJKMNOPQRSTUVWXYZ
Notice that there is no L.
|
The reason for this question is because I made a deadlineless bounty and I need a tips question to link in the bounty
Vyxal 3 is the third major version of the Vyxal golfing language. As it is significantly different to Vyxal 2, the tips there don't apply.
Therefore, what tips and tricks do you have for golfing in Vyxa... |
I recently tried to produce the shortest C code possible to display all its command line arguments (which are stored in argv).
I ended with a relatively small piece of code, and I was wondering if there was some trick I'm not aware of.
Here's my try (I compile with C17, but any standard before C23 is very likely to com... |
Generate the contents of an SVG file containing 6 bingo cards. Winner is the one that uses the shortest code. A qualifying answer has an output that can be directly pasted in a blank to get the required image. Rules are as follows.
The generated SVG code should comply with SVG version 1.1 described here.
The size of t... |
This prompt asked you to convert back and forth to factoradic, but is very limited in scope (only decimal integers from 0 to 10!-1). Your task in this challenge is to reach just a bit further and fully implement conversion between factoradic and any other integer base.
The factoradic system is extended to the reals by ... |
Story (skip, if you prefer the naked task): You need five skills for an imaginary sport: Speed, strength, endurance, accuracy and tactics. If you achieve a score in each of these disciplines, you can work out how well you have mastered the sport as a whole. But, as your coach always says: concentrate on your strengths,... |
Task
Take in 3 inputs. The length of the wall, the height of the wall and the coverage of the paint. Output how many tins of paint are required.
Output
Since there's no way to purchase 1/3 tin of paint, you'll need to round the amount of paint tins up to the nearest integer.
Assumptions/Stipulations
Only 1 coat of pai... |
One lane is closed, the vehicles have to thread their way in according to the zip-lock system: One car from one lane, the next car from the other lane, always taking turns.
Input: Two vehicle queues, represented e.g. as strings, in which short cars are represented by individual symbols, lorries by several identical sym... |
Write a program that accepts HTTP requests on any port of your choice above 1024, and responds to requests on any URL of your choice with its own source code. It must work with, at least, Firefox and Chrome. The code should be delivered as text/plain (removed requirement because none of the answers but one met it) with... |
It is a well-known fact that you can colour a two-dimensional map with four colours in such a way that two countries with a common border always have different colours. There have already been enough challenges on this topic.
However, the prerequisite for this is that there must be no enclaves, i.e. non-contiguous area... |
Weather conditions at airports are reported to pilots in METAR (METeorological Aerodrome Report) format. This format could be described as being "golfed." Here are some examples:
METAR KPDX 241653Z 16003KT 1/4SM R10R/4500VP6000FT FG SCT000 01/M01 A3040 RMK AO2 SLP293 FG SCT000 T00061006 $
METAR PAMR 241753Z 00000KT 10... |
Inspired by How do you write dates in Latin?
Challenge
Given a month-and-day date, output that date in abbreviated Latin, as explained below.
Input
Input is flexible, following conventions from other date and sequence challenges. You may choose to:
Take a date in mm/dd or dd/mm format or two separate month,day argumen... |
There was a prior question about golfing an HQ9+ compiler that translates HQ9+ code into the language it is written in, but that was closed as a duplicate of the interpreter challenge because converting an interpreter to a compiler is seen as trivial. This question is based on the closed one, but has some changes.
Writ... |
Sometimes I see a claim like "80% of respondents agreed" and I think "what was your sample size? 5?" because, of course, with a sample size of 5 it's possible to get 80% to agree on something. If the claim is "47% of respondents agreed" then I know it must be a larger sample size.[1]
challenge
Given a positive integer ... |
The absolute value of a number \$x\$ is normally written as \$|x|\$. The left and right side of the absolute value uses the same symbol, so it is not immediately obvious how to parse nested absolute values e.g. \$||1-2|+|3-|4-5|||\$
Your goal is to parse such an expression containing nested absolute values:
The express... |
Looking at
Arnauld's answer, it seems like this version is not really more difficult than the other version, so I made it an optional requirement of the other challenge
The absolute value of a number \$x\$ is normally written as \$|x|\$. The left and right side of the absolute value uses the same symbol, so it is not i... |
The following is an unfolded milk carton:
+-----+-\|/-+-----+-\|/-+-+
| | / \ | | / \ | |
+-----+/---\+-----+/---\+-+
| | | | | |
| | | | | |
| | | | | |
+-----+-----+-----+-----+-+
\ / \ / \ / \ /
\_/ \_/ \_/ \_/
This is a code-golf kolmo... |
Objective
Given two non-negative integers encoded in unbounded-length Gray code, add them and output the result, where the result is also encoded in Gray code.
Gray code
There are many equivalent formulations of Gray code, but here's an intuitive one.
The Gray code encodes each non-negative integer as an infinite bit-s... |
On the TV cooking show Guy's Grocery Games, the chefs cannot begin shopping until Guy Fieri, the show's host, says "Three, two, one, go!" However, the words do not have to be all together. He often "hides" the words in things like this (based on a real example, but not quoting verbatim):
There are three of you here; a... |
We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if n teens have m torches with them, but each group needs at least one torch?
Example: Three teens with torches (X) and two without ... |
Given \$x\$ distinguishable balls (say they have different colors), sample with replacement repeatedly until all the balls that have been seen, have been seen at least twice.
Challenge
The input is the integer value \$x \geq 2\$.
The challenge is to compute the probability that you would have seen all the balls when yo... |
Someone I know has no coding experience, but has proposed an algorithm* to determine the character limit of text fields they find online. They copy a string containing the numbers from 1 to 1,000 inclusive, not separated in any way, and they read the last few digits it displays.
For example, after pasting, they might s... |
Inspired by this and this question
Challenge
Your challenge is to print any 100 consecutive digits of Champernowne's Constant. You must give the index at which that subsequence appears. The 0 at the beginning is not included.
For example, you could print any of the following:
+-----+------------------------------------... |
Write a program that precisely clones GNU cat version 8.32, which is
installed on my computer.
In any case, if called with the same arguments, same stdin, and same files,
your program's output to both stdout and stderr must by byte-for-byte identical
to that of GNU cat, and the exit code must be the same. This applies ... |
Consider compass-and-straightedge construction, where you can construct new points from existing ones by examining intersections of straight lines and circles constructed with one of the following two options:
Draw the unique infinitely long straight line passing through points \$(x, y)\$ and \$(x', y')\$
Draw the uni... |
Write code that outputs the smallest integer \$n > 5\$ such that \$\frac{\sqrt{\log_2{n}}}{(\log_2 {\log_2 n})^2} > 1\$. Your code may have at most one digit in its source code. You can use your chosen digit more than once however.
By digits we are only counting the ASCII characters between 0x30 and 0x39 (inclusive).
|
In this programming-puzzle, your goal is to write the following function in JavaScript, using (essentially) point-free (tacit) programming:
(f) => void(f())
Your submission should be an expression which returns a function which behaves like the above (taking a function as an argument and calling it, and returning unde... |
In this challenge you will receive a list of positive integers \$W\$ called a word, and a square symmetric matrix \$M\$. Your task is to determine if the word can be turned into the empty list by applying a series of valid moves.
The valid moves are:
If two consecutive values in the list are equal you may remove them ... |
Interestingly, although there are challenges that work with images, there is no challenge to simply output an image. This is that challenge
Goal: output an image in the shortest possible code.
Output: Any image output is accepted. Files would be preferable, but most any non-character on the screen will function as an i... |
The lack of a social life drove a poor nerd into inventing another superfluous esolang called !+~%. For no good reason it initializes the accumulator with 6 and knows the following commands:
! (out(Accu); Accu = 6) prints the accumulator value as decimal string to stdout (without newline) and resets the accumulator to... |
In this challenge, you implement an interpreter for a simple stack-based programming language. Your language must provide the following instructions:
push a positive number
pop two numbers and push their sum
pop two numbers and push their difference (second number - first number)
pop a number and push it twice (dup)
p... |
There is an asdfmovie video about a pie flavoured pie. Someone also made an edited version with more pies, so I created this challenge.
The input is a positive integer.
The code should first output the following string:
I baked you a pie!
Oh boy, what flavour?
Then, the next line should be PIE (input number of times)... |
Given year, month and optionally weekday of 1st, output the calendar of the month. The first week should remain nonempty.
For empty cell, fill it with the date where it's supposed to be, in last or next month, and add # to indicate gray. If last few days can't fit in 5 lines, then they share last line with 5th week, us... |
Write an irreducible proper quine, i.e. a program that prints its own source code, which can't be reduced by removing characters to a shorter program with the same constraints.
Eg. the python quine:
var='var=%r;print(var%%var)';print(var%var)
can be reduced to the quine
v='v=%r;print(v%%v)';print(v%v)
thus it is no... |
Given a list of Integers greater than zero, Sort each of the unique values in ascending order, then repeat the process on the remaining duplicate values and append.
Example:
[1,5,2,2,8,3,5,2,9] ==> [1,2,3,5,8,9,2,5,2]
[8,5] ==> [5,8]
[2,2,2] ==> [2,2,2]
|
I want an n*n table that is filled with black or white and the following conditions are satisfied in it:
All cells of a 2*2 square in this table should not be the same color.
All black and white cells must be connected horizontally or vertically.
Acceptable examples:
Can anyone design a function that takes n as inpu... |
Given a list of non-negative integers the function \$f\$ replaces every integer with the number of identical integers preceding it (not necessarily contiguously). So
f [1,1,2,2,1,3,3] = [1,2,1,2,3,1,2]
We will say that a list, \$X\$, is in a loop if there is some positive integer \$n\$ such that \$f^n X = X\$. That i... |
What am I?
As a plant cell, your program/function/etc. must undergo photosynthesis:
When the input is 6CO2+6H2O+light in any order, output C6H12O6+6O2 in any order. It does not have to be the same for each arrangement of the input.
When the input is just r, replicate (i.e. output your own code). quine rules apply.
Whe... |
Consider an \$n \times n\$ grid and a circle of radius \$r \leq \sqrt{2} n\$ with its center in the top left. In each square there is an integer from the range -3 to 3, inclusive. For a given radius, there is a set of squares in the grid which are not at least half covered by a circle of radius \$r\$ but are at least ... |
In this challenge you will write code to take a list of positive integers and output all maximal linear sublists.
A sublist is is a list which can be created by deleting values from the the input list. Sublists have more structure than just lists. They in a way "remember" which values are deleted.
Similarly we say tha... |
Consider an \$n \times n\$ grid of integers. The task is to draw a straight line across the grid so that the part that includes the top left corner sums to the largest number possible. Here is a picture of an optimal solution with score 45:
We include a square in the part that is to be summed if its middle is above o... |
Challenge
This challenge is based on the domino effect:
Initially, each domino is located on one straight line and is in a vertical state. It can be dropped either to the left along the same straight line, or to the right. Then this domino will knock down the next one, and that one, perhaps, the other.
The dominoes are... |
Given a string of ASCII text as input, encode it in BPSK31 using Varicode. You may either output an audio file in any common format, or play the audio over the device speakers. You may output at any sample rate and with any carrier frequency between 500 Hz and 2500 Hz. The sample rate and carrier frequency must be cons... |
You know what a monotonic sequence is: each element is bigger than its predecessor (monotonically rising) or as its successor (monotonically falling).
Bitonic means you have two arms of the sequence, one monotonically rising, the other falling.
For example, 1,3,5,7,6,4,2 is bitonic (rising until 7, then falling until t... |
The flick input method is a way of inputting Japanese kana on a modern smartphone. It is arranged in a 12-key layout, with the following labels:
あかさ
たなは
まやら
小わ、
When a key is tapped, it produces its respective kana. However, when the key is flicked in one of the four cardinal directions (up, down, left, right) it prod... |
Disclaimer: the content of this post is not medical information and should not be used for any medical purpose, as it is deliberately oversimplified for the purpose of the challenge.
There are several different strains of Neisseria meningitidis, the bacterium that causes meningococcal meningitis. Vaccines are available... |
The following problem is taken from the real world — but indubitably code-golf!
In this puzzle, the programming language is fixed, and your job is to write the most efficient program in this fixed language. The language has no loops; a program is a straight-line sequence of instructions. Each instruction consists of ex... |
For this problem you are given an \$n \times n\$ matrix of integers. The task is to find a pentagon in the matrix with maximum sum. The pentagon must include part (or all) of the x and y axes as two of its sides starting from the top left cell.
All the sides except one must be horizontal or vertical. The remaining si... |
Input a datetime, format the datetime in YYYY-MM-DD HH:mm:ss format using 30-hour clock time.
The 30-hour clock time works as:
After 6 a.m., it is same as 24-hour clock time
Before 6 a.m., it use date for previous day, and plus Hours by 24.
For more examples, you may checkout the testcases.
Rules
To simplify the que... |
Introduction
In the video the best way to count, binary is proposed as the best system of counting numbers. Along with this argument is a proposal on how to say numbers in this system. First, we give names to each "double power of two", \$2^{2^n}\$ for each \$n\$.
number = symbol = spoken
============================
2... |
Related: Sort these bond ratings
Credit rating agencies assign ratings to bonds according to the credit-worthiness of the issuer.
The rating business is mostly controlled by "Big Three" credit rating agencies (i.e. Fitch Ratings, Moody's, and Standard & Poor's (S&P)), which use a similar tiered rating system.
Task
For ... |
This is an exact inverse of the question Convert to Spoken Binary. This introduction is copied from there.
Introduction
In the video the best way to count, binary is proposed as the
best system of counting numbers. Along with this argument is a
proposal on how to say numbers in this system. First, we give names to
eac... |
You want to draw a regular polygon but you have limited space! In this challenge, you should draw a polygon with n sides which is as big as possible for a given square container image.
I found surprisingly little information on the Internet about inscribing a polygon into a square. To save you the hassle, I verified th... |
Input
An integer n and a pair of distinct integer valued (x, y) coordinates on the boundary of the grid. The coordinates are indexed from 1. For example, n=10 and (1,2), (10, 7).
The points will always be on different sides of the grid and neither of them will be \$(1, 1)\$.
Output
The number of integer points in an n... |
Given two non-empty 01 strings, check if there is string containing both given strings, and their first appearance end at same position.
Test cases:
01, 1 => true (01)
0, 00 => false (0 would at least come 1 character earlier)
01, 11 => false (can't meet on same position)
01, 0 => false (can't meet on same position)
11... |
if you have a range of numbers with values missing, eg l=[1,2,9,10,99], you can always use modulus and subtraction to make all the numbers in the list cover a smaller range, for example: l%99%6=[1,2,3,4,0]. your task is to take in a list of numbers and output an equation which will map them to unique numbers in the ran... |
In this challenge, an infinitely proportional sequence is defined as a infinite sequence of positive integers such that:
All positive integers are contained infinitely many times within the sequence.
As more and more terms are added to the sequence, for all positive integers \$n\$, the ratio of the number of \$n\$s to... |
Objective
Write a full program that works exactly like the flow chart below.
Each output, which is an integer, shall be through stdout, followed by a line feed.
Each input shall be a line of string fed through stdin, and shall be judged to a predicate you choose for branching. The same predicate must be used for all br... |
The Dutch system for naming one's ancestors is a lot more interesting than the English version. For English, the sequence goes "parent", "grandparent", "great-grandparent", "great-great-grandparent", "great-great-great-grandparent"; and in Dutch those terms are "ouder", "grootouder", "overgrootouder", "betovergrootoude... |
Classic Tetris was often a difficult game to play. One problem was that you could only work with the Tetris piece you were given, so if you had an awkward board, it would sometimes be difficult to find a suitable location to put your piece. Another problem was that you could only look one piece ahead, so it was difficu... |
Consider a 10 by 10 grid of points at integer coordinates. Given a coordinate (x, y) of one of the points in the grid and a radius r, some of the points in the grid will fall inside a circle of radius r that is centered at (x, y). You will count the number of such points.
Input
An integer coordinate (x, y) in a 10 by... |
Background
The monkeys need your help again organizing their defense and have asked you, Benjamin the code monkey, to create a program that will list all tower upgrade options as they appear in your insta-monkey collection. Each tower has three unique upgrade "paths", called "top", "middle", and "bottom", each having a... |
Happy New Year 2024!
2024 is a tetrahedral number. A tetrahedral number is a number that can be represented in the form \$n(n+1)(n+2)/6\$ for some positive integer \$n\$. Or, equivalently, they are the sum of the first \$n\$ triangular numbers. They are also the number of objects in a triangular pyramid which has \$n\$... |
OEIS sequence A003242 comprises the numbers of Carlitz compositions for any given positive integer. This is the number of integer partitions of the integer for which no two adjacent parts are equal.
For example, for 4:
Generate the possible integer partitions (and their permutations): [1,1,1,1], [1,1,2], [1,2,1], [2,1... |
In most programming languages, the string Hello, World! can be represented as "Hello, World!". But if you want to represent "Hello, World!" you need to escape the double quotes with backslashes for "\"Hello, World!\"", and to represent that you also need to escape the backslashes resulting in "\"\\\"Hello, World!\\\"\"... |
Given a constructible point \$(x, y) \in \mathbb R^2\$, output the steps required to construct \$(x, y)\$
Constructing a point
Consider the following "construction" of a point \$(\alpha, \beta)\$ in the Cartesian plane:
Begin with the points \$(0, 0)\$ and \$(1, 0)\$. Then, more points can be added by performing a fini... |
Following the great advice (what do you mean it's not advice?!) on Adding unnecessary fluff we can devise the following task:
Take a list of positive integers and a positive integer \$m\$ as input.
Only keep the prime values from the list.
Define \$f(n) = F_{n^2 + 1}\$ (the \$n^2+1\$-th element in the Fibonacci sequen... |
So simple: Provide some code that outputs foo and with the reversed source outputs bar. But before you come up with something like this boring python 2:
print "foo"#"rab" tnirp
you should know the score: You multiply the number of bytes with (1 + dead bytes), where dead bytes are bytes that can be changed to most othe... |
I was wondering if it was possible to make this code even shorter than it already was.
f=lambda x:f(x-1)+f(x-2) if x>1 else 1
[print(f(i))for i in range(20)]
Expected output:
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
Good luck, "golfers" (I'm assuming thats what you guys are called)
Note: spe... |
Challenge
Display Inky the ghost from Pac-Man using only ANSI escape codes.
Here's a text representation of the image
B B B B B C C C C B B B B B
B B B C C C C C C C C B B B
B B C C C C C C C C C C B B
B C W W C C C C W W C C C B
B W W W W C C W W W W C C B
B E E W W C C E E W W C C B
C E E W W C C E E W W C C C
C C W... |
Given two strings containing only 0 and 1, decide the probability that first appears earlier as a consecutive substring in an infinite random 0/1 stream.
You can assume that neither string is suffix of the other string, so 01, 1, 00, 0 are invalid. (*)
IO format flexible. Your answer should be precise given ideal float... |
Write a program to calculate the first 500 digits of the mathematical constant e, meeting the rules below:
It cannot include "e", "math.e" or similar e constants, nor may it call a library function to calculate e.
It must execute in a reasonable time (under 1 minute) on a modern computer.
The digits are to include the... |
Consider an \$n \times n\$ grid of integers which is part of an infinite grid. The top left coordinate of the \$n \times n\$ grid of integers is \$(0, 0)\$.
The task is to find a circle which when overlaid on the grid gives the largest sum of values inside it. The constraints are:
The circle has its centre at \$(x, x... |
This quite literally came to me in a dream.
A common combination padlock design has letters on the dials so you can set the combination to a word. Unfortunately, I can't read, but I can count. Considering I am in a hurry, send the shortest path around the dials to open the 4 letter lock, given the current letters and t... |
Input
A single-character string containing an uppercase or a lowercase letter from the English alphabet.
Alternatively, you may handle only uppercase or only lowercase letters as input.
Output
This 3x3 typeface of the input letter (source), with two distinct, printable ASCII characters of your choice (excluding tabs a... |
Given two points \$(x_1, y_1)\$ and \$(x_2, y_2)\$ with integer coordinates, calculate the number of integer points (excluding the given points) that lie on the straight line segment joining these two points. Use any maths formula you like, such as
$$gcd(|x_2 - x_1|, |y_2 - y_1|) - 1$$
Input
Four integer coordinates of... |
Given an n non-negative integers, how many numbers must be changed so that each number x appears x times? You cannot add or remove elements, only replace them with other numbers.
For example:
1 6 23 6 9 23 1 1 6
can be turned into:
1 6 2 6 6 2 6 6 6
with 5 changes, which is optimal.
Test cases
0 => 1
1 2 3 => 1
5 5 5... |
I found this YouTube video with a table on it showing some card suits with ampersands. You might not understand what it is about, but I still want to make a challenge about it.
The input is two suits, being one of the following:
heart
diamond
spade
club
You can do anything for any other input.
Then the output is their... |
Consider the sequence 1/2, 1/3 + 1/2, 1/4 + 1/3 + 1/2, and so on. In mathematical symbols, this is
$$S(n)=\sum_{m=2}^{n+1}\frac{1}{m}$$
where S is the function that makes the sequence.
Outputting this sequence as a fraction would not be complicated. To add depth to the challenge, you must output as a repeating decimal.... |
Abracadabra is a magic word. To make it even more magical, let's make several alterations to how it may be written:
Change the casing for any subset of characters; for example: aBrAcAdAbRa
Append an exclamation mark to it: abracadabra!
Change each occurrence of a into a different vowel: ybrycydybry
Change any single c... |
Every Brazilian citizen has a national identification number associated with them, named CPF.
This number has 11 digits (formatted as XXX.XXX.XXX-XX) and it's validated by the following (real) algorithm1:
Take the 9 most significant digits of the number. Call it c.
Multiply the n-th least significant digit of c by n+1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.