instruction stringlengths 34 53.1k |
|---|
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... |
Write a program that when given a string \$S\$, it generates a program of the same language as itself.
The generated program, when given a continuous substring of \$S\$, should predict the next character in an occurence of the subtring in \$S\$. You are guaranteed that this substring occurs exactly once in \$S\$ and do... |
Task
Given the x,y coordinates (coordinates are guaranteed to be integers) of the vertices of two simple polygons in clockwise or anti-clockwise order. Output a Truthy value if both the polygons are similar otherwise a Falsy value
A simple polygon is a polygon that does not intersect itself and has no holes. That is, i... |
Objective
Take \$a \in ℤ_{>1}\$ and \$b \in ℤ_+\$ as inputs. Write a function \$f\$ such that:
$$
f(a,b) =
\left\{
\begin{array}{ll}
\log_ab & \quad \text{if} \space \log_ab \in ℚ \\
-1 & \quad \text{otherwise}
\end{array}
\right.
$$
Rules
Types and formats of the inputs doesn't matter.
Type a... |
Context
Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. This is the basic skeleton almost everyone follows.
Task
Your task, should you choose to accept it, is to write a program/f... |
There has been a question about yes in the past, but this one is slightly different. You see, despite yes having a rather long size, it is incredibly fast. Running the following command:
timeout 1s yes > out
yields a file that is 1.9 GB. Compared to this program:
int puts();main(){while(1){puts("y");}}
which yields a... |
CodeDrawing one-liner
Teaser
Behold this formidable drawing:
Can you draw this in a single stroke? Give it a try.
Can you do this one, now:
Give it a try.
How it works
These "make this drawing with one pen stroke" problems are graph-theory problems with a rather simple solution. For each vertex, compute its degree. I... |
Pipe a short stream to the following Java program run with accompanying command line options, such that it prints true.
class Code implements java.io.Serializable {
private static final long serialVersionUID = 0L;
private static long count;
@Override public int hashCode() {
++count;
return... |
Rules
You will receive as input a list that contains integers and strings. Your task is to move all of the strings to the end of the list and all of the integers to the beginning of the list.
This is code-golf so the answer with the least number of bytes wins.
|
Inspired by Find the largest fragile prime
A recurring prime (or whatever you choose to call it) is a prime that, when removing leading digits, always remain prime regardless of how many digits are removed.
for example
6317 is a recurring prime because...
317 is a recurring prime because...
17 is a recurring prime beca... |
I like pizza!
Task
Given the radius of a pizza and a list of ingredients, create the corresponding ascii pizza!
Example size 4 pizza with mozzarella cheese, olives and ham:
#####
#@@@@M#
#H@O@@@@#
#M@@@H@@#
#@OO@@@@#
#@@H@@@@#
#M@M@@@@#
#O@@@H#
#####
Input
A positive integer r for the size of the pizza and... |
Print the biggest-size subset of strings in the input that are all permutations of each other. If there are ties, any one will do. If no strings are permutations of each other (for example, only one string was given or the strings contain distinct characters), this is just one of the strings. If no strings were passed ... |
You are given four integers: \$e,s,b\in\{0,1\}\$ and \$S\in \{0,1,2,4\}\$, where \$e,s,b,S\$ stand for egg, sausage, bacon and spam respectively.
Your task is to figure out whether the corresponding ingredients match a valid entry in the following menu:
[e]gg | [s]ausage | [b]acon | [S]pam
-------+-----------+--------... |
Sandbox
Finding radicals of arbitrary ideals in rings is hard! However, it's a doable task in polynomial rings, since they are Noetherian (all ideals are finitely generated)
Background
A quick introduction to radical ideals
A ring is a set, paired with two binary operations + and * such that 0 is a additive identity, 1... |
Game of Game of Life
Conway's Game of Life is a 0-player game. But that's okay! We can make it a multi-player game.
This game is played on the smallest square grid that will accommodate a 6x6 square for each player (12x12 for 2-4 players, 18x18 for 5-9 players, etc). This grid is actually a torus, so it wraps in bot... |
Context
At Hogwarts School of Witchcraft and Wizardry, students are sorted into 4 houses, Gryffindor, Ravenclaw, Slytherin and Hufflepuff. This sorting is done by a magical hat, called the Sorting Hat.
Task
Your task is to code a sorting hat. In other words, you should create some deterministic rule that, given the nam... |
Here, x (supplied as input) and n (the result of your computation) are both positive integers. n * x = n shifted. Find n.
Here's an example of shifting:
123456789 -> 912345678
abcdefghi -> iabcdefgh (letters = any 0~9 digit)
123 -> 312
Shifting only happens once to the right. Shifting left, e.g.
123456789 -> 234... |
The purpose of this task is to write a program or function to find the most common substring within a given string, of the specified length.
Inputs
A string, s, of any length and characters that are valid as inputs for your language.
A number, n, indicating the length of substring to find. Guaranteed to be equal to or... |
Background
Famously, the acronym GNU stands for GNU's Not Unix. 1
It's recursive because, after expanding it once, it still contains the acronym GNU, and so must be exanded again:
(GNU's Not Unix)'s Not Unix
And so on, ad infinitum. Visualizing this, we get a kind of Droste effect:
┌─────────────────────────────────... |
Context
If a0 and b0 are two decimal numbers, with a and b representing the decimal expansion of all digits but the least significant one, then we know that
$$\frac{a0}{b0} = \frac{a{\not\mathrel0}}{b{\not\mathrel0}}= \frac{a}{b}$$
Phony fraction
A phony fraction is a fraction where the numerator and denominator share ... |
Context
From Wikipedia:
A polyomino is a plane geometric figure formed by joining one or more equal squares edge to edge.
one-sided polyominoes are distinct when none is a translation or rotation of another (pieces that cannot be flipped over). Translating or rotating a one-sided polyomino does not change its shape.
In... |
Task
Given a positive integer n, draw the corresponding rocket.
Examples
From n = 1 to 4 the rockets are below. For your program's output, the trailing newline after a rocket is optional.
|
/ \
*---*
| o |
| o |
*---*
/_\
|
/ \
/ \
*-----*
| o o |
| o o |
| o o |
| o o |
*-----*
/___\
|
/ \
/ ... |
Based on this Numberphile video
A self-locating string is a number (or set of numbers) in a decimal expansion which corresponds to its location, from the start of the decimal.
For example, take the number:
.2734126393112
Here, we can identify certain items quickly, e.g:
.27 _3_ _4_ 1263 _9_ 3112
There are a few more ... |
Task
Your task is to generate a password that is both secure and short in the fewest bytes possible given an integer seed as input.
Input
No seed
Or
An integer seed
Output
A password
Scoring
Your score is how many seconds the password takes to crack on How secure is my password divided by (bytes * password length)
Scor... |
Context
In this challenge, a random walk is a stochastic process in which a particle at a position with integer coordinates (or a drunk man) moves at each integer time step (that is, at t = 1, 2, 3, ...) by taking a step of size 1 to any of its neighbouring positions, with the direction of the step being aligned with t... |
Context
As a conlanger, I am interested in creating a uniform, naturalistic language. One of the tricks is to create vocabulary according to certain structures of words. An example from English: In English, we have the word “tap” structured consonant-vowel-consonant. Usually, this means that there are many other words ... |
Objective
Given an ASCII character, toggle its "shift-ness" on the standard US keyboard (ANSI-INCITS 154-1988 (R1999)), then output it.
Mapping
) ↔️ 0
! ↔️ 1
@ ↔️ 2
# ↔️ 3
$ ↔️ 4
% ↔️ 5
^ ↔️ 6
& ↔️ 7
* ↔️ 8
( ↔️ 9
" ↔️ '
+ ↔️ =
, ↔️ <
- ↔️ _
. ↔️ >
/ ↔️ ?
: ↔️ ;
(Capital Latin letters) ↔️ (Small Latin letters)
[ ↔️ {
\... |
You're writing your favorite language and you want to display the following string: abcdefghijklmnopqrstuvwxyz to your happy customer. Unfortunately, your keyboard is broken and you can now only type symbols !+-*/[]().
You must submit a code that evaluates to be the string abcdefghijklmnopqrstuvwxyz or print the string... |
Given a string of brackets tell the user whether or not the brackets are well matched or not. Brackets include []{}(). For example:
() <---- Well Matched
([{}][]) <---- Well Matched
({)} <---- Not Well Matched
({]) <----- Not Well Matched
This is a code-golf challenge so as always the shortest solution wins.
|
Background
There's a terrible problem in my console - the quotes never get included inside the arguments! So, when given this argument:
["abc","def","ghi","jkl"]
it says that the argument is like this:
[abc,def,ghi,jkl]
It would be very nice if you can fix this problem!
Challenge
Add double-quotes (") in order to sur... |
Background
We define a circular step sequence of order \$n\$ as follows:
$$
a_1, a_2, \dots, a_n = \text{Permutation of } 1 \dots n \\
b_i = \min ( |a_{i+1} - a_i|, n-|a_{i+1} - a_i| ), 1 \le i < n \\
\text{Circular step sequence} \stackrel{\text{def}}{=} b_1, b_2, \dots, b_{n-1}
$$
Informally, it is the \$n-1\$ distan... |
A binary multiple of a positive integer k is a positive integer n such that n is written only with 0s and 1s in base 10 and n is a multiple of k. For example, 111111 is a binary multiple of 3.
It is easy to show that a positive integer has infinitely many binary multiples. See here for a construction proof of one binar... |
Context
After "Computing a specific coefficient in a product of polynomials", asking you to compute a specific coefficient of polynomial multiplication, I wish to create a "mirror" challenge, asking you to compute a specific coefficient from polynomial division.
Polynomial division
Let us establish an analogy with inte... |
A time in the format hhMMss is represented by six numbers in the range 0..9 (e.g.100203 for 3 seconds after 2 minutes after 10am (10:02.03), or 155603 for three seconds after 56 minutes after 3pm (15:56.03).
Treating these times as integers, these numbers are therefore in the range 000000 to 235959; but not all numbers... |
This challenge is inspired by a talk about Schläfli symbols, etc that I gave in a Geometry seminar. While I was putting together this challenge, I saw that Donald Knuth himself was interested in (some subset of) this problem. In October 2016, he commented on a related OEIS sequence:
If [the OEIS author] is wrong about... |
Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values.
The challenge is to write the shortest program that takes a polynomial, of degree at most 4, and simply returns how many distinct real roots said polynomial... |
Description of the problem
Imagine a quarter of an infinite chessboard, as in a square grid, extending up and right, so that you can see the lower left corner. Place a 0 in there. Now for every other cell in position (x,y), you place the smallest non-negative integer that hasn't showed up in the column x or the row y.
... |
Simple challenge: The code must be both valid Lisp and valid Fortran, and must print out "hello world" in both.
Note: I've sunk about 5 hours into this at this point, I'm not even sure it's possible at this point...
Details:
Must be in a single source file.
Any version of Fortran and any Lisp are allowed (specify whic... |
Task
Write a program/function that when given a positive integer \$n\$ and a digit \$d\$ which is not 0 outputs a way to represent \$n\$ using only addition, subtraction, multiplication, exponentiation, division, concatenation, parenthesis and the digit \$d\$.
Examples
n = 6, d = 1 => (1 + 1) * (1 + 1 + 1)
n = 6, d... |
This will turn into a series involving other aspects of calculus, including using the "derivative" of a string to find "stationary points" etc, as well as "integration" of sentences
Introduction
If y'all have ever studied calculus, you'll most likely know that differentiation is limited to differentiable functions.
No... |
Definitions:
A palindrome is a string which reads the same backward or forward (not counting spaces or special characters), such as "madam" or "Sorel Eros".
A date is said to be a palindrome when its dd-mm-yyyy format is a palindrome (or any other local representation).
Two strings are said to be anagrams when the co... |
The point of this challenge is to find the smallest positive integer that uses up at least all of the digits supplied in the input after it is squared and cubed.
So, when provided an input such as 0123456789 (i.e. a number that finds the result):
69² = 4761
69³ = 328509
It means that 69 is the result of such an input.... |
The Monkey has swung home to find his tree all in pieces.
He likes order and scoops up all his 'tree-parts' and sets them out in 3 groups.
The Monkey's 3 nested lists:
STEP = [['S', '1', 'B', '3'], ['S', '3', 'B', '11'], ['S', '5', 'B', '12'], ['S', '4', 'B', '13'], ['S', '2', 'B', '14']]
TRANSITION = [['T', '2', 'B',... |
Task
Given a string composed of ASCII printable characters, return how many strings could fit the given pattern with character literals and regex-like ranges.
Pattern string
The pattern string follows this grammar (the | means an option and the * means 0 or more occurrences of whatever was immediately to the left):
pat... |
Setup: For two sets \$A,B\$, we say \$A \subseteq B\$ if every element in \$A\$ is also in \$B\$.
Another way of saying this, is that we can order the elements of \$A,B\$ into two lists \$L_A,L_B\$, such that \$L_A[i] = L_B[i]\$ where \$i\$ ranges over the indices of \$L_A\$.
We proceed to extend this idea, to define ... |
Write a script that outputs A to stdout infinitely.
There should be no newlines or separators between the characters.
Standard loopholes apply.
This is code-golf. The shortest solution in each language wins.
|
[ CODE GOLF]
BAM! - Fire and Smoke
Your Oscilloscope has exploded from one too many waves.
Re-create these waves assuming the following:
All waves are Sine Waves
An amplitude of 1 spans 3 lines (Therefore and amplitude of 2 would span 5 lines) [Vertically]
We want to see 100 characters worth of sine (Can be any ch... |
Task
As input you have:
a positive integer N
And you should output:
The number of integers in \$[1,N]\$ (an inclusive range) which end with the digit \$2\$ in base ten.
Test cases
1 -> 0
2 -> 1
5 -> 1
10 -> 1
12 -> 2
20 -> 2
30 -> 3
54 -> 6
97 -> 10
100 -> 10
Rules
It is a code-golf so the lowest score in bytes wi... |
How many petals around the rose
How many petals around the rose is a dice game you can play with your friends. Similar to "can I join the music box", there is a person that knows how the game works and the others have to discover the rule.
In this game, someone rolls some dice (usually two or more) and then people have... |
Context
(Feel free to skip, doesn't really matter for the algorithmic explanation of the task)
European Portuguese is a fairly complicated language to learn, mostly because of its grammar. One particular annoying thing is conjugating the verbs correctly:
We have this mechanism that, when we have a verb followed by a no... |
"All roads lead to Rome" is a saying that essentially means there are plenty of different ways of achieving an objective.
Task
Your task is to write a program that finds a set of link connections from one Wikipedia page to the Wikipedia page about Rome.
Notice that it is not enough to find the word Rome with a hyperlin... |
Introduction
The \$n\$-ellipse is a generalization of the ellipse with possibly more than two foci. Specifically, given \$n\$ points on the plane, called foci, the \$n\$-ellipse is the set of points of the plane whose sum of distances to the \$n\$ foci is equal to a constant \$t\$.
This challenge is about plotting the ... |
Given a strictly positive integer n (therefore 0 isn't a valid test case), produce an approximate triangle of height n.
A non-programmatic process of drawing the picture
Initially we start with the base of the triangle.
|
So, we want to draw a triangle of a height of 5. First we know that all the |'s align on a straig... |
Task
Your task is to take a character in:
AÁÀÃÂBCÇDEÉÊFGHIÍJKLMNOÕÓÔPQRSTUÚVWXYZaáàãâbcçdeéêfghiíjklmnoõóôpqrstuúvwxyz
and turn it into a characters in:
AAAAABCCDEEEFGHIIJKLMNOOOOPQRSTUUVWXYZaaaaabccdeeefghiijklmnoooopqrstuuvwxyz
by the obvious operation: dropping the accents in the letters.
Input
A character in any se... |
Miller-Rabin test
Given a base \$b\$ and an odd number \$n\$:
Write \$n\$ as \$2^{s}\times d + 1\$ where \$d\$ is odd
\$n\$ is a strong probable prime if either:
\$b^d\equiv 1 \pmod n\$
\$b^{d\cdot2^r}\equiv -1 \pmod n\$
for any non-negative \$r\$ strictly less than \$s\$.
A strong probable prime which is composite ... |
Sometimes I make bad jokes... And a bad joke I like to make involves interpreting exclamation marks in sentences as the factorial sign.
Task
Your task is to write a program that receives a sentence and applies the factorial joke to the sentence.
The "factorial joke" consists of looking for exclamation marks "!" and doi... |
Task
Given an integer matrix M and a modulus m, find an inverse of M modulo m. If the matrix M is not invertible modulo m, the behaviour is left unspecified.
Matrix inverse
If M is a square matrix, its inverse exists if and only if its determinant is not 0. Similarly, when we are talking about matrices modulo m, the in... |
I'm recieving 2-dimensional positions of two objects as a string with this format: x1,y1,x2,y2. The string is recieved from a readline call (replaced in the snippet with a prompt).
In order to get the horizontal and vertical position differentials, I'm writing the following code:
[x1,y1,x2,y2]=prompt("Please enter th... |
My robot for generating Mad Libs-style sequence challenges has gone rogue! To defeat it, I need you to write code that can solve all the challenges it can crank out.
Your input is three selections for the blanks A, B, C, each from (1,2,3), specifying the sequence challenge to solve, and the number \$n\$ that's the inpu... |
Write the shortest program that prints, in order, a complete list of iPhone iterations, according to this site:
iPhone
iPhone 3G
iPhone 3GS
iPhone 4
iPhone 4S
iPhone 5
iPhone 5c
iPhone 5s
iPhone 6
iPhone 6 Plus
iPhone 6s
iPhone 6s Plus
iPhone SE
iPhone 7
iPhone 7 Plus
iPhone 8
iPhone 8 Plus
iPhone X
iPhone XR
iPhone XS... |
Challenge
You will be given a string as an argument. You need to convert that string to upper case. But you can't use any built in method or function nor any external programs.
Rule
No use of built in methods or functions or external programs. Only arithmetic, bitwise, logical operators, regex, replace, split, join, A... |
She said s(he) be(lie)ve(d), he said sbeve.
Input
A non-empty string, s. It's guaranteed that s will have only printable ASCII characters and at least one word (defined as [A-Za-z0-9]+) in parentheses, and all parentheses will be closed respectively.
Output
A string containing all non-whitespace characters (whitespa... |
Correct a single-letter typo in a fixed text.
Input: The paragraph below but with exactly one typo, where a single letter a-zA-Z is replaced by a different letter a-zA-Z. To be clear, the letter isn't replaced everywhere it appears, but just in that one place. For example, the first word "In" might become "IZ". Non-let... |
Background
In JIS X 0208 a 94 by 94 map (kuten (区点)) is defined to encode Chinese characters (kanji), phonetic moras (kana) and other symbols. Along with this standard there are 3 different encodings that maintain 1-1 correspondences with the map, namely JIS, Shift_JIS and EUC. These encodings take 2 bytes for each cha... |
Write a program or function that fulfills the following
Scores less than 101 bytes under normal code-golf rules
Takes no input1 and always outputs a single integer.
Every integer is a possible output.
Your score will be the probability of the most frequent integer occurring, with a lower scoring being the goal. That... |
There are 5 different "special characters": % & # $ !
These special characters are in a string with numbers. Like so: "5 ! 60%2$5.3" (valid). You must determine the validity of the string and there are certain rules in order to determine validity of the string.
Rules:
These special characters can exist in a string... |
In this challenge you will take a an ascii art image of a highway like so
| | | | | |
| | | |
| | | | | |
| | | |
| | | | | |
| | | |
| | | | | |
And you need to put rain across its lanes like so
|\\\|\\\| |\\|\\|
|\\\\\\\| |\\\\\|
|\\\|\\\| |\\... |
This is a simple game of getting rid of those damn numbers.
You start with the numbers from 1 to 19, written in a grid of 9 by 3:
1 2 3 4 5 6 7 8 9
1 1 1 2 1 3 1 4 1
5 1 6 1 7 1 8 1 9
You may notice that the number 10 is missing, this because the number zero would be hard to get rid of later on.
The two rules are:
I... |
Task
Given a set of n unique elements and a multiset l of positive numbers that add up to n, find all the ways of partitioning those unique elements into disjoint sets with sizes given by the elements of l.
(A multiset is a set that allows repeated elements)
The point here is that we are taking everything in the output... |
There are 10 types of people in the world, those who understand binary and those who do not.
Where are you? Let's see!
Challenge
Your task is to convert a decimal integer to binary, only using a set of arithmetic operators (+, -, *, / and %). You can use conditional statements, loops and variables. (No bitwise operator... |
This challenge initially appeared in this challenge as a an extra brain teaser. I am posting it with permission from the original author so that we can have a formal competition.
Your task here will be to implement a function1 that forms a permutation on the positive integers. This means that each positive integer ... |
[Question inspired by Can you calculate the average Levenshtein distance exactly? . Thank you Anush. ]
The longest common substring between two strings is the longest substring which is common to both. Please note this is not the same as the longest common subsequence whose fastest algorithm takes quadratic time.
The ... |
You have a square board with a bunch of items laid out on it in one of a \$3 \times 3\$ grid of cells and you want to lift it up using balloons, but you can only attach balloons to the corners of the board. Your task is to determine the minimum number of balloons in each corner to make sure the board won't tip over in ... |
Given an positive integer n (including 0 if you decide to support it), output all numbers in the generated sequence up to the index n. For the current test cases of the current challenge numbers are one-indexed. Feel free to submit 0-indexed answers though.
Base sequence
We start from this sequence (NOT, but quite simi... |
Task
Given a input string s which contains only printable ascii characters output all strings which contain only printable ascii characters and are strictly smaller than s in any order
String a is strictly smaller than a string b if either of the following is true:
len(a) < len(b)
len(a) == len(b) and string a is lexi... |
Inspiring myself on a recent challenge, we ought to compute a sequence that is very close to A160242.
Task
Your task is to generate the sequence \$ \{s_i\}_{i=0}^\infty \$:
1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 1, ...
Which is more easily understandable in this format:
1 2 1
1 2... |
Your task is to write a program or function that takes as input a list of positive integers and determines if there are any two integers in the list, that both appear the same number of times.
For example the list
[1, 2, 3, 2]
Has one 1 and one 3 so it satisfies the condition.
But the list
[3, 2, 2, 1, 2, 3]
does not... |
I am quite proficient in C++ and Java and want to learn competitive programming to participate in contests like Google codejam and other online contests held on sites like CodeChef and Codeforces. I would like to get information about any free resources including websites and courses to learn the "sport". Book suggesti... |
This challenge like some of my previous challenges will have you counting free polyforms, which are generalizations of Tetris pieces.
This code-golf challenge will have you count polyomino-like polyforms on hypercubes. In particular, this challenge is to write a program that takes in three parameters:
n, which represe... |
We know that not all fractions have a terminating binary representation. However every fraction can be written as a leading portion followed by a repeating portion. For example \$1/3\$ starts with \$0.\$ and then just repeats \$01\$ endlessly. This corresponds to the bar notation taught in primary school. For examp... |
Note: Bot Factory KoTH (2.0) is now posted; you're probably looking for that one instead!
In this challenge, bots (consisting of JS functions) move around an infinite factory (playing field), collecting characters (UTF-16). These characters can be used to build worker bots, or droppedfor other bots to pick up.
Results
... |
The system
Assume the Earth is flat and that it extends infinitely in all directions. Now assume we have one infinitely long train railway and n trains in that railway. All trains have different speeds and all trains are going in the same direction. When a faster train reaches a slower train, the two trains connect (be... |
Background
Binary Sudoku, also known as Takuzu, Binario, and Tic-Tac-Logic, is a puzzle where the objective is to fill a rectangular grid with two symbols (0s and 1s for this challenge) under the following constraints:
Each row/column cannot have a substring of 000 or 111, i.e. one symbol cannot appear three times in ... |
Challenge
Your task is to generate a string using this sequence:
1,1,2,1,1,2,3,2,1,1,3,2,4,2,3,1,....
Which is more understandable in this format:
1
1 2 1
1 2 3 2 1
1 3 2 4 2 3 1
1 4 3 2 5 2 3 4 1
The pattern increases the number of Digits in the string by two for each increment in the Value of N
For each integer val... |
Challenge
Your goal is to write a function that puts quotes around a sequence of capital letters in a string.
So some examples (everything on the left (before function) and right (after function) are STRINGS):
Hello the name's John Cena -> "H"ello the name's "J"ohn "C"ena
I got BIG OLD truck -> "I" got "BIG" "OLD" truc... |
Challenge
Print the numbers:
1
22
333
4444
55555
666666
7777777
88888888
999999999
In that order.
I/O
Takes no input. The numbers can have any delimiters desired (or none). That includes lists, cell arrays, .jpeg, etc.... Example outputs:
122333444455555666666777777788888888999999999
[1,22,333,4444,55555,666666,77777... |
This challenge is inspired by @LuisMendo's MATL answer to my "binary multiples" challenge.
Task
Pick a code-golf challenge that is open and that has been posted before this one; let me call it the "linked challenge". The linked challenge must be a challenge whose task involves producing output.
Write the shortest code ... |
This code-golf challenge will have you computing OEIS sequence A300154.
Consider a spiral on an infinite hexagonal grid. a(n) is the number of cells in the part of the spiral from 1st to n-th cell that are on the same [row*] or diagonal (in any of three directions) as the n-th cell along the spiral, including that cel... |
Here are the first 100 numbers of a sequence:
1,2,33,4,55,66,777,8,99,11,111,12,133,141,1515,1,11,18,191,22,222,222,2232,24,252,266,2772,282,2922,3030,31313,3,33,33,335,36,377,383,3939,44,441,444,4443,444,4455,4464,44747,48,499,505,5151,522,5333,5445,55555,565,5757,5855,59559,6060,61611,62626,636363,6,66,66,676,66,666,... |
Identify each letter of the English alphabet with the number denoting its position in the alphabet, that is,
a = 1, b = 2, c = 3, ..., z = 26
(no distinction between lower and upper case letters is made). Every other character is identified with 0.
The "sum" of a word is the sum of its characters, for example: the su... |
Introduction
The current coronavirus disease is officially named COVID-19, from the 3 words corona virus disease, and the year 2019. (Technically it's coronavirus, making 2 words, but whatever...)
Given this example, we can apply this naming convention to name other potential diseases.
Challenge
You will be given 3 wor... |
In this challenge, bots must survive as long as possible. In each turn, the bot with the most HP is eliminated.
This challenge is inspired by the Smallest unique number KoTH.
Results
After 100,000 rounds:
Jack: 63390
The Follower: 4942
The Algorithm: 2452
The Randomiser: 140
Toe Tipping: 0
EZ: 0
The Average: 0
LowProfi... |
Goal
Write a program or function that returns the day of the week for a date, eg.
01/06/2020 -> Mon
However, it's unknown if the date is in the format mm/dd/yyyy or dd/mm/yyyy. If you can be certain of the day of the week, return it. If there is uncertainty, return an error.
02/07/2020 -> Err (Thu? Fri?)
Input... |
Pure data is a graphical programming language designed for audio processing. This makes it unsuitable for most general programming but especially unsuitable for code-golf.
It would then be nice to have a tips question so that people can get a first foot up in this language.
What tips are there for golfing in Pure Data... |
Symja is a "computer algebra language & Java symbolic math library for Android NCalc calculator". It's a fun little language, so I'm wondering if y'all have any tips for golfing in Symja.
As per usual, "remove comments", etc, isn't really an answer. It turns out that there is no comment system in Symja, so "remove com... |
Context
When I was a little kid, I watched a Disney movie where Goofy told his son "Boy, even a broken clock is right two or three times a day." (see this youtube clip, courtesy of @Arnauld).
Rationale
Given the previous statement, we wish to look at a clock that is stopped and answer the following question: is this cl... |
Let's consider the sequence of the binary representation of positive integers (without any leading zero):
1 2 3 4 5 6 7 8 9 10 11 12 ...
1 10 11 100 101 110 111 1000 1001 1010 1011 1100 ...
If we join them together, we get:
1101110010111011110001001101010111100 ...
If we now look for the pattern... |
A directed graph G is given with Vertices V and Edges E, representing train stations and unidirectional train routes respectively.
Trains of different train numbers move in between pairs of Vertices in a single direction.
Vertices of G are connected with one another through trains with allotted train numbers.
A hop is ... |
Natural numbers ≡ \$\mathbb{N}≡\{0,1,2,...\}\$
The submission can be either a program or a function, both cases will henceforth be referred to as "function".
The task is to golf the shortest function \$\mathbb{N}^n→\mathbb{N}\$, i.e. a function that maps \$n\$ natural numbers (with \$n>0\$ being a number of your choosi... |
In the shortest amount of code in any programming language, filter out the duplicate items in an array of which the order is irrelevant.
Here are some test cases:
[1, 2, 2, 3, 1, 2, 4] => [1, 2, 3, 4]
['a', 'a', 'b', 'a', 'c', 'a', 'd'] => ['a', 'b', 'c', 'd']
I also should note that there currently aren't any open q... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.