instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Deleted questions on Stack Overflow sometimes make for great golf material.
Write a function that takes a nonnegative integer as input, and returns true if all the digits in the base 10 representation of that number are unique. Example:
48778584 -> false
17308459 -> true
Character count includes only the function.
If ... | stackexchange_codegolf |
Philosophers have long pondered the Trolley problem. Unfortunately, no human has solved this problem yet. Luckily, as programmers we can use computers to solve the problem for us!
Input
Your program will take as input a (finite) directed graph (with at most one edge from x to y, for any x and y), with a designated nod... | stackexchange_codegolf |
The New York Times periodically runs a puzzle they call the "Spelling Bee" in which they list six "allowed" letters plus one "mandatory" letter and challenge the reader to form as many five-letter-or-longer dictionary words as possible out of those letters. Each "allowed" letter can appear 0 or more times. The mandator... | stackexchange_codegolf |
Surprised that we don't have a symmetric difference challenge yet.
Given two lists only containing positive integers, return all items among these two lists that aren't contained in both of the lists.
Rules
From the set definition:
A set is a collection of definite distinct items.
So you can assume the items in the ... | stackexchange_codegolf |
A man has two devices.
A time machine - He can control this machine by thinking. It allows him to travel from any point in time to another point in time in the past or future (or even the present point in time) in no time at all. Note that if he travels to the past from B to A, then all normal events (time machines, a... | stackexchange_codegolf |
The problem:
Given a non-empty set of points in the Cartesian plane, find the smallest circle that encloses them all (Wikipedia link).
This problem is trivial if the number of points is three or less (if there's one point, the circle has a radius of zero; if there are two points, the line segment that joins the points ... | stackexchange_codegolf |
Description
You are given the results of a range function where every element has been rounded down to the nearest whole number. Your goal is to recover the original list.
For example, the following function (in Python3) will produce an input for your program:
from numpy import arange, floor
def floored_range(A, B, C):... | stackexchange_codegolf |
You are an employee at the hip new grocery store Half Foods, and it's the day before Thanksgiving Christmas Easter. Since the store will be packed with customers rushing to get their foodstuffs, the store needs a traffic manager to send everyone to the appropriate lines. Being lazy, you'd like to automate this so that ... | stackexchange_codegolf |
Input
A list of words separated by any number of spaces.
Output
A horizontal ASCII art graph, where the n-th line is composed by as many asterisks (*) as the n-th word is long.
Example usage
The > signals user input, you should not input it when testing the program.
> This is an example histogram of word length
****
**... | stackexchange_codegolf |
Pickleball doubles is a game where only the serving side can score. The server calls the score as a triple of numbers, the serving side's score, the receiving side's score, and \$1\$ or \$2\$ to indicate whether the server is the first or second of their side to serve. If the server's side wins a point, their score i... | stackexchange_codegolf |
I have so many secrets and nowhere to keep them!
The goal is simple: write a program that lets you save a string and have it be protected by a password.
The program will take an alias, password and (optional) secret as parameters.
If this is the first time the program is called with a given alias, then it will store/re... | stackexchange_codegolf |
You've been hired by a bomb defusing company to perform some "controlled" demolition of un-exploded ordnance. You are given a list of bombs represented by non-negative integers.
[3,2,4,0,3,1,2]
Every step you can set up and explode a bomb. When a bomb \$n\$ explodes, it destroys all bombs within \$n\$ places replacin... | stackexchange_codegolf |
Given an arbitrary sequence consisting of 1 and A
split this sequence up so that A is at the beginning of each sub sequence.
Sequences without a leading A and Sequences without 1 before the next A will be self contained.
Example
Input
111A11A1111111A1A1AA
should result in
111
A11
A1111111
A1
A1
A
A
Above already cont... | stackexchange_codegolf |
Given a word consisting of lowercase letters only, do the following:
For each letter, get the prime factorization of its position in the alphabet.
For each prime factor, p, draw a diamond of side length p and stick the letter in the middle of the diamond.
The biggest diamond is in the middle, subsequent smaller diamon... | stackexchange_codegolf |
Duplicate? I knew somebody must've done this before.
Programming a programming language in itself is something that has interested me since I knew what a programming language was. So I thought I'd create a Code Golf challenge for you.
Challenge
Create an interpreter for a given programming language, programmed entirel... | stackexchange_codegolf |
My Python 3 function golf(...) should take a list of lists of lists of strings representing a solid cube and return whether there are any places in which two equal strings are directly next to each other on the x, y or z axis (not diagonally).
If there are no adjacent duplicates, True shall be returned, else False.
T... | stackexchange_codegolf |
Legendre's Conjecture is an unproven statement regarding the distribution of prime numbers; it asserts there is at least one prime number in the interval \$(n^2,(n+1)^2)\$ for all natural \$n\$.
The Challenge
Make a program which only halts if Legendre's conjecture is false. Equivalently, the program will halt if there... | stackexchange_codegolf |
Without taking any input, output this exact text:
A
B A
C B A
D C B A
E D C B A
F E D C B A
G F E D C B A
H G F E D C B A
I H G F E... | stackexchange_codegolf |
Challenge
Given a string of any length, write it as a triangle, spiraling out from the center. For example, abcdefghijklmnop becomes:
g
fah
edcbi
ponmlkj
Or more explicitly:
If you like, you can spiral counter-clockwise instead:
g
haf
ibcde
jklmnop
Or add spaces uniformly:
g
f a h
... | stackexchange_codegolf |
Your task is to form an expression equaling \$ 11111111111 \text{ (11 ones)} \$ using only the following characters: 1+(). Keep in mind that the result is in base 10, and not some other base like binary. Of course, these expressions should follow the order of operations. Furthermore, the only operations which should be... | stackexchange_codegolf |
A super prime is a prime whose index in the list of primes is also a prime:
3, 5, 11, 17, 31, 41, 59, 67, 83, 109, 127, 157, 179, 191, 211, 241, 277, 283, 331, 353, 367, 401, 431, 461, 509, 547, 563, 587, 599, 617, 709, 739, 773, 797, 859, 877, 919, 967, 991, ...
For this challenge, an "order 2" super prime is defined... | stackexchange_codegolf |
You are given one-quarter of a map that is symmetrical over the x- and y-axes as input. The program should print the complete map.
The map can contain the following characters: -+/\|., and they should be turned as expected. The in data is always rectangular and small.
Example
$ cat in
+---
|./.
|/..
$ ./solution < in
... | stackexchange_codegolf |
Background
Inspired by Octave's (and, by extension, MATL's) very convenient interpretation of truthy/falsy matrices, Jelly got the Ȧ (Octave-style all) atom.
Ȧ takes an array as input and returns 1 if the array is non-empty and does not contain the number 0 (integer, float, or complex) anywhere in the tree structure; o... | stackexchange_codegolf |
Introduction
One day, you were just relaxing in your office in the CIA, when suddenly you see an alert on your computer. Your programs have just intercepted hundreds of coded messages! A quick examination reveals the rule for encoding, but you need a program in order to decode fast.
Challenge
You will be given a list... | stackexchange_codegolf |
Challenge
Create a console program to display each byte of a file.
Winning
Since this is code-golf, fewest bytes wins.
Rules
Program must be a console application, meaning that it will be ran from some sort of command-line interpreter;
Every byte must be uppercase hexadecimal, separated by a space, and it must be 2 ... | 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 |
The challenge here is to accurately depict the flower of life (which is a sacred geometrical figure according to some) in the language of your choice.
The design consists an arrangement of circles and partial circles of radius 1 as shown whose centres arranged on a triangular grid of pitch 1, plus one larger circle of... | stackexchange_codegolf |
Challenge
Display to the screen or write to stdout this exactly:
**
**
****
****
****
****
****
****
****
**********
**********
**********
Winning
This is code-golf, so the shortest submission (in bytes) wins.
| 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 |
Write a program or function that takes in a 4×4 text grid consisting of exactly 4 A's, 4 B's, 4 C's, and 4 D's, such as:
ACDC
BBCA
BADD
ABCD
The ABCD's may be in any arrangement but there will always be 4 of each. You can assume the input is valid. If desired you can also assume it has a trailing newline and/or that i... | stackexchange_codegolf |
Task
Define a simple regex as a non-empty regular expression consisting only of
characters 0 and 1,
grouping parentheses ( and ),
one-or-more repetition quantifier +.
Given a non-empty string of 0s and 1s, your program should find the shortest simple regex matching the full input string. (That is, when matching a sim... | stackexchange_codegolf |
You just invited a liberal arts major to your house and you're telling him/her
"You know, I am a great programmer and I can do x and y and z..."
S/he quickly gets bored and asks you:
"If you really are a great programmer, can you make a programme to let me draw, I just need to draw lines on the screen by using the
... | stackexchange_codegolf |
The idea of this challenge is simple: create a bot to play the card game Euchre.
For those of you who don't already know them, I've written out the rules to Euchre here as they pertain to this challenge.
I recommend using python or something similar, but the only real restriction is that it has to be compatible with th... | stackexchange_codegolf |
Disclaimer
It is bad practice to draw out your molecules in 2 dimensions because that is not how they are. I chose to do this in 2D because it is easier to explain.
Note that the bond angles are wrong too: the angle in CH4 is 109.5°, not 90° as I said and the bond angle in NH4 is 107°. BHCl2 does have a bond angle of ... | stackexchange_codegolf |
Given a list of positive integers as input you are to determine if there is a way to pair up the elements such that:
All but one element is in a pair
No element is in more than one pair
Every pair is of equal elements
No two pairs have elements separated by the same distance in the original list
For example if the in... | stackexchange_codegolf |
These days, I watched on TV a Gay Pride parade; at the time, I was thinking about quines and how they're a bit queer, outputting themselves (out of the closet?) and, well, why not combine both things into a Quine Pride Parade?
The challenge is to write a program that:
Is a quine.
Prints the sentence I am a quine writ... | stackexchange_codegolf |
Challenge
So, um, it seems that, while we have plenty of challenges that work with square numbers or numbers of other shapes, we don't have one that simply asks:
Given an integer n (where n>=0) as input return a truthy value if n is a perfect square or a falsey value if not.
Rules
You may take input by any reasonable... | stackexchange_codegolf |
Task description
Given an integer, swap its (2k–1)-th and 2k-th least significant bits for all integers k > 0. This is sequence A057300 in the OEIS.
(The number is assumed to have “infinitely many” leading zeroes. In practice, this simply means prepending a single 0 bit to odd-length numbers.)
This is code-golf, so th... | stackexchange_codegolf |
SE Sandbox Link, Codidact Sandbox Link
Inspired by this video.
Given a positive integer, draw its Cistercian representation as ascii art.
The Challenge
Cistercian numerals are a decimal-based number representation system which use simple line based drawings to represent 4-digit numerals. Their structure is as follows:... | stackexchange_codegolf |
Everyone knows that the news is boring. Really boring. Unless if it's about Politicians and their scandals. That is fun! But alas, Politicians can commit only so many scandals. So, I am employing you to make the news more interesting.
Objective Given an HTML snippet, perform all the substitutions found here, that is, i... | stackexchange_codegolf |
Story, or why we are doing this.
None. This exercise is completely pointless ... unless you are Stephen Hawking.
The Challenge
Given a list of angles, find the average of those angles. For example the average of 91 degrees and -91 degrees is 180 degrees. You can use a program or function to do this.
Input
A list of deg... | stackexchange_codegolf |
I need to stop thinking of punny names
Your task is to create as many snippets (programs that have input and output built-in), functions or full programs as possible that sorts whatever your language's version of integer arrays is in ascending order, but for each program, you're only allowed to use the characters in AS... | stackexchange_codegolf |
The Challenge
Given an integer input, return the first Fibonacci number that contains the input within itself along with the index of that Fibonacci number (indexes starting at 0 or 1 - up to you, but please mention which in your answer). For example, if given the input of 12, the program would return 26: 121393 as 12 ... | stackexchange_codegolf |
The player has to keep guessing a number from 1 to 10 until they guess the correct number to win the game. If they make an incorrect guess, they're told if their guess was too low or too high.
Each line has to render below the previous line for me to accept the solution as the new code for the game (However, you can st... | stackexchange_codegolf |
Write one/two program(s)/function(s):
The first one should return a truthy value if given your Stack Exchange username.
~~Optional~~
An obfuscated one (as explained below) that does the same thing.
Rules for number 2:
May be no more than ten times the byte-count of number 1 or 100 bytes, whichever is higher.
Must ... | stackexchange_codegolf |
Playing the game of memory against a machine is highly unfair, because they play almost as good as small children. So let's make the machine play alone, but in a fair way:
Input: 1...26 pairs of lowercase letters in random order like zz or gttg or abcdefghiabcdefghi. You can trust each letter appears exactly twice and... | 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 |
What general tips do you have for golfing in S.I.L.O.S? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to S.I.L.O.S (e.g. "remove comments" is not an answer).
Please post one tip per answer.
S.I.L.O.S can be run here.
| stackexchange_codegolf |
Here's a relatively simple challenge for you:
Given a list of positive integers:
Line them up in a grid, and sum each column. For example, if the input was [123, 7, 49, 681], the grid would look like this:
1 2 3
7
4 9
6 8 1
And the sum of each column would be [18, 19, 4]:
1 2 3
7
4 9
6 8 1
--... | stackexchange_codegolf |
Greeklish, a portmanteau of the words Greek and English, is a way of writing modern Greek using only ASCII characters. This informal way of writing was extensively used in older applications / web forums that did not support Unicode, and were not programmed to show Greek characters. Nowadays, its use is minimized due t... | stackexchange_codegolf |
In the IRC protocol, raw messages look similar to this:
command arg1 arg2 :arg3 with spaces :arg4 with spaces :arg5
In a shell environment (e.g. bash), that would be equivalent to:
command arg1 arg2 "arg3 with spaces" "arg4 with spaces" arg5
The format specification is as follows:
Raw messages will only contain prin... | stackexchange_codegolf |
There is a competition with \$n\$ participants in total. Alice is one of the participants. The outcome of the competition is given as a ranking per participant with a possibility of ties; e.g. there can be three participants who won 2nd place, and the next best participant gets the 5th place.
More rigorously, a partici... | stackexchange_codegolf |
Oops, Auto-correct.
You have a word. But it's wrong. You wonder what word it would be. Thankfully, being a code golfer, You can make a code to take a rough guess.
I/O
You will be given a (wrong, all lowercase) word, and a '(All lowercase)Dictionary list'. You have to output the word with the least Levenshtein distanc... | stackexchange_codegolf |
You know what a palindrome, a prime and a date are.
Your task is to list all dates in 100 thousands of years that fulfill
all three characteristics.
Nevermind anything but the numbers, use the following formats: YYYYMMDD and YYYYYMMDD.
Dates between 0000-01-01 and 9999-12-31 should be printed as 8 digit palindrome... | stackexchange_codegolf |
You are playing a famous game called \$1\text{D Array BattleGround}\$. In the game, the player can be stationed in any position from \$0\$ to \$10^5\$.
You are a Paratrooper in the game and have the ability to do two types of operation \$-\$
Advance, which would multiply your position by \$2\$
Fall-back, which would d... | stackexchange_codegolf |
In mathematics, a cyclic quadrilateral is one whose vertices all lie on the same circle. In other words, every vertex is on the circumcircle of the other three. For more information, see the MathWorld article.
Examples
These quadrilaterals are cyclic:
This trapezoid is not cyclic.
(Images from Wikipedia)
Objective
Gi... | stackexchange_codegolf |
Introduction
As is known, in 2017, Finland celebrates its 100 years of independence. To mark the occasion, it is your job to produce a Finnish flag for everyone's enjoyment.
Challenge
Create a program or a function that produces the flag of Finland (the grey border is there for presentation purposes only):
Flag specif... | stackexchange_codegolf |
Tonight is card game night! You are the dealer and your task is to write a program to deal the cards to the players.
Given an array of cards and the number of players, you need to split the array of cards into a hand for each player.
Rules
Your program will receive an non-empty array A , as well as a non-zero positive... | stackexchange_codegolf |
Two points pand q in a topological space can be separated if there are open sets U and V such that:
p is an element of U and q is an element of V
U and V do not have any elements in common
Your task is given a topology (a set of open sets) and two points p and q (p!=q) to output sets U and V satisfying the above cond... | stackexchange_codegolf |
Koronkorko is the Finnish word for compound interest. We don't want compound interest in our strings, so let's find the shortest possible regular expression to exclude it.
Given a string consisting only of the uppercase alphabetic characters A-Z, determine the shortest possible regular expression that matches the strin... | stackexchange_codegolf |
Given an integer N > 1, output all other numbers which prime decompositions have the same digits as the prime decomposition of N.
For example, if N = 117, then the output must be [279, 939, 993, 3313, 3331], because
117 = 3 × 3 × 13
therefore, the available digits are 1, 3, 3 and 3 and we have
279 = 3 × 3 × 31
939 =... | stackexchange_codegolf |
Story
Long time ago Bobby created a Bitcoin wallet with 1 Satoshi (1e-8 BTC, smallest currency unit) and forgot about it. Like many others he later though "Damn, if only I invested more back then...".
Not stopping at daydreaming, he dedicates all of his time and money to building a time machine. He spends most of his t... | stackexchange_codegolf |
Your task is to write a program that will output a readable list of every five letter words with the structure:
consonant - vowel - consonant - vowel - consonant
The output should be sorted alphabetically with one word per line and no words repeated twice. It can be lowercase or uppercase but not mixed. So the list cou... | stackexchange_codegolf |
Given two inputs -- one of them a non-empty printable ASCII string (including space, excluding newline), the other being one of two distinct, consistent values of your choice (1 / 0, l / r, left / right, etc.) -- output an ASCII art airplane banner of the string, pointing either left or right. For consistency, I'll be ... | stackexchange_codegolf |
Given a constructible point \$(x, y) \in \mathbb R^2\$, output the steps required to construct \$(x, y)\$
Constructing a point
Consider the following "construction" of a point \$(\alpha, \beta)\$ in the Cartesian plane:
Begin with the points \$(0, 0)\$ and \$(1, 0)\$. Then, more points can be added by performing a fini... | stackexchange_codegolf |
In math, a permutation σ of order n is a bijective function from the integers 1...n to itself. This list:
2 1 4 3
represents the permutation σ such that σ(1) = 2, σ(2) = 1, σ(3) = 4, and σ(4) = 3.
A square root of a permutation σ is a permutation that, when applied to itself, gives σ. For example, 2 1 4 3 has the squa... | stackexchange_codegolf |
Your task is, given a family tree, to calculate the Coefficient of Inbreeding for a given person in it.
Definition
The Coefficient of Inbreeding is equal to the Coefficient of Relationship of the parents. The Coefficient of Relationship between two people is defined as weighed sum over all common ancestry as follows:
E... | stackexchange_codegolf |
Challenge:
Create a program that takes input of a positive non-zero integer and outputs the 4 next numbers in the sequence described below.
Note: Checking if the input is actually a positive non-zero integer is not necessary
Sequence:
Every number in this sequence (apart from the first, which is the input) shall be com... | stackexchange_codegolf |
Background
Scrabble is a word game in which players collaboratively build a board consisting of letter tiles that spell words. Each word must be connected to another word, and players gain points based on the letters they use and where they are placed. Words can be spelled either from left-to-right or top-to-bottom, an... | stackexchange_codegolf |
Challenge
Your task is to generate a string using this sequence:
1,1,2,1,1,2,3,2,1,1,3,2,4,2,3,1,....
Which is more understandable in this format:
1
1 2 1
1 2 3 2 1
1 3 2 4 2 3 1
1 4 3 2 5 2 3 4 1
The pattern increases the number of Digits in the string by two for each increment in the Value of N
For each integer val... | stackexchange_codegolf |
The challenge
This challenge is very straightforward. Given four 3-dimensional points, calculate the surface area of the tetrahedron that they form. This is code-golf, so shortest code wins. Standard loopholes apply, with the added stipulation that any built-in function to do this task given four points is prohibited.
... | stackexchange_codegolf |
Your task is to write a program or function that takes a string as input, and prints Hello (input), I'm (language name).
Examples
Python:
Input: Oliver
Output: Hello Oliver, I'm Python
C++:
Input: Jacob
Output: Hello Jacob, I'm C++
etc.
Remember, this is code-golf, so the code with the lowest number of bytes wins.
Lead... | stackexchange_codegolf |
Codegolf the hamming code (with distance equals 3)!
The sequence looks like this: 0, 7, 25, 30, 42, 45, 51, 52, 75, 76, 82, 85, 97, 102, 120, 127, 385, 390, 408, 415, 427, 428, 434, 437, 458, 461, 467, 468, 480, 487, 505, 510, 642, 645, 667, 668, 680...
Task
Given n output the first n items in OEIS sequence A075926. Y... | stackexchange_codegolf |
This is a quine challenge related to Write the shortest self-identifying program (a quine variant)
Write a function or a full program that compares lexicographically its source code and input, that is, output three distinct values of your choice telling if input / source code is Bigger, Equal or Less than source code /... | stackexchange_codegolf |
\$\left\{ n \atop k \right\}\$ or \$S(n, k)\$ is a way of referring to the Stirling numbers of the second kind, the number of ways to partition a set of \$n\$ items into \$k\$ non-empty subsets. For example, to partition \$\{1,2,3,4\}\$ into \$2\$ non-empty subsets, we have
$$\begin{matrix}
\{\{1\},\{2,3,4\}\} & \{\{2\... | stackexchange_codegolf |
Challenge
Print the following characters:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
The catch is that you may not use any one of them in your code.
You may print them in arbitrary order, with or without a leading or trailing newline, but you may not print any other characters.
Rules
You may not ... | stackexchange_codegolf |
Create a function that accepts a list of dates (unsorted with possible duplicates) and returns the days of the week in one of the following formats:
A format similar to MTWTFSS or SMTWTFS (i.e. beginning with Monday or Sunday), with non-days replaced by an underscore _, illustrated below.
WEEKDAY if all the dates are ... | stackexchange_codegolf |
What general tips do you have for golfing in INTERCAL? I'm looking for ideas which can be applied to code golf challenges and are also at least somewhat specific to INTERCAL (i.e. "remove comments" is not a useful answer).
I know exotic languages can be really useful to win golf contests, but I don't see much INTERCAL ... | stackexchange_codegolf |
Write a program that prints the following 80-character line:
This program from codegolf.stackexchange.com permutes itself to encode a string.
then accepts one line of input, then prints its source code with its code points possibly reordered (none added and none deleted). When that code is executed, the same has to h... | stackexchange_codegolf |
Former US Secretary of Defense, Donald Rumsfeld, famously popularized the phrase "known knowns." Here we're going to distill his remarks into a four-line stanza.
Specifically, output this text:
known knowns
known unknowns
unknown knowns
unknown unknowns
Capitalization doesn't matter (for example, Known unKnowns is fin... | stackexchange_codegolf |
Most people here are familiar with seven segment displays, which are also used in matchstick puzzles. Below are the digits 0 through 9 and letters a through z, except k,m,t,v,w, written in this format.
_ _ _ _ _ _ _ _
| | | _| _| |_| |_ |_ | |_| |_|
|_| | |_ _| | _... | stackexchange_codegolf |
Edit 2020-11-06: This challenge has been edited with new provisions to encourage participation. The edits have been bolded for emphasis.
Welcome to a cops and robbers version of Find an Illegal String.
An illegal string is "a string of characters that cannot appear in any legal program in your programming language of... | stackexchange_codegolf |
We already have a challenge for computing the GCD of two Gaussian integers, but that challenge explicitly allows to choose any of the four possible values.
Your task now is to bring the Gaussian integer computed by the GCD in the following normal form:
The result differs from the original number by a factor of 1,i,-1 ... | stackexchange_codegolf |
Dotcomma is a simple esolang I made a while ago that only uses four operators: [.,]. In this challenge, you'll determine if a dotcomma program consisting only of [.] halts. Without ,, there is no input, output, or queue, making this challenge possible.
Blocks:
Any code wrapped in [] is a block. All blocks and operators... | stackexchange_codegolf |
Challenge
Create a 3D word puzzle where the cube's dimensions match the length of the input word. The uppercase word (A-Z) must be validly placed within the cube in one of the fixed orientations: horizontally, vertically, or diagonally. The program should randomly place the hidden word and fill the rest of the cube wit... | stackexchange_codegolf |
Task
Given a string as input, generate a "blurred" version of that string.
Input
Your input will be a single-line string of ASCII characters, containing a minimum of 2 alphanumeric characters
Output
A string that is the "blurred" version of the input string.
A blurred string is one where every alphanumeric character fr... | stackexchange_codegolf |
Related:
Determine the position of a non-negative number in the infinite spiral
Wind me a number snake!
Challenge:
Given a grid, with an ID starting at the center and spiraling out, what is the ID given a position in the fewest number of bytes?
Grid:
+---------------+---------------+---------------+---------------+--... | stackexchange_codegolf |
Mr. Mackey is a South Park character well-known for adding "m'kay" in everything he says.
Write a program or function that transforms a string of text into something Mr. Mackey would say.
M'kay placement
m'kay has a random 50% chance of being added after the punctuations ,, ., ? and !. If that is the case, it will be... | stackexchange_codegolf |
Barbrack
Your task is to write a program or function that takes a non-negative integer (in decimal or any other convenient base for your language), and output a number in the numbering system Barbrack.
What's that?
Barbrack is a numbering system I made up that can represent non-negative integers. Zero is represented wi... | stackexchange_codegolf |
Your Task:
You all know what a magic square is! But what about a magic cube? A magic cube is the 3D version of a magic square, and is a set of numbers in a cube, where the sums of every straight (not diagonal) line are equal. You must write a program or function that receives an integer, and returns the number of va... | stackexchange_codegolf |
Challenge
Given a positive integer \$n\$, count the number of \$n\times n\$ binary matrices (i.e. whose entries are \$0\$ or \$1\$) with exactly two \$1\$'s in each rows and two \$1\$'s in each column.
Here are a few examples of valid matrices for \$n=4\$:
1100 1100 1100
1100 0011 01... | stackexchange_codegolf |
Inpsired by a youtube video from a fellow PPCG user...
You challenge is to use ASCII-art draw a Minecraft castle wall of Andesite and Diorite. The shape of the wall is the Cantor Set. For reference, the Cantor Set is made by repeating the following N times:
Triple the current step
Replace the middle one with blank spa... | stackexchange_codegolf |
I was messing around with infinite resistor networks (long story) when I came across the following interesting recursive pattern:
|-||
|---
Each instance of this pattern is twice as wide as it is tall. To go from one level of the pattern to the next, you break up this rectangle into two sub-blocks (each of which is a ... | stackexchange_codegolf |
Given as input a positive nonzero integer n >= 10 and a sequence of digits 0-9 (which may be taken as a string or a list), find the first contiguous subsequence of digits in the sequence that sums to n and output the start and end indexes. You may use zero- or one-based indexing. If no such subsequence exists, your pro... | stackexchange_codegolf |
Task
Your task is to write a program that, taking no input, outputs a string that represents a formatted codegolf answer of itself. The pattern is the following:
[Language name][1], n bytes
=
```
source code
```
[1]: link-to-language
With the language name being the language that you wrote your program (as stated in... | stackexchange_codegolf |
This geometric spiral looks complicated, but it's fairly simple to draw; take the following box:
Draw a straight line between the corner of the box and some set distance above the next corner counter-clockwise.
Continue this pattern inward, always staying that set distance away from the corner of the next line. Here... | stackexchange_codegolf |
Keeping with a festive theme, print a carol singing angel with the shortest possible code. The angel is raising money for the homeless, so must be able to sing all three of the below songs available at request. To illustrate she can sing them, the title of the song must be placed within the speech bubble. This song tit... | stackexchange_codegolf |
Given an integer \$ n \ge 2 \$, you need to calculate \$ \lfloor n \log_2(n) \rfloor \$, assuming all integers in your language are unbounded.
However, you may not ignore floating-point errors - for example, in python lambda n:int(n*math.log2(n)) is an invalid solution, because for example for n=10**15, int(n*math.log2... | stackexchange_codegolf |
Given a strictly positive integer n (therefore 0 isn't a valid test case), produce an approximate triangle of height n.
A non-programmatic process of drawing the picture
Initially we start with the base of the triangle.
|
So, we want to draw a triangle of a height of 5. First we know that all the |'s align on a straig... | stackexchange_codegolf |
Introduction
Recently I was trying out one of the more obscure use-cases of a modern smartphone: Calling someone by number. While typing it in, I noticed that some of my phonebook entries were displayed, even though the number I was trying to call was different! After some experiments, I figured out why.
What it does
... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.