instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Challenge
Your goal is to write a program that prints another program.
That printed program should print another program, and the new program should print another program, until the end.
Rules
Each program must less than 256 bytes. (If this needs to be changed, leave a comment)
The last program must be an empty progra... | stackexchange_codegolf |
In this exercise, you have to analyze records of temperature to find the closest to zero.
Write a program that prints the temperature closest to 0 among input data.
Input
N, the number of temperatures to analyse (optional). This will be nonzero.
The N temperatures expressed as integers ranging from -273 to 5526.
Outp... | stackexchange_codegolf |
Challenge
Create a function or program that, when given an integer size, behaves the following way:
If size is equal to 1, output
┌┐
└┘
If size is greater than 1, apply the following substitutions :
Source
Target
┌
┌┐└┌
┐
┌┐┐┘
└
┌└└┘
┘
┘┐└┘
Note: this is basically a Unicode box-drawing version of the... | stackexchange_codegolf |
Backstory
Meet my friend Jimmy:
/o\
Jimmy is a little character who likes to stand on platforms. Here's Jimmy safely standing on a platform:
/o\
-------------
Now, Jimmy has a good sense of balance, so he can safely stand with one leg off of the platform, like so:
/o\
-------------------
Although i... | stackexchange_codegolf |
Inspired by this, print an ascii diamond pattern built using 0-9.
Rules
Input n should be between 0-9, anything outside that range is undefined
The diamond should be padded with spaces
The middle line should always have no padding and be the only line to contain n, in the center
Print to stdout
As always, this is code... | stackexchange_codegolf |
Introduction:
I think most people will know how darts work. But since some might not, here are the rules of playing Darts in a nutshell:
Amount of players: 2
Starting points: 501
Goal: Get your points to 0 first
Darts per player: 3
Available numbers on the board: 1 through 20, and Bulls-eye
Here is the layout of a Da... | stackexchange_codegolf |
It's almost Christmas, so Santa has to plan his route. You're helping him, for reasons unknown.
Santa needs help planning the route and wants you to give him a solution, but since you're all ungrateful and unwilling to give to the man who has given you so much, so have decided to give him a program with as few bytes as... | stackexchange_codegolf |
The gravitational binding energy of a planet is the amount of energy required to separate every tiny piece of it so that no piece will orbit or collide with another piece. For a uniform sphere, Wikipedia gives this formula:
$$E = \frac{3GM^2}{5R}$$
Where G is the gravitational constant (6.672e-11 m3•kg-1•s-2), M is mas... | stackexchange_codegolf |
Challenge
Make the shortest program to determine if the figures in the input will fit into the space in the input.
Requirements
The input will be in the format of this example:
Input:
+----+ -- +--+
| +----+ | |
| | +--+
| |
+---------+
Output:
+----+
|+--++----+
|| |-- |
|+--+ |
... | stackexchange_codegolf |
Stuttering is a problem which many of us might have experienced or at least seen it. Although most of famous speech recognition softwares have serious issues with stuttered speaking, let's imagine a software which understands stuttering, but cannot fix them and only writes them as is.
An example written text by such a ... | stackexchange_codegolf |
Inspired and looted from this dice challenge by Arnauld
Input
You are given a 5x1 or 1x5 (your choice) dice matrix which consist of binary 3x3 sub-matrices.
Goal
Given a valid dice matrix, you are to score it using the rules of 6,5,4 which are as follows:
If the roll contains 6,5,4, add the other two dice together and... | stackexchange_codegolf |
Let \$S \subset \mathbb N_{\geq0}\$ be a subset of the nonnegative integers, and let $$
S^{(k)} = \underbrace{S + S + \dots + S}_{k\ \textrm{times}} = \{ a_1 + a_2 + \dots + a_k : a_i \in S\}.
$$
For example, $$\begin{align}
\{1,2,3\}^{(2)}
&= \{1+1, 1+2, 1+3, 2+1, 2+2, 2+3, 3+1, 3+2, 3+3\}\\
&=\{2,3,4,5,6\}
\end{align... | stackexchange_codegolf |
Since Euclid, we have known that there are infinitely many primes. The argument is by contradiction: If there are only finitely many, let's say \$p_1,p_2,...,p_n\$, then surely \$m:=p_1\cdot p_2\cdot...\cdot p_n+1\$ is not divisible by any of these primes, so its prime factorization must yield a new prime that was not ... | stackexchange_codegolf |
Your task is to hide a small message or string inside a larger block of text. To do so, you must hide the message as capital letters inside the larger
For the quoted test:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut convallis porta varius. Donec loBortis adipiscing dolor ac Euismod. Ut Mincidunt eY ... | stackexchange_codegolf |
Background
The Zundoko Kiyoshi function originates from this tweet by kumiromilk. Translated from Japanese, it reads roughly as follows:
The test for my Java lecture had a problem that said "Implement and describe your own function". I made it continuously output either "zun" or "doko" randomly; if the sequence "zun",... | stackexchange_codegolf |
Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted).
Your random sample should be uniformly sampled from all lists of n non negative integers that sum to one hundred.
Your code should run in a... | stackexchange_codegolf |
Your task
Take a list of strings as the input, and output the maximum average ord.
Example
Given the list ['hello', 'world', 'bye']:
The average ord of 'hello' is:
(ord(h) + ord(e) + ord(l) + ord(l) + ord(o)) / len('hello')
= 106.4
The average ord of 'world' = 110.4
The average ord of 'bye' = 106.7
The maximum ave... | 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 |
Surreal Numbers are one way of describing numbers using sets. In this challenge you will determine the value of a surreal number.
Intro
A surreal number consists of two sets: a left and right. The value of the surreal number must be greater than all numbers in the left set and less than all numbers in the right set. We... | stackexchange_codegolf |
I was doing the bandit wargame from overthewire.org and because I am a script kiddie, I googled the answer for level 24.
password="UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ"
for i in {0000..9999}
//looping to try any possible pin code
do
echo $password' '$i >> wordlist.txt
//save password and possible pin code into wordlist
... | stackexchange_codegolf |
It's 22022 and the Unicode consortium is having a problem. After the writing system of the ⮧⣝Ⅲⴄ⟢⧩⋓⣠ civilization was assigned the last Unicode block, the consortium members have been scrambling to find a new encoding to replace UTF-8. Finally UTF-∞, a proposal by Bob Rike, was adopted. UTF-∞ is backwards compatible wit... | stackexchange_codegolf |
Your task is to create a program or function that takes, as input, a natural number (n) between 1 and 25 (inclusive) and prints an isometric representation of a slide and ladder with n number of rungs.
Ladder and slide specifications
The ladder is always oriented on the left and the slide on the right. We're viewing it... | stackexchange_codegolf |
Intro
When you search in google, it always shows you a result with a sample text from the found webpage.
For example if you search for "Madonna greatest vinyl", google will show you one line link, and below a short excerpt from that found webpage:
Madonna Greatest Hits Records, LPs, Vinyl and CDs
Madonna - Greatest Hi... | stackexchange_codegolf |
Implement any model of computation as powerful as a Turing machine using any existing language's type system.
Your solution should handle the computation using the language's type system, not the language's regular Turing complete features, nor a macro system. It is however acceptable to use the language's regular f... | stackexchange_codegolf |
Following last year's event, we're doing Code Golf Advent Calendar 2022!
On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes for solving them fast ... | stackexchange_codegolf |
To normalize a vector is to scale it to a length of 1 (a unit vector), whilst keeping the direction consistent.
For example, if we wanted to normalize a vector with 3 components, u, we would first find its length:
|u| = sqrt(ux2 + uy2 + uz2)
...and then scale each component by this value to get a length 1 vector.
û ... | stackexchange_codegolf |
Write a plain TeX program that lists the first two hundred primes (in base-10 notation). Including external files/resources is not permitted. The output may be to the terminal, the log file, or the actual dvi/pdf file, at your option, but should be easily readable to a human; in particular, there must be some delimiter... | stackexchange_codegolf |
I have a specific number in mind, but it's part of a challenge I'm doing, and I don't want people to do (all) the work for me.
Here is a number which has the same digits, but shuffled:
5713167915926167134578399473447223554460066674314639815391281352328315313091488448321843
8892917486601064146636679920143691047671721184... | stackexchange_codegolf |
I have string \$s\$ of length \$n\$ and some constant integer \$k\$ which is at most \$n\$. Give the fastest algorithm to sample a random string with Levenshtein distance \$k\$ from \$s\$ uniformly.
Your algorithm should output any of the strings with edit distance exactly \$k \leq n\$ from the input string \$s\$ with ... | stackexchange_codegolf |
Challenge
In this challenge, you have to fill an \$M\$ x \$N\$ rectangle grid with the most \$A\$ x \$B\$ rectangle pieces possible.
Requirements:
The sizes of the \$M\$ x \$N\$ rectangle grid is always bigger than the sizes of the \$A\$ x \$B\$ rectangle pieces. In other words, \$min(M, N) ≥ max(A, B)\$
You can freel... | stackexchange_codegolf |
Barbrack
Your task is to write a program or function that takes a non-negative integer (in decimal or any other convenient base for your language), and output a number in the numbering system Barbrack.
What's that?
Barbrack is a numbering system I made up that can represent non-negative integers. Zero is represented wi... | stackexchange_codegolf |
What is the shortest way we can express the function
f(a,b)(c,d)=(a+c,b+d)
in point-free notation?
pointfree.io gives us
uncurry (flip flip snd . (ap .) . flip flip fst . ((.) .) . (. (+)) . flip . (((.) . (,)) .) . (+))
which with a little bit of work can be shortened to
uncurry$(`flip`snd).((<*>).).(`flip`fst).((.... | stackexchange_codegolf |
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... | stackexchange_codegolf |
Each element on the periodic table of the elements has an atomic weight. For example, boron (element 5) has an atomic weight of 10.81. Your challenge is to write a program which takes as input the atomic number of an element and outputs its atomic weight.
Your program only needs to support elements up to and including ... | stackexchange_codegolf |
You must make a polyglot that outputs the square of the input in one language and the square root of the input in another. The shortest answer in bytes wins!
You must have a precision of at least 3 decimal places, and the input will always be a positive float.
| stackexchange_codegolf |
Description
Write a function f(m, G) that accepts as its arguments a mapping m, and a set/list of distinct, non-negative integers G.
m should map pairs of integers in G to new integers in G. (G, m) is guaranteed to form a finite abelian group, but any element of G may be the identity.
There is an important theorem that... | stackexchange_codegolf |
Remove one stick and output the stack updated.
Description
You can remove only sticks on top( completely drawn).
You can assume:
there are 5 sticks on the table.
there's one and only one stick you can remove.
sticks are recognizable : there aren't overlapping sticks on the same orientation and there aren't sticks join... | stackexchange_codegolf |
Create a script that, when run from a console, will display the text already in the console, prior to running.
Challenge
How will the winner of the challenge will be determined?
The golf with the shortest length (in bytes) will win.
Example Input and Output
Input:
(Shown is Windows)
Microsoft Windows [Version 10.... | stackexchange_codegolf |
Given a matrix like this:
1 1 3 -2
3 -4 1 -1
1 1 1 0
0 -1 0 0
By taking a 2×2 "sliding sum", where the sum of every 2×2 region of the matrix is one element of the resulting matrix, we get:
1 1 1
1 -1 1
1 1 1
We can do this for sliding windows of any size. For example, a 1×3 sliding sum of the same input ... | stackexchange_codegolf |
You will be given two Arrays / Lists / Vectors of non-negative integers A and B. Your task is to output the highest integer N that appears in both A and B, and is also unique in both A and B.
You may assume that there is at least one such number.
Any reasonable Input and Output method / format is allowed.
These Looph... | stackexchange_codegolf |
Given a positive integer n, compute the nth Wilson number W(n) where
and e = 1 if n has a primitive root modulo n, otherwise e = -1. In other words, n has a primitive root if there does not exist an integer x where 1 < x < n-1 and x2 = 1 mod n.
This is code-golf so create the shortest code for a function or program t... | stackexchange_codegolf |
Note: As per consensus on Meta, challenge-writing questions are on topic here.
In light of this "thing to avoid when writing challenges", I started to think about challenges involving random generation of certain kinds of objects.
It sometimes happens that I want to post a code-golf challenge that involves randomly g... | stackexchange_codegolf |
Shortest program wins, of course.
| stackexchange_codegolf |
From codegolf.com (not loading as of Sept 15, 2011) was one that was driving me crazy. Print to STDOUT a clock of an exacting form, reading time from STDIN and marking an h at the hour and m at minute (rounded down to a multiple of 5) and an x if they overlap, unused ticks are marked with an o, so that
echo "23:13" | ... | stackexchange_codegolf |
I'm not sure if this is the right place to ask, but I found this similar question so I'll go ahead.
I'm very new to code golfing, so keep your smothered laughs and throw-up emoji's to yourselves please ;). Anyway, someone recently posted a challenge (that was shortly deleted) to draw a 16x16 pixel image of the Old Man ... | stackexchange_codegolf |
Challenge
Create a program that, when run, changes the contents of the source file. This means that you can delete/add/change characters in the source file, but you can't delete the (source) file itself (deletion is when the source file does not exist after the program is run).
In the case of pre-compiled languages suc... | stackexchange_codegolf |
Given a non-empty list of digits 0 though 9, output the smallest number that can be produced by an expression formed by reordering these digits and introducing exponentiation signs ^, with adjacent digits getting concatenated as multi-digit numbers. Exponentiation is evaluated as right-associative.
For example, [4, 2, ... | stackexchange_codegolf |
Your input will be an English sentence, phrase, or word. It will only contain a-zA-Z' -,.!?. Your task is to take the input, remove spaces, and then redistribute capitalization such that letters at indexes that were capitalized before (and only letters at indexes that were capitalized before) are capitalized.
For examp... | stackexchange_codegolf |
You have been given the charge to calculate the current balance as of the day that you perform the calculation for 330,000 individuals who worked for an average of 30 years spanning 300 years where the initial principal was 1 with an addition of 1 per day and interest rate set at 3%.
You initially tried to use online ... | stackexchange_codegolf |
In this question Tom learned that, in general, there are many motivations to choose to include case sensitivity in his programming language, because the possible combinations for a variable name are much more than what's possible with a case insensitive programming language for a name of the same length.
But, as a more... | stackexchange_codegolf |
Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted.
An IPv4 address is a 32-bit numeric address written as four numbers separated by periods. Each number can be zero to 255.
We need to write a... | stackexchange_codegolf |
Summary
A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.
Input
A string, which is a single line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument e... | stackexchange_codegolf |
You are a package handler for Big CompanyTM and your job is to load boxes into a truck. These are special, stretchy trucks: their length can be adjusted at will. But stretching trucks are expensive, so keep the truck lengths as short as possible!
The Challenge
Write a full program or function that, when given the truck... | stackexchange_codegolf |
RNA, like DNA, is a molecule found in cells encoding genetic information. It consists of nucleotides, which are represented by the bases adenine (A), cytosine (C), guanine (G) and uracil (U).* A codon is a sequence of three nucleotides.
Proteins are large molecules which perform a vast array of functions, such as kerat... | stackexchange_codegolf |
Introduction:
In my recent Strikethrough the Word Search List challenge I mentioned the following:
When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one.
In some cases I do them in reversed order as a change of pace, although that doesn't matter too much r... | stackexchange_codegolf |
In golf, a knowledgable caddie helps an already good golfer to be even better. In this challenge, you build a "caddie" to help you code golf. In particular, your caddie will compress golfed code in such a way that another program can uncompress and then run the code. A good caddie will compress golfed code to be much s... | stackexchange_codegolf |
Can you imagine solving the New York Times crossword puzzle without any clues? Maybe not with all of the creativity and new words and phrases appearing in modern crosswords, but with a fixed word list there's some hope. In this challenge, you create a crossword puzzle grid in which this is theoretically possible.
The... | stackexchange_codegolf |
What all languages have a construct similar to python's eval, so you can write code during runtime and run it?
A list would be helpful for certain programming challenges - ones where it is obvious an eval is either necessary or highly efficient.
| stackexchange_codegolf |
What is Typoglycemia?
Typoglycemia is a term that refers to the phenomenon where readers are able to understand text even when the letters in the middle of words are jumbled, as long as the first and last letters of each word remain in their correct positions. For example,
Aoccdrnig to a rscheearch at Cmabrigde Uinerv... | stackexchange_codegolf |
Background
The nuclear industry has term, SCRAM, used to describe a quick shutdown of the reactor. There's a fun myth that it stands for "Safety Control Rod Ax Man," the role which served to shut down the Chicago Pile if it got too hot by literally cutting a rope with an ax (although this was debunked).
The US Nuclear... | stackexchange_codegolf |
This challenge is from a game, Keep Talking And Nobody Explodes.
This is like one of those toys you played with as a kid where you have to match the
pattern that appears, except this one is a knockoff that was probably purchased at
a dollar store. – From the manual
Objective
The Simon Says module consists of 4 colored ... | stackexchange_codegolf |
Please note the special scoring for this challenge.
Given a non-empty string made of a-z, output the string immediately before it in the shortlex order.
Shortlex order
We enumerate strings in shortlex order by first listing the strings of length 0, then those of length 1, then length 2, and so on, putting them in alph... | stackexchange_codegolf |
What tips do you have for golfing in (,)? I've found that there are so many ways to make code shorter, and I want more ways. I doubt there even are any tips for (,) that are applicable in the majority of programming languages, but if there are, feel free to include them.
Please, one tip per answer.
| stackexchange_codegolf |
Gamma function is defined as
It is a well-known fact that for positive integers it coincides with a properly shifted factorial function: Γ(n) = (n - 1)!. However, a less famous fact is
Γ(1/2) = π1/2
Actually, the Gamma function can be evaluated for all half-integer arguments, and the result is a rational number mult... | stackexchange_codegolf |
I'm writing a program that takes a number from input (call it x), loops from 0 to (x - 1) (let's call our iterator y) and prints \$y^x+x\$ for each y.
After the loop, it then prints "SUM: N" (without a newline) where the N is the sum of the all of the previously printed values.
How can I make the code I already have sh... | 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 |
Related: Deck Names Friends or Foes Paying for Spells
The Magic: the Gathering card game has five colours of magical mana: white (W), blue (U), black (B), red (R), and green (G). Cards can be any of the \$2^5=32\$ subsets of these colours. Hereafter 'colours' refer just to the initials W, U, B, R, G.
The order that the... | stackexchange_codegolf |
An ant starts on an edge of a dodecahedron, facing parallel to it. At each step, it walks forward to the next vertex and turns either left or right to continue onto one of the other two edges that meet there. A sequence of left/right choices that returns the ant to its initial state (edge and direction) is called a rou... | stackexchange_codegolf |
Working on something in probability theory, I stumbled across another combinatorical exercise. These are always fun to solve, searching for intelligent approaches. Of course, one can use brute force for the following task, but this challenge is restricted complexity, so this is not allowed.
Task
Given an integer Input ... | stackexchange_codegolf |
The question score on Stack Exchange is the total number of upvotes minus the total number of downvotes a question receives. However, the reputation gained/lost for every upvote/downvote is different (eg. 10/-2 on Code Golf).
Given the total reputation earned, the reputation gained by an upvote and the reputation lost ... | stackexchange_codegolf |
Challenge Taken with permission from my University Code Challenge Contest
After finishing her studies a couple of months ago, Marie opened a bank account to start receiving the payment of her first job in town. Since then she has been performing a few transactions with it. Her first payment was $1000 dollars. With tha... | stackexchange_codegolf |
We all know the standard order of operations for math functions
(PEMDAS),
but what if we instead evaluated expressions left-to-right?
The Challenge
Given a string through standard input or through command line args, find the difference between the traditional evaluation (PEMDAS) and the in-order (left-to-right) evaluat... | stackexchange_codegolf |
Use any programming language to generate two random digits between 1 and 9 (including both). Then your program should display:
in the first line: the first random digit,
in the second line: the second random digit,
in the third line: a number whose tens and units digits are the first and second random digits res... | stackexchange_codegolf |
Tic-Tac-Latin!
This is a true story, so names have been altered.
My latin teacher, Mr. Latin, created his own proprietary (no joke) tic tac toe variant. Let's call it tic-tac-latin. The game is simple, it is essentially tic tac toe played on a four by four grid.
Formal rule declaration
A line is either a row, column o... | stackexchange_codegolf |
As input, you are given a positive integer n. Output a code in response. Each n should generate a unique code. There are some constraints on the code that it outputs:
The code must be 7 or more characters long in based on the input.
The code will be have only 7 characters when input string is less than 676000 and must... | stackexchange_codegolf |
Background
Inspired by I'm a palindrome. Are you?, where it is presented the shocking fact that “()() is not a palindrome, but ())(”, I asked myself what instead is ()() and the answer is simply: it is a string with a vertical symmetry axis!
The task
Write a program or function that takes a string S (or the appropriate... | stackexchange_codegolf |
Zeckendorf's theorem shows that every positive integer can be uniquely represented as a sum of non-adjacent Fibonacci numbers. In this challenge, you have to compute the sum of two numbers in Zeckendorf representation.
Let Fn be the n-th Fibonacci number where
F1 = 1,
F2 = 2 and
for all k > 2, Fk = Fk - 1 + Fk -... | stackexchange_codegolf |
Write a program using the fewest bytes of source code which given a list of strings finds all elements which are still in the list when any character is deleted.
For example, given a list of all English words boats would be output because oats, bats, bots, boas, boat are all English words and thus would be in the list.... | stackexchange_codegolf |
The brainiacs at New Scientist tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again to make ABLEST." (https://twitter.com/newscientist/status/1379751396271124480)
This is of course correct. It is not, however,... | stackexchange_codegolf |
In set theory, a set is an unordered group of unique elements. A pure set is either the empty set \$\{\}\$ or a set containing only pure sets, like \$\{\{\},\{\{\}\}\}\$.
Your challenge is to write a program that enumerates all pure sets, in some order of your choice. Standard sequence rules apply - you may:
Output al... | stackexchange_codegolf |
Write a function that takes a string of letters and spaces (no need to handle non-letters) and performs the ANNOUNCER VOICE translation algorithm as follows:
First, uppercase everything.
For each word,
Elongate each consonant cluster by tripling each letter; except, if the word begins with a consonant cluster, do no... | stackexchange_codegolf |
In 256 bytes or fewer write a function, \$f\$, from the positive integers to the positive integers that is:
Monotonic: larger inputs always map to larger outputs. (\$a < b \implies f(a) < f(b)\$)
Non-linear: does not have asymptotic order notation \$O(n)\$. (\$\displaystyle\forall c: \exists n:c\cdot n < f(n)\$)
Your... | stackexchange_codegolf |
A Ken Thompson virus is a virus that infects your compiler and other programs. Since it infects all your tools, you can not detect it without using tools from before the virus was introduced.
Your will create a prototype for inserting the Ken Thompson virus into code. The goal of this virus will be to allow you to (fak... | 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 |
Given an ASCII art hexagon as input, output one whose sides are all one unit longer.
_____
____ / \
/ \ / \
/ \ / \
\ \ => \ \
\ / \ /
\____/ \ /
\_____/
... | stackexchange_codegolf |
Your program must take as input a line of characters, like this:
@+.0
And output the characters sorted by how dark they are, like this:
.+0@
Requirements:
You must use a monospaced font for darkness detection.
You must find out how many pixels each character takes up. You must actually draw the character and count p... | stackexchange_codegolf |
Greeklish, a portmanteau of the words Greek and English, is a way of writing modern Greek using only ASCII characters. This informal way of writing was extensively used in older applications / web forums that did not support Unicode, and were not programmed to show Greek characters. Nowadays, its use is minimized due t... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 20, Part 1. (This day is a dreaded one for many of you, I know :P)
Obligatory final "but you're not Bubbler" explanation.
As the train carries you to the destination, you've got some spare time. You open the travel boo... | stackexchange_codegolf |
Your task is to decompose a number using the format below.
This is similar to base conversion, except that instead of listing the digits in the base, you list the values, such that the list adds up to the input.
If the given base is \$n\$, then each number in the list must be in the form of \$k\times n^m\$, where \$0\l... | stackexchange_codegolf |
Story:
The π was recently computed with accuracy to 100 trillions digits, but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits of them!
Challenge:
Your task will be to write program or function which takes string of digits including dec... | stackexchange_codegolf |
Intro
Imagine a list of elements and their outcomes when some non-commutative function is applied to them. For example, we will use the elements Rock, Paper, and Scissors, the outcomes Win, Lose, and Tie, and an operator * such that X*Y = what would happen if you played X against Y
As a list, you might write it this wa... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
As soon as the Elves get bored with the last week's game, Bin comes up with a new game. The rules are similar, except the Elves are supposed to say the numbers that have its "left side" equal to its "right side" when written in binary.... | stackexchange_codegolf |
Make a Number Expression is related : actually, it is also about Aheui. But it just made number expression, but this made real Aheui code.
Aheui is esolang written in only Korean character. Because of its nature, Aheui can't use Arabic numbers.
But, of course, there is way to generate number.
Brief introduction to Ahe... | stackexchange_codegolf |
Do you ever look at 3D shapes and think that we have 2 many dimensions. So let's make 3D into 1D! (See what I did there?)
Task
Given a 2D representation of a cube (layout below), flatten it into a single string, based on pointers.
The CUBE
This is the layout of the cube filled with no-ops (,) and pointers at the corner... | stackexchange_codegolf |
Inspiration
Given a positive integer \$1 \le n \le 9\$, output all positive \$n\$-digit integers \$i\$ for which the following is true:
Each digit from \$1\$ to \$n\$ appears exactly once in \$i\$. Therefore, \$i\$'s digits are a permutation of the digits from \$1\$ to \$n\$.
\$i\$ is divisible by \$n\$
Removing the r... | stackexchange_codegolf |
The dealer has been sloppy and lost track of what cards his/her deck contains and what cards are missing, can you help him/her?
A complete deck consists of 52 playing cards, namely:
Each color in the deck (hearts, diamonds, spades, clubs) contains:
The numbers [2 - 10]
A Jack
A Queen
A King
An Ace
Task
Your program... | stackexchange_codegolf |
In this exercise, you have to analyze records of temperature to find the closest to zero.
Write a program that prints the temperature closest to 0 among input data.
Input
N, the number of temperatures to analyse (optional). This will be nonzero.
The N temperatures expressed as integers ranging from -273 to 5526.
Outp... | stackexchange_codegolf |
Your task is to create a program where if any one character is deleted, it will detect which character was deleted and then re-insert the deleted character in its own source file.
For instance, if your program is RadiationHardened and it is modified to RadiaionHardened, then your program must output that the 5th byte (... | stackexchange_codegolf |
Given a string, replace all left-double-quotes into two backticks and all right-double-quotes into two single-quotes.
Left-quotes means the quotes that starts a quote. Right-quotes means the quotes that ends a quote. Quotes cannot be nested. You may assume that there are an even number of double-quotes in the string.
E... | stackexchange_codegolf |
The Cantor function is continuous everywhere and constant almost everywhere, but has an average slope of 1:
The function can be found recursively:
\$f_0(x)=x\$
\$f_{n+1}(x)=\left\{\begin{matrix}\frac{1}{2}f_n(3x)&x\in[0,\frac{1}{3})\\ \frac{1}{2}&x\in[\frac{1}{3},\frac{2}{3})\\ \frac{1}{2}+\frac{1}{2}f_n(3x-2)&x\in[\f... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.