instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
You need to produce output that is non-deterministic.
In this case, this will be defined to mean that the output will not always be the same result.
Rules:
A pseudo-random number generator that always has the same seed does not count.
You can rely on the program being run at a different (unknown) time each execution.
... | stackexchange_codegolf |
Each day you put up a new word on a marquee sign with movable letters, buying just the letters you need to write it. You re-use letters you've bought for earlier words whenever possible. Given the words you want to write each day in order, output the letters you buy each day.
Example
Input: ['ONE', 'TWO', 'THREE', 'S... | stackexchange_codegolf |
Challenge
In this challenge you will construct trees, in the form of ASCII Art using recursion. Basically you will generate the ASCII version of the Fractal Tree
Input
Number of iterations 0 < N <= 5
Output
The Nth iteration of the Fractal Tree. It must be a matrix of 63 rows and 100 columns. (i.e. 6300 printable ch... | 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 |
Identify whether an IP address is internal, global, link-local, or reserved.
Input should be an IPv4 address in decimal octets separated by periods.
Output should be 0 for link-local (RFC 3927), 1 for internal (RFC 1918), 2 for global IPs (Internet), and 3 for otherwise reserved addresses.
All these address types are d... | stackexchange_codegolf |
Given a compressed string \$s\$ made of printable ASCII characters (32 to 126), your task is to print or return the original text by applying this simple decompression algorithm:
Start with \$k=0\$
Look for the first occurrence of the digit \$k\$ in \$s\$ and the sub-string \$s'\$ consisting of the \$2\$ characters pr... | stackexchange_codegolf |
A time in the format hhMMss is represented by six numbers in the range 0..9 (e.g.100203 for 3 seconds after 2 minutes after 10am (10:02.03), or 155603 for three seconds after 56 minutes after 3pm (15:56.03).
Treating these times as integers, these numbers are therefore in the range 000000 to 235959; but not all numbers... | stackexchange_codegolf |
In Emoji Math, a user created module for the video game Keep Talking And Nobody Explodes, numbers are written as strings of emoticons, where each emoticon represents a base 10 digit.
Below is the conversion table between digits and emoticons.
Digit | Emoticon
0 | :)
1 | =(
2 | (:
3 | )= ... | stackexchange_codegolf |
Tetration, represented as \${}^ba\$, is repeated exponentiation. For example, \${}^32\$ is \$2^{2^2}\$, which is \$16\$.
Given two numbers \$a\$ and \$b\$, print \${}^ba\$.
Test cases
1 2 -> 1
2 2 -> 4
5 2 -> 3125
3 3 -> 7625597484987
etc.
Scientific notation is acceptable.
Remember, this is code-golf, so the code w... | stackexchange_codegolf |
Simple task, write a program/function that returns error if and only if presented with itself.
The program must give a valid output for any input other than itself.
For the error part, you can only use errors already built in errors that comes with your language of choice. New/ self-defined error messages are not allow... | stackexchange_codegolf |
Background
Most of you know what a Fibonacci number is. Some of you may know that all positive integers can be represented as a sum of one or more distinct Fibonacci numbers, according to Zeckendorf's Theorem. If the number of terms in the optimal Zeckendorf Representation of an integer n is itself a Fibonacci number, ... | stackexchange_codegolf |
When code-golfing there will be times where you need a Hex Dump of your code, usually because you've used unprintable characters. So, why not make a program that Hex Dumps itself?
The Challenge
This challenge is to, given no input, output a Hex Dump of your source code in the following formatting:
0000: 00 00 00 00 00 ... | stackexchange_codegolf |
TailwindCSS is a utility that lets one write CSS code using only HTML classes, which are then converted to CSS code with the Tailwind compiler. Ordinarily, one would write CSS in a separate file from the HTML, and reference named classes:
<!-- without Tailwind -->
<p class="crazy-monologue">Crazy? I was crazy once. The... | stackexchange_codegolf |
Given a non negative integer number \$n\$ output how many steps to reach zero using radicals, divisions or subtractions.
The algorithm
Get digits count ( \$d\$ ) of \$n\$.
Try the following operations in order:
$$\sqrt[d]{n}$$
$$n/d$$
$$n-d$$
Take the first integer result not equal to \$n\$.
Floating point errors ... | stackexchange_codegolf |
"Buzzing" Bill is a well respected beaver. He is the hardest working in his home dam. He was a strong beaver and was able to lift more logs than anyone at the dam. Unfortunately Buzzing Bill's career came to an end in a tragic accident. Being such a prominent figure in his town, the Beaver newspaper wanted to write a ... | stackexchange_codegolf |
If a string T of length K appears K or more times in a string S, then it is potentially communistic. For example, 10 in 10/10 is potentially communistic, for it appears 2 times and is of length 2. Note that these substrings cannot overlap.
A communistic transformation is one that takes this string T and moves each cha... | stackexchange_codegolf |
OEIS sequence A020872 counts the number of restricted forests on the Möbius ladder Mn.
The Challenge
The challenge is to write a program that takes an integer as an input n > 1 and returns A020872(n), the number of restricted forests on the Möbius ladder Mn. This is code-golf, so shortest code wins.
(An ulterior motiv... | stackexchange_codegolf |
Minecraft inventory management is hard. You have 17 diamonds, but you need 7 to craft an enchantment table, a pickaxe, and a sword. Do you pick them up and right click 7 times? Or do you right click once and right click twice and take the 7 left? It's so confusing!
for those of you who are now confused, don't worry, I'... | stackexchange_codegolf |
A Cullen Number is any number that is contained in the sequence generated using the formula:
C(n) = (n*2^n)+1.
Your Task:
Write a program or function that receives an input and outputs a truthy/falsy value based on whether the input is a Cullen Number.
Input:
A non-negative integer between 0 and 10^9 (inclusive). ... | stackexchange_codegolf |
Write a function or program that, when given a list of names, outputs or returns a list where duplicates of given names have a unique shortened version of their surname.
Input:
A list of names, where a name is defined by a given name and a last name separated by a space. Names are non-empty strings containing only upp... | stackexchange_codegolf |
Given a non-negative integer (n), create a function that returns n in alphabetical order, according to the literal spelling of each digit in n.
Examples:
Input: 101
>> one, zero, one
>> one, one, zero
Output: 110
Input: 31948
>> three, one, nine, four, eight
>> eight, four, nine, one, three
Output: 84913
Input: 5544
... | stackexchange_codegolf |
Background
I like my old 8-bit 6502 chip. It's even fun to solve some of the challenges here on PPCG in 6502 machine code. But some things that should be simple (like, read in data or output to stdout) are unnecessarily cumbersome to do in machine code. So there's a rough idea in my mind: Invent my own 8-bit virtual ma... | stackexchange_codegolf |
In this challenge, submissions will be programs or function which, when given an emoticon such as :-), :(, or :D, will rate their happiness from 0 to 3.
An emoticon will be one of the following:
:(: 0
:|: 1
:): 2
:D: 3
Emoticons may also have noses (a - after the :).
Test cases:
:( -> 0
:-| -> 1
:D -> 3
:-) -> 2
:|... | stackexchange_codegolf |
Introduction
Forte is a very peculiar esoteric language based on the concept of modifying the values of numbers. In Forte numbers are not constants but variables, you can use the LET instruction to assign new values to them.
For example, after executing LET 2=4-1 from now on 2 assumes the value of 3, which means that w... | stackexchange_codegolf |
Say i have a list (unorder):
Score = ['score1','score10','score6','score2','score22','score12']
Names = ['name1','name10','name6','name2','name22','name12']
email = ['email1','email10','email6','email2','email22','email12']
and then Score is sorted to be
ScoreSorted = ['score1','score2','score6','score10','score12','s... | stackexchange_codegolf |
UPDATE: isSuicidal() was added to the plane class, this allows you to check if a plane is on an irreversible collision course with the walls!!
UPDATE: updateCoolDown() separated from simulateMove()
UPDATE: non-Java entry wrapper, written by Sparr, available for testing, see comments
UPDATE Zove Games Has written an aw... | stackexchange_codegolf |
The task here is pretty simple. You should write a program that takes a string as input and outputs it (that is a cat program).
Additionally when the \$n\$th byte of your program is removed (without replacement) the augmented program should take a string as input and remove the \$n\$th character. If the input to your... | stackexchange_codegolf |
Challenge Taken from here and also here
An n parentheses sequence consists of n (s and n )s.
A valid parentheses sequence is defined as the following:
You can find a way to repeat erasing adjacent pair of parentheses "()" until it becomes empty.
For example, (()) is a valid parentheses, you can erase the pair on the 2... | stackexchange_codegolf |
Write code to generate a PDF file containing 6 bingo cards. Winner is the one that uses the shortest code and needs no actions except for installing a library and running the code. (No Save As PDF). Rules are as follows.
The generated PDF file should display accurately in Adobe's PDF reader, Google Chrome and Moxilla ... | stackexchange_codegolf |
The Goldbach conjecture states that:
every even number that is greater than 2 is the sum of two primes.
We will consider a Goldbach partition of a number n to be a pair of two primes adding to n. We are concerned with numbers is of increasing Goldbach partition. We measure the size of a number's Goldbach partitions ... | stackexchange_codegolf |
Your company lately hired a new bunch of extremely dedicated sysadmins. They feel that just watching computer screens is quite limiting (I mean, 60Hz refresh rate is just NOT enough), so they hooked up the CPU data bus to an DAC and play that on a speaker through the server room so that they can hear up to 20kHz. One p... | stackexchange_codegolf |
Task
The task is to tile polygons, given a vertex configuration.
Scoring
Your score is equal to the "complexity level" your submission reaches. Complexity levels are cumulative, meaning that to reach #3 you must also support #1 & #2.
Submissions at an equal complexity level are distinguished by byte count; lowest wins... | stackexchange_codegolf |
A superabundant number is an integer n that sets a new upper bound for its ratio with the divisor sum function σ. In other words, n is superabundant if and only if, for all positive integers x that are less than n:
$$\frac{\sigma(n)}n>\frac{\sigma(x)}x$$
For a few of the values:
n σ(n) σ(n)/n superabundant
1 1 ... | stackexchange_codegolf |
Let's for once do something useful.
Given the text from a Try It Online codegolf submission, produce the equivalent Chat Mini Challenge submission, which is of the form
Language, N bytes: [`code`](URL)
or (if submission is a single byte – TIO will add a trailing s on the first line only if needed)
Language, 1 byte: [`... | stackexchange_codegolf |
This is the second in a series of Island Golf challenges. Previous challenge
Two hermits have arrived on a desert island. Since they came seeking solitude, they wish to live as far away from each other as possible. Where should they build their huts to maximize the walking distance between them?
Related reading
Input
Y... | stackexchange_codegolf |
Like the previous SmokeDetector challenge? This one is for you too ;)
Note: SmokeDetector is a bot that detects spam and offensive posts on the network and posts alerts to chat.
What to implement
Smokey's !!/coffee command uniformly at random picks one of these words (sorts of coffee):
Espresso
Macchiato
Ristretto
A... | stackexchange_codegolf |
Background
Here is a Halloween related challenge.
As you may have seen from my last challenge I quite like what I term as ascii art animations, that is not just draw a pattern but draw a pattern that progresses. This idea came to me after I was asked a couple of years ago to liven up a (rather dull) presentation by mak... | stackexchange_codegolf |
I would like to convert ASCII art to something that takes less bytes. I have string like this:
my $string = ' ██ ████ █';
And I would convert this to something like this:
print "█" x 1."█" x 1."█" x 1"█" x 1"█" x 1;
So I would write this in one line and convert to using x operator. How can achieve ... | stackexchange_codegolf |
Because I can't concentrate on any task for more than about 5 seconds, I often find myself breaking up words into a sub-strings, each of which is a different length and doesn't contain any repeated characters. For example, the word "pasta" might be broken up in "past" & "a", "pas" & "ta", or "pa" & "sta" and you get th... | stackexchange_codegolf |
V1.1: Added criterion to help with tiebreakers, a bit overkill but still.
Task: Crack the scrambled code for calculating the argument of a complex number \$z=x+iy\$ given two inputs.
You must post a comment in the cops’ thread with a link to your working source, mentioning clearly that you have cracked it. In your ans... | 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 an image, either as input (possibly in RGB triplets) or with the filename as input (you may assume the image has a specific filename, possibly without an extension), output an image representing a single color channel of the image.
You will also take another input, representing which channel to output. The input ... | stackexchange_codegolf |
Write a program to generate a rectangular word-search of size 6x9. Words may go downwards, rightwards and diagonally (downwards and to the right), they may also overlap on the board.
The challenge is to include as many different English words as possible from https://www.ef.co.uk/english-resources/english-vocabulary/to... | stackexchange_codegolf |
Goal
In light of the World Series being around the corner, I need a program that can read the box scores and tell me what inning it is. This is complicated slightly because baseball uses an odd method to record the score. They don't write down the at-bat team's score for the inning until they've scored a run (and are s... | stackexchange_codegolf |
Your task
Given a numerical string or integer \$\ge 0\$ (which may have leading zeros), convert it to letters using the below rules.
Rules
Loop through the digits:
If the digit is 0 or 1, combine it with the next digit and output that letter of the alphabet (0-indexed).
If the digit is 2, combine with the next digit O... | stackexchange_codegolf |
Introduction
You are the police chief of the NYPD and you have been tasked to position police officers so that all of the streets are patrolled. Your squad is short-staffed, however, meaning that you need to position as little officers as possible.
Challenge
Given a map of blocks, you must return the smallest number of... | stackexchange_codegolf |
Your task is to output a square sandbox of size n+2 with / characters in the corners and | for the sides, and - for the top, with n**2 layers of sand (.) overflowing out of the sandbox of width n+2
Testcases
1
->
/-/
|.|
/./
...
2
->
/--/
|..|
|..|
/../
....
....
....
....
3
->
/---/
|...|
|...|
|...|
/.../
.....
...... | stackexchange_codegolf |
421 is a rather popular dice game in France and some other European countries. It is mostly played in bars and pubs to determine who's going to buy the next round of drinks. The full game is usually played in two rounds, with tokens that each player tries to get rid of, but this is irrelevant here. (Wikipedia page in F... | stackexchange_codegolf |
Your task
Given a numerical string or integer \$\ge 0\$ (which may have leading zeros), convert it to letters using the below rules.
Rules
Loop through the digits:
If the digit is 0 or 1, combine it with the next digit and output that letter of the alphabet (0-indexed).
If the digit is 2, combine with the next digit O... | stackexchange_codegolf |
Introduction
This challenge appeared in the 2020 Estonian Open Informatics Olympiad and was created Sandra Schumann. I thought it was interesting because it involves symmetry and is quite hard even to brute force by hand.
The problem author said that it's ok for me to post it here:
Challenge
You may use a modified vers... | stackexchange_codegolf |
This question is an extension of Check if words are isomorphs and copies the first part of it to give the definition of an isomorph.
Two words are isomorphs if they have the same pattern of letter repetitions. For example, both ESTATE and DUELED have pattern abcdca
ESTATE
DUELED
abcdca
because letters 1 and 6 are th... | stackexchange_codegolf |
Challenge
Write a function or program which takes a positive decimal number, call it A, and output two positive numbers, B and C, such that:
A == B bitxor C
B and C must not contain any of the digits 0, 3 or 7 in its decimal representation.
Examples
>>> decompose(3)
1, 2
>>> decompose(7)
1, 6
>>> decompose(718)
121, ... | stackexchange_codegolf |
"Buzzing" Bill is a well respected beaver. He is the hardest working in his home dam. He was a strong beaver and was able to lift more logs than anyone at the dam. Unfortunately Buzzing Bill's career came to an end in a tragic accident. Being such a prominent figure in his town, the Beaver newspaper wanted to write a ... | stackexchange_codegolf |
Amazingly, this simple task doesn't seem to exist already, so...
Your task is to write a program that takes as input a 12 hour time, and converts it into "military time", or 24-hour time format.
Input will be in the form:
HH:MM am/pm
Although slight variations are allowed:
The space separating the am/pm from the res... | stackexchange_codegolf |
Related puzzle: Pathfinder (available on Puzzle Picnic)
Background
A robot is standing on a cell of a rectangular grid, where each cell has one or more gems except for the one with the robot. The robot can move to a horizontally or vertically adjacent cell in one step, and it picks up one gem from the cell it steps on.... | stackexchange_codegolf |
Sandbox
Adapted from exercise 8 of 100 little Keg exercises
String manipulation is a very important part of any programming language. Consequently, that is what this challenge is about.
The Challenge
I want you to write a program that:
Takes a series of characters as input and,
Then takes another input (integer/letter... | stackexchange_codegolf |
Task
Given an array of positive integers, replace each element with the parity of the sum of the other elements. The array is guaranteed to have at least 2 elements.
Definition
Parity: whether a number is odd or even.
Example
For the array [1,2,3,1]:
Replace 1 with the parity of 2+3+1, i.e. even.
Replace 2 with the ... | stackexchange_codegolf |
Special thanks to Bubbler and AdmBorkBork for supplying feedback about this challenge
Keta (Keyboard tacit — clever naming, I know!) is a golfing language I’ve been working on recently. One of it’s features is it’s most probably unique bracket autocompletion system, which will hopefully allow for shorter programs.
The... | stackexchange_codegolf |
Given an input, calculate the correct suffix and output the number in a readable format in short scale (where 1 billion is 10^9). The suffixes must go to at least 10^3000, in which the rules for calculating them can be found here, or a list can be found here.
There is no need to output the exact numbers, this is focuse... | stackexchange_codegolf |
I use "sentence" here loosely to mean "any sequence of words separated by spaces" and "words" to mean "sequences of alphanumeric (hexatrigesimal) characters unseparated by spaces".
Conversion is from base-36 (0123456789abcdefg...) or (0123456789ABCDEFG...)
Conversion to base-16 (0123456789abcdef) or (0123456789ABCDEF)... | stackexchange_codegolf |
Given a MM/DD date (12/24) and a start/end date range (11/01 - 06/24), figure out if the date is within the listed date span.
Date ranges can be sequential (05/01 - 11/01) or wrap around to the next year (11/01 - 05/01).
Examples:
12/24 is in 11/01 - 06/24 = True
06/24 is in 11/01 - 06/24 = True
06/24 is in 06/24 - 06... | stackexchange_codegolf |
I was browsing esolangs, and chanced upon this language: https://github.com/catseye/Quylthulg.
One interesting thing about this language, is that it doesn't use prefix, postfix, or infix, it uses all three of them, calling it "panfix" notation.
Here is an example. To represent normal infix 1+2 in panfix, it becomes: +1... | stackexchange_codegolf |
This question asking us to make a "Cyclic Levenquine" has gone unanswered. So today we will ask a slightly simpler version. In this challenge we will define a K-Levenquine to be a program whose output is Levenshtein distance K from its source.
Task
Your goal in this challenge is to write a program with some output dif... | stackexchange_codegolf |
UBASIC is a freeware basic interpreter written by Yuji Kida at Rikkyo University in Japan, specialized for mathematical computing. It is considered to be a "ready-to-run" language that and is capable of running on DOS and Windows.
What general tips do you have for golfing in uBasic? Any ideas that can be applied to cod... | 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 |
This question is a part of the lean LotM.
A ring is a type of structure that takes the rules of addition and multiplication we are familiar with and abstracts them, so we can reason about them. To do this we state a number of expected properties as axioms and see what we can say about systems that follow these axioms.... | stackexchange_codegolf |
Pipe a short stream to the following Java program run with accompanying command line options, such that it prints true.
class Code implements java.io.Serializable {
private static final long serialVersionUID = 0L;
private static long count;
@Override public int hashCode() {
++count;
return... | stackexchange_codegolf |
Problem:
Generate a sentence that can be read and understood. It must contain a subject, verb, and object, and tenses and plurals must match. The program must also be able to generate several different sentences to qualify.
Rules:
Hard-coding the sentences is not permitted, and nor is reading them directly from a file... | stackexchange_codegolf |
The subfactorial or rencontres numbers (A000166) are a sequence of numbers similar to the factorial numbers which show up in the combinatorics of permutations. In particular the nth subfactorial !n gives the number of derangements of a set of n elements. A derangement is a permutation in which no element remains in the... | stackexchange_codegolf |
There are 5 different "special characters": % & # $ !
These special characters are in a string with numbers. Like so: "5 ! 60%2$5.3" (valid). You must determine the validity of the string and there are certain rules in order to determine validity of the string.
Rules:
These special characters can exist in a string... | stackexchange_codegolf |
A bracelet consists of a number, \$\mathit{N}\$, of beads connected in a loop. Each bead may be any of \$\mathit{C}\$ colours. Bracelets are invariant under rotation (shifting beads around the loop) and reflection (turning the bracelet over).
Here are all \$11\$ bracelets with exactly two beads of each of three differe... | stackexchange_codegolf |
Please help me automate my discrete mathematics homework. Given a valid propositional formula, check if it is an instance of one of Łukasiewicz's axioms. Here's how it works.
A term can be defined inductively as follows:
Single lower-case letters of the Latin alphabet (a, b, c, etcetera) are terms.
Given a term ϕ, ¬ϕ ... | stackexchange_codegolf |
Takuzu is a logic game in which you have to complete a grid with cells containing 0s and 1s. The grid must follow 3 rules:
No three horizontal or vertical consecutive cells can be the same.
There must be an equal number of 0s and 1s in each row and column.
No two rows can be the same, and no two columns can be the sam... | stackexchange_codegolf |
In this challenge, you will be given a square matrix A, a vector v, and a scalar λ. You will be required to determine if (λ, v) is an eigenpair corresponding to A; that is, whether or not Av = λv.
Dot Product
The dot product of two vectors is the sum of element-wise multiplication. For example, the dot product of the f... | stackexchange_codegolf |
This task is rather simple, and makes use of three distinct "operator" characters. Your task is, given a simple sequence of letters, perform the following task to encode it using <,>,*. You may choose to use either upper or lowercase letters, you do not have to handle both.
Cipher Explanation
The cipher is simple, you... | stackexchange_codegolf |
What general tips do you have for golfing in ///? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to /// (e.g. "remove unnecessary whitespace" is not an answer). Tips for itflabtijtslwi and Lines are on-topic and valid here as well.
Please post one tip per ... | stackexchange_codegolf |
A skyline is an array of positive integers where each integer represents how tall a building is. For example, if we had the array [1,3,4,2,5,3,3] this would be the skyline in ascii art:
#
# #
## ###
######
#######
A maximal rectangle is a rectangle that cannot be extended in any direction while being contained... | stackexchange_codegolf |
Write the shortest possible program that turns a binary search tree into an ordered doubly-linked list, by modifying the pointers to the left and the right children of each node.
Arguments: a pointer to the root of the binary tree.
Return value: a pointer to the head of the linked list.
The binary tree node has three f... | 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 |
In graph theory a tree is just any graph with no cycles. But in computer science we often use rooted trees. Rooted trees are like trees except they have one specific node as the "root", and all computation is done from the root.
The depth of a rooted tree is the smallest number, \$n\$, such that any node of the tree ... | stackexchange_codegolf |
Input:
A decimal
Output:
The input truncated
How to truncate them?
The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in consecutive order. The two step-by-step examples below should clarify what I mean by that:
Example 1: Input: 17.46940822
Ste... | stackexchange_codegolf |
Oreoorererereoo
Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability).
Rules
The input is lowercase, a non-empty string with no whitespace containing any combination of the strings "o" and "re", and contain... | 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 |
The Narrative
You are a bad musician. You never bothered to learn how to count rhythms. To remedy this shortcoming, you decide to write a program that will tell you how to count in any given time signature. You are still a bad musician, but you can at least pretend that you can count rhythms.
The Objective
Given a time... | stackexchange_codegolf |
Imagine a text file where each csv record may have different numbers of fields. The task is to write code to output how many fields there are in each record of the file. You can assume there is no header line in the file and can read in from a file or standard input, as you choose.
You can assume a version of rfc418... | stackexchange_codegolf |
About Hangul
As I'm Korean, I'm really proud of Korean character, Hangul(한글).
Hangul is a syllabary invented by King Sejong the great, 4th king of Joseon dynasty, in 1443.
Because today (October 9th) is Hangul day in Korea, I'll give you a challenge: Make some Hangul ascii-art
List of characters
So, To make ASCII art, ... | stackexchange_codegolf |
Your task is to slowly calculate exponentiation, with the following steps:
Given two inputs (in this example, 4 and 8), you must calculate the exponentiation by calculate the equation bit by bit. You would do 4^8, have a greater base value (4) and a smaller exponent (8). You can do this using more exponentiation and di... | stackexchange_codegolf |
Implement a function or program that can run simplified BitCycle code. The functions you must implement are:
<^>v: Change the direction of a bit to the direction this is pointing.
+: Turn all 0s left and all 1s right.
\ and /: Reflect one bit 90 degrees, then become inactive. In regular BitCycle, this is displayed as -... | stackexchange_codegolf |
Your task is to write a RoboZZle interpreter. If you're not familiar with the game, please watch the video at robozzle.com or read my description below.
A robot lives on a rectangular grid of squares coloured red, green, blue, or black. Black squares are inaccessible. The others are accessible and some of them contain ... | stackexchange_codegolf |
Are you feeling jealousy towards Mathematica, Matlab et al. for their intricate plotting capabilities? If you answered yes, this challenge is for you!
Challenge
Given, via parameters or standard input, a list of numbers list and a positive integer h for the height of the plot, write a program/function/snippet that prin... | stackexchange_codegolf |
Inspired by this challenge, as well as a problem I've been working on
Problem:
Given a non-empty set of points in 3D space, find the diameter of the smallest sphere that encloses them all. The problem is trivial if the number of points is three or fewer so, for the sake of this challenge, the number of points shall be ... | stackexchange_codegolf |
In chess, the Fool's Mate is the fastest possible way to reach checkmate. It is reached with Black's second move. In chess notation, one possible sequence of moves that achieves Fool's Mate is 1.f3 e6 2.g4 Qh4#.
This is not the only possible way to achieve this checkmate (in the same number of moves). There are three ... | stackexchange_codegolf |
There's a confusing factor in the 'Curious' badge. The "Positive question record".
(total questions - negative questions - closed - deleted)/total questions is the formula of the question record. (negative, closed and deleted 'stack' with each other. that means if a question is negative and closed, it counts as two min... | stackexchange_codegolf |
You have to make a game Too-low --- Too-high (TLTH) in shortest code (in bytes)
Game rules:
Computer will choose a random number out of integer range (-32768..32767).
Now you will think of a number and input it.
The computer will tell if your number is lower (TOO LOW) or higher (TOO HIGH) than the chosen number.
W... | stackexchange_codegolf |
Today, you're going to be writing Polish. No, not Polish notation—Polish, the actual language spoken in Poland.
Given a number and a noun, output a Polish sentence telling me that there are that many of that thing, using the appropriate template below.
The input consists of an integer in the range from 0 to 200, and a ... | stackexchange_codegolf |
Background
From Wikipedia: An Egyptian fraction is the sum of distinct unit fractions. That is, each fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, and all the denominators differ from each other. The value of an expression of this type is a positive rational number ... | stackexchange_codegolf |
Cops thread (read first)
Robbers, your task is to find a Shue program p that when given the cops input i, outputs a program h, which outputs "Hello Shue!". The length of your p has to be less than or equal to the length of the cop's p. The robber with the most cracks wins.
| stackexchange_codegolf |
The mean of a population \$(x_1,\dots,x_n)\$ is defined as \$\bar x=\frac1n\sum_{i=1}^n x_i\$. The (uncorrected) standard deviation of the population is defined as \$\sqrt{\frac1n\sum (x_i-\bar x)^2}\$. It measures how dispersed the population is: a large standard deviation indicates that the values are far apart; a lo... | stackexchange_codegolf |
Inspired by last week's APL lesson.
Given an uppercase 2D seat map and a 1D list of customers, return the seat map and the customer list but modified as follows (to indicate occupied seats and seated customers):
For each unique letter in the input passenger list, lowercase that many (or all, if there are not enough) of... | stackexchange_codegolf |
Challenge:
Given a list of non-negative integers, determine by how much you should increase each item to create the closest binary box with the resulting integer-list.
What is a binary box?
A binary box is where the first and last rows consists of 1-bits; the first and last columns consist of 1-bits; and everything els... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.