instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Challenge Description
Cycle all letters from the first part of the alphabet in one direction, and letters from the second half of the alphabet in the other. Other characters stay in place.
Examples
1: Hello world
Hello_world //Input
Hell ld //Letters from first half of alphabet
o wor //Letters from second hal... | stackexchange_codegolf |
Challenge Description:
An anagram is a word or phrase formed by rearranging the letters of another word or phrase. For example, "listen" and "silent" are anagrams. In this challenge, your task is to write a program or function that takes a list of strings as input and returns the unique anagrams.
Write a program or fun... | stackexchange_codegolf |
In Haskell (and probably some other languages or something) zip is a function which takes two lists, and produces a list of tuples by pairing elements at the same index:
zip [1,2,3] [6,5,4] = [(1,6),(2,5),(3,4)]
If there are extra elements on one of the input lists those are trimmed off and don't appear in the result:... | stackexchange_codegolf |
This is the cops' thread. The robbers' thread is here.
Your challenge is to make a program that runs forever without halting1, unless it gets a particular input or inputs2. If it receives that input, it must terminate in a finite amount of time3. This is code-golf, so the shortest answer that has not been cracked by a ... | 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 |
Background
There are self-extracting .ZIP files. Typically they have the extension .EXE (and by executing the file they will be extracted) but when renaming them to .ZIP, you can open the file with some ZIP extracting software.
(This is possible because .EXE files require a certain header but .ZIP files require a certa... | stackexchange_codegolf |
Often, I find myself running a script or query that will take a significant amount of time to run. I can leave that script open and enjoy some guilt-free procrastination.
Now, what if I could write a script that seems to be one of the above scripts to any onlookers, but in looks only? I could put it up on a screen an... | stackexchange_codegolf |
Given a mapping from the integers from 1 to N to the integers from 1 to N, determine if the mapping is surjective, injective, bijective, or nothing.
You may choose any character/digit for the four outputs.
Specs
Input format: n, arrays of pairs (n is the highest number in the domain and range)
For example, if the first... | stackexchange_codegolf |
Sometimes, when I'm idly trying to factor whatever number pops up in front of me¹, after a while I realize it's easier than I thought. Take 2156 for example: it eventually occurs to me that both 21 and 56 are multiples of 7, and so certainly 2156 = 21 x 100 + 56 is also a multiple of 7.
Your task is to write some code ... | stackexchange_codegolf |
Introduction
The lexicographical permutations of a list with n elements can be numbered from 0 to n! - 1. For example, the 3! = 6 permutations of (1,2,3) would be (1,2,3), (1,3,2), (2,1,3), (2,3,1), (3,1,2), (3,2,1).
When a permutation is applied to a list, its elements are ordered in the same order as the numbers in t... | stackexchange_codegolf |
Fibonacci + FizzBuzz = Fibo Nacci!
Your challenge is to create a Fibo Nacci program!
A Fibo Nacci program outputs the first 100 Fibonacci numbers (starting from 1).
If the Fibonacci number is divisible by both 2 and 3 (i.e. it is divisible by 6), then output FiboNacci instead of the number.
Otherwise, if the Fibonac... | stackexchange_codegolf |
If you cannot see this post, you can use this image
Your task is to create a markdown parser that outputs Unicode. It should support , , , and ̲̲̲̲̲̲̲̲̲.
Every alphabetical character should be converted into Math Sans. This includes the characters before an underline character.
Underlines: Add a ̲ character (code point... | stackexchange_codegolf |
This is the robbers' thread. See the cops' thread here.
In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the robbers will try to come up with their algorithm. The catch is, the 'algorithm' must be a single closed-form mathematical e... | stackexchange_codegolf |
Randomly choose one out of k-length, ordered subset of characters in a string, while only storing a limited number of characters. The subset must be chosen with equal probability and may contain repeated characters. Do this without generating all possible permutations and assume k is at most the length of the string. F... | stackexchange_codegolf |
Take as input two strings \$A\$ and \$B\$. Output a string \$C\$ that is \$A\$ but with two characters swapped such that the Levenshtein distance \$d(C,B)\$ is as small as possible. You must swap two characters and you cannot swap a character with itself, although you may swap two identical characters in different po... | stackexchange_codegolf |
Today's challenge is to draw a binary tree as beautiful ascii-art like this example:
/\
/ \
/ \
/ \
/ \
/ \
... | stackexchange_codegolf |
Input
A single integer in your language's preferred format, e.g int or an array of digits are all acceptable.
Output
A truthy or falsely value, depending on whether the given number is palindromic (same forwards and backwards)
Rules
Numbers will always be positive, at least two digits long.
This is fastest-algorithm, ... | stackexchange_codegolf |
What happens when the CapsLock key on your keyboard doesn't have a notch in it?
"This hPPENS."
The goal of this program is to consistently emulate keyboard misses where each A press is replaced with CapsLock. Uppercase 'A's from the source should yield the same effect. When CapsLock is enabled, capitalization is revers... | 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 |
I don't like strings with more than three vowels in a row. Can you write a program that removes all the vowels I don't want from words?
You may write a program or function, taking input via STDIN (or closest alternative), command-line argument or function argument and outputting the result via STDOUT (or closest altern... | stackexchange_codegolf |
In this challenge, you implement an interpreter for a simple stack-based programming language. Your language must provide the following instructions:
push a positive number
pop two numbers and push their sum
pop two numbers and push their difference (second number - first number)
pop a number and push it twice (dup)
p... | stackexchange_codegolf |
Objective
Given a string with single Unicode vulgar fraction, parse it to a rational number.
Valid inputs
A valid input is one of:
¼ U+00BC; one quarter
½ U+00BD; one half
¾ U+00BE; three quarters
⅐ U+2150; one seventh
⅑ U+2151; one ninth
⅒ U+2152; one tenth
⅓ U+2153; one third
⅔ U+2154; two thirds
⅕ U+2155; one fifth... | stackexchange_codegolf |
Let \$A\$ be a square matrix that is at least \$2 \times 2\$ where each element is an integer. \$A^2 = A \times A\$ will then have the same dimensions as \$A\$, and will have integer elements. For example, let
$$A = \left[ \begin{matrix}
-3 & 2 \\
0 & -1
\end{matrix} \right]$$
Therefore,
$$\begin{align}
A^2 & = \left... | stackexchange_codegolf |
This is a repost of Evolution of “Hello World!”, originally written by user Helka Homba
It should not be closed as a duplicated, due to meta consensus here.
The original was asked over two years ago and was last active more than six months ago. I have permission from Helka Homba to post this here
Since the original, ma... | stackexchange_codegolf |
Introduction
All these snakes everywhere! I've had enough, and have decided that I much prefer camels. Therefore, I want you to convert my snakes to camels for me.
Challenge
Turn any snake_case string into a camelCase string.
Capitals should be returned to lowercase before the conversion occurs.
Test Cases
In: camel_c... | stackexchange_codegolf |
Cops' challenge
This cops-and-robbers challenge challenges the Cop to write a non-empty program that, when run, produces some non-empty output in language A, and, when reversed, produces some non-empty output in language B. The program may produce any output to STDERR when run in either language, but may not take input... | stackexchange_codegolf |
Given a list of N lists, each containing M positive integers, and a separate list of M positive integers (target values), return a list of N scalars (integers with a value of 0 or more) that correspond to each list in the lists of lists, such that when each value in a list is multiplied by it's scalar, and the values a... | stackexchange_codegolf |
Challenge: Get the JavaScript string value containing only the "-" character using code only containing the following three symbols: +[]. Note: I'm not sure if this is possible.
Scoring criterion: The number of bytes of code used.
Why? I've set myself a challenge to be able to write code using only the above three char... | stackexchange_codegolf |
Which language usually produces shorter golfed code: Pyth, CJam or Golfscript?
In asking this, I do not mean which has a prettier syntax or which has the most useful commands, I mean overall, which one is usually the shortest? What types of problems would we expect each language to have an advantage in?
| stackexchange_codegolf |
Disclaimer: No, this is not a joke challenge to reverse a string.
Task
There is only one operation to support: subtraction (-).
You also only have two atoms to support: zero (0) and one (1).
Here, the prefix notation -AB is equivalent to the postfix notation AB-, where A and B are expressions.
Your task is to (recursiv... | stackexchange_codegolf |
Background
Gödel numbers are a way of encoding any string with a unique positive integer, using prime factorisations:
First, each symbol in the alphabet is assigned a predetermined integer code.
Then, to encode a string \$ x_1 x_2 x_3 \ldots x_n \$, where each \$ x_i \$ represents an symbol's integer code, the resultan... | stackexchange_codegolf |
Write a program to calculate the first 500 digits of the mathematical constant e, meeting the rules below:
It cannot include "e", "math.e" or similar e constants, nor may it call a library function to calculate e.
It must execute in a reasonable time (under 1 minute) on a modern computer.
The digits are to include the... | stackexchange_codegolf |
You're tasked with writing an algorithm to efficiently estimate cost of solving an Eni-Puzzle from a scrambled state as follows:
You're given m lists of containing n elements each(representing the rows of the puzzle). The elements are numbers between 0 and n-1 inclusive (representing the colors of tiles). There are exa... | stackexchange_codegolf |
In order to defend someone’s baffling decision, people often say that that person is going over everyone’s heads and playing “3-dimensional chess”. Now it’s your chance to play 3-dimensional chess!
Rules
There are many variants of 3D Chess, but for this challenge I’ve made up my own. My version is just like regular che... | stackexchange_codegolf |
It's winter, and the time of year has come for it to start getting cold (and for strange colorful headcloths to start appearing... soon). Let's write some code to make avatar pictures and other images frozen over, to fit the theme!
Input
The input to submissions to this challenge should be an image (the image to m... | stackexchange_codegolf |
This is a simple challenge: given n in any way practical (Function arg, stdin, file, constant in code) output the internal angles
(NOT the sum of the internal angles, just one) of a regular polygon with n sides. The output can be in degrees, gradians or radians, and can be displayed in any way practical (Function retu... | stackexchange_codegolf |
Consider:
c=(a,b)=>(+a||0)+(+b||0)
Yes, it is not good to solve it like that. But I want to shorten it even more. If a is a string and b is a string, then return 0. If one is a number, return it (floats and intergers). And if both inputs are numbers, then return the sum (if either string can be cast to a number, treat... | stackexchange_codegolf |
Take a line of input (function arguments or stdin, etc.).
Remove comments in it, where a comment starts and ends with ".
Do not remove comments in string literals, which start and end with '. String literals do not contain escapes, because smalltalk has nice, easily lexable syntax ;).
Output this string.
The number of... | stackexchange_codegolf |
Write shortest possible code that will return true if the two given integer values are equal or their sum or absolute difference is 5.
Example test cases:
4 1 => True
10 10 => True
1 3 => False
6 2 => False
1 6 => True
-256 -251 => True
6 1 => True
-5 5 => False
The shortest I could come up with in python2 is 56 chara... | stackexchange_codegolf |
Given a positive integer \$n\$, output \$n\$ 2D bool images with the same width and height such that:
Each image should be 4-connected, i.e. for each two pixels that are true, you can start from one and go up, down, left and right for some times to the other pixel, only passing through true pixels.
Each image should h... | stackexchange_codegolf |
Given is a board of variable size with a maximum size of 5 times 5 fields. Every field kann be filled with an 'x'. If it is not filled with an 'x', it is filled with an 'o'.
The starting state of every board is given (see below). With each board, 10 rounds have to be played (at max, conditions: see below) and the evolu... | stackexchange_codegolf |
A lexicographically increasing number is an integer whose digits are in strictly increasing order. Print all lexicographically increasing numbers under 10000.
Here are lines of the expected output:
0
1
2
3
4
5
6
7
8
9
12
13
14
15
16
17
18
19
23
24
25
26
27
28
29
34
35
36
37
38
39
45
46
47
48
49
56
57
58
59
67
68
69
78... | stackexchange_codegolf |
Let's play some code-golf!
The challenge is to find the winner of a game of Tic-Tac-Toe.
This has been done many times by giving a board that has one clear winner but here is the twist:
The cells are numbered like this:
1|2|3
-+-+-
4|5|6
-+-+-
7|8|9
You get an array of exactly 9 moves like that:
{3, 5, 6, 7, 9, 8, 1, ... | stackexchange_codegolf |
Draw lines between every pair of distinct points for n points arranged in a circle, producing something like the below result. Shortest code (in bytes) wins! Your lines don't have to be transparent, but it looks better that way. The output must be a vector graphic, or be an image at least 600 pixels by 600 pixels (eith... | stackexchange_codegolf |
Today in my statistics class, I found that some factorials can be simplified when multiplied together! For example: 5! * 3! = 5! *3*2 = 5! *6 = 6!
Your job:
Given a string containing only Arabic numbers and exclamation points, simplify my factorial to its shortest possible string, in the least amount of bytes for your ... | stackexchange_codegolf |
This is a rock:
*
Rocks can be stacked. Apart from the bottom-most layer, each rock must rest on two other rocks, like this:
*
* *
You have a pile of rocks, and your boss wants you to pile them symmetrically, taking up the least horizontal space possible.
Your challenge is to take a number of rocks as input, and out... | stackexchange_codegolf |
My doubles pickleball group often has five people. Four are playing and one is awaiting the next game. We can represent the state of the game with a string of five characters like abCde. This indicates that a and b are playing against c and d with c serving. We want to write a routine that gives the possible positions ... | stackexchange_codegolf |
This is the robbers' thread of this challenge
The cops will choose an OEIS sequence and write two full programs in two different languages that produces that nth item in the sequence when given an n via STDIN. The two programs must be anagrams of each other, meaning each can be rearranged from the other's letters.
The... | stackexchange_codegolf |
Take a list of 2-digit hexadecimal numbers as input, and output the binary value, replacing each 1 with an 'X', and each 0 with a space.
For example
Input = FF, 81, 47, 99.
FF = 11111111 in binary, so print XXXXXXXX
81 = 10000001 in binary, so print X X
47 = 01000111 in binary, so print X XXX
99 = 10011001 in ... | stackexchange_codegolf |
There are N doors and K monkeys. Initially, all the doors are closed.
Round 1: The 1st monkey visits every door and toggles the door (if the door is closed, it gets opened it; if it is open, it gets closed).
Round 2: The 1st monkey visits every door and toggles the door. Then The 2nd monkey visits every 2nd door and ... | stackexchange_codegolf |
I am too bored and want a challenge to solve. But I do not see any interesting challenges, and I am too lazy to search for one. Can you (Well, technically your code) suggest me one?
I/O
Input: None.
Output: A link to a random open(i.e. non-closed) challenge("Challenge" excludes tips!) on PPCG. You may not link to an a... | stackexchange_codegolf |
Make me an icecream cone please
We have a ton of great ice cream places here in New England. Most of them are closed for the winter now, so...
.-@@-.
(======)
(--------)
(==========)
(__________)
\/\/\/\/\/
\/\/\/\/
\/\/\/
\/\/
\/
GOAL
Output the above icecream cone exactly. (or return it from ... | stackexchange_codegolf |
This is alternate of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you accept it, is to write a program/function that outputs/returns its input/args. But again, The tricky part is that if I rot-13 your source code, the output must be returned rot-19.
Your co... | stackexchange_codegolf |
Introduction
The challenge is a very interesting variant of the game racetrack and those two challenges:
To Vectory! – The Vector Racing Grand Prix
Program a Racing Car
Source of this challenge is here (in German): c't-Racetrack
This challenge is especially interesting (and different from the two abovementioned chall... | stackexchange_codegolf |
Let's build an advent Calendar for this Christmas!
Many Advent calendars for children take the form of a large rectangular card with numbered windows for each day of December starting from 1 ( although advent time begins on Advent Sunday, which is the fourth Sunday before Christmas day and often happens to be on Novemb... | stackexchange_codegolf |
Inspired by wezl.
Your challenge is to take words (sequences of [a-zA-Z]) and truncate them to length 3. For example, never gonna give you up would become nev gon giv you up.
Words will not necessarly be delimited by spaces - for example, youtube.com/watch?v=dQw4w9WgXcQ will become you.com/wat?v=dQw4w9WgX. Input will b... | stackexchange_codegolf |
Heading into the final day of regular season games for the 2023 NBA season, the fifth to ninth seeds in the Western Conference were still very undecided. Four games would determine the seeding:
New Orleans (N) at Minnesota (M)
Utah at LA Lakers (L)
Golden State (G) at Portland
LA Clippers (C) at Phoenix
Let the Boole... | stackexchange_codegolf |
This challenge is inspired by a board game I played some time ago.
The story of this challenge doesn't necessarily have to be read, the goal of the challenge-section should explain everything necessary.
The Story
People are locked inside a large room with a human-devouring monster. The walls of the room are enchanted, ... | stackexchange_codegolf |
Write a program that outputs the exact string:
jan ale o, toki!
("Hello, world" but in toki pona to prevent builtins.)
with an optional trailing newline.
Additionally when all copies of any one byte present in your program are removed the program must fail to produce a correct output no matter what byte is selected.
T... | stackexchange_codegolf |
Given year, month and optionally weekday of 1st, output the calendar of the month. The first week should remain nonempty.
For empty cell, fill it with the date where it's supposed to be, in last or next month, and add # to indicate gray. If last few days can't fit in 5 lines, then they share last line with 5th week, us... | stackexchange_codegolf |
Maximillian is the chief commander of the Great Greek Army and he is leading his forces into a crucial war with Spain.
If all the enemy soldiers stand in a straight line incrementally marked starting from position 1, and a particular soldier at position \$i\$ dies, the soldiers at position \$2i\$ and \$2i+1\$ die as we... | stackexchange_codegolf |
The goal of this challenge is to implement a digital low-pass filter.
You are free to implement any type of digital filter you want, however whatever results produced must pass the validation script below.
Here's a general description of what the validation script expects:
When an FFT is taken of the filtered signal, ... | stackexchange_codegolf |
Capacitors are notorious for being manufactured with high tolerances. This is acceptable in many cases, but some times a capacity with tight tolerances is required. A common strategy to get a capacity with the exact value you need is to use two carefully measured capacitors in parallel such that their capacities add up... | stackexchange_codegolf |
Challenge
Imagine a hexagonal grid as shown below. Let's call such a grid has size \$n\$ if it has \$n\$ dots on one side. The following is one of size 3:
- - -
- - - -
- - - - -
- - - -
- - -
Then, pick as many dots as possible on the grid so that no two dots are adjacent. For size 3, the maximum is 7 dots:
-... | stackexchange_codegolf |
I recently ordered some new and colorful tiles to replace my boring old white tiling for my kitchen. However, when the tiles arrived, they were all in a weird shape! Therefore, I need a program to figure out how to arrange the tiles so that I need to use as few of my old boring white tiling as possible.
Even though t... | stackexchange_codegolf |
Given a letter of the English alphabet, your task is to build a semi-diagonal alphabet to the input.
How to build a Semi-Diagonal alphabet?
Brief Description:
First, you take the position of the letter in the alphabet, P (P is 1-indexed here). Then, you print each letter until the input (inclusive) on a line, precede... | stackexchange_codegolf |
Your challenge is to write a program to solve a 3x3x3 Rubik's Cube. This challenge is based on this one from 2013, rewritten to adhere to current community standards, and reposted with the original author's permission and help on meta.
Input
The input should represent an unsolved Rubik's Cube.
You may read this input v... | stackexchange_codegolf |
There are currently nine feature length films in the core Fast & Furious/The Fast and the Furious media franchise, a series of films about bald men scowling and driving cars very fast. The names of the films, as can be seen, follow a completely logical and sensible convention:
The Fast and the Furious
2 Fast 2 Furious... | stackexchange_codegolf |
Input
A non-empty array of positive integers.
Task
Convert each integer to either binary, octal, decimal or hexadecimal in such a way that each digit (0 to F) is used at most once.
Output
The list of bases that were used to solve the puzzle.
Detailed example
The expected output for [ 16, 17 ] is [ octal, decimal ].
Her... | stackexchange_codegolf |
Introduction
Everyone knows the FizzBuzz sequence. It goes something like this:
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
.
.
.
In case you don't know, if the number is divisible by 3, it's Fizz. If it is divisible by 5, it's Buzz. If it is divisible by both, it's FizzBuzz. If it is not divisible by bo... | stackexchange_codegolf |
Given an input integer from 1, 2, ..., n, the task to write code to make a number as close as possible (as measured by absolute distance) to e using only the four mathematical operations +, -, *, / and parentheses (brackets). You can use any of the integers up to n once but don't have to use all the numbers and you are... | stackexchange_codegolf |
Objective
Given a vertex figure consisting of regular convex polygons, determine whether it represents a convex uniform polyhedron.
What is a uniform polyhedron?
A uniform polyhedron is a polyhedron whose faces are regular polygons, while having the same vertex figure for each vertices. Generally a uniform polyhedron c... | stackexchange_codegolf |
3D-modeling software mainly uses UV Mapping to map textures onto a 3D object. The valid values for both U and V are usually located in an inclusive [0..1] range.
Challenge
You bought a new 3D-modeling software which is super-easy to use. However there is one issue with it: it adds or subtracts a random integer number f... | stackexchange_codegolf |
Challenge
Given an array of positive integers and a threshold, the algorithm should output a set of consecutive-element-groupings (subarrays) such that each group/subarray has a sum greater than the threshold.
Rules
The solution should honor two additional criteria:
be of highest cardinality of the groups (i.e. highes... | stackexchange_codegolf |
When playing the piano, I realized that to play a chord right, I usually need to remember just which tones of the chord are played on white and which on black keys. The rest is usually handled by the "autopilot".
Let's write a program that given a 7th chord, it outputs which of its tones are to be played on black (char... | stackexchange_codegolf |
Given a string \$X\$ we will say two strings, \$a\$ and \$b\$, are building blocks of \$X\$ if \$X\$ can be made by concatenating some \$n\$ \$a\$s with \$m\$ \$b\$s in any order. For example the string tomato has building blocks to and ma:
to ++ ma ++ to
We will say that the fineness of a set of building blocks is th... | stackexchange_codegolf |
Task
Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them.
Rules
Input,Output can be in any convenient format.
The array may have at most 1 decimal number.
Examples
input:[22,33,44,55.55,33]
output:4433332255.55,55.5522333344
input:[34,900,3,11,9]
o... | stackexchange_codegolf |
Background
Given a triangle \$ABC\$, extend its three sides by the opposite side length, as shown in the figure below. Then the six points surprisingly lie on a circle called the Conway circle, whose center coincides with the incenter (the center of incircle, the circle that is tangent to the three sides from the insid... | 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 |
Alternatively: Now you're checking with portals!
Inspired this challenge
I am somewhat of a self-declared Chess Anarchist. That means that when I play chess, en passant is forced (else the brick gets used), double check is mate (and pasta), and all sorts of new pieces and squares are added to the game.
One such piece i... | stackexchange_codegolf |
I was playing around with cellular automaton and I found one that had some interesting behavior. Here's how it works:
It reads a binary string from left to right, if it encounters a 1 followed by 2 other values it will append a 0 to the result and continue reading. If it encounters a 0 (or there are less than 3 value... | stackexchange_codegolf |
Suppose denominations of banknotes follow the infinity Hyperinflation sequence: \$ $1, $2, $5, $10, $20, $50, $100, $200, $500, $1000, $2000, $5000, \cdots \$. How many banknotes are required, at minimum, to pay a \$$n\$ bill?
Consider Alice needs to pay \$ $992 \$ to Bob. It is possible for Alice to use 7 banknotes \$... | stackexchange_codegolf |
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 regular dodecahedron is one of the five Platonic solids. It has 12 pentagonal faces, 20 vertices, and 30 edges.
Your task is to output the vertex coordinates of a regular dodecahedron. The size, orientation, and position of the dodecahedron are up to you, as long as it is regular.
You may output the coordinates in a... | stackexchange_codegolf |
Unsurprisingly, fibonacci primes are primes that are also Fibonacci numbers. There are currently 34 known Fibonacci primes and an additional 15 probable Fibonacci primes. For the purpose of this challenge, the Fibonacci numbers are the sequence \$F_n\$ defined as \$F_1 = 1\$, \$F_2 = 1\$, and \$F_n = F_{n-1} + F_{n-2}\... | stackexchange_codegolf |
Background:
Okay, i dropped my android smartphone and damaged the touchscreen
The lower half (yeah, exact half!) is spider-webbed and does not work (potrait-mode)
Fortunately for me, the display itself is working
My phone is already rooted and adb enabled, so i have managed to enable 360 degree display rotation
Using t... | stackexchange_codegolf |
This challenge is inspired by Blink the CAPS LOCK by zeppelin.
Most webcams feature a small integrated LED light, indicating if the webcam is in use, as controlled by a hardware mechanism to prevent spying.
Your task is to blink it:
Turn it on.
Wait for 0.5 (±0.1) seconds.
Turn it off again.
Wait for 0.5 (±0.1) secon... | stackexchange_codegolf |
Robbers' Thread
In this challenge, your goal is to crack some code written by the Cops (their code is here) by modifying it. You have cracked their code if:
Your modified code has a maximum levenshtein-distance of 10 from theirs, and has fewer characters
The function, given the same valid input, will produce the same... | stackexchange_codegolf |
Write a square block of code that is N characters wide and N characters tall, for some positive integer N.
For instance, your N may be 5 and the block look like this:
ThisI
sMy5B
y5Cod
eBloc
kOkay
This block needs to behave as follows:
When the top row is extracted and run as a program, the exact text row needs to be... | stackexchange_codegolf |
Given two integers, which may be negative, zero, or positive, \$a\$ and \$b\$ (taken in any reasonable format, including inputting a plain complex number), convert it to \$a + bi\$ where \$i\$ is the imaginary number (square root of negative one). Then, raise it to the power of a third (positive integer) input variable... | stackexchange_codegolf |
Introduction
The telephone numbers or involution numbers are a sequence of integers that count the ways \$n\$ telephone lines can be connected to each other, where each line can be connected to at most one other line. These were first studied by Heinrich August Rothe in 1800, when he gave a recurrence equation where th... | stackexchange_codegolf |
In: Enough memory and a positive integer N
Out: N-dimensional N^N array filled with N, where N^N means N terms of N-by-N-by-N-by...
Examples:
1: [1] which is a 1D array (a list) of length 1, containing a single 1
2: [[2,2],[2,2]] which is a 2D array (a table) with 2 rows and 2 columns, filled with 2s
3: [[[3,3,3],[3,3,... | stackexchange_codegolf |
Characters
Let’s call these Unicode characters English IPA consonants:
bdfhjklmnprstvwzðŋɡʃʒθ
And let’s call these Unicode characters English IPA vowels:
aeiouæɑɔəɛɜɪʊʌː
(Yes, ː is just the long vowel mark, but treat it as a vowel for the purpose of this challenge.)
Finally, these are primary and secondary stress ma... | stackexchange_codegolf |
Curling is a sport where two teams aim to place stones as close to the centre of a target as possible. The winner of a curling end is the team whose stone is closest to the centre – they score as many points as the number of their stones closer to the centre than any of their opponents.
Task
Given two lists of pairs of... | stackexchange_codegolf |
This is my 12th question, so I thought of this idea.
Goal:
Output 12, with any preceding or trailing whitespace permitted
In as many languages as possible (where different versions or flags count as the same language)
Without using any numbers
The criteria for a valid programming language are the same as those of The ... | stackexchange_codegolf |
Inspired by the recent craze over another two character language, ;#
Intro
According to community consensus, acceptable answers on this site must use programming languages that, at minimum:
Can determine if a natural number is prime
Can add two natural numbers together
Can represent a list/tuple of numbers, as well as... | stackexchange_codegolf |
This challenge requires integration with C, so you can stop reading if you're not interested.
Matrix multiplication is a simple operation, but the performance depends a lot on how efficiently the code is written.
Let's compute m = x * y. The following code is the implementation of the textbook algorithm.
for (int i = 0... | stackexchange_codegolf |
Given 4 points on the 2D planes A, B, C, D, calculate the area of the intersection region of the triangles OAB and OCD, where O is the center of the plane, having coordinate (0, 0).
Algorithms that runs in constant time complexity (in terms of arithmetic operations) are encouraged, but not forced.
Rules
Each point is ... | stackexchange_codegolf |
We're going rootin' tootin' cow-poke shootin!
This is a simple contest, first program to draw their pistol wins.
How it works:
I require 2 things from you, an executable, and a command to be run
from a bash terminal.
The executable needs to do one thing: wait
until it receives 'draw!' from STDIN, and then print 'bang!... | stackexchange_codegolf |
Output the numbers 1-16 (or any other set of 16 distinct items). Then, repeatedly, output a random value chosen uniformly from the last 16 items outputted.
After the same item is printed 16 times in a row, halt.
If a number appears multiple times in the last 16 values, it should have proportionally more chance to be ch... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.