instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Inspired by this challenge and related to this one.
Background
Badugi [bæduːɡiː] is a low-ball draw-poker variant.
The Pokerstars World Cup Of Online Poker $1K event starts within 3 hours and I'll need to know how good my hands are!
The game uses a standard deck of 52 cards of four suits and thirteen ranks. The suits... | stackexchange_codegolf |
Toki Pona is a constructed language with 137ish words, designed to constrain the speaker to expressing ideas in a simple and straightforward manner, reducing ideas to more essential forms.
Often, people attempt to avoid directly expressing numeric quantities in Toki Pona, opting to express them in more practical terms.... | stackexchange_codegolf |
In this challenge, you are going to take a number and turn it into a string, but not in the common way. You will use the aaaaa way!
The aaaaa way is simply replacing each digit of the input number with the letter at that position in the alphabet. For example, 11111 would become aaaaa and 21223 would become babbc. If th... | stackexchange_codegolf |
Print a tower block with the shortest possible code.
Input:
The input defines how many floors the tower block has. One floor contains a window on either side of the door. The window is made up of 3x3 hashes.
An example of a 4 storey tower block is below:
=====================
)V V V V V V V V V V(
)V ... | stackexchange_codegolf |
In this task you are given an odd number of white balls and the same number of black balls. The task is to count all the ways of putting the balls into bins so that in each bin there is an odd number of each color.
For example, say we have 3 white balls. The different ways are:
(wwwbbb)
(wb)(wb)(wb)
for the two differ... | stackexchange_codegolf |
Introduction:
A typical cartoonish cactus usually looks like this:
One big stem in the middle, with some L-shaped branches sticking out.
We'll use this general shape for this challenge.
Challenge:
Given a pair of words, create an ASCII-art cactus with two upside down alphabets as stem. The first word is the left branc... | stackexchange_codegolf |
Title stolen inspired by Greg Hewgill's answer to What's the difference between JavaScript and Java?
Introduction
Java and JavaScript are commonly used languages among programmers, and are currently the most popular tags on Stack Overflow. Yet aside from similar names, the two have almost nothing in common.
In honor of... | stackexchange_codegolf |
Given, in any way and order,
dimensions (in whichever order you want)
a probability (in whatever format you want)
number of iterations (you may choose whether to count the initial state or not)
do one of the following:
animate, or
output each step of, or
return a list of states of
a spaces-filled sky of those... | stackexchange_codegolf |
Background
(Based on a true, heart-wrenching story)
In my time, I've played around with Lisp and similar languages often. I've written with them, ran them, interpreted them, designed them, and made machines write with them for me... And if there is one thing that bothers me, it's seeing Lisp that does not comply with m... | stackexchange_codegolf |
In the video game Minecraft, you can obtain beacons and put them on pyramid-like structures to give you special effects, such as speed or jump boost.
Your task is to, given an effect, construct the beacon pyramid required for it.
There are multiple sizes of beacon pyramids, required for different effects. The largest h... | stackexchange_codegolf |
Challenge:
Create a program or function that takes an integer input, which outputs a new program/function as specified below.
Input:
Integer n: Time in seconds before the Time Bomb explodes.
Output:
The original program which had the time in seconds n as input, will output a new program/function that does the following... | stackexchange_codegolf |
The sequence of Fibonacci numbers is defined as follows:
\$
F_0 = 0 \\
F_1 = 1 \\
F_n = F_{n-1} + F_{n-2}
\$
Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not need to handle the inputs \$ 0 \$ or \$ 1 \$, nor any non-Fibonacci numbers.
Errors as a result of floating point inaccu... | stackexchange_codegolf |
A number is a Chen prime if it satisfies two conditions:
It is prime itself
Itself plus two is either a prime or a semi-prime.
A prime is a number where it has exactly two divisors and those divisors consist of itself and one.
A semi-prime is a number which is the product of two primes. (Note that 12 = 2*2*3 is not s... | stackexchange_codegolf |
Introduction
You started to write a "Hello, World!" program, but after you wrote the part to print the hello, you forgot what your program should actually print. So now, you somehow managed it to write a program which can check if the entered word is what you search.
The task
Your task is to write a program or function... | stackexchange_codegolf |
Related to: Make a ;# interpreter and Generate ;# code
;# - A Whirlwind Guide
This is a simple language with two commands. Its only data structure is an accumulator, which is initialized to 0.
; Increment the accumulator
# Calculate the value of the accumulator modulo 127, and print the corresponding ASCII character.... | stackexchange_codegolf |
Let us assume that we have number X.
Let us assume that we have positive integer "components" (C) of this X number.
We can add these components together like C1+C2+...+Cn = X.
We have N as limit of number of components.
We have B as limit of biggest component
Distribution: if we have [8;8;5] then avg of components is ... | stackexchange_codegolf |
Above is the picture of the flag of the country Nepal. Pretty cool.
What's cooler, is the aspect ratio, which is defined under the constitution as:
That formula in copyable form:
$$ 1 : \frac{6136891429688-306253616715\sqrt{2}-\sqrt{118-48\sqrt{2}}(934861968+20332617192\sqrt{2})}{4506606337686} $$
Your task is to out... | stackexchange_codegolf |
Referring to the printable ASCII character codes in decimal, we know that from 32 to 126 we have the printable characters with 32 being (space). Your challenge is to write a program using only characters from 32 to 125 (excluding 126) which when executed, prints its own source code except that each character in the sou... | stackexchange_codegolf |
It's laundry day, and you have lots of clothes that need to be washed. Wanting to have as much time left over for code golf as possible, you hope to optimize how quickly you wash and dry them all.
You have three types of appliances:
Washing machines: Take dirty clothes and turn them into wet clothes
Dryers: Take wet c... | 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 |
Is the path correct ?
Given a string, your program must determine whether or not Alice can reach Bob, following the signs on the map. You must return a truthy or falsy value.
The input string will contain the following characters :
(space) and \n. Only used for padding.
>, <, ^, v, are the "signs". They show the dire... | stackexchange_codegolf |
The original 151 Pokemon, in an array format suitable for initializers:
["Bulbasaur", "Ivysaur", "Venusaur", "Charmander", "Charmeleon", "Charizard", "Squirtle", "Wartortle", "Blastoise", "Caterpie", "Metapod", "Butterfree", "Weedle", "Kakuna", "Beedrill", "Pidgey", "Pidgeotto", "Pidgeot", "Rattata", "Raticate", "Spear... | stackexchange_codegolf |
In this challenge you will write code to take a list of positive integers and output all maximal linear sublists.
A sublist is is a list which can be created by deleting values from the the input list. Sublists have more structure than just lists. They in a way "remember" which values are deleted.
Similarly we say tha... | stackexchange_codegolf |
In the card game Magic: the Gathering there are five different colours, which represent loose affiliations of cards, White (W), Blue (U), Black (B), Red (R) and Green (G). These are often arranged in a pentagon as follows:
W
G U
R B
Both in the lore of MtG as well as in many card mechanics, adjacent colours in th... | stackexchange_codegolf |
In chess, a knight can only move to the positions marked with X relative to its current position, marked with ♞:
A Knight's Graph is a graph that represents all legal moves of the knight chess piece on a chessboard. Each vertex of this graph represents a square of the chessboard, and each edge connects two squares th... | stackexchange_codegolf |
After giving back the results of the last topology exam to his students, Pr. Manifold was worried about complaints.
Since he is aware his students know where his office is located, Prof. Manifold decided to transform his office into a bunker with a 10 digit password (all characters are digits).
But he suspected his st... | stackexchange_codegolf |
Pike is a dynamically typed interpreted scripting language, heavily influenced by C, which typically compiles to C99 with a few #defines. (It even has a preprocessor!)
What general tips do you have for golfing in Pike? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat... | stackexchange_codegolf |
Is there any better way to golf this (other than removing newlines/indentation)?
function(a,b,...)
local c=s(a,b)
local d=c
for i,v in ipairs{...} do d=d:push(v) end
return c
end
I'm particularly bothered by the double local usage, but as Lua does not have multiple assignment, and I cannot use function paramet... | stackexchange_codegolf |
The JavaScript compressor RegPack uses a very simple string compression algorithm. Given a piece of code, it will make a list of characters that aren't used in that code and use them to delimit repeated strings that are inserted back into the string.
To show how strings are compressed, it's necessary to show how the de... | stackexchange_codegolf |
[Question inspired by Can you calculate the average Levenshtein distance exactly? . Thank you Anush. ]
The longest common substring between two strings is the longest substring which is common to both. Please note this is not the same as the longest common subsequence whose fastest algorithm takes quadratic time.
The ... | stackexchange_codegolf |
Prologue
After installing an anti-XSS browser extension, Stack Snippets suddenly stopped working all across the Stack Exchange network. I could no longer learn from Stack Overflow, see working demos on User Experience and, worst of all, could not test JavaScript answers on Programming Puzzles and Code Golf! Desperately... | stackexchange_codegolf |
I once had a beautiful rectangular array. It was very symmetrical, but unfortunately it has fallen apart and now I only have the top left corner. Your task will be to rebuild the original array.
Your program will receive a 2 dimensional array of integers. For ease of parsing, you may assume they are all between 1 and 9... | stackexchange_codegolf |
Challenge:
Your task is to use any language to output that language's name times the number of character's in its name.
Use the common name or acronym of the language.
If there are
multiple versions of a language, you need not include the version number.
The capitalization matters.
Examples:
PHP -> PHPPHPPHP
Java -> ... | stackexchange_codegolf |
When making a Minecraft data/resource pack, you need to include a pack.mcmeta file, which specifies information about it. pack.mcmeta contains a description, but it also contains a pack_format number, which tells Minecraft which versions this pack is for.
Your task is to take a version string, and output what pack_form... | stackexchange_codegolf |
If you consider the following PHP+C polyglot snippet, there is a problem regarding class property access in the printf call:
#include <stdio.h>
#include <stdlib.h>
#define class struct
#define function
class Point {
#define public int
public $x;
public $y;
};
int
function main()
{
struct Point*
$p = ... | stackexchange_codegolf |
Your task is to write a program, function or snippet (yes, snippets are allowed) that simply outputs an integer. However, you must be able to separate your submission into prefixes that also produce distinct integers. You cannot use any bytes that have appeared in previous prefixes. For example, we can have the prefixe... | stackexchange_codegolf |
Our boolean operators are AND, OR, XOR, NAND, NOR, XNOR and, in conjunction with one of those operators, NOT.
Our numbers are \$1\$ and \$0\$.
The challenge is to write a program or function that calculates the results of the input.
Input
A string, array or other input format of your choice; containing alternating numb... | stackexchange_codegolf |
Looking at
Arnauld's answer, it seems like this version is not really more difficult than the other version, so I made it an optional requirement of the other challenge
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 i... | stackexchange_codegolf |
Your task is to make a script with the shortest byte count, that reverses a word then replaces each letter with the next letter next in the alphabet.
Examples:
input: hi
output: ji
input: hello
output: pmmfi
input: test
output: utfu
A few notes:
Should the letter's value be 27 (z+1), assume it is an a.
Symbols, num... | stackexchange_codegolf |
Your input is a ragged list of positive integers and a positive integer. Your task is to find that positive integer and return it's index, or if the positive integer doesn't exist, indicate it's nonexistence.
How are indices in ragged lists defined? They are simply lists of indices that when used consecutively to index... | stackexchange_codegolf |
You have your very heavy cubical box on a flat floor at position (0,0). All you can do with it is roll it in four cardinal directions (east, north, west, south). Your task is to bring it to a target position, such that the side facing up is the same as before your manipulations.
Make a program or function which receive... | stackexchange_codegolf |
If you haven't played golf before, here's a list of golf-related terms I use in this question
Shot, also called a stroke: Every time the ball is hit, this is a shot.
Hole: A golf course is split into holes, in which the goal is to hit a ball from one designated location to another in as few shots as possible.
Tee: Whe... | stackexchange_codegolf |
See also: Make a move on a Go board.
Task
Go is a board game where two players (Black and White) place stones on the intersections of grid lines on a 19×19 board. Black moves first — for example, on D4:
In this challenge, you must take a Go board coordinate like D4 as input, and output an ASCII representation ... | stackexchange_codegolf |
Create a program that interprets the programming language Bucket.
Bucket works on two buckets: the first can hold A and the second can hold B units of liquid. The things you can do with these buckets are:
f: fill bucket A
F: fill bucket B
e: empty bucket A
E: empty bucket B
p: pour units of liquid from A to B until one... | stackexchange_codegolf |
Probably a simple code-golf challenge. Given 2 positive integers m and n, make a list of n values that are positive integers whose sum is equal to the number m. Either all values in the output are the same value or the difference is exactly 1.
Examples
For example
m=6 and n=3 would become 2, 2, 2
m=7 and n=3 would bec... | stackexchange_codegolf |
Your task is to write a program or function which:
When run for the first time, outputs its source code.
On subsequent executions, it should output what it output previously, but with one random character change (defined below). It does not have to be a uniformly random change, but every possible change should have a ... | stackexchange_codegolf |
In a now deleted stackoverflow question, someone posted the following:
Write a program or function to print alternating patterns in * and # based on a given integer n. Some examples:
Input: n=1
Output:
*
Input n=5
Output:
*####
###**
***##
###**
*####
Input: n=8
Output:
*#######
######**
***#####
####****
****####
##... | stackexchange_codegolf |
Given an unordered list of musical pitches, write the shortest program/function (scored in bytes) to sort the list from lowest pitch to highest.
Pitches will be given in scientific pitch notation, consisting of a tone name followed by an octave number. Here, the tone name will be a single letter A–G, possibly followed ... | stackexchange_codegolf |
I recently found out about the Fishing language, and it is now a favorite of mine. However, I'm finding it difficult to do anything cool with it, including code golf. Are there any tips for golfing with Fishing to use the least characters? And any string manipulation tricks would be cool, as I am finding that difficult... | stackexchange_codegolf |
Part 1 of the challenge revolved around converting the letters into specific unicode characters.
Lore
In this part we receive the output from the function made in Part 1, which now has to be arranged in an artistic manner.
Aim
Take 1 word as input which has already undergone transformation in the function made in Part ... | stackexchange_codegolf |
Have you ever wondered, when doing shopping, how to pack your products into 2 bags you're carrying so that a total weight would be distributed among them as evenly as possible?
Your task is to write a function, that takes a list of positive numbers (lets say integers for simplicity) as an input. It should return two li... | stackexchange_codegolf |
Challenge
Create a program that will build a recursive list of all linked webpages (given a starting point), to a depth determined by user input.
Any valid link in the HTML should be crawled, whether or not it is a script, image, etc.
Example Input
<program name> <url to crawl> <depth>
webcrawler http://crawlthissite.c... | 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 |
In this challenge you will take two lists as input and you will zip them. The zip can be defined with this recursive expression:
\$
\mathrm{zip}(a,b) = \begin{cases}
\left[\,\,\right] & a = \left[\,\,\right] \\
[a_0]\mid\mid\mathrm{zip}(b, t) & a = [a_0] \mid\mid t
\end{cases}
\$
or this Haskell program if you would l... | stackexchange_codegolf |
Given an integer from 1 to 999 inclusive, output a truthy value if it appears horizontally, vertically, or diagonally, either forwards or backwards, anywhere in the 3x3 square of digits 1-9 on a standard number pad:
789
456
123
If the number does not appear, output a falsy value.
The exact 65 numbers you need to outpu... | stackexchange_codegolf |
Inspired by this
Your task today: given two strings, find the string with the lowest maximum Levenshtein distance to the input strings. For example, using Steffan and Seggan, the average string will be Steggan. It is distance 2 from Steffan (replace the gg with ff), and 1 from Seggan (add a t). That gives it a maximu... | stackexchange_codegolf |
Robbers thread
Your task is to create a method for hiding information in an image. You will post three encoded messages of your choice (keep them classy), each with its associated image. Reveal the messages for the first two images and do not reveal the third. Robbers have the task of determining what your third hidden... | stackexchange_codegolf |
Leaderboard
User Language Score
=========================================
Ell C++11 293,619,555
feersum C++11 100,993,667
Ell C++11 78,824,732
Geobits Java 27,817,255
Ell Python 27,797,402
Peter Taylor... | stackexchange_codegolf |
Instructions
Your goal is to write code that makes a "string" from a string in the least amount of bytes possible, as per the rules of code-golf. Standard loophole rules apply.
To make a string, you have to assume the string contains only alphabetical characters and basic punctuation such as the period, comma, colons a... | 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 |
An activity I sometimes do when I'm bored is to write a couple of characters in matching pairs. I then draw lines (over the tops never below) to connect these characters. For example I might write \$abcbac\$ and then I would draw the lines as:
Or I might write \$abbcac\$
Once I've drawn these lines I try to draw cl... | stackexchange_codegolf |
Given a ragged list of positive integers return a full cycle of recursive rotations starting with the unchanged input and ending with the state immediately before revisiting the initial state.
Examples:
[[2,3],4,5,5] -> [[2,3],4,5,5] , [4,5,5,[3,2]] , [5,5,[2,3],4] , [5,[3,2],4,5]
[1,10,[2,2,4],6,[[5,6],7],1] -> [1,10... | stackexchange_codegolf |
Given a fraction in the format m/n (where m and n are coprime integers), output the corresponding Unicode fraction. Your program/function will not be expected to take in any input that does not correspond to a Unicode character. Arrays, e.g. [2, 3] as opposed to 2/3, are accepted. m / n as opposed to m/n is also fine. ... | stackexchange_codegolf |
Due to technical limitations of Stack Exchange, the title is rendered incorrectly. The correct title for this challenge is
Make a
Word Icicle!
Word Icicle
Word cicle
ord cicle
ord icle
ord i le
or i le
or i l
or l
or
r
Today's challenge is to make icicles out of t... | stackexchange_codegolf |
Confidant Numbers
Let x be an integer of an arbitrary base, such that D is an array of its digits. x is a Confidant Number if, for all n between 1 and the length of D:
D[n+1] = D[n] + D[n-1] + ... + D[1] + n
Take, for example, the number 349 in base 10. If we label the indices for this number, we have the following.
... | stackexchange_codegolf |
Semordnilaps (also known as heteropalindromes, semi-palindromes, half-palindromes, reversgrams, mynoretehs, reversible anagrams, word reversals, or anadromes) are words which are also words when spelled backwards. A few examples are:
Ward <=> Draw
Mined <=> Denim
Parts <=> Strap
Given a positive integer N (via functi... | 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 |
This is based on how my company deals with the monitoring of the working times for every employee. Each one of us has a card that can be passed in front of a sensor, so that a clock registers the times at which the employees check in or out the office. Every time register is linked to a code:
Code 0: the employee arri... | stackexchange_codegolf |
Well, turns out Doorknob's
username on GitHub, Reddit, and other sites is
KeyboardFire. That gives me an idea...
The task
You work at KeyboardFire Inc., a company that makes special keyboards. And, by
"special", I mean that, whenever you press a key, something in your house lights
on fire! With the new KeyboardFire Doo... | stackexchange_codegolf |
Source: Wikipedia
For this challenge, you should write two programs which resemble the figure and ground of the above image, such that one of them prints figure and the other prints ground. Specifically:
Write a program which takes no input and prints the string figure. The only allowed whitespace characters in your ... | stackexchange_codegolf |
Goal:
Given an array of strings, create abbreviated versions of each string.
Specification:
For this challenge, an abbreviation is the first N characters of a string. For the string abc: a, ab, and abc are all valid abbreviations, while bc, and ac are not.
Given an array of strings, we want to find the shortest set of... | stackexchange_codegolf |
Intro
Find the result of number cannibalism.
Why was 6 scared of 7? Becase 7 8 9.
Your program will have to find the result of applying the 8 operation(defined below) on a number, repeatedly.
Related, Sandbox
Challenge
Your input will be a single positive integer, n.
You need to find each 8 in the integer, and substitu... | stackexchange_codegolf |
One way to generalize the concept of a range from the integers to the Gaussian integers (complex numbers with integer real and imaginary part) is taking all numbers contained in the rectangle enclosed by the two ends of the range. So the range between two Gaussian integers a+bi and c+di would be all Gaussian integers x... | stackexchange_codegolf |
This problem is an extension of what happens to me on a regular basis: I have to have $1.00 in coins and have to be able to give change to somebody. I discovered rather quickly that the ideal coins to have were 3 quarters, 1 dime, 2 nickels, and 5 pennies. This is the smallest number of coins (11 total) that allows me ... | stackexchange_codegolf |
Generator functions
This gives the context for why this challenge came to life. Feel free to ignore.
Generator functions are a nice way of encoding the solution to a problem of combinatorics. You just write some polynomials, multiply them and then your solution is the coefficient of one of the terms.
For example, how m... | stackexchange_codegolf |
(inspired by this challenge over on Puzzling -- SPOILERS for that puzzle are below, so stop reading here if you want to solve that puzzle on your own!)
If a letter in a word occurs alphabetically later than the previous letter in the word, we call that a rise between the two letters. Otherwise, including if it's the sa... | stackexchange_codegolf |
This challenge is not code golf. Please read the scoring before you attempt to submit an answer.
You will be given a multi-line string as input. You should output the size of the largest contiguous chunk of non-space characters. Contiguous just means that the chunk is a single piece rather than multiple disconnect... | stackexchange_codegolf |
Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded.
Cubax is composed of N³ smaller cubes (elements) linked together in a kind of doubly linked chain. The chain h... | stackexchange_codegolf |
The three-dimensional Levi-Civita symbol is a function f taking triples of numbers (i,j,k) each in {1,2,3}, to {-1,0,1}, defined as:
f(i,j,k) = 0 when i,j,k are not distinct, i.e. i=j or j=k or k=i
f(i,j,k) = 1 when (i,j,k) is a cyclic shift of (1,2,3), that is one of (1,2,3), (2,3,1), (3,1,2).
f(i,j,k) = -1 when (i,j... | stackexchange_codegolf |
You are to take a string representing a piece of brainfuck code and Explanations, containing only printable ASCII characters and newlines ( to ~, ASCII 10 and 32 to 126) as input and output an explanation of that code, formatted to be compliant with Stack Exchange markdown.
That is, the explanation must satisfy:
Each... | stackexchange_codegolf |
Multiplicative Persistence
Multiply all the digits in a number
Repeat until you have a single digit left
As explained by Numberphile:
Numberphile "What's special about 277777788888899?"
Numberphile "Multiplicative Persistence (extra footage)"
Example
277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872
... | stackexchange_codegolf |
Given two rectangles, which are possibly not in the orthogonal direction, find the area of their intersection.
Input
You may take the rectangles as input in one of the following ways:
The coordinates of the four vertices of the rectangle. These coordinates are guaranteed to represent a rectangle.
The coordinates of t... | stackexchange_codegolf |
Good Afternoon Golfers,
Our challenge for today is inspired by XKCD comics 356 and 370. We're going to write a program to calculate the resistance of a group of resistors. A forewarning that this is nearly tough enough to warrant being a code challenge, however I think that there is a certain art to writing slightly mo... | stackexchange_codegolf |
Anomalous Cancellation (from Wolfram Alpha):
Anomalous cancellation is a "canceling" of digits of a and b in the numerator and denominator of a fraction a/b which results in a fraction equal to the original. Note that if there are multiple but differering counts of one or more digits in the numerator and denominator t... | stackexchange_codegolf |
RPS 25 is a version of Rock Paper Scissors which has 25 hand symbols instead of just 3. Each symbol defeats 12 symbols, and is defeated by 12 others.
Here's a link to a chart showing which symbols defeat which.
The challenge here is simple: your program should take in two strings representing the symbols thrown by each... | stackexchange_codegolf |
Context
Just look around! Whenever someone posts an answer, the same template is followed over and over again! A first line with the byte count and language name. Then the code. Then the TIO link. This is the basic skeleton almost everyone follows.
Task
Your task, should you choose to accept it, is to write a program/f... | stackexchange_codegolf |
You and some buddies are going bowling. There are a total of N bowlers. However, there are only N-1 chairs to sit in. The solution is simple: whoever's turn it currently is doesn't get a chair. Then when their turn is over, they sit in the chair of the person that goes next.
Lets take an example. Say You are named A, ... | stackexchange_codegolf |
Introduction
Dobble/SpotIt is a card game, where people have to spot same symbol on pair of cards in shortest time, indicate it and move to next pair. Each card has multiple symbols (8 in normal version), but exactly one is common between each pair of cards.
Example from physical copy of game:
Challenge
Write a progr... | stackexchange_codegolf |
Your Programs:
You'll write two programs (both in the same language). The storage program takes a string from STDIN and stores it somewhere persistent (see below) and then exits without error. The retrieval program takes no input, retrieves the string that was stored, and prints it to STDOUT.
Objective test of Persiste... | stackexchange_codegolf |
Write the shortest program possible that takes in a set of distinct positive integers and outputs an ASCII rendering of concentric hexagons with those side lengths, made from slashes, underscores, spaces, and newlines.
The shortest program in bytes as counted by https://mothereff.in/byte-counter wins.
Examples
(They lo... | stackexchange_codegolf |
The following data contains the (approximate) population of each UTC timezone in the world (source):
UTC;Population (in thousands)
-11;57
-10;1853
-9.5;8
-9;639
-8;66121
-7;41542
-6;272974
-5;332101
-4.5;31923
-4;77707
-3.5;499
-3;248013
-2;4855
-1;3285
0;285534
+1;857443
+2;609921
+3;496279
+3.5;81889
+4;129089
+4.5;3... | stackexchange_codegolf |
You wake up and find out that your computer has been stolen! You have a few sensors and scanners, but unfortunately, the footage is incomplete, so you want to find and rank your suspects for further investigation.
Your computer is a rectangle, and your camera caught a bunch of people walking around with packages; howev... | stackexchange_codegolf |
Challenge :
Your job is to find the given number N.
Input :
You will be given a string in the following form:
dN ± Y = X
Where:
d, N, X, Y are all numbers with d , X , Y being integers (not decimals).
Output :
Solve the equation and output the value of N rounded. Round up if decimal is greater than or equal to 0.5... | stackexchange_codegolf |
Let a counting tree be a rooted tree in which every node is labeled with the number of descendants it has.
We can represent such trees as ragged lists with each node being represented by a list containing its label followed by its children. For example the following is a counting tree:
[5,[2,[0],[0]],[0],[0]]
However ... | stackexchange_codegolf |
Consider an array A of integers of length n. The k-max subarray sum asks us to find up to \$k \leq 3\$ (contiguous) non overlapping subarrays of A with maximum sum. If A is all negative then this sum will be 0. If A = [-1, 2, -1, 2, -1, 2, 2] and k=2 for example, then the two subarrays could be [2, -1, 2] and [2, 2] ... | stackexchange_codegolf |
Background
Python 3 has many types of string literals. For example, the string this 'is' an exa\\m/ple can be represented as:
'this \'is\' an exa\\\\m/ple'
"this 'is' an exa\\\\m/ple"
r"this 'is' an exa\\m/ple"
'''this 'is' an exa\\\\m/ple'''
"""this 'is' an exa\\\\m/ple"""
r'''this 'is' an exa\\m/ple'''
r"""this 'is' ... | stackexchange_codegolf |
This is a pretty run of the mill question. I will define a sequence and you golf some code to output a entry given a index.
The first item in the sequence is 2.
The nth item in the sequence is the smallest positive integer other than n and 1 sharing at least one factor with n (other than 1) that has not already appea... | stackexchange_codegolf |
Lists can contain lists and we have nested lists. But we don't like nested lists and want to flatten them. By flattening I mean create a list which does not contain any list, but elements of lists it contained before. I'll explain it more.
Input
An arbitrary size list which has the below properties:
it can contain int... | stackexchange_codegolf |
You must fill an array with every number from 0-n inclusive. No numbers should repeat. However they must be in a random order.
Rules
All standard code-golf rules and standard loopholes are banned
The array must be generated pseudo-randomly. Every possible permutation should have a equal probability.
Input
n in any way ... | stackexchange_codegolf |
It is known that any natural number can be decomposed into the sum of three triangular numbers (assuming 0 is triangular), according to Fermat's Polygonal Number Theorem. Your task is to come up with an algorithm of decomposing number into 3 triangular numbers that has the best asymptotic complexity. As an input you ar... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.