instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Adapted from tips for restricted-source in Python
Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the zsh language. While we already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep within the ... | stackexchange_codegolf |
Since the first weekend of October is drawing near, let's have our own Oktoberfest!
Background
You and some other programmers have been hired by the local sausage guys in Munich, Germany. The sausage guys provide Oktoberfest with all the sausages the giant Volksfest needs. You manage to overhear your boss speaking to t... | stackexchange_codegolf |
Your task is to write a function or program that takes two non-negative integers i and k (i ≤ k), and figure out how many zeroes you'd write if you wrote all whole numbers from i to k (inclusive) in your base of choice on a piece of paper. Output this integer, the number of zeroes, to stdout or similar.
-30% if you al... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
Related to AoC2020 Day 3.
On the way to vacation, you're traveling through a forest on an airplane. For some biological and geological reasons, the trees in this forest grow only at the exact integer coordinates on a grid, and the entire for... | stackexchange_codegolf |
Task
Take the (integer) number of human years that the dog has lived, \$n\$, as input and return its age in dog years, \$d\$, to two decimal places.
The number of human years, \$n\$, will be between \$1\$ and \$122\$ inclusive: \$n \in [1,122], n \in \Bbb{N}\$.
According to BBC's Science Focus Magazine, the correct fun... | stackexchange_codegolf |
This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here
A pretty common beginner style question is to print some string, but there's a catch! You need to do it without using any of the characters in the string itself!
For this challenge, we will find out who is the best at printi... | stackexchange_codegolf |
Background
There's a common riddle that goes something like this:
A snail is at the bottom of a 30 foot well. Every day the snail is able to climb up 3 feet. At night when they sleep, they slide back down 2 feet. How many days does it take for the snail to get out of the well?
The intuitive answer is
30 days, becau... | stackexchange_codegolf |
Task description
Sometimes, you really need to fit something you’re writing in a small space. It may be tempting to drop the vowels and wrt lk ths – and failing that, who really needs spaces? Thssprfctlrdbl!†
Write a function or program that removes lowercase vowels aeiou, and then spaces, and then any characters from ... | stackexchange_codegolf |
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... | stackexchange_codegolf |
Problem source: https://oj.vnoi.info/problem/backtrack_j
We have these two shapes:
#.
##
and
.#
##
Let's call the first shape the L and the second shape the flipped L.
On a 4x4 board, there are 16 cells. Each cell can be either free or occupied. In all the illustrations, # represents an occupied cell and . represents... | stackexchange_codegolf |
Credit: Marco Verch CC BY 2.0
A two-cube calendar, as shown in the picture, uses two cubes with digits painted on the faces to display the date. For dates in the range 1-9, a leading zero is used ("01", "02", ..., "09").
Now, if you do the math, you might come to the conclusion that these calendars should be impossibl... | stackexchange_codegolf |
Objective
Given a permutation of 4 distinct items, classify the permutation by the normal subgroup(s) it belongs.
Input/Output Format
You gotta choose the followings as the hyperparameters for your submission:
The 4 distinct items.
The permutation serving as the identity permutation.
The input format is to accept a... | stackexchange_codegolf |
This task is simple: Write a program or function that outputs the list of all musical notes (using English note names) from A♭ to G♯.
All notes without a name consisting of a single letter (i.e. black notes on a musical keyboard) should have their name printed twice, once as the sharp of a note, once as the flat of one... | stackexchange_codegolf |
A complete deterministic finite automaton is a machine, with some states. Each state in the automaton has, for each character in the alphabet, a pointer to a state (not necessarily a different one). The automaton starts at some state, and then reads a string, character by character. For each character, the automaton mo... | 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 |
You're given a n-by-m matrix of integers, where n,m > 3. Your task is to find the 3-by-3 sub-matrix that has the lowest mean, and output this value.
Rules and clarifications:
The integers will be non-negative
Optional input and output format
The output must be accurate up to at least 2 decimal poins (if it's non-integ... | stackexchange_codegolf |
Let's say you have some text, and you want it to send it to your friend, but you don't want anyone else to read it. That probably means you want to encrypt it so that only you and your friend can read it. But, there is a problem: you and your friend forgot to agree on an encryption method, so if you send them a messa... | stackexchange_codegolf |
We have a square 10x10 meter garden outside our house. We want to plant grass and make a terrace. We have decided how to divide the garden, but we haven't decided the ratio between amount of grass vs terrace.
We need help visualizing it, and ASCII-art is clearly the best way to do so.
Challenge:
Take an integer in the... | stackexchange_codegolf |
Given an input of a list of slices of a string, output the original string.
Each slice will be given as a list of length 2, containing the start position
of the slice (an integer ≥0) and the slice itself. If your language does not
support arrays of arbitrary types, you may also take this as a struct or
similar, or simp... | stackexchange_codegolf |
I wrote some text, but it looks too professional. I want to make it look like I was really tired when I wrote it. I need you to insert some typos.
Your challenge is to take an arbitrary single line of text, and add typos. This means that for each character, there will be a 10% chance for it to be typofied.
The definiti... | stackexchange_codegolf |
In Haskell the list notation:
[a,b,c]
Is just syntactic sugar for:
a:b:c:[]
And the string notation:
"abc"
Is just syntactic sugar for:
['a','b','c']
This means that the string:
"abc"
Is the same as:
'a':'b':'c':[]
Task
Given a string you should output what the de-syntaxed version would look like in Haskell.
Rule... | stackexchange_codegolf |
WPA2, the actual encryption standard that secures all modern wifi networks, has been cracked... This challenge has nothing to do with the way that the WPA2 was cracked, however is is about computing the 64-digit hexadecimal key that corresponds to a given WPA-PSK pass-phrase.
A wireless network with WPA-PSK encryption ... | stackexchange_codegolf |
Write shortest possible code that will return true if the two given integer values are equal or their sum or absolute difference is 5.
Example test cases:
4 1 => True
10 10 => True
1 3 => False
6 2 => False
1 6 => True
-256 -251 => True
6 1 => True
-5 5 => False
The shortest I could come up with in python2 is 56 chara... | stackexchange_codegolf |
Write a program or function that takes a mathematical expression in Morse code as input, and returns the solution in Morse code.
Valid operations are plus: + and minus: _ (underscore). You can assume you will only receive non-negative integer input, and that the result will be non-negative.
The expression will contain... | stackexchange_codegolf |
Surprisingly, we haven't had any challenges on graph colouring yet!
Given an undirected graph, we can give each vertex a colour such that no two adjacent vertices share the same colour. The smallest number χ of distinct colours necessary to achieve this is called the chromatic number of the graph.
For example, the foll... | stackexchange_codegolf |
In Haskell the list notation:
[a,b,c]
Is just syntactic sugar for:
a:b:c:[]
And the string notation:
"abc"
Is just syntactic sugar for:
['a','b','c']
This means that the string:
"abc"
Is the same as:
'a':'b':'c':[]
Task
Given a string you should output what the de-syntaxed version would look like in Haskell.
Rule... | stackexchange_codegolf |
This is a cross-post of a problem I posted to anarchy golf: http://golf.shinh.org/p.rb?tails
Given two integers \$ n \$ and \$ k \$ \$ (0 \le k \le n) \$, count the number of combinations of \$ n \$ coin tosses with at least \$ k \$ tails in a row.
For example, if \$ n = 3 \$ and \$ k = 2 \$, the answer is \$ 3 \$:
HHH... | stackexchange_codegolf |
Inspired by this Numberphile entry
Background
The cube distance numbers of an integer n are defined here as the set of integers that are x³ distance away for a given x. For a simple example, with n=100 and x=2, the cube distance numbers are {92,108}.
This can be extended into a larger set simply by varying x. With x ∈ ... | stackexchange_codegolf |
Pyth is in ongoing development, meaning that new features are being added all the time.
I want to make Pyth a better langauge, so I'd like to know what features people are looking for.
This is the place the post ideas you have for making Pyth better.
In your answer, please state:
What you'd like to see changed/added.
... | stackexchange_codegolf |
Background
The number 1729 is the Hardy-Ramanujan number. An amazing property of it was discovered by S. Ramanujan (who is widely regarded as the greatest Indian mathematician1), when G.H. Hardy paid a visit to him in a hospital. In Hardy's own words:
I remember once going to see him when he was ill at Putney. I had r... | stackexchange_codegolf |
To be able to challenge the Elite-4 of top programmers, you need to show your badges first, that qualify you as a potential programmer-master. However, there's a twist. Once you show a badge, it is collected, which means you can't re-show it. So better come prepared! There are n badge collectors, each has a known list ... | stackexchange_codegolf |
Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list.
Output: Their sum. Use the same format for output integers as input integers. For example, the input 5 16 would lead to the o... | stackexchange_codegolf |
A cannonball is fired so that in the first eyeblink of its flight it ascends by N treetops, during the second eyeblink by N-1 treetops, etc until it reaches the highest point of its trajectory. Then it starts falling by 1, 2, etc treetops per eyeblink until it hits the ground. At the same time the cannonball is moving ... | stackexchange_codegolf |
What general tips do you have for golfing in MathGolf? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to MathGolf (for tips which can be applied to loads of programming languages, look at the general tips).
| stackexchange_codegolf |
(Inspired by this challenge)
Given two input strings, one of which is exactly one character longer than the other, arrange the strings into ASCII art as if they are two halves of a zipper that is only halfway zippered. The longer word forms the bottom of the zipper, and is the first and last character of the combined z... | stackexchange_codegolf |
The absolute value of a number \$x\$ is normally written as \$|x|\$. The left and right side of the absolute value uses the same symbol, so it is not immediately obvious how to parse nested absolute values e.g. \$||1-2|+|3-|4-5|||\$
Your goal is to parse such an expression containing nested absolute values:
The express... | stackexchange_codegolf |
Problem description
Vertices \$V\$ of directed graph \$G=(V,E)\$ represent gossipping ladies; edge \$(u,v) \in E\$ signifies that lady \$u\$ knows of lady \$v\$ (which does not imply that lady \$v\$ knows of lady \$u\$). Assume that each lady knows of herself.
Intuitively, lady \$a\$ gossips about every lady \$b\$ she ... | stackexchange_codegolf |
Task
Given an array of non-negative integers a, determine the minimum number of rightward jumps required to jump "outside" the array, starting at position 0, or return zero/null if it is not possible to do so.
A jump from index i is defined to be an increase in array index by at most a[i].
A jump outside is a jump wher... | stackexchange_codegolf |
In the tabletop RPG named Pathfinder, there is a feat that characters can take called Sacred Geometry, which allows a character who has it to buff their spells in exchange for doing some math: to use it, the character rolls a number of six-sided dice equal to their ranks in a particular skill, consults a table based on... | stackexchange_codegolf |
Implement a function or program which raises x to the power of y. Inputs are 16-bit signed integers. That is, both are in the range [-32768, 32767]. The output should be in the same range. I chose this range because it should make it possible to do exhaustive testing to ensure all edge-cases are covered.
If the output ... | stackexchange_codegolf |
Sandbox
Inspired by a Codingame challenge I tried (and failed at) about a month ago.
Given a binary tree of words, say:
HELLO
/ \
WORLD EATING
/ / \
ARCH IDAHO GUARD
/
DOOZY
/
... | stackexchange_codegolf |
Inspired by this accidental misspelling
If you could read the title, then you already know what the challenge is about. If not, then I'll tell you. Easy: simply take each word (single space delimited), and swap the positions of the first two letters. You may assume that the input will contain only lowercase ASCII let... | stackexchange_codegolf |
The Pi function is an extension of the factorial over the reals (or even complex numbers). For integers n, Π(n) = n!, but to get a definition over the reals we define it using an integral:
In this challenge we will invert the Π function.
Given a real number z ≥ 1, find positive x such that Π(x) = z. Your answer must b... | stackexchange_codegolf |
What general tips do you have for golfing in BQN? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to BQN (e.g. "remove comments" is not an answer).
Please post one tip per answer.
At the moment of writing, the official BQN site is the most comprehensive res... | stackexchange_codegolf |
Challenge
Given a positive integer, find the fastest way to iterate over its digits. Bytecode size doesn't matter as much as speed of execution.
Examples
For 6875, the program would output 6 8 7 5.
For 199182, it would output 1 9 9 1 8 2.
For 0, it would output 0.
| stackexchange_codegolf |
In 1946 Erdos and Copeland proved that a certain number is a normal number, i.e. the digits in its decimal expansion are uniformly distributed.
Users will input a sequence of digits and you will find the smallest prime that contains that string in base 10.
Example:
input -> output
"10" -> 101
"03" -> 103
"222" ... | stackexchange_codegolf |
There's never really been a definitive ASCII-cards challenge AFAIK. So, using the following deck of ASCII cards:
.------..------..------..------..------..------..------..------..------..------..------..------..------.
|2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--.... | stackexchange_codegolf |
Let's assume that
$$
f(x) = \frac{Ax+B}{Cx+D}
$$
Where, \$x\$ is a variable and \$A\$,\$B\$,\$C\$,\$D\$ are constants.
Now we have to find out the inverse function of \$f(x)\$, mathematically \$f^{-1}(x)\$, To do this first we assume,
$$
y = f(x)
\\\rightarrow y=\frac{Ax+B}{Cx+D}
\\\rightarrow Cxy+Dy=Ax+B
\\\rightarrow... | stackexchange_codegolf |
I have a string like this:
s = "helloworldandhellocodegolf"
I want to make every consonant after a vowel uppercase.
Desired output:
heLloWoRldaNdheLloCoDeGoLf
As you can see, l gets uppercased because it's right after the vowel e etc..
If there are repeated vowels, like:
s = "aabeekad"
Desired output:
s = "aaBeeKaD"... | stackexchange_codegolf |
We already have challenges dealing with simulating vanilla Conway's Game of Life, Wireworld and rule 110, but so far none corresponding to a (specific) non-totalistic rule. So here is one.
In June 2000 David Bell described the Just Friends rule, which uses the same square grid and two states as regular Life but has the... | stackexchange_codegolf |
The day this post was published was Christmas Eve. Tomorrow will be Christmas. Yesterday was Christmas Eve Eve. In two days it will be
Christmas Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Ev... | stackexchange_codegolf |
Introduction
A known fact is that Jon Skeet can code Perl and make it look like Java. In this challenge you will try to do something similar.
Challenge
Write a piece of code of any length that can be executed without any errors/exceptions in two different languages. Your program can take inputs, give outputs, whatever ... | stackexchange_codegolf |
Summary
The goal of this challenge is to create an undone image-version of a 15-puzzle / sliding puzzle also called taquin in french.
Details:
Given an input composed of:
an image,
an integer n,
an other integer r,
your program, or function, or anything else that fits, must output the same image (i.e. same size and f... | stackexchange_codegolf |
I'm currently cooking us some cup noodles, but we're really sleepy at the moment. They'll be finished in 50 seconds from now, can you wake me up then?
Problem:
Write a program or function that waits 50 seconds of busy waiting (so that you too doesn't sleep) and then outputs at least 1 visible character to wake me up.
B... | stackexchange_codegolf |
Gematria is an ancient Jewish method to determine a numeric value of a letter sequence, using a fixed value for each letter. Gematria is originally applied to Hebrew letters, but for the context of this challenge, we'll use Latin script instead. There are many ways to implement Gematria in Latin script, but let's defin... | stackexchange_codegolf |
Given a number n, calculate the amount of bases in the range of [2, n) in which b(n) is a Palindrome.
Example
n = 8 has the base conversions:
2 = 1000
3 = 22
4 = 20
5 = 13
6 = 12
7 = 11
Of which 2 of them, 3 = 22 and 7 = 11 are palindromes. So return 2.
Clarifications
For the sake of convenience, Your answer only ne... | stackexchange_codegolf |
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... | stackexchange_codegolf |
Befunge is a 2-dimensional programming language, with an instruction pointer (IP).
In Befunge-98, the ; character tells the IP to skip characters up until the next ; (Let us call it skipping mode when the IP is skipping characters). Here is an example:
"This part is read into the stack" ; this part is not ; @
I would ... | stackexchange_codegolf |
Your task is, given a array of numbers, that is strictly increasing, output the crate stack. The input is an array of positive integers which represents which layer has how many crates there are. So the first number is the top layer and so on. The sum of the array is the size of the crate.
Since the array order follows... | stackexchange_codegolf |
I thought it'd be interesting to turn AoC day 3 puzzle into a Golfing Challenge, so here it is.
Task
Find the number of # you'd encounter in an 11x11 grid (consisting of # and .) that repeats itself (to the right side), starting at the top left corner, which is always a .. You will need to check the position that is \$... | stackexchange_codegolf |
In an earlier challenge I asked code golfers to produce strings which copy each character in a string. For example:
TThhiiss iiss ddoouubbllee ssppeeaakk!!
This challenge is simply to detect if some text meets the definition of a double speak string.
There is an even number of characters.
When split into pairs, ev... | stackexchange_codegolf |
Today our lesson is about rectangles and triangles.
you will be given as an input an n x n grid that is based on two characters # and *
you have to classify it into : triangle or rectangle.
where # represents a point and * represents a blank space.
Example input:
#***
##**
###*
####
Output:
triangle
Another exa... | stackexchange_codegolf |
Background:
Jack is a pumpkin that enjoys spooking the citizens of the villages near his pumpkin patch every Halloween. However, every year after someone lights the candle inside of him, he has a limited amount of time to spook everyone before the candle burns out, thus being unable to spook any more villagers because... | stackexchange_codegolf |
Create the shortest program/function/whatever that splits an inputted string along un-nested commas. A comma is considered nested if it is either within parentheses, brackets, or braces.
Input and output
Output should be a list or a string joined with linebreaks. The input may contain any characters. All testcases wil... | stackexchange_codegolf |
Background
When you run tail -f file in bash, the file is outputted and then any subsequent appends.
However, when you remove something that has already been displayed, tail outputs:
tail: nameoffile: file truncated
Your Challenge
When given an input f, append tail: [value of f]: file truncated (with trailing & leadin... | stackexchange_codegolf |
This is a mirror: |. I just found out that you can stick a mirror in the middle of a string if the string can be mirrored on itself! For example, the string abccba. If you cut it in half the two halves are mirror images of each other:
abc <--> cba
So, we can stick a mirror in the middle of the string, and our new st... | stackexchange_codegolf |
Take a square matrix containing positive integers as input, and calculate the "rotated sum" of the matrix.
Rotated sum:
Take the sum of the original matrix and the same matrix rotated 90, 180 and 270 degrees.
Suppose the matrix is:
2 5 8
3 12 8
6 6 10
then the rotated sum will be:
2 5 8 8 ... | stackexchange_codegolf |
Given a non-empty 2D array consisting of 0 and 1, find the number of squares whose 4 corners are all 1. The squares do not need to be "upright". All the rows are guaranteed to have the same length.
Reasonable input/output methods are allowed.
Testcases:
0001000
1000000
0000000
0000100
0100000
This returns 1.
10101
000... | stackexchange_codegolf |
Your program must accept as input six numbers, which describe a triangle - for example, the inputs 80, 23, 45, 1, 76, -2 describe a triangle with vertices (80, 23), (45, 1), and (76, -2). The input must be given as six plain real numbers or as a list of six real numbers, in the order given in the example. Your task is ... | stackexchange_codegolf |
Scralphabet
A normal bag of Scrabble tiles contains the following letters (? is a blank tile, which can stand for any other letter):
AAAAAAAAABBCCDDDDEEEEEEEEEEEEFFGGGHHIIIIIIIIIJKLLLLMMNNNNNNOOOOOOOOPPQRRRRRRSSSSTTTTTTUUUUVVWWXYYZ??
The letters have the following value:
{"A": 1,"B": 3,"C": 3,"D": 2,"E": 1,"F": 4,"G":... | stackexchange_codegolf |
Suppose denominations of banknotes follow the infinity Hyperinflation sequence: \$ $1, $2, $5, $10, $20, $50, $100, $200, $500, $1000, $2000, $5000, \cdots \$. How many banknotes are required, at minimum, to pay a \$$n\$ bill?
Consider Alice needs to pay \$ $992 \$ to Bob. It is possible for Alice to use 7 banknotes \$... | stackexchange_codegolf |
You're given a rectangular grid of the characters . and #, like this:
..........
..#.......
....#..#..
...#......
..........
Your task is to fill the entire axis-aligned bounding box of the # with further #:
..........
..######..
..######..
..######..
..........
The axis-aligned bounding box is the smallest rectangle... | stackexchange_codegolf |
Intro
Reverse and add is as simple as it sounds, take n and add it to its digits in reverse order. (e.g. 234 + 432 = 666).
If you apply this process repeatedly some numbers will eventually hit a prime number, and some will never reach a prime.
Example
I currently have
11431 rep.
11431 is not prime
11431 + 13411 = 2484... | stackexchange_codegolf |
Lonely primes (as I call them) are primes, where given a number grid with width w ≥ 3, are primes which do not have any other primes adjacent to them orthogonally or diagonally.
For example, if we take this grid where w = 12 (primes highlighted in bold):
1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16 17... | stackexchange_codegolf |
Given a string of printable ASCII, output the frequency of each character in that string.
The Challenge
Input is given as a string of printable ASCII characters (decimal [32-126] inclusive).
Output the frequency of each character, in ASCII order.
The output must have a format similar to [character][separator][count]. ... | stackexchange_codegolf |
Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line.
So the end-result becomes:
cccccccccc
oooooooooooo
nnnnnnnnnnnnnn
eeeeeeeeeeeeeeee
mmmmmmmmmmmmmmmmmm
ooooooo... | stackexchange_codegolf |
I want to read two strings on separate lines, each string the same length and containing only 0's and 1's, and determine if the first is the one's complement of the second. How succinctly can this be done in Python3? (Sorry to specify the language, but this is for my son who's studying Python)
A list comprehension see... | stackexchange_codegolf |
This is an exact inverse of the question Convert to Spoken Binary. This introduction is copied from there.
Introduction
In the video the best way to count, binary is proposed as the
best system of counting numbers. Along with this argument is a
proposal on how to say numbers in this system. First, we give names to
eac... | stackexchange_codegolf |
Golf the leaderboard of this question (id=111735). Your program should issue one HTTP or HTTPS request to StackExchange API, parse it and present to user in form similar to a typical Leaderboard Snippet
Sample output (for the question 47338 instead of this):
Leaderboard
Author Language Size
1. FryAmTheEggman ... | 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 |
I'm letting this one out of the sandbox. Hopefully it is well-written and make sense, feel free to improve.
So in order to make 1+ more popular (and ease the creation of golfed 1+ text-printing programs) here comes the metagolf challenge:
The 1+ Language
1+ is a fun deque-based esolang where 1 is the only literal, and ... | stackexchange_codegolf |
Given a positive integer input N, output the two non-negative numbers, a and b, where a < b, with the lowest possible mean value that will result in the number N being part of the recurring relation sequence:
f(0) = a
f(1) = b
f(n) = f(n-2)+f(n-1)
In case there are more than one solution where the mean of a and b are ... | stackexchange_codegolf |
Given a base type T, this can be augmented with * or [], each meaning pointer and array. For example, []*T means "array of pointer to T" and *[]T means "pointer to array of T".
Let's call * and [] type modifiers. C has a way of ordering these modifiers tied to the evaluation order. []*T in C-style becomes T *[], and *[... | stackexchange_codegolf |
Given a list (array) of names, your challenge is to join the items using some glue and abbreviate the longest items first until the joined string fits a maximum length. And output that string. Since the glue is part of the final string, the length of the glue is included too
Abbreviation is done using the … character
... | stackexchange_codegolf |
Odd prime numbers are either in the form of 4k+1 or 4k+3 where k is a non-negative integer. If we divide the set of odd prime numbers into two such groups like this:
4k+3 | 3 7 11 19 23 31 43 47 59 67 71
|
4k+1 | 5 13 17 29 37 41 ... | stackexchange_codegolf |
It's Christmas in July, so what better way to celebrate than a virtual white elephant gift exchange!
For this King of the Hill challenge, you must create a bot that plays in a White Elephant exchange simulation, trying to get the highest-valued present it can.
Game Rules
The game will be played over many rounds, each ... | stackexchange_codegolf |
Input:
Ten unique integer coordinates, between (0,0) and (100,100).
Output:
The coordinates arranged in the order/an order such that a path drawn between the coordinates in that order is the shortest path possible.
This is code golf so the shortest code wins!
| stackexchange_codegolf |
Given the equation of a non-parabolic conic section, output its characteristics.
Spec
Some info on conic sections:
for more info visit Wikipedia
From an equation of the form \$ax^2+bx+cy^2+dy+E=0\$, it is possible to derive the type of conic section using a combination of square completion and simple arithmetic.
For t... | stackexchange_codegolf |
The tetration operation consists of repeated exponentiation, and it is written ↑↑. For instance,
3↑↑3 =3 ^(3^3) = 3^27 = 7,625,597,484,987
A tetrate of two is an integer that is equal to 2↑↑n for some nonnegative integer n. As an edge case, we say that 2↑↑0=1.
In this challenge, you will be given a positive integer as... | stackexchange_codegolf |
Here in the absolutely made up country Rnccia we have a lot of good stuff, but the roads aren't good. There are lots of holes and only half of them get fixed. Even then, only half of the fixes are well done. Your task is to embrace the bad roads of this country and draw them for me.
Input
You receive two positive integ... | stackexchange_codegolf |
Input
Two dates, each comprising of a month (Dec or Jan) and a day (01-31). These will be given as 4 integers (12 01 01 01, for example), in any reasonable format you choose (leading zeroes, no leading zeroes, list, individual inputs, list of lists, etc.). The first date is supposed to represent today's date.
Output
I... | stackexchange_codegolf |
Ah, Tinder . . . the app that takes the code golf approach to online dating. With just a few well-chosen right swipes and a bit of luck (or a cute puppy pic), you too could have more matches than /(?!)/.
This code-golf challenge involves Tinder dates of a very different kind. Given a Tinder version number as input, hoo... | stackexchange_codegolf |
Cops' Thread
Your challenge is to find an uncracked, unsafe cop on the cops thread, and find an input value for which their code does not do as specified by the challenge.
You must use values within the bounds specified by the cop and the challenge - if a float breaks their program but they specified integers only, it... | stackexchange_codegolf |
Say I have a pile of boxes:
AAA
BBB
I can create it in two steps:
BBB
↓
(empty)
---
AAA
↓
BBB
But with this:
AB
BA
I need three steps:
A
↓
(empty pile)
---
BB
↓
A
---
A
↓
B
BA
Your challenge
Given a pile of boxes, output the minimum number of steps needed to create that pile.
A step consists of dropping a ro... | stackexchange_codegolf |
Write a program that takes in (via STDIN/command line) a non-negative integer N.
When N is 0, your program should print O (that's capital Oh, not zero).
When N is 1, your program should print
\|/
-O-
/|\
When N is 2 your program should print
\ | /
\|/
--O--
/|\
/ | \
When N is 3 your program should print
\ | /
\... | stackexchange_codegolf |
When I was a child, I used to play this game a lot.
Rules
There are two players (let's call them A and B), and each player uses his hands as guns. There are three possible moves:
Hands up to load ammunition to your gun.
Each gun starts empty. Loading increases the ammunition by one.
Hands pointing to the other player... | stackexchange_codegolf |
Inspired by this Youtube Video from Tom Scott.
Write a program or function that prints the current amount of views this question has.
That's it.
Your program may only access the stack exchange api, any other websites are disallowed.
Output
An integer with the exact amount of views this question has at the moment. Outpu... | stackexchange_codegolf |
One of easiest code written by a programming language is a program printing sequence of characters (ex. "Hello, world!"). However, some esoteric programming languages like Brainfuck, even this simplest code is quite annoying to write.
Your task is to write a program (don't have to written in brainfuck), which prints a ... | stackexchange_codegolf |
Who will rule the realm?
You are given a family tree which contains: name, sex, date of birth, date of death and a list of heirs, for each family member. You may use any convenient (nested) list format to represent the tree. The following examples will use JSON. Determine who will rule the realm and in which order.
The... | stackexchange_codegolf |
Given an initial \$n\$-tuple \$t_0=(t_{0,1},...,t_{0,n})\$, we can obtain its corresponding Ducci sequence \$\{t_0, t_1, ...\}\$ by the recurrence \$\displaystyle t_{i+1}=\left(\left|t_{i,1}-t_{i,2}\right|,\left|t_{i,2}-t_{i,3}\right|,...\left|t_{i,n}-t_{i,1}\right|\right)\$.
That is, to obtain the next term of the seq... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.