instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
When I write documentation, comments, etc. I love making ASCII tables. They usually end up looking pretty good, but I always feel that they could look even better - especially since UTF-8/Unicode includes the box drawing characters. However, these characters are very burdensome to use, requiring several key presses to ... | stackexchange_codegolf |
Happy Pi Day everyone! For no reason at all, I'm trying to construct a Monte Carlo estimator of Pi that is as short as possible. Can we construct one that can fit in a tweet?
To clarify, what I have in mind is the typical approach of drawing random points from the unit square and calculating the ratio that fall within ... | stackexchange_codegolf |
“Cut” a matrix of integers on the line where the sum of the absolute differences of “severed” neighbors is the least.
Example
Consider this matrix:
1 2 -4
5 -1 3
2 -2 0
It can be cut in 4 places, here shown by lines lettered A–D:
A B
╷ ╷
1 ╎ 2 ╎ -4
C ---╎----╎----
5 ╎ -1 ╎ 3
D ---╎----╎--... | stackexchange_codegolf |
The Dottie number is the fixed point of the cosine function, or the solution to the equation cos(x)=x.1
Your task will be to make code that approximates this constant. Your code should represent a function that takes an integer as input and outputs a real number. The limit of your function as the input grows should b... | stackexchange_codegolf |
Many formulas in math involve nested radicals (square root signs inside other square roots signs). Your task here is to draw these using ascii art.
Specs
You will be given two integers, the number inside the radical, and the number of radicals. I think the best way to explain what you have to do is with an example. Her... | stackexchange_codegolf |
Given the equation of a polynomial and an x-coordinate find the rate of change of the point at that x-coord on the curve.
A polynomial is in the form: axn + axn-1 + ... + ax1 + a, where a ϵ Q and n ϵ W. For this challenge, n can also be 0 if you don't want to have to deal with special cases (constants) where there is n... | stackexchange_codegolf |
Given three integers >= 2, create an ASCII cube in an orthogonal (cabinet) projection.
The three integers represent height, width and depth (measured in visible characters) including the corners. The corners should be 'o's or '+', free choice.
w: 10, h: 5, d: 4
Thus gives:
o--------o
/ /|
/ / |
o... | stackexchange_codegolf |
Input:
Any Brainfuck program. This includes brainfuck programs with comments such as +++COMMENT[>+++<-]..
Output:
A program in one of the below languages that produces the same output as the Brainfuck program on all inputs. It should produce the same output exactly as the interepreter on this website There are no code-... | stackexchange_codegolf |
Your task is to make a program in L that takes n as an input number, output a program p in L that prints its own first n characters.
Rules
The program p has to be irreducible, See an example below.
PAY ATTENTION TO THIS RULE: If a program takes an input as n, the first n characters of the output would be the same as... | stackexchange_codegolf |
With equations that have more than one unknown, simultaneous equations can be used in solving for them. This challenge will only deal with linear equations with two unknowns, to make things as elementary as possible.
The program should take two lines of input from stdin, each containing a linear equation with two unkno... | stackexchange_codegolf |
Given a key, and an array of strings, shuffle the array so that it is sorted when each element is XOR'd with the key.
XOR'ing two strings
To XOR a string by a key, XOR each of the character values of the string by its pair in the key, assuming that the key repeats forever. For example, abcde^123 looks like:
a ... | stackexchange_codegolf |
Given a non-negative integer, return the absolute difference between the sum of its even digits and the sum of its odd digits.
Default Rules
Standard Loopholes apply.
You can take input and provide output by any standard Input / Output method.
You may take input as a String, as an Integer or as a list of digits.
Th... | stackexchange_codegolf |
What is the shortest regular expression (REGEX) you can create for file extensions for all of the following image file formats (photographs, paintings, sketches, and drawings)?
.ACAD
.AFD
.AFP
.AOM
.AOMA
.APNG
.ASCII
.AVIF
.AVIFAV
.BMP
.BPG
.CABAC
.CDEC
.CDR
.CDRAW
.CGM
.CHEVC
.CIEC
.CIPA
.CMYK
.COLLADA
.CRT
.CWC
.DEEP... | stackexchange_codegolf |
A jigsaw puzzle consists of (usually rectangular-ish) pieces. On each side of a piece, there is either an edge or a connector (a term I made up). A connector is either a tab sticking out (outie) or a slot facing inwards (innie). Two pieces can be joined if the outie tab can fit into the innie slot. The goal is to assem... | stackexchange_codegolf |
Your task is to given two integer numbers, a and b calculate the modular multiplicative inverse of a modulo b, if it exists.
The modular inverse of a modulo b is a number c such that ac ≡ 1 (mod b). This number is unique modulo b for any pair of a and b. It exists only if the greatest common divisor of a and b is 1.
Th... | stackexchange_codegolf |
Animate the text in your terminal
The goal
The goal is to "animate" the string "Hello world" in your output so that each character gets capitalised after each other.
Your program can exit after each letter has been capitalised.
For example;
# Iteration 1
Hello world
# Iteration 2
hEllo world
# Iteration 3
heLlo worl... | stackexchange_codegolf |
You’re given two \$r×c\$ grids. Each cell contains either 0 or 1. What are the minimum number of swaps (between horizontally and vertically adjacent cell elements, no wrapping i.e no swapping between last and first element of a row) are required in the first grid for it to match the second. If the matched arrangement c... | stackexchange_codegolf |
Just take an input in any way and then print it backward (trailing newlines allowed). For example:
Hello World -> dlroW olleH
Hi -> iH
Yes, it is case sensitive. Shortest code wins
| stackexchange_codegolf |
Your goal is to calculate the sum of Fibonacci series from n th term to m th term (including both terms).
No use of / * % or mathematically what they are in your language of choice.
No use of special functions or code language specialized in doing so !
You have to produce the series yourself and not by any special fun... | stackexchange_codegolf |
Background
We will be using a 3x3 cube for this challenge.
Rubik's cubers have their own notation for movements on the cube:
Each of the 6 faces has a clockwise turn notated with a single capital letter: UDLRFB. There are three additional letters MES denoting the three center slices.
Counterclockwise rotations have a ... | stackexchange_codegolf |
Given a UTF-16 string, test its endianness.
Rules:
As long as the input is in UTF-16 without BOM, its type doesn't matter. In C++ on Windows, it can be std::wstring or std::u16string. In Haskell, it can be [Int16] or [Word16].
The endianness is tested by noncharacters. If the input contains a noncharacter, it is in wr... | stackexchange_codegolf |
Interpret DOGO
DOGO is a lesser known programming language. While the original DOGO (a joke language from a Usenet post) has never been implemented, a language resembling it has been created. The commands for the language are:
+===========+================================================================+
| Command | ... | stackexchange_codegolf |
A ragged list is a (finite depth) list where each element is either a positive integer or a ragged list.
A ragged list is properly tiered if it contains either all positive integers or all properly tiered ragged lists.
For example [1,2,3,6] is properly tiered because it is a list of only positive integers. [[1,2],[[1]... | stackexchange_codegolf |
Introduction
There have been a few examples of the smallest possible OCI container that does "X". However these examples never correctly handle termination signals.
Challenge
Produce the smallest possible container that correctly handles PID 1 signal responsibilities.
The container does not need to manage child process... | stackexchange_codegolf |
Challenge: With any given number that has multiple digits, every digit in the number needs to repeatedly be summed together until the sum is a single digit number. To make things interesting, if there's a 0 in the number, then it must equal 26, because zero starts with the letter z, which is the 26th and final letter o... | stackexchange_codegolf |
What are Fibonacci networks?
In 1202, an Italian mathematician known as Fibonacci posed the following problem:
"A male and a female rabbit are born at the beginning of the year. We assume the following conditions:
1.After reaching the age of two months, each pair produces a mixed pair, (one male, one female), and then... | stackexchange_codegolf |
In Chess, a Knight on grid \$(x, y)\$ may move to \$(x-2, y-1)\$, \$(x-2, y+1)\$, \$(x-1, y-2)\$, \$(x-1, y+2)\$, \$(x+1, y-2)\$, \$(x+1, y+2)\$, \$(x+2, y-1)\$ or \$(x+2, y+1)\$ in one step. Imagine an infinite chessboard with only a Knight on \$(0, 0)\$:
How many steps is required for moving a Knight from \$(0, 0)\$... | stackexchange_codegolf |
iBug recently got a long bar made of composite, yet valuable materials. The bar is so long that iBug can't easily sell it for credits, so he wants to cut it. The bar is made of such fragile and magic materials that, if a part is broken, all parts of the bar made of the same material will break, too, making it hard to c... | stackexchange_codegolf |
Given a list of integers produce a Forward Difference at a specified order/depth.
For the list of integers:
(10, 18, -12, 4, 8, -3, -5, 67, 9, 14)
The Forward Differences at the various orders/depths are:
0 10, 18, -12, 4, 8, -3, -5, 67, 9, 14
1 8, -30, 16, 4, -11, -2, 72, -58, 5
2 ... | stackexchange_codegolf |
You may have seen Jacob's Ladder in children's science museums. If you're not familiar with what they look like, there are several images and video examples on the Wikimedia Commons. The challenge today is to create an animated ASCII version of the electrical gadget. In the end, it should look something like this:
La... | stackexchange_codegolf |
Background
In Western music, every single music note has an assigned name. Within each octave, there are twelve unique notes in the following order: "C C#/Db D D#/Eb E F F#/Gb G G#/Ab A A#/Bb B C", where the final C is one octave above the first.
To tell the difference between notes of different octaves, a number (for... | stackexchange_codegolf |
The Universal Crossword has a set of guidelines for crossword puzzle submissions.
In this challenge we are going to be concerned with their rules for hidden word themes. A hidden word clue consists of a clue and a word. It can either be a
"word break" or a "bookend".
For a word break the word must not appear as a cont... | stackexchange_codegolf |
Let's start by defining a reflection of a character in a string:
Given a string with distinct lowercase alphabetical letters with no spaces such
as abcdefg, define a reflection of a letter in the string c as
moving it (without changing the order of any other letter) to a new
place in the string such that the num... | stackexchange_codegolf |
Last Thursday user @SpookyGengar delighted us with his/her first challenge about Making Squared Words. What if we double the number of sides?
The challenge
Take a string as input in any reasonable format you need (string, char array...) and output an octogonal representation of the input (also in any reasonable format:... | stackexchange_codegolf |
Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.
Wikipedia for more information
For example you can be given a max weight of 15 and objects with ... | stackexchange_codegolf |
In this challenge, you will create the shortest graphical program that displays exactly "Hello, world!"
You will need no input.
You might be asking yourself, "what does he mean by graphical?" Well, by graphical, I mean not writing to stdout. For example, look at my ES6 answer, which makes an alert box pop up rather tha... | stackexchange_codegolf |
Display the remaining battery charge, as a percentage of maximum charge
Remember if you can't run your code on a phone, calculator, etc, you can probably install your environment on a laptop at least. If you absolutely can't run on a device that has a battery, then unfortunately your language isn't eligible since you h... | stackexchange_codegolf |
If you don't know what a queen is in chess, it doesn't matter much; it's just a name :)
Your input will be a square of arbitrary width and height containing some amount of queens. The input board will look like this (this board has a width and height of 8):
...Q....
......Q.
..Q.....
.......Q
.Q......
....Q...
Q.......... | stackexchange_codegolf |
I was pondering today about how many characters it would take in each language to throw an exception, and noticed there wasn't any existing collection of answers, so:
The task
Throw an exception in the least amount of characters. If your language does not have exceptions, then a panic is valid. A panic constitutes as a... | stackexchange_codegolf |
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| | | | | | | ... | stackexchange_codegolf |
Given an n-dimensional array filled with numbers, output which p-dimensional array has the largest sum.
Input
An n-dimensional array of numbers, or your language's equivalent. You can assume this is a rectangular array, or not.
n, the number of dimensions in the array. (doesn't need to be called n)
p, the number of di... | stackexchange_codegolf |
Objective
Given an expression involving ternary values, evaluate it into a ternary value.
Ternary Values
The three truth values in question are the values of Haskell's Ordering, namely LT, EQ, and GT. They stand for "less-than", "equal-to", and "greater-than", respectively. Furthermore, they themselves have an order; L... | stackexchange_codegolf |
Given a PPCG user's user ID, calculate how much times is their Each SE site reputation is from average reputation in the Stack exchange sites they have made accounts.
Let me explain, If someone's total network reputation (Total reputation in the stack exchange sites he has participated) is 10k, and if he has participat... | stackexchange_codegolf |
Given a pattern and a ragged list of positive integers, your task is to decide whether the pattern matches the ragged list.
The pattern is also represented by a ragged list. But in addition to positive integers, it may contain a wildcard value.
Here is the rule for matching:
A positive integer matches the same positiv... | stackexchange_codegolf |
Given an integer N from 1-9, you must print an NxN grid of NxN boxes that print alternating 1s and Ns, with each box having an alternating starting integer.
Examples
Input: 1
Output:
1
Input: 2
Output:
12 21
21 12
21 12
12 21
Input: 3
Output:
131 313 131
313 131 313
131 313 131
313 131 313
131 313... | stackexchange_codegolf |
What general tips do you have for golfing in Keg? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Keg (e.g. "remove comments" is not an answer).
Please post one tip per answer.
| stackexchange_codegolf |
The task is simple. You're given an arbitrary string message. Return that message prefixed with a number, such that the length of that number plus the message equals the number. In other words, the length in your output must be the total length of your output.
If multiple candidates exist, you can output any of them.
F... | stackexchange_codegolf |
Challenge :
Inspired by Alphabet Position Finder
Given an string and one of two possible mathematical operator (+ or -) as input, your task is to return the operation of each alphabet position from the string.
Example :
Input: "Hello World", "+"
=> "Hello World" = [8, 5, 12, 12, 15, 23, 15, 18, 12, 4] (converted to the... | stackexchange_codegolf |
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 ... | stackexchange_codegolf |
There is a building with an infinite number of floors and you are the only passenger in an elevator which can lift an infinite number of people. You are going home, but before the elevator gets to your floor, the elevator stops at another floor to allow people to enter the elevator and input their destination floors. Y... | stackexchange_codegolf |
Input
A string s of printable ASCII characters, newlines, and spaces (0x20 ( ) to 0x7E (~)), and a non-negative integer n.
Challenge
To write a program that outputs either another program, or s depending on n. If n = 1, Then your code should output code which outputs s. If n = 2, Your code should output code which outp... | stackexchange_codegolf |
Background
You are the apprentice of a powerful wizard, and your master is currently developing a spell for creating an inter-dimensional labyrinth to trap his enemies in.
He wants you to program his steam-powered computer to analyze the possible layouts.
Programming this diabolical machine is highly dangerous, so you'... | stackexchange_codegolf |
We know that f is a polynomial with non-negative integer coefficients.
Given f(1) and f(1+f(1)) return f. You may output f as a list of coefficients, an ASCII formatted polynomial, or similar.
Examples:
f(1) f(1+f(1)) f
0 0 0
1 1 1
5 75 2x^2 + 3
30 3904800 4x^4 + 7x^3 + 2x... | stackexchange_codegolf |
Plot contrivance
You wake up to find that something has gone horribly wrong! Your time machine has malfunctioned and you are lost sometime between June 2022 and October 1991.
You check the computer that you keep on the desk to see what time it is, but alas the positron interference from your quantum undetangler has fr... | stackexchange_codegolf |
The 80's TV series Knight Rider featured an intelligent, self-aware car called KITT. One distinctive aspect of the car was a front-mounted scanner bar that allowed KITT to "see" (and that looked suspiciously familiar to fans of another, earlier TV series).
The scanner had eight lights as seen in this picture:
The ligh... | stackexchange_codegolf |
I tested the waters on this sort of question with python, but now I get to the real question I want to ask.
restricted-source challenges are uniquely rewarding in Haskell because of Haskell's strict rule set. Type coercion which is the bread and butter for other languages in these sort of challenges is arguably non-ex... | stackexchange_codegolf |
(This challenge exists to extend sequence A276272 in the On-Line Encyclopedia of Integer Sequences, and perhaps create a new OEIS sequence1.)
This is a code-challenge, which will have you write code to compute as many terms of this sequence as possible.
Background
A polytet is a kind of polyform which is construct... | stackexchange_codegolf |
Let's say you have a stack, which at the start contains a b c in this order (a is on the top). You are given the required output stack, in any reasonable format (a list, a string, etc.), e.g. [a, c, b] (here a is on the top, below it c and below it b). You can also take the input reversed if you want, e.g. [b, c, a] wh... | stackexchange_codegolf |
This challenge, I hope, is simple to understand. Given a date-string (given in any format you prefer, so long as it has 4 digits of year and 2 digits of day and month), calculate the weekday for the particular date-string. You must output 7 different values, corresponding to the weekday you have calculated.
It's okay i... | stackexchange_codegolf |
This problem is inspired from shinh's problem.
Given an input of positive integer \$n\$, output a smiley triangle (see below) with \$n\$ rows.
Detailed rules
Can be either a function or a full program.
Standard I/O rules applied.
RULE CLARIFICATION: Output as exactly a string, rather than an array of strings whose it... | stackexchange_codegolf |
Challenge :
Given a word, check whether or not it is an isogram.
What :
An isogram is a word consisting only of letters with no duplicates (case insensitive). The empty string is an isogram.
Examples :
"Dermatoglyphics" ---> true
"ab" ---> true
"aba" ---> false
"moOse" ... | stackexchange_codegolf |
You are trying to guess my emotion.
I will give you an adjective, as the input to the function/program.
Your task is to output my emotion, either :) for happy, or :( for sad.
Details
For these adjectives, you must output the happy face :)
contented
delighted
merry
overjoyed
pleased
blessed
chipper
content
convivial
gle... | stackexchange_codegolf |
Your task
Given a string, output the range of ASCII values.
Example
Let's say we have the string Hello.
We get the ASCII values:
H = 72
e = 101
l = 108
l = 108
o = 111
Now, we get the range (max - min):
111 - 72 = 39
Our answer is 39.
Test cases
Input Output
Hello, World! 82
aaaaa 0
Code Golf ... | stackexchange_codegolf |
My obsession with set theory continues. I believe that most programming languages have neither sets as possible structures nor set theory operations such as Union and Intersection. If I am wrong then this question becomes trivial and I learn something new.
It would be fun to ask for the code golf construction of a ful... | stackexchange_codegolf |
In March 25, 1821, Greece fought its great war of independence. In order to honor this, your task is to print the Greek national anthem:
Σε γνωρίζω από την κόψη
του σπαθιού την τρομερή.
Σε γνωρίζω από την όψη
που με βιά μετράει τη γη.
Απ' τα κόκκαλα βγαλμένη,
των Ελλήνων τα ιερά!
Και σαν πρώτα ανδρειωμένη,
χαίρε ω χαίρ... | stackexchange_codegolf |
You know those stackable shelves that are basically just wooden boxes that can be stacked together? We're going to simulate building some bookshelves out of those with some ASCII art.
Our books are all conveniently uniform in size, and all look like the following:
|X|
|X|
|X|
The bookshelves are individual boxes, alwa... | stackexchange_codegolf |
I saw a problem which asks you to print "Hello World" using the fewest characters, including spaces. How can I further shorten this code? Thank you in advance!
#include<iostream>
int main(){printf("Hello World");}
| stackexchange_codegolf |
The positive rational numbers can be shown to be numerable with the following process:
Zero has the ordinal 0
Arrange the other numbers in a grid so that row a, column b contains a/b
Plot a diagonal zig-zag top right to bottom left
Keep a running tally of the unique numbers encountered along the zig-zag
Here's a pict... | stackexchange_codegolf |
Your task is to decipher a non-empty string consisting of printable ASCII characters in the range [32..126].
Reading the string character per character:
each time you encounter a letter in lowercase, associate it with the next letter in uppercase, starting with 'A'
each time you encounter a letter in uppercase, replac... | stackexchange_codegolf |
Your friend Jack is a picky eater. He only likes certain foods, and he only likes to eat a certain amount of them each day. Despite this, Jack has very strict calorie and macronutrient goals that he strives to meet with his diet. To complicate things further, Jack's cravings change day by day, and he will only eat the ... | stackexchange_codegolf |
Introduction
Some ASCII characters are just so expensive these days...
To save money you've decided to write a program that encodes expensive characters using inexpensive ones.
However, character prices change frequently and you don't want to modify your program every time you need to encode or decode a different chara... | stackexchange_codegolf |
This challenge is from a game, Keep Talking And Nobody Explodes.
It's hard to say how this mechanism works. The engineering is pretty impressive, but there must have been an easier way to manage nine wires. — from the manual
Input
Exactly 9 "wires", each which is labeled 'A', 'B', or 'C', and is colored red, blue, or b... | stackexchange_codegolf |
We've all heard of the ol' Fizz Buzz problem, but what happens when you try to apply it with more factors? Fizz Buzz Crackle Pop!
The Challenge
Write a full program that takes an integer input n, then n tuples containing an integer and a string, then another integer (>1) k, as such:
n int1 str1 int2 str2 (...) intn st... | stackexchange_codegolf |
In Minecraft, pistons are blocks that can move other blocks. However, they can only move at most twelve blocks, and won't work at all if any obsidian is in the way. Also, slime blocks are sticky and stick to other blocks, except for obsidian.
Your challenge
Take as input a 5x5 matrix or similar, containing one piston a... | stackexchange_codegolf |
Challenge
Given the formula of a chemical, output the Mr of the compound.
Equation
Each element in the compound is followed by a number that denotes the number of said atom in the compound. If there isn't a number, there is only one of that atom in the compound.
Some examples are:
Ethanol (C2H6O) would be C2H6O where ... | stackexchange_codegolf |
You will be given as input a non-empty list of positive integers. For example:
[1,2,2,2,1]
You want to produce a ragged list as output which has this as its "depth map". This list should have the same elements in the same order but each element n should be at the depth equal to its value.
[1,[2,2,2],1]
This is a li... | stackexchange_codegolf |
A lazy physicist has the job to perform the double slit experiment. However, they are lazy and can't be bothered to set up all the equipment themselves and so are going to simulate the effects. They can't program though so are going to need some help. As they are lazy your program should be as short as possible.
Given... | stackexchange_codegolf |
Note: the title was misspelled intentionally.
Given a string s, swap the first vowel runs of every 2 words. For this challenge, y is considered a vowel.
For example, given an input of "great day sir":
1. Input: "great day sir"
2. Identify pairs of words: "[great day] [sir]" (No word for sir to pair with)
3. Identify th... | stackexchange_codegolf |
Consider an eight bit number in which an even position bit will never be 1 if one of its neighbors is 0 (considering MSB and LSB as neighbors). There are fewer than 64 such numbers, so there is at least some reversible mapping of them to 6 bit numbers.
Your task is to write a pair of functions (or code blocks or your l... | stackexchange_codegolf |
Leon's story
Leon is a professional sling shooter and he comes to a shooting range everyday to practice. A casual target is not a challenge for him anymore so before shooting he first covers the target of radius 1.0 with k rectangle stickers. He then fires n shots that cannot hit the stickers.
What's special about Leo... | stackexchange_codegolf |
let S, a and b each represent a string
Goal: Write a standard string replace function where the you replace all occurrences of a in a string S with b so long as a is not already part of an instance of b
for example, if we have the string S = My oh my that there is a big ol' that
and we wanted to do a fancy replace with... | stackexchange_codegolf |
Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of".
The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any ... | stackexchange_codegolf |
Background
You may be aware that periods in between letters in gmail addresses are ignored. Email sent to example@gmail.com, exam.ple@gmail.com, and e.x.a.m.p.l.e@gmail.com all end up in the same place!
This is a great way to have multiple different emails addresses for things like signing up for free trails, or filter... | stackexchange_codegolf |
The challenge is to identify the missing number in a string of undelimited integers.
You are given a string of digits (valid input will match the regular expression ^[1-9][0-9]+$). The string represents a sequence of integers. For example, 1234567891011. All numbers in the sequence are in the range from 1 and 214748... | stackexchange_codegolf |
If you have ever had any exposure to Japanese or East Asian culture you will have surely encountered the Amidakuji game:
As Wikipedia explains, it is a type of lottery drawn on paper and used to randomly select a permutation of N items.
For example, it may be used to randomly assign a starting sequence to N people, o... | stackexchange_codegolf |
Inspired by this stack of little statues that are currently on my desk at work, given to me by my colleagues from Sri Lanka when they visited The Netherlands:
This is split into two different challenges due to popular demand:
Part 1) Determine the amount of statues (this challenge)
Part 2) Can the statues be stacked?
... | stackexchange_codegolf |
I'm a narcissist. (Not Really)
I'm also very lazy... (Not Really)
So I want to know the score of this question, and how many people have viewed it.
But I'm too lazy to check myself...
Challenge
Your challenge is to output the score of this question, and how many views there are. No input may be taken, and output may... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2017 Day 11.
Obligatory why me and not Bubbler link
After having rescued a child process lost on a hexagonal infinite grid, you hear someone else screaming for help. You turn around, and unsurprisingly, there is a... | stackexchange_codegolf |
A barcode of EAN-13 symbology consists of 13 digits (0-9). The last digit of this barcode is its check digit. It is calculated by the following means (the barcode 8923642469559 is used as an example):
Starting from the second digit, sum up all alternating digits and multiply the sum by 3:
8 9 2 3 6 4 2 4 6 9 5 5 9
|... | stackexchange_codegolf |
Robbers post
A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:
Split the string into equal sections.
Reverse the strings, and starting from the start of each string.
Pu... | stackexchange_codegolf |
The golfing language Jelly has a very complex and clever string compression system which I'm not going to go into depth about here. You can find a very good explanation here.
Basically, Jelly's string literals are represented as “...», where ... is a string of characters from Jelly's codepage that is decoded into a bas... | stackexchange_codegolf |
Task
Your task is to write a program that, taking no input, outputs a string that represents a formatted codegolf answer of itself. The pattern is the following:
[Language name][1], n bytes
=
```
source code
```
[1]: link-to-language
With the language name being the language that you wrote your program (as stated in... | stackexchange_codegolf |
Your task is given an input string of the full/short name of a CS:GO (Counter-Strike: Global Offensive, a computer game) rank return an integer from 1-18 representing the rank number. A higher number means you are a higher rank and so "better" at CS:GO.
Input
A string representing either the full name or short name of ... | stackexchange_codegolf |
Problem:
Your task is to write a program that takes as input a height (in meters) and weight (in kilograms), and outputs the corresponding BMI category.
BMI is a measure of the ratio of your weight to your height. It's dated and inaccurate for many people, but that doesn't matter here!
BMI can be calculated using the f... | stackexchange_codegolf |
Task
Write a polyglot in two languages that when run, outputs the name of the language it is run in. Additionally, this program must also output the other language's name if the source code is reversed
Example:
Program ABC in language foo outputs foo. ABC in language bar outputs bar. CBA in language foo outputs bar, an... | stackexchange_codegolf |
I was challenged by one of my friends to solve this coding problem:
Given a non-negative number represented as an array of digits, add one to the number. The digits are stored such that the most significant digit is at the head of the list. Return the value as a new list.
This was my solution, which does not work if [9... | stackexchange_codegolf |
Rules:
Your program must print "hello world" when executed
Your program must be interpretable or compilable into 2 or more languages
Your program must require no input or arguments
Languages with identical syntax are too easy, and will be shunned. We all know you can write echo hello world in Bash and Batch, so let's ... | stackexchange_codegolf |
Your task, at the moment that you choose to accept it, is to write a program that, when given a string and a PCRE-regex, calculates the minimum Levenshtein distance to another string that matches the regex (fully). All strings, as well as the regexes, should be in the Latin-1 character set.
This is code-golf, so the sh... | stackexchange_codegolf |
Create the shortest program to check who has won in an nd tic tac toe game.
Your program should work when n (width) and d (dimension number) are in these ranges:
n∈[3,6]∩ℕ ie a number from this list: 3,4,5,6
d∈[2,5]∩ℕ ie a number from this list: 2,3,4,5
n = 3; d = 2 (32 ie 3 by 3):
[][][]
[][][]
[][][]
n = 3; d = 3... | stackexchange_codegolf |
Background
BitCycle is a two-dimensional Turing-complete programming language involves moving bits around a playfield.
Because I am too lazy to write BitCycle programs myself, you will be writing a program which outputs BitCycle programs for me! Unfortunately, the storage space on my computer is only about a bit, so yo... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.