instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
I only very recently discovered code golf and just found this part of the Stackexchange network, and naturally after looking at so many clever answers, I feel inferior. Inner me knows I'll get better over time, but inner me is also vain and needs validation.
At the same time, I don't take kindly to pandering, so you'd ... | stackexchange_codegolf |
Goal
Write a program or function that takes a positive integer n and randomly generate a legal series of pitches (henceforth called a Pitch string) of length n.
Input
A non-zero, positive integer n <= 100
Output
Return a random string, or list of characters, that represent a possible, valid pitch string of length n. Th... | stackexchange_codegolf |
Golomb rulers are sets of non-negative integers such that no two pairs of integers in the set are the same distance apart.
For example, [0, 1, 4, 6] is a Golomb ruler because all distances between two integers in this set are unique:
0, 1 -> distance 1
0, 4 -> distance 4
0, 6 -> distance 6
1, 4 -> distance 3
1, 6 -> di... | stackexchange_codegolf |
This is a program I wrote in JavaScript to validate some inputted credentials, with an intentional vulnerability. The credentials_validator function takes an object as input, with usernames and passwords. It returns a function, which takes a username and password and returns true if the credentials are valid.
Your chal... | stackexchange_codegolf |
Each natural number (including 0) can be written as a sum of distinct powers of integers (with a minimum exponent of 2). Your task is to output the smallest power required to represent \$n\$.
For example:
2 = 1^2 + 1^3 // Output 3
9 = 1^2 + 2^3 = 3^2 // Output 2
15 = 2^2 + 2^3 + 1^4 + 1^5 + 1^6 // Output 6
20 = 2^2 + ... | stackexchange_codegolf |
This is my friend Thomas. He is half tree, half emoticon.
| |
| :D |
| |
He is lonely. Let's make him some friends!
Given a text-based emoticon as input (e.g. ಠ_ಠ, :P, >_>, not , , or ), output the corresponding treemote.
A treemote's length is how many characters it is lon (basically most builtin length functi... | stackexchange_codegolf |
You are given two arbitrary integer lists, e.g. [-10, 99, -6, 43], [100, 32, 44]. You are to pick one integer from each list and sum them up, then sort the best pairs ordered by the absolute distance to 100 in ascending order. Paired up integers from each list shall not be repeated in the output.
For instance, we have
... | stackexchange_codegolf |
Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. (2, ウシロ) → ウ/シ\ロ.
To help you out with this, I'll explain a little about Japanese phonology.
Background: on moras
For the purpose of this challenge, we will write Japane... | stackexchange_codegolf |
The goal is to make a two frame animation with ASCII art of a hammer smacking a table.
Trailing white-space is allowed and the frames need to repeat continuously. The program should iterate over both frames with a time of 0.5 seconds between frames.
Lowest byte count wins for each language!
Sample:
Animation Frames:
Fr... | stackexchange_codegolf |
Is this Q too easy to ask, or has it just never been thought of?
Generate a random number, either 0 or 1 using a program
You may use a pre-defined function. The code must be executable. (It can't be just a function that requires more code to execute.) Randomness of the output will be verified by showing that it is no... | stackexchange_codegolf |
Given an image of a goat, your program should best try to identify whether the goat is upside down, or not.
Examples
These are examples of what the input may be. Not actual inputs
Input:
Output:
Downgoat
Spec
Your program should be at most 30,000 bytes
The input will contain the full goat
The picture will always cont... | stackexchange_codegolf |
The goal of this challenge is to print the following tongue twister:
She sells seashells by the seashore,
The shells she sells are seashells, I'm sure.
So if she sells seashells on the seashore,
Then I'm sure she sells seashore shells.
This is more complicated than just calling your language's print equivalent. Since ... | stackexchange_codegolf |
Can you write a program that renders to screen a group of pixels exploding apart (as in a simple particle engine) and can you do this in any remarkably small number of characters (key strokes)? (Recall the game lemmings, when those little guys would explode and their little pixel pieces fly apart.)
Someone programmed a... | stackexchange_codegolf |
In this challenge you will write a function that takes a list (ordered set) containing real numbers (the empty list is an exception, as it has nothing) and calculates
$$f(x)=\begin{cases}1 & \text{if } |x|=0 \\ x_1+1 & \text{if } |x|=1 \\
\log_{|x|}\sum_{n=1}^{|x|}{|x|}^{x_n} & \text{otherwise}
\end{cases}$$
where \$|x... | stackexchange_codegolf |
The Challenge
Given two vertexes and a point calculate the distance to the line segment defined by those points.
This can be calculated with the following psudocode
def dist(point, v1, v2):
direction := normalize(v2-v1)
distance := length(v2-v1)
difference := point - v1
pointProgress ... | stackexchange_codegolf |
Given a list of date ranges r as input, output or return any ranges not found in r.
For the sake of this example, input will be in YYYY-MM-DD format.
Let's say you have three date ranges:
[2019-01-01, 2019-02-01]
[2019-02-02, 2019-04-05]
[2019-06-01, 2019-07-01]
You can see that there is a gap in between 2019-04-05 an... | stackexchange_codegolf |
Let's define a simple 2D language, which we'll give the incredibly original name befinge. Befinge has 5 instructions:
<>^v, as in most 2D esolangs, redirect the instruction pointer in their respective directions.
. is a no-op.
The instruction pointer starts out at the top-left corner going right. If the instruction ... | stackexchange_codegolf |
Given a positive integer \$n\$, your task is to find out the number of partitions \$a_1+a_2+\dots+a_k=n\$ where each \$a_j\$ has exactly \$j\$ bits set.
For instance, there are \$6\$ such partitions for \$n=14\$:
$$\begin{align}&14 = 1_2+110_2+111_2&(1+6+7)\\
&14 = 10_2+101_2+111_2&(2+5+7)\\
&14 = 10_2+1100_2&(2+12)\\
... | stackexchange_codegolf |
Related: Program my microwave oven and Generate lazy values.
My colleague is so lazy that he doesn't even bother to move his finger when programming the microwave oven. (This is actually true!)
Help him find the microwave input that gives the time closest to what he wants, but where all digits are the same. If two inpu... | stackexchange_codegolf |
Every integer can be expressed in powers of 2. You know this as the binary system
Assume you are given a set of k numbers (0 < k < 2^n).
You want to decide for this set whether every integer power of 2 up to 2^(n-1) occurs at least m times
One example:
n = 7 (2^n = 128, )
k = 5
set =
{100,
91,
88,
63,
44}
m = 3
Solut... | stackexchange_codegolf |
You know what a palindrome, a prime and a date are.
Your task is to list all dates in 100 thousands of years that fulfill
all three characteristics.
Nevermind anything but the numbers, use the following formats: YYYYMMDD and YYYYYMMDD.
Dates between 0000-01-01 and 9999-12-31 should be printed as 8 digit palindrome... | stackexchange_codegolf |
This is the follow up question to standard Sudoku solver.
You are given a Sudoku grid where . represents an empty cell and the other cells are filled with numbers 0-8 (inclusive).
Rules:
All the numbers in Sudoku must appear exactly once in all left-top to right-bottom diagonals.
All the numbers in Sudoku must appear ... | stackexchange_codegolf |
Edit (Jan 24/2021): The original specification for the challenge had a few problems. Underneath the original text, I have added alternate conditions that were suggested by @caird-coinheringaahing (thanks for the tips).
There is a gameshow in the UK called "Countdown", and a parody called "8 out of 10 Cats does Countdow... | stackexchange_codegolf |
If we have a list of integers we can "squish" one of them by:
decrementing it
replacing adjacent values with its new value
For example in this list:
[1,2,8,3,6]
If we squish the 8 we get:
[1,7,7,7,6]
The question is:
Given a starting array, what is the largest we can make its sum by repeatedly squishing values?
For... | stackexchange_codegolf |
The challenge
Given a positive integer N, compute the proportion of N-step walks on a plane that don't intersect themselves.
Each step can have any of the 4 possible directions North, East, South, West.
A walk intersects itself if it visits a previously visited point.
Examples
N=1: a single-step walk obviously doesn'... | stackexchange_codegolf |
So, normally, this is a forbidden loophole to fetch the desired output from an external source. But this challenge is an exception ! In this challenge you will have to fetch data from the internet and output it to the SDTOUT.
The task
For the purpose of this challenge, you'll be the owner of the imaginary a.pi domain!... | stackexchange_codegolf |
If a string T of length K appears K or more times in a string S, then it is potentially communistic. For example, 10 in 10/10 is potentially communistic, for it appears 2 times and is of length 2. Note that these substrings cannot overlap.
A communistic transformation is one that takes this string T and moves each cha... | stackexchange_codegolf |
A piggy bank is a container used to collect coins in. For this challenge use the four US coins: quarter, dime, nickel, and penny.
Challenge
Your challenge is to create an electronic piggy bank. Write a program (or function) that when run (or called), outputs (or returns) the count of each coin you have, as well as the ... | stackexchange_codegolf |
Be sure to see the other challenge, Reverse ASCII character map!
The ASCII charset (American Standard Code for Information Interchange) is the most widely-used character encoding standard. ASCII codes represent text in computers, telecommunications equipment, and other devices.
Challenge
Your challenge is to print a ... | stackexchange_codegolf |
Over at our friends at Puzzling.SE, the following puzzle was posted: Is this chromatic puzzle always solvable? by Edgar G. You can play it here.
Puzzle explanation
Given a m x n grid with tiles of three different colours, you may select any two adjacent tiles, if their colours are different. These two tiles are then co... | stackexchange_codegolf |
The Sequence
Everyone knows the only even prime number is 2. Ho-hum. But, there are certain even numbers n where, when concatenated with n-1, they become a prime number.
For starters, 1 isn't in the list, because 10 isn't prime. Similarly with 2 (21), and 3 (32). However, 4 works because 43 is prime, so it's the first ... | stackexchange_codegolf |
I'm a musician, and I need more polyrhythms in my life!
A polyrhythm occurs in music (and in nature) when two events (claps, notes, fireflies flashing etc.) are occurring at two different regular intervals. The two kinds of event happen a different number of times in the same interval.
If I tap with my left hand twice,... | stackexchange_codegolf |
This is a fewest-operations challenge where the objective is to sort a vector into ascending order using the fewest reversals. Your algorithm can only sort the vector using "sub-vector reversals"1, but it can use other operations for arithmetic operations, loops, checking if it's sorted etc. The number of sub-vector re... | stackexchange_codegolf |
Lost is a 2-Dimensional programming language where the instruction pointer starts at a random location, moving in a random direction. A description of the language can be found at the bottom of the post for completeness' sake and a tutorial for the language can be found in the above link.
The task here is simple to de... | stackexchange_codegolf |
In this king-of-the-hill challenge, you will program a bot, consisting of a python function of the form
def BOTNAME(info, me, round):
pass # ... main body
Specifically, the function must run in python3.9. Each bot will be entered into the contest 10 times.
The arguments it take in are info, me, round. The three ar... | stackexchange_codegolf |
Totally not inspired by Visualize long division with ASCII art ;)
Your job is to show long hand addition with ASCII art. You solve longhand addition by adding up the columns right to left, placing the value of the ones place in the result, and carrying the tens place over to the top of the next column.
Input
Input can ... | stackexchange_codegolf |
Given an non-negative integer \$n \ge 0\$, output forever the sequence of integers \$x_i \ge 3\$ that are palindromes in exactly \$n\$ different bases \$b\$, where the base can be \$2 \le b le x_i-2\$.
This is basically the inverse of OEIS A126071, where you output which indices in that sequence have the value \$n\$. I... | stackexchange_codegolf |
The task is simple: given a 32 bit integer, convert it to its floating point value as defined by the IEEE 754 (32-bit) standard.
To put it another way, interpret the integer as the bit-pattern of an IEEE binary32 single-precision float and output the numeric value it represents.
IEEE 754 single precision
Here is a conv... | stackexchange_codegolf |
Balanced binary search trees are essential to guarantee O(log n) lookups (or similar operations). In a dynamic environment where a lot of keys are randomly inserted and/or deleted, trees might degenerate to linked lists which are horrible for lookups. Thus there are various kinds of self-balancing binary trees that cou... | stackexchange_codegolf |
Two or more positive integers are said to be "friendly" if they have the same "abundancy". The abundancy of an positive integer \$n\$ is defined as $$\frac {\sigma(n)} n,$$ where \$\sigma(n)\$ is the sum of \$n\$'s divsors. For example, the abundancy of \$30\$ is \$\frac {12} 5\$ as
$$\frac {\sigma(30)} {30} = \frac {1... | stackexchange_codegolf |
We all know run-length decoding: A list of character-length pairs expands to a string of that many characters, so A1B4C2 expands to ABBBBCC. But what if we stretch this concept to 2 dimensions?
Instead of character-length pairs, in this challenge you will be given character-length-direction triples. For example, using ... | stackexchange_codegolf |
Task:
Make a program that draws the following figure line by line.
Your program should wait for one-second after drawing each line(it can be longer, just has to be a noticeable difference) .
Your program can only draw line by line (you cannot jump to another point or re-draw over a line)
Given a positive integer n, pr... | stackexchange_codegolf |
Background
A Medusa have released a dangerous Hydra which is revived unless the exact number of heads it have is removed. The knights can remove a certain number of heads with each type of attack, and each attack causes a specific amount of heads to regrow. The knights have hired you to write a program or function that... | stackexchange_codegolf |
Challenge:
Given the input array l with a list of strings, only keep the elements in the sequence that have a letter that's repeated at least 3 times. Like 'lessons' has 3 s letters, so it should be kept in the sequence. But, 'lesson' has only two s letters, so it should be removed.
Notes:
l will always be a sequence,... | stackexchange_codegolf |
Common words should still be avoided to be used as passwords. This challenge is about coding a very simple program that munges a given password (Modify Until Not Guessed Easily).
Input
A word, which is a string written in the alphabet abcdefghijklmnopqrstuvwxyz. It does not matter if the letters are lowercase or upper... | stackexchange_codegolf |
Given a non-empty list of decimal digits (0, 1, ..., 9), replace each zero by the most recent nonzero, if possible.
Example 1: given
1 4 3 0 0 7 5 5 0 3
the output should be
1 4 3 3 3 7 5 5 5 3
Note how the first two zeros are replaced by 3, which is the most recent (i.e. rightmost) nonzero. Similarly, the last zer... | stackexchange_codegolf |
Your task, if you wish to accept it, is to write a program that outputs a non-zero number(can be integer or float). The tricky part is that if I reverse your source code, the output must be the original integer negated.
Rules
You must build a full program. That is, your output has to be printed to STDOUT.
Both the num... | stackexchange_codegolf |
Given a matrix consisting of positive integers, output the path with the lowest sum when traversing from the upper left element to the bottom right. You may move vertically, horizontally and diagonally. Note that it's possible to move both up/down, right/left and diagonally to all sides.
Example:
1* 9 7 3 10... | stackexchange_codegolf |
This is the cops thread of this cops and robbers challenge. The robbers thread is here.
Related, but hashes numbers instead of strings and uses a different scoring system.
Definitions
A hash collision is when two different strings produce the same hash.
Summary
In this challenge, the cops will make a hash function, wit... | stackexchange_codegolf |
When you resize an image down to a very small size, it looks very blocky when you scale the pixels back up individually.
In extreme cases, as above, you can no longer reconstruct the original image, as too much information has been lost. Your task is to build a program that will imagine what the original, unscaled im... | stackexchange_codegolf |
Given a UTF-8 string, give a string that represents byte counts of each characters.
Rules:
As long as the input string is encoded in UTF-8 (without BOM), its type doesn't matter. In C++, it can be char[] or std::string. In Haskell, it can be [Int8] or [CChar].
The output must be (in usual case) a string of ASCII digit... | stackexchange_codegolf |
Given a natural number \$n\$, return the \$n\$-th Leyland number.
Leyland Number
Leyland numbers are positive integers \$k\$ of the form
$$k = x^y + y^x$$
Where \$x\$ and \$y\$ are integers strictly greater than 1.
They are enumerated in ascending order.
EDIT: @DigitalTrauma suggested I include following "definition":
... | stackexchange_codegolf |
The city defines a dog as any living entity with four legs and a tail. So raccoons, bears, mountain lions, mice, these are all just different sizes of dog.
Given an ASCII-art image of an animal, determine if that animal is a dog.
Rules
An animal is a dog if it has four legs and a tail.
The foot of a leg starts with one... | stackexchange_codegolf |
Lorem Ipsum is placeholder text used when preparing layout without wanted to have content already filled.
One of its key features over using some arbitrary text is that it is nonsense.
It isn't even valid latin (though it is close).
This prevents anyone being shown the layout from becoming distracted reading the text.
... | stackexchange_codegolf |
This is a simple challenge which hopefully may lead to some creative answers.
Quoting Wikipedia: "Dual-tone multi-frequency signaling (DTMF) is an in-band telecommunication signaling system using the voice-frequency band over telephone lines between telephone equipment and other communications devices and switching cen... | stackexchange_codegolf |
Inspired by my geography class, Sandboxed
Simulate weathering / erosion.
Input
Input will be given as a string of any 2 characters (or see below) you like in the shape of the rock (here i use spaces and hashes):
###
####
#####
#######
#######
########
Or if your language doesn't support strings, a square matrix ... | stackexchange_codegolf |
I have just tried a game called Couch 2048.
(Note: You should have a look to better understand this question.)
Since it wasn't very exciting for me, I've been asking myself 'How much more till 2048!?'
That inspired me to post a challenge, because calculating this in not as easy as I thought.
Your goal:
Given a list of ... | stackexchange_codegolf |
Your task
Given a simple regular expression, you have to count how many strings of length n have a match of length n with the given simple regex. This will just be a subset of regexs. Like, no lookaheads or named groups or recursion or whatever weird things regexs have.
Simple regular expression
For the purposes of thi... | stackexchange_codegolf |
My PPCG holiday is over :D
Intro
Fractional time is the year + (the value (minute of year) / number of minutes in the year).
Example calculation
You should assume that February always has 28 days and the year is always 365 days long.
Let's say we want to convert the time: 17:34 3rd March 2013 to fractional time. Firstl... | stackexchange_codegolf |
Here's a simple challenge, so hopefully lots of languages will be able to participate.
Given a positive integer \$n\$, output \$A076039(n)\$ from the OEIS.
That is, start with \$a(1)=1\$. Then for \$n>1\$:
$$a(n)=\left\{ \begin{array}{ll} n\cdot a(n-1), & \text{if } n>a(n-1) \\ \lfloor a(n-1)/n \rfloor, & \text{otherw... | stackexchange_codegolf |
I need to go to the bank and withdraw some money. I need to withdraw $30, $22 to pay my roommate for the internet and $8 for laundry. Since neither of these can make change, I need my $30 to be split into two partitions of the two sizes. That means when the teller asks me how I want my $30 I am going to have to make... | stackexchange_codegolf |
We can arrange the positive integers like this:
1_| 2 | 5 | 10
4___3_| 6 | 11
9___8___7_| 12
16 15 14 13
That is, in L-shaped brackets expanding down and right infinitely.
Then, we can read it off with the antidiagonals:
1 2 5 10
/ / /
4 3 6 11
/ / /
9 8 7 12
/ / /
16 15 14 13
For the above, we rea... | stackexchange_codegolf |
Given string s of even length as input, randomly capitalize exactly half of the letters.
You can assume the input will always be a non-zero, even length
You can assume the input will consist of only lowercase letters ([a-z])
Exactly half of the letters should be capitalized in the output
Every permutation that has exa... | stackexchange_codegolf |
Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with.
Specifics:
Your language needs to support variadic argument functions: something callable that takes an arbitrary number of arguments and returns a value.
Parameters must be... | stackexchange_codegolf |
Note to mods, if the title doesn't do justice, change it to whatever, I thought it was funny.
You're tasked with hanging up the lights for this Christmas season, and your family has decided that for it to be a merry Christmas, you need to hang at least 2 Christmas lights on your house. So, your challenge is, given a n... | stackexchange_codegolf |
A standard road intersection contains 4 sidewalk corners and four crosswalks connecting them. It could also have 2 diagonal walks.
sRRRRs
iOOOOi
dAAAAd
eDDDDe
side0----1walk
ROAD|\ /|ROAD
ROAD| \/ |ROAD
ROAD| /\ |ROAD
ROAD|/ \|ROAD
side2----3walk
wRRRRw
aOOOOa
lAAAAl
kDDDDk
Not all 6 ... | stackexchange_codegolf |
This is the follow up question to standard Sudoku solver.
You are given a Sudoku grid where . represents an empty cell and the other cells are filled with numbers 0-8 (inclusive).
Rules:
All the numbers in Sudoku must appear exactly once in all left-top to right-bottom diagonals.
All the numbers in Sudoku must appear ... | stackexchange_codegolf |
You should write a program or function which receives the volume of a bowl and the volume of the water in it as input and outputs or returns an ASCII representation of a bowl with water in it with the desired volumes.
A bowl has the following structure:
\ /
\___/
The bowl has at least one _ character. The count... | stackexchange_codegolf |
Originally sandboxed by @xnor
Left-or-right is a very simple language @xnor made up. Its expressions are made of arrows < (left), > (right), and parentheses. The goal is to evaluate an expression to either < or >.
An expression A<B picks the left item A, while A>B picks the right one B. Think of < and > as arrows point... | stackexchange_codegolf |
Generate the following list of lists consisting of the unique last digits of the powers from 1 to 9 for the numbers [0..9]
[[0], [1], [2, 4, 8, 6], [3, 9, 7, 1], [4, 6], [5], [6], [7, 9, 3, 1], [8, 4, 2, 6], [9, 1]]
e.g. For the number 2 we have:
\$2^1,2^2,2^3,2^4,2^5,... \to 2,4,8,16,32,64,128,... \to 2,4,8,6,4,8,..... | stackexchange_codegolf |
Background
From Wikipedia: An Egyptian fraction is the sum of distinct unit fractions. That is, each fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, and all the denominators differ from each other. The value of an expression of this type is a positive rational number ... | stackexchange_codegolf |
You need to print A-Z like this:
1. A
2. B
3. C
4. D
5. E
6. F
7. G
8. H
9. I
10. J
11. K
12. L
13. M
14. N
15. O
16. P
17. Q
18. R
19. S
20. T
21. U
22. V
23. W
24. X
25. Y
26. Z
But your source code cannot use 1,2,4,6.
Trailing newlines in output allowed,, but leading ones not allowed.
Standard loopholes apply, shor... | stackexchange_codegolf |
The Animal-Alphabetical Sequence is an infinite string of letters built accordingly to the following procedure:
Start with the letter A;
Replace each letter with the name of the animal starting with such letter in the table below;
Go back to step 2.
For instance, the first four steps of the procedure give:
A
ADD... | stackexchange_codegolf |
This is a repost of Evolution of “Hello World!”, originally written by user Helka Homba
It should not be closed as a duplicated, due to meta consensus here.
The original was asked over two years ago and was last active more than six months ago. I have permission from Helka Homba to post this here
Since the original, ma... | stackexchange_codegolf |
You are developing some code to generate ID numbers. Policy requires that no ID numbers include the digit sequence 666.
Create a function (or your language's equivalent) which takes a positive integer parameter and returns the next integer that does not include 666 when that integer is expressed in decimal. (60606 is f... | stackexchange_codegolf |
You're driving a car in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to continue left, right, or straight. A sequence of choices that returns you to your initial state (street segment and direction) is called... | stackexchange_codegolf |
Say I have a pile of boxes:
AAA
BBB
I can create it in two steps:
BBB
↓
(empty)
---
AAA
↓
BBB
But with this:
AB
BA
I need three steps:
A
↓
(empty pile)
---
BB
↓
A
---
A
↓
B
BA
Your challenge
Given a pile of boxes, output the minimum number of steps needed to create that pile.
A step consists of dropping a ro... | stackexchange_codegolf |
There have been a couple of challenges involving doubling source code: here and here. The task we have here is a bit harder, but should be doable in almost every language.
In this challenge, you will take in an arbitrary positive integer. Your program must output that integer doubled.
When your source code is doubled, ... | stackexchange_codegolf |
Building a golfed rot13 encryptor is too easy because the letters are all the same order in the ASCII character space. Let's try a rot32 engine instead.
Your task is to build a function that takes a Base64 string as input and returns the same string but with each letter rotated 32 symbols from its original (in essence,... | stackexchange_codegolf |
Your task is to print this exact text:
z
yz
xyz
wxyz
vwxyz
uvwxyz
tuvwxyz
stuvwxyz
rstuvwxyz
qrstuvwxyz
pqrstuvwxyz
opqrstuvwxyz
nopqrstuvwxyz
mnopqrstuvwxyz
lmnopqrstuvwxyz
klmnopqrst... | stackexchange_codegolf |
Gemtext is a very simple markup format used by the alternative web protocol Gemini. Write a Gemtext to HTML converter.
From the Wiki:
A line of text is a paragraph, to be wrapped by the client. It is is
independent from the lines coming before or after it.
A list item starts with an asterisk and a space. Again, the r... | stackexchange_codegolf |
As per Luke's request and Peter Taylor's addition to this challenge.
Introduction
Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row loses. An interesting fact is that the maximum amou... | stackexchange_codegolf |
Introduction
The game Minecraft has a 1 in 10000 chance of showing "Minceraft" instead of "Minecraft" on the title screen.
Your challenge
Your challenge is to code a function or program that takes no input, and on average 1 of 10000 times, returns "Minceraft" and the rest of the time returns "Minecraft".
Scoring
This i... | stackexchange_codegolf |
Challenge
This challenge is pretty simple: Output the total number of possible Tweets. Given the fact that \$1{,}114{,}112\$ Unicode characters exist, and Tweets can be up to \$280\$ characters long, we calculate this number like so:
$$\sum_{l=1}^{280}1{,}114{,}112^l$$
Calculated, this number becomes:
13806352273767118... | stackexchange_codegolf |
Challenge
Assume two vectors \$\mathbf{a} = (a_1,a_2,\cdots,a_n)\$ and \$\mathbf{b} = (b_1,b_2,\cdots,b_n)\$ are given in an \$n\$-dimensional space, where at least one of \$b_1,\cdots,b_n\$ is nonzero. Then \$\mathbf{a}\$ can be uniquely decomposed into two vectors, one being a scalar multiple of \$\mathbf{b}\$ and on... | stackexchange_codegolf |
Definition
If you take the sequence of positive integer squares, and concatenate them into a string of digits (i.e. 149162536496481100...), an "early bird" square is one that can be found in this string ahead of its natural position.
For example, 72 (the number 49), can be found at an offset of 2 in the string, althoug... | stackexchange_codegolf |
"I want to go to the Araby bazaar to buy a present for the one I have fallen in love with. However, if I arrive too late all the stores will be closed and I won't be able to buy anything. Can you help me?"
Goal: Get the boy to Araby from North Richmond Street before all the stores close.
Actual Goal: Make sure the boy ... | stackexchange_codegolf |
Inspired by this question by @CᴏɴᴏʀO'Bʀɪᴇɴ.
Taken from the question:
Your task is simple: given two integers a and b, output ∏[a,b]; that
is, the product of the range between a and b. You may take a and b in
any reasonable format, whether that be arguments to a function, a list
input, STDIN, et cetera. You may ... | stackexchange_codegolf |
Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: je, tu, il, elle, nous, vous, ils, elles; followed by a space, the... | stackexchange_codegolf |
Given a multidimensional, rectangular array of nonnegative integers, sort it at every depth (lexicographically), starting from the innermost.
For example, with this array:
[ [ [5, 1, 4],
[10, 7, 21] ],
[ [9, 20, 2],
[4, 2, 19] ] ]
You'd sort at the deepest first:
[ [ [1, 4, 5],
[7, 10, 21] ],
[ [2,... | stackexchange_codegolf |
The Collatz Conjecture
The famous Collatz Conjecture (which we will assume to be true for the challenge) defines a sequence for each natural number, and hypothesizes that every such sequence will ultimately reach 1. For a given starting number N, the following rules are repeatedly applied until the result is 1:
While N... | stackexchange_codegolf |
Consider you have a hash function \$\mathcal{H}\$ which takes strings of length \$2n\$ and returns strings of length \$n\$ and has the nice property that it is collision resistant, i.e. it is hard to find two different strings \$s \neq s'\$ with the same hash \$\mathcal{H}(s) = \mathcal{H}(s')\$.
You would now like to ... | stackexchange_codegolf |
In this thread we use 32-bit signed integers (assuming the usual two's complement). For simplicity I shall call this type Int32. The range is from -2147483648 through 2147483647. Any two values can be successfully multiplied (the result is an Int32 as well) since we use multiplication without overflow checking (we only... | stackexchange_codegolf |
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} ... | stackexchange_codegolf |
Inspired by Make a Rectangle from a Triangle.
Task
There is a famous formula on the sum of first \$n\$ squares:
$$
1^2 + 2^2 + \dots + n^2 = \frac{n(n+1)(2n+1)}{6}
$$
It is known that this number is composite for any \$n \ge 3\$.
Now, imagine a collection of row tiles (a tile of shape \$1 \times k\$ with the number \$k... | stackexchange_codegolf |
In this king-of-the-hill challenge, you will program a bot, consisting of a python function of the form
def BOTNAME(info, me, round):
pass # ... main body
Specifically, the function must run in python3.9. Each bot will be entered into the contest 10 times.
The arguments it take in are info, me, round. The three ar... | stackexchange_codegolf |
Tichu is a card game in which players take turn playing sets of cards from a deck consisting of a standard 52-card deck, plus 4 additional cards:
the dragon, which has a greater value than any other card
the phoenix, which can act as a wildcard
the dog, which passes the turn to your partner
the Mah Jong, which has val... | stackexchange_codegolf |
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... | stackexchange_codegolf |
Toki pona is a minimalist constructed language, and thus it has minimalist phonotactics (rules describing what sounds make valid words).
Toki Pona has 8 consonant sounds m, n, p, t, k, s, w, l and j and 5 vowel sounds a, e, i, o, u. A single basic syllable in toki pona consists of any 1 consonant, any one vowel and op... | stackexchange_codegolf |
We've all seen those online "maths hax" that look like this:
Think of a number, divide by 2, multiply by 0, add 8.
And, by magic, everyone ends up with the number 8!
Language
Let's define a programming language which uses the syntax of the text above, called "WordMath". WordMath scripts follow this template:
Think of... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.