instruction stringlengths 34 53.1k |
|---|
Challenge
Design a compression algorithm specialized for compressing ASCII mazes. You will need to create both a compression algorithm and a decompression algorithm. Your score will be based on the size of your compressed mazes.
Mazes
These mazes are made primarily of the characters (floors), +, -, |, and # (walls), a... |
Rectangles have this nice property - an \$n \times m\$ rectangle consists of exactly \$n \times m\$ characters!
A.. more interesting property is that the rectangles can be aligned nicely in a multiplication table - for example, a \$3 \times 3\$ table:
# ## ###
# ## ###
# ## ###
# ## ###
# ## ###
# ## ###
Your challe... |
Background
Though this is a bit late for Pi Day, I saw an article about Pilish and thought it would make a great challenge. Pilish is created by using a sequence of words where each word's length corresponds to a digit of pi.
Example from Wikipedia:
The following Pilish poem (written by Joseph Shipley) matches the fir... |
So, you have a random list (random meaning it doesn't matter what order it is in) of numbers with a length of n, where n is a positive integer smaller than 1000 and larger than 1.
The random list must contain every number from 0 to (n - 1). Eg: [0, 3, 2, 5, 1, 4] (where n is 6).
Note: If there is more than one digit yo... |
Challenge
You have one string of input bytes, output only the last byte in it.
Rules
Your submission may be a program or function outputting the last byte in the input which
is either a string, stdin or command-line arguments, and
is non-empty.
I was trying to solve this with brainfuck, however all languages are allo... |
Shortest program wins, of course.
|
Your task here will be to write a very dumb AI capable of fetching all treasures on a map.
Map
The map is defined as follow: (artist-mode™-powered)
Basic case:
+-+-+-+-+-+-+-+-+-+-+-+-+-+
|P| | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | | | | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | |T| | | | | | | ... |
If I need to get the number of diagonal squares in all directions:
I do the following formula 2 N − 2 − |x − y| − |x + y − N − 1|
The above example has 13 and that's what the formula gives.
Now, what if you wanted to get the diagonal squares, but only in one direction?
The top right has 4 squares, the top left has 3, ... |
Write a program that takes a single line string that you can assume will only contain the characters /\_‾. (That's forward and backward slash, underline and overline. You can use ~ in place of overline if you need since overline is not convenient ASCII.)
For example, one possible input is:
__/‾‾\/\_/‾
Your program nee... |
Inspired by this game
Challenge:
Given an ASCII art string representing a number, output that number.
Example:
Input:
&&&& ##### .====.. .&&&
$$$$$. %% %% % % . +. .
@@@ . @@ . = . = . ????
+++. && &&. % % = =
$$$ . @@@@@ # # . ===.
.$$$$$ ... |
In Pascal's triangle each number is the sum of the two numbers directly above it, treating empty spots as zero:
By rotating the triangle, we can cut out square matrices of varying sizes and rotations which I will call Pascal's matrices. Note that those matrices always need to contain the top \$1\$. Here are some examp... |
Write a program that inputs the dimensions of a painting, the matting width, and the frame width for a framed portrait. The program should output a diagram using the symbol X for the painting, + for the matting, and # for the framing. The symbols must be space-separated. Trailing whitespace is alright, as long as the o... |
You will be given an ASCII text. This text may have zero, one or many appearances of a split a character (let's assume it will be the space character )
You will also be given an offset integer value (zero based) anywhere between zero and the length of the text.
You should calculate the relative offset inside the one sp... |
Introduction (may be ignored)
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the second challenge in this series. The first challenge can be found here.
In this challenge,... |
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter:
XYZABC
VW DE
U F
T G
S H
RQ JI
PONMLK
Write a program that takes in a single letter character, A-Z, and... |
Hehe, see what I did with the title? Anyways...
Your job is to create a sudoku solver that accepts input in Morse code and creates output in Morse code. Here's the Morse code numbers for reference:
0: -----
1: .----
2: ..---
3: ...--
4: ....-
5: .....
6: -....
7: --...
8: ---..
9: ----.
Rules:
The code must... |
Challenge:
Input: A positive integer \$n\$
Output:
Create a list in the range \$[1,n]\$, and join it together to a string (i.e. \$n=13\$ would be the string 12345678910111213).
Now we output a triangle using the prefixes or suffixes of this string, in one of the following four orientations based on the input integer:
... |
Multiplicative Persistence
Multiply all the digits in a number
Repeat until you have a single digit left
As explained by Numberphile:
Numberphile "What's special about 277777788888899?"
Numberphile "Multiplicative Persistence (extra footage)"
Example
277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872
... |
There's a visual method for multiplication that is taught to Japanese schoolchildren [citation needed] that uses lines and crossings to get the answer.
Image Source
Your task is to implement this in ASCII art. You will be given two numbers to multiply. The output should be the corresponding ASCII art made up of \, /, ... |
Given a list of jobs, which must be done in order, with each taking a slot to do, how long will it take to perform them all if after doing a job the same job cannot be done for the next two slots (cooling off slots)? However, a different job can be assigned in this cooling off slots.
For example,
[9,10,9,8] => output: ... |
This riddle was inspired by that thread. Consider that you are super-hacker and try to break MD5 hashing algorithm by looking for a hash collisions for a given hash string which your friend gave to you. But this is a non-trivial task and you have a migraine disorder so you try to break the problem into smaller parts. F... |
Your task is to take a 24 BPP sRGB image and output the same image upscaled 3x into red, green, and blue subpixels. The resulting image will be made entirely of pure black, red, green, and blue pixels.
Each pixel from the source image, when zoomed, produces an arrangement of 9 sub-pixels that can be either on or off (i... |
What are some tips for golfing in Turing Machine But Way Worse, a language made by MilkyWay90 and ASCII-only?
Tips should be Turing Machine But Way Worse-specific and not be trivial (For examples that you shouldn't post, removing unnecessary whitespace or using shorter state names).
EDIT: Added documentation to TMBWW
|
Given: a width, a height, and a set of sets of points. Output: An image where each set of points is connected and colored in (like a shape). Each shape must be a different color from all of the other shapes, but the actual color doesn't matter as long as each color is distinct. The shapes must be in order; whether you ... |
Create a program or function which takes a list of strings as input, and outputs the longest string that is a substring of all input strings. If there are several substrings of equal length, and no longer substring, output any one of them.
This may mean outputting the empty string.
If there are several valid outputs, ... |
I got into code-golfing recently and tried to write the smallest tautogram checker.
A tautogram is a sentence in which all words start with the same letter, for example: Flowers flourish from France.
Given a sentence as input, determine whether it is a tautogram.
Test Cases
Flowers flourish from France
True
This i... |
OEIS sequence A020872 counts the number of restricted forests on the Möbius ladder Mn.
The Challenge
The challenge is to write a program that takes an integer as an input n > 1 and returns A020872(n), the number of restricted forests on the Möbius ladder Mn. This is code-golf, so shortest code wins.
(An ulterior motiv... |
Challenge:
Your program will take two integers n and k as input, and output the smallest integer greater than (but not equal to) n that contains at least k occurrences of the digit 5.
You can assume 1 ≤ k ≤ 15 and 1 ≤ n < 10**15.
This is a restricted-time challenge. Your program must run on TIO for all of the test cas... |
Inspired by this SO question.
Challenge:
Input:
A string \$s\$
A character \$c\$
Output:
Create a diamond-square ASCII art of the string in all four directions, with the first character of the string in the center and going outwards. Which is inside a square ASCII-art carpet, with the character as filler. This may so... |
The sorting algorithm goes like this:
While the list is not sorted, snap half of all items (remove them from the list). Continue until the list is sorted or only one item remains (which is sorted by default). This sorting algorithm may give different results based on implementation.
The item removal procedure is up to ... |
Introduction:
I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the first one:
Challenge:
Input: Two integers
Output: One of three distinct and unique outputs of your own choice. One ... |
Challenge
This is a simple one: Given a positive integer up to 1,000,000, return the closest prime number.
If the number itself is prime, then you should return that number; if there are two primes equally close to the provided number, return the lower of the two.
Input is in the form of a single integer, and output sh... |
Turn-based tactics games like Advance Wars, Wargroove, and Fire Emblem are made up of a square grid of varying terrain with units of differing movement classes requiring different costs for each terrain type. We'll be investigating a subset of that problem.
Challenge
Your task is to determine if one location is reachab... |
Task
Your task is to write as short as possible program preferably in Brainf**k which determines the last digit of given number after it's conversion from decimal to binary system.
Input
An integer in decimal system consisting of up to 200 digits. There is a newline character (ASCII 10) after the given number
Output
On... |
Introduction (may be ignored)
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the third challenge in this series (links to the first and second challenges).
In this challen... |
Given an integer k and either a block of text, or a 2d array that the inner arrays may have unequal lengths (that resembles a block of text), rotate every character or element in the k-th column up or down to the next position that exists.
Example
Rotate the 20th column of the following text (1-based):
A line with more... |
disclaimer: the Mean mean is made up by me
Define the arithmetic mean of \$n\$ numbers as
$$M_1(x_1,...,x_n)=\frac{x_1+x_2+...+x_n}{n}$$
Define the geometric mean of \$n\$ numbers as
$$M_0(x_1,...,x_n)=\root{n}\of{x_1x_2...x_n}$$
Define the harmonic mean of \$n\$ numbers as
$$M_{-1}(x_1,...,x_n)=\frac{n}{\frac{1}{x_2} ... |
Introduction:
I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the second (first one can be found here):
Challenge:
Some rules about badminton serves:
A serve will always be done di... |
Telephones in the United States (and perhaps some other places) have letters associated with some of the numbers.
2 = A, B, C
3 = D, E, F
4 = G, H, I
5 = J, K, L
6 = M, N, O
7 = P, Q, R, S
8 = T, U, V
9 = W, X, Y, Z
No letters are associated with the number 0 or 1.
Your challenge: Given any phone number in seven-digit... |
Problem:
In chess, there is a somewhat well known rule about draw by repetition. If the same position is repeated 3 times (or more) then the player intending to make the move which will cause the this repetition can claim a draw.
Sometimes this is an easy task for an arbiter to spot, if the last few moves are just the ... |
Your task is to take an ASCII art image and output it rotated clockwise by 45 degrees and scaled by a factor of \$\sqrt 2\$. The scaling comes from using a lattice pattern which introduces space between the characters.
To explain it visually, a \$3 \times 3\$ block would be processed like so:
123
456
789
becomes
1
... |
Challenge
For each character of the string except for the last one, do the following:
Output the current character.
Followed by randomly outputting from the following list a random number of times between 1 - 5 (inclusive):
The current character
The next character of the string
The switchcase version of the character... |
Take a positive integer \$k\$ as input. Start with \$n := 1\$ and repeatedly increase \$n\$ by the largest integer power of ten \$i\$ such that \$i \le n\$ and \$i + n \le k\$.
Repeat until \$n = k\$ and return a list of all intermediate values of \$n\$, including both the initial \$1\$ and the final \$k\$.
During this... |
I'm surprised this hasn't been posted before!
The Consistent Overhead Byte Stuffing (COBS) algorithm is used to delimit byte streams.
We choose a frame marker (we'll use 0x00) and wherever 0x00 occurs in the stream it is replaced with the number of bytes until the next 0x00 occurs (we'll call this a milestone). This re... |
We have X Girls and Y Boys in a class. If more girls sit together they will not behave. Similarly if more boys sit together they will not behave.
Write a program/algorithm to get maximum same gender that will be seated if seating is done to efficiently to get them behave.
Example 1: 5 girls and 1 boy
Expected Output: ... |
You are given four numbers. The first three are \$a\$, \$b\$, and \$c\$ respectively, for the sequence:
$$T_n=an^2+bn+c$$
You may take input of these four numbers in any way. The output should be one of two distinct outputs mentioned in your answer, one means that the fourth number is a term in the sequence (the above ... |
Challenge
Robin likes having his variables declaration in the shape of an arrow. Here's how he does it:
Input any number of strings
Order them by ascending length
Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best):
5 or 4
3 2
1 1
2 3
4 ... |
You're tasked with writing an algorithm to efficiently estimate cost of solving an Eni-Puzzle from a scrambled state as follows:
You're given m lists of containing n elements each(representing the rows of the puzzle). The elements are numbers between 0 and n-1 inclusive (representing the colors of tiles). There are exa... |
We define \$R_n\$ as the list of remainders of the Euclidean division of \$n\$ by \$2\$, \$3\$, \$5\$ and \$7\$.
Given an integer \$n\ge0\$, you have to figure out if there exists an integer \$0<k<210\$ such that \$R_{n+k}\$ is a permutation of \$R_n\$.
Examples
The criterion is met for \$n=8\$, because:
we have \$R_8... |
I recently had a problem to solve at work where I had two lists: a master list, and a smaller list that contains a subset of the items in the master list potentially in a different order. I needed to reorder the master list in such a way that the items in the subset would appear in the same order without changing the o... |
Given a date as input in any convenient format, output a calendar with that date as the exact center of a five-week window. The header of the calendar must include the two-letter abbreviations for the days of the week (i.e., Su Mo Tu We Th Fr Sa). Three-letter or other abbreviations of the days are not allowed.
For exa... |
What to do?
Starting from a, count in the sequence:
a, b, c, d, ... , y, z, aa, ab, ac, ... , ay, az, ba, bb, bc, ... , zy, zz, aaa, aab, aac, ... , zzy, zzz, aaaa, aaab, aaac, ...
Input
The input, n, will an integer representing how far to count.
Output
The output should be n space-separated strings following the abo... |
This question is inspired by Kevin Cruijssen's question.
Now that the carpet is laid out, we want to roll it. Your task is to write a program that takes a string and returns a spiral made from this string (representing a rolled carpet viewed from the side).
The procedure for one step of rolling the carpet is the follow... |
Shocking news: Dr. Mad J Scientist has released a proof of P = NP to the world. But the proof is nonconstructive, and she's keeping the algorithm to herself.
Worry not. Without even looking at her proof, we can still (almost) write a computer program that solves NP-complete problems in polynomial time.
The Problem
Inpu... |
Given an input string, output at random the unique combinations with repetition of the characters in the input string, from length 1 up to the length of the input string, with an equal chance of each one occurring.
Example: given the input abcd (or any combination thereof of the four characters a,b,c,d) , there is an e... |
Summary
A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.
Input
A string, which is a single line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument e... |
Introduction
I can type at a moderate pace, using the QWERTY keyboard layout. But if a word like yellowwooddoor has a ton of repeated letters, it takes a bit longer to type it. Even worse is when a word like "jump" has the same finger used for multiple different consecutive letters.
Here's how long it takes me to type ... |
Challenge
Given two strings in any default I/O format, do the following:
NOTE: The challenge will refer to the first string as the "data" and the second referred to as the "program".
Change the program to an infinite string which is just the program repeated infinitely (e.g. 10 --> 1010101010...). The challenge will r... |
Everyone knows the Fibonacci sequence:
You take a square, attach an equal square to it, then repeatedly attach a square whose side length is equal to the largest side length of the resulting rectangle.
The result is a beautiful spiral of squares whose sequence of numbers is the Fibonacci sequence:
But, what if we didn... |
Introduction (may be ignored)
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the fourth challenge in this series (links to the first, second and third challenge).
In this ... |
Write a program/function that takes two integers in the range \$0\$ to \$255\$ inclusive, and returns whether the binary forms of the numbers are exactly one bit different.
For example, \$1\$ and \$0\$ have binary forms 00000001 and 00000000, which are one bit apart. Similarly, \$152\$ and \$24\$ are 010011000 and 000... |
The Arecibo message is a 1974 interstellar radio message carrying basic information about humanity and Earth sent to globular star cluster M13 in the hope that extraterrestrial intelligence might receive and decipher it... The message consisted of 1,679 binary digits, approximately 210 bytes...
The number 1,679 was ch... |
When writing a programm 1 missing character can ruin everything,
wouldn't it be great if the programm told you what was missing ?
Task:
Create any (non Empty) programm, that takes no input and outputs nothing.
That when 1 Character is removed from the programm, outputs that Character.
Input: None
Output:
Output nothing... |
Problem
You're stuck in a cabin in the middle of the woods, with only an old scrabble set to entertain yourselves. Upon inspection you see that the scrabble letters are so worn, that only the points for each letter are visible.
Nonetheless you decide to play a game. You pull seven letters from the bag and place them o... |
Your task is to take two single-variable integer polynomial expressions and multiply them into their unsimplified first-term-major left-to-right expansion (A.K.A. FOIL in the case of binomials). Do not combine like terms or reorder the result. To be more explicit about the expansion, multiply the first term in the firs... |
Challenge
Given some input string, return a truthy value if it represents a correct roman numeral between 1 (=I) and 3999 (=MMMCMXCIX), and a falsey value otherwise.
Details
The input is a non-empty string that only comprises the characters IVXLCDM.
The roman numerals (that we use here in this challenge) are defined a... |
Background
Recognizing primality seems like a poor fit for (artificial) neural networks. However, the universal approximation theorem states that neural networks can approximate any continuous function, so in particular it should be possible to represent any finitely-supported function one desires. So let's try to re... |
Inspired by this chat mini-challenge.
Given a string as input (ASCII printable characters only), output the string with the letters "raining" down. Each letter must be a random number of lines downward (random between 0 and the length of the string, each having non-zero probability), and only one character per column. ... |
Your task is to make a program that takes in an integer n > 1, and outputs the roll of a single n-sided die. However, this dice follows the rules for exploding dice.
When you roll the die, check what value you rolled. If you got the maximum for that kind of die (on a standard d4 that would be 4, or 6 on a d6, etc.), ro... |
Test Driver • Challenge Discussion • Submit Adventurer
(Image Source)
Several rival adventurers are raiding the ruins for treasure, but they can only carry so much at a time and have their limits of endurance. They want to get the most valuable treasure and get out before they become too tired to continue. They are tr... |
The Idea
We've done matrix spirals before, and full rotations, and even diagonal
rotations,
but not, as far as I can find, snake rotations!
What is a snake rotation?
Imagine the rows of a matrix snaking back and forth, with dividers between
them like the dividers of long queue:
+--------------+
1 2 3 4 5|... |
Challenge
You will be given an input represented by x, which is a string containing at least 3 characters. It will consist only of the standard numeric characters, 0 through 9. Your job is to find and output how many right triangles can be formed with the given numbers.
Rules
Numbers must be kept in the order they wer... |
Introduction
The idea is to use the asterisk character (star) * to display an ascii-art star at a specified dimension. The dimension is an input number greater than or equal to \$1\$ that specifies the height in lines of the upper point of the star. The stars here are intended to be six pointed stars with larger sizes ... |
Introduction (may be ignored)
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the fifth challenge in this series (links to the first, second, third and fourth challenge).
I... |
You are given an array/list/vector of pairs of integers representing cartesian coordinates \$(x, y)\$ of points on a 2D Euclidean plane; all coordinates are between \$−10^4\$ and \$10^4\$, duplicates are allowed. Find the area of the convex hull of those points, rounded to the nearest integer; an exact midpoint should ... |
The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows:
You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made o... |
Write a program, given an input n, will generate all possible n-tuples using natural numbers.
n=1
(1),(2),(3),(4),(5),(6)...
n=2
(1,1),(1,2),(2,1),(2,2),(1,3),(3,1),(2,3),(3,2),(3,3)...
n=6
(1,1,1,1,1,1) (1,1,1,1,2,1) (1,1,1,2,1,1)...
The output may be in any order that does not break any other rules.
The program... |
Your goal is to write a program that takes no input and outputs the following text:
ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos.
But there's a catch: for each letter (any character whose general category in Unicode starts with L) in your s... |
Python is the fastest-growing major programming language today. It is the most wanted language for the third year in a row, meaning that developers who do not yet use it say they want to learn it.[1]
The reason for Python's popularity is its many versions.[citation needed] There are in fact 116 versions of Python, incl... |
Given some positive integer \$n\$ that is not a square, find the fundamental solution \$(x,y)\$ of the associated Pell equation
$$x^2 - n\cdot y^2 = 1$$
Details
The fundamental \$(x,y)\$ is a pair of integers \$x,y\$ satisfying the equation where \$x\$ is minimal, and positive. (There is always the trivial solution \$... |
This! is an RGB colour grid...
Basically it's a 2-dimensional matrix in which:
The first row, and the first column, are red.
The second row, and the second column, are green.
The third row, and the third column, are blue.
Here are the colours described graphically, using the letters R, G, and B.
Here's how we calcu... |
You want to create a square chessboard. Adjacent tiles must alternate black and white like a standard chessboard, and the bottom left corner can be either black or white.
Your program will take in two positive integers, the number of black and the number of white tiles. These will always be less than 1024. You don't ha... |
Introduction:
A 3x3x3 Rubik's Cube has \$43,252,003,274,489,856,000\$ possible permutations, which is approximately 43 quintillion. You may have heard about this number before, but how is it actually calculated?
A 3x3x3 Rubik's Cube has six sides, each with nine stickers. Looking at the (external) pieces instead of sti... |
Introduction:
Inspired by these two SO questions (no doubt from the same class): print the elements in the subarray of maximum sum without adjacent elements java and Maximum sum of non adjacent elements of an array, to be printed.
Challenge:
Given a list of integers, output a subsequence consisting of non-adjacent elem... |
I came up with a series of numbers the other day and decided to check what the OEIS number for it was. Much to my surprise, the sequence did not appear to be in the OEIS database, so I decided to name the sequence after myself (note that someone else who's a lot smarter than me has probably already come up with this, ... |
Introduction (may be ignored)
Putting all positive integers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive integers. This is the sixth challenge in this series (links to the first, second, third, fourth and fifth chall... |
This happy individual is known in folklore as the Easter Bunny.
Colours
It is created using 4 colours:
Light pink
Dark pink
White
Black
(I'm happy for these colours to be approximated in your answer. It does not need to be this precise shade)
Shapes
It is constructed of these shapes:
Two tall ellipses in light pink... |
Each day you put up a new word on a marquee sign with movable letters, buying just the letters you need to write it. You re-use letters you've bought for earlier words whenever possible. Given the words you want to write each day in order, output the letters you buy each day.
Example
Input: ['ONE', 'TWO', 'THREE', 'S... |
Your task is to generate a nonsense word that is reasonably pronounceable with the specified number of 'syllables'. Each time the program is run possibly results in a different nonsense word.
Pronounceability
A pronounceable word is made up of syllables, which are in turn made up of a vowel group that is possibly sandw... |
Codegolf challenge - mapping values in a multidimensional array
[
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
]
This 2D array is sick of being so false, and wants to find the truth about life, once and for all. Your task is to write a map function to act as a highway to all the values in this array.
An example implementatio... |
(Title with thanks to @ChasBrown)
Sandbox
The Background
This challenge is inspired by a question that I recently posted on Puzzling Stack Exchange. Please feel free to follow the link if you are interested in the original question. If not then I won't bore you with the details here.
The Facts
Every printable standard... |
This is taken from this question (with permission ofcourse). I'll quote:
Create a function which takes a string, and it should return true or
false based on whether the input consists of only a repeated character
sequence. The length of given string is always greater than 1 and the
character sequence must have a... |
John, a knight wants to kill a dragon to escape the castle! The dragon has A heads and B tails.
He knows, that:
if you cut off one tail, two new tails grow
if you cut off two tails, one new head grows
if you cut off one head, one new tail grows
if you cut off two heads, nothing grows
To defeat the dragon, John needs ... |
Input
Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20.
Output
True if a1^(a2^a3) > b1^(b2^b3) and False otherwise.
^ is exponentiation in this question.
Rules
This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop PC.
You can output anything Truthy ... |
This question is tricky (and in particular harder than Which big number is bigger?), for those who like more challenging puzzles.
Input
Integers a1, a2, a3, a4, a5, b1, b2, b3, b4, b5 each in the range 1 to 10.
Output
True if a1^(a2^(a3^(a4^a5))) > b1^(b2^(b3^(b4^b5))) and False otherwise.
^ is exponentiation in this... |
A few hours earlier, I got this puzzle:
Suppose, you toss a coin n times, then what is the probability of getting m number of heads? ( where m belongs to the set of all prime numbers)
For instance, take n = 2, then
SS = { HH, HT, TH, TT }
So, output is 1/4 (for HH case)
Then, for n = 3,
SS = { HHH, HHT, HTH, THH, HTT... |
J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):
If \$A\$ is any positive integer having \$m\$ digits, there exists a positive integer \$N\$ such that the first \$m\$ digits of \$N!\$ constitute the integer \$A\$.
Challenge
Your challenge is given some \$A \geqslant 1\$ find a corresponding \$N \ge... |
Bob got kidnapped and is stuck in a maze. Your job is to help him find a way out. But since it is a very dark and scary maze, he can't see anything. He can only feel walls when he runs in to it, and knows when he has found the exit, but doesn't know anything more that.
Since he has to run your program by memory, it has... |
Brain-Flak is a stack-based esoteric language with eight commands:
() Evaluates to 1
<> Switch active stack; evaluates to 0
[] Evaluates to height of current stack
{} Pop current stack; evaluates to the popped number
(...) Execute block and push the result; evaluates as result
<...> Execute block; eva... |
Definitions:
A triangle is considered a right triangle if one of the inner angles is exactly 90 degrees.
A number is considered rational if it can be represented by a ratio of integers, i.e., p/q, where both p and q are integers.
A number n is a congruent number if there exists a right triangle of area n where all thr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.