instruction stringlengths 34 53.1k |
|---|
Introduction
This is one is pretty straightforward. We will be drawing a snake in ascii. This was inspired by that old snake game where you have to collect the fruit and you continuously grow.
Definition
Given a positive integer N that represents the snake's length, draw a snake so that it has a body of n plus a head a... |
Given a Sudoku puzzle, find all possible marks that can be filled into each empty cell.
Test case
Input:
[
[
// Top left:
[
0, 0, 0,
3, 4, 0,
0, 0, 2
],
// Top middle:
[
7, 4, 0,
0, 0, 0,
0, 0, 3
... |
This was inspired by a now removed CS.SE question.
Task
Given two non-empty input strings A and B, output the smallest distance from A to a palindrome that contains B as a substring. Distance is defined by the number of character replacements (Hamming distance).
Restrictions
Sensible input: a palindrome exists. This m... |
Here are all the 2x2 binary matrices
#0 #1 #2 #3 #4 #5 #6 #7 #8 #9 #10 #11 #12 #13 #14 #15
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
00 00 00 00 01 01 01 01 10 10 10 10 11 11 11 11
00 01 10 11 00 01 10 11 00 01 10 11 00 01 10 11
Two binary square matri... |
Inspired by Hyperprogramming: N+N, N×N, N^N all in one.
Thanks to @MartinEnder and @trichoplax for their help in the sandbox.
Definitions
Hyperquines
Define a hyperquine of order n as a quine-like full program or function P that satisfies all rules that apply to proper quines and, in addition, has the following struct... |
Brain-flak is a stack-based turing-tarpit language, written collaboratively between me, DJMcMayhem, and 1000000000.
Some users are very experienced in the mysterious ways of Brain-Flak. So I thought it a good idea to set up this question as a way for us, and hopefully others too, to share our knowledge with the commun... |
Assume we want to shift an array like it is done in the 2048 game: if we have two equal consecutive elements in array, merge them into twice the value element.
Shift must return a new array, where every pair of consecutive equal elements is replaced with their sum, and pairs should not intersect.
Shifting is performed... |
Given a number determine if it is a folding number.
A folding number is a number such that if you take it binary representation and "fold" it in half, That is take the result of XNOR multiplication of the first half of the number and the second half with it digits in reverse, you will get zero.
If the number has a odd... |
Find out the dimension of a simple nested list:
[] -> 1
[[]] -> 2
[[[]]] -> 3
...
List taken as input, dimension as output.
No counting length of strings - list manipulation and loops only.
i.e. no getting the length of the input and dividing by 2.
Any language is permitted. Get golfing!
|
Don't ask me how or why but while coding on a project I noticed that the characters of a couple of words had a particular pattern referred to the alphabet, I connected each character of the words with the pencil on the alphabet and I obtained two spirals, then I noticed that the first spiral was clockwise and the other... |
The 80's TV series Knight Rider featured an intelligent, self-aware car called KITT. One distinctive aspect of the car was a front-mounted scanner bar that allowed KITT to "see" (and that looked suspiciously familiar to fans of another, earlier TV series).
The scanner had eight lights as seen in this picture:
The ligh... |
Challenge
Ever seen those movie trailer titles (namely Martian, Interstellar, etc) where they have huge gaps in between letters slowly spreading out?
The challenge is to recreate this effect given a string, gap multiplier and direction, by inserting appropriate amount of spaces in between the letters.
Example
Input: '... |
Your task is to make a histogram given a sample of arbitrary size.
Input
A float array or any other reasonable form of input with an arbitrary number of elements.
Output
The histogram; more to follow.
How to make a histogram
We'll use the sample: [1.1, 3, 5, 13, 15.5, 21, 29.7, 63, 16, 5, 5.1, 5.01, 51, 61, 13]
To ma... |
Challenge
Given an integer n, calculate the sum of all even numbers between 0 and n
Examples
n output
-------------
100 2550
255 16256
1000 2502500
Shortest code in bytes wins
|
We have already defined a folding number here.
But now we are going to define a Super Folding Number. A Super Folding number is a number that if folded enough times it will eventually reach one less than a power of two. The method of folding is slightly different than in the folding number question.
The folding algor... |
Input:
A string (the wave-snippet) with a length >= 2.
A positive integer n >= 1.
Output:
We output a single-line wave. We do this by repeating the input string n times.
Challenge rules:
If the first and last character of the input string matches, we only output it once in the total output (i.e. ^_^ of length 2 beco... |
Challenge
Inspired by this challenge and the nasty Hurricane Matthew, we will be generating some lightning bolts dynamically.
n = 15:
\
/\
/ \
/ /
/\ /\
/ \ \
/ / /\
/\ \
/ / \
/\ \ /\
/ \ \
/\ /
\
\
/\
Input
Positive Integer n determines the depth of the lightning round.
Rul... |
For this challenge, the objective is to take a list of integers, and output the sum of every unique integer in that list, i.e. count multiples of the same integer only once.
Your input will be a string in the format "{1,2,3,4}" with any amount of elements. The string will never have whitespace or be in a format that do... |
The Wythoff matrix is an infinite matrix consisting of the Grundy numbers of each square on a chessboard in Wythoff's game.
Each entry in this matrix is equal to the smallest nonnegative number that does not appear anywhere above, to the left, or diagonally northwest of the position of the entry.
The top-left 20-by-20 ... |
String Similarity
String similarity is basically a ratio of how similar one string is to another. This can be calculated in many ways, and there are various algorithms out there for implementing a ratio calculation for string similarity, some being more accurate than others. It's actually very useful to use these metho... |
Here is a tic-tac-toe board:
a b c
| |
1 - | - | -
_____|_____|_____
| |
2 - | - | -
_____|_____|_____
| |
3 - | - | -
| |
Given a set of moves, print the board with the tokens on.
Input will be taken in as moves separated by... |
You have probably seen these signs on the doors of various shops:
OPENING HOURS
mon-fri 0900-1800
sat-sun 1100-1530
The task here is to generate a sign like that, grouping consecutive days with the same opening hours, from a list of opening hours for the whole week. Note that the week "wraps around" for what is con... |
We shall soon have a new logo & site design, let us use this last breath of the simple times and golf this ASCII version of the speech bubble beta logo:
+-------------------------------------------+
| .---------------------------------. |
| .EPEpEpBPEpEGCXCgCgCGJgCgP&PWP&P&P&Y` |
| .RSRsRWRSRsRsHoNoNONxNONON... |
This is going to be relatively quick...
Challenge
Given a lower-case word as input, calculate the Pearson's Correlation Coefficient between the letter position of the word (nth letter within the word, x), and the letter position within the alphabet (nth letter of the alphabet, y).
Background
Pearson's Correlation Coeff... |
Say I have a list such as [3, 0, 4, 2, 1], and I use selection sort to sort it, I could visualize it like this:
3,0,4,2,1
|-|
0,3,4,2,1
|-----|
0,1,4,2,3
|-|
0,1,2,4,3
|-|
0,1,2,3,4
This challenge is about visualizing sorting like this.
Input
Your input will be a list of positive integers, in any format yo... |
Your job is to simulate a couple of keystrokes that a user types in.
Input
A string array or string with a delimiter of your choice (outside the range 32-126) containing at least one 'keystroke'.
This array will only contain two types of string: passive keystrokes (single chars) and commands (chars within brackets [ ... |
Introduction
To draw a Fibonacci series of square, you start by drawing a one-unit square:
_
|_|
Then another one to the left:
_ _
|_|_|
Then a two-unit one on top:
_ _
| |
|_ _|
|_|_|
Then a three-unit one on the right:
_ _ _ _ _
| | |
|_ _| |
|_|_|_ _ _|
Then a five-unit one on the bottom:
_ _ _ ... |
Here is a simple challenge for you: You must produce this ASCII representation of a chess board. White is represented by uppercase characters, and black is represented by lowercase. Empty tiles are represented by a .. Here is the full board:
rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR
Since... |
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).
Input:
A positive integer n >= 1.
Output:
n lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.
Test case (n=5):
*
**
... |
Introduction
Braincopter is an esoteric Brainf*** derivative that encodes a Brainf***
program as an image. As a 2D language, it uses two additional commands; they
rotate the instruction pointer (initially pointing right) clockwise and
counterclockwise. Braincopter is very similar to Brainloller, except that
instead of ... |
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... |
Your task make a bot that plays Atomas, with the highest score.
How the game works:
The gameboard starts with a ring of 6 "atoms", with numbers ranging from 1 to 3. You can "play" an atom between two atoms, or on another atom, depending on the atom itself.
You can either have a normal atom, or a special atom.
The norma... |
Introduction
A decimal is terminating if it has a finite number of decimal digits. For example, 0.4 (2/5) is terminating because it has one decimal digit.
A decimal is purely periodic if it has an infinite number of decimal digits and has no decimal digits before its repetent (the part of the decimal that repeats.) For... |
Given positive integer n < 10, create a 2 dimensional matrix where each location is filled with its x and y index (starting from the top left).
For example:
Input: 2
00 10
10 11
Input: 3
00 10 20
01 11 21
02 12 22
Once the grid is created, randomly fill each index. This can be with an 'x' or any other way to denote a... |
Write a program or function that takes in a positive integer N, and outputs an N×N pixel image of Google's "G" logo according to this* construction:
For example, if N is 400, a 400×400 pixel logo should be output, with correct dimensions and colors:
It should look accurate regardless of how large or small N is. e.g... |
Challenge: Write a piece of code that only runs when the code is not being altered. If you change anything, the code should detect this and deny running. Of course, it should not be possible to just alter the detection mechanism (since this is a change in itself).
|
I was walking through a pumpkin patch the other day for a birthday party, and noticed the pumpkin vines making a nifty pattern, with whirls, loops, and offshoots. We're going to simulate that here with some ASCII art.
(())
\
p--q p-----q
/ \ / \
(()) b--d (())
Vine ... |
Write a program or function that takes in positive integers a, b and c, and prints or returns a/b to c decimal places, using the operations +-*/% [add, subtract, multiply, divide, modulate] on the positive integers: you can use all that your language allows, but not on floating point numbers. The range of a,b,c would b... |
Task
Given a non-empty string of lowercase ASCII letters a-z, take its first character, and:
Surround it with a square of copies of the second character,
Surround that with a diamond of copies of the third character,
Surround that with a square of copies of the fourth character…
…alternating between square and diamon... |
An 'Even string' is any string where the parity of the ASCII values of the characters is always alternating. For example, the string EvenSt-ring$! is an even-string because the ASCII values of the characters are:
69 118 101 110 83 116 45 114 105 110 103 36 33
And the parities of these numbers are:
Odd Even Odd Even Od... |
The Halloween is upon us, and I haven't decorated my house yet, so I gonna need your help to do this task
Input
The input will be a list of 4 digits numbers, where each digit represent a portion of decoration:
EMBU
||||
|||+-upper decoration
||+-bottom decoration
|+-mouth/nose
+-eyes
Eyes:
0 - °
1 - ¯
2 - -
3 - ^
4 - ... |
Inspired by Bake a slice of Pi
Challenge
Given input 3 <= n <= 100 and 3 <= y <= n, construct an n x n matrix of the decimal portion of pi (14159...), starting in the top left. Then, take the upper-right triangle of size y x y and concatenate it together. Output the resulting number.
For example, for input n = 5, y = 3... |
World Time Conversion
Challenge:
Given an initial clock time in UTC and a list of countries: for each country in the list, output the local time it is in that country based on the initial time. In cases where a country is big enough to have multiple local time zones (like the United States), you may output any valid l... |
The Cashier's Algorithm is an algorithm for making change in the minimal number of coins that works quite well for most currency systems. However like most greedy algorithms it is not without its flaws. If a currency system is set up just right (or just wrong) there are certain values in which the Cashier's Algorithm... |
Related
Explanation
Given a string such as DCBA, convert it to ASCII ordinals, such as 68 67 66 65. Then, take the differences between each value, eg 67 - 68 = -1, 66 - 67 = -1... giving -1 -1 -1 Now as long as there is more than 1 left over value, repeat getting the differences.
For a 3 letter string, your pathway sho... |
Input:
A positive integer n which is 1 <= n <= 25000.
Output:
In this sequence we start with the decimal number 1/n.
Then we take the sum of digits up until the n'th digit after the comma (1-indexed); followed by the sum of digits up until the (n-1)'th, then (n-2)'th, etc. Continue until n is 1.
The output is the sum ... |
This should be a fairly simple challenge.
For an array of numbers, generate an array where for every element all neighbouring elements are added to itself, and return the sum of that array.
Here is the transformation which occurs on the input array [1,2,3,4,5]
[1,2,3,4,5] => [1+2, 2+1+3, 3+2+4, 4+3+5, 5+4] => [3,6,9,12... |
Referencing xkcd 1688:
Your task is to deduct the age of a map by asking the user questions. These question must be exactly the same as in the xkcd guide, except from the capitalisation and additional newline(s). Additionally, you should give the user some options to choose from, which don't have to be in the order as... |
A positive integer may be represented in an integer base \$1 \le b < \infty\$.
When converted to that base it has some number of distinct digits.
Any positive integer in base \$1\$ has \$1\$ distinct digit.
Most positive integers in base \$2\$ have \$2\$ distinct digits, the exceptions being those of the form \$2^n - 1... |
In Javascript you can recover the complete language using only the symbols ()[]!+. Here's the basics:
false => ![]
true => !![]
undefined => [][[]]
NaN => +[![]]
0 => +[]
1 => +!+[]
2 => !+[]+!+[]
10 => [+!+[]]+[+[]]
Array => []
Number =>... |
Given an ASCII string, output the exploded suffixes of it. For example, if the string was abcde, there are 5 suffixes, ordered longest to shortest:
abcde
bcde
cde
de
e
Each suffix is then exploded, meaning each character is copied as many times as its one-indexed location in that suffix. For example, exploding the suf... |
Goal
Generate (N) random line segments of uniform length (l), check if they cross the equidistant (t) parallel lines.
Simulation
What are we simulating? Buffon's needle. Smooth out the sand in your sandbox, draw a set of equally spaced parallel lines (call the distance in between t). Take a straight stick of length l a... |
Write a program or a function that outputs the integer number of answers this question has. Your solution should still work as more answers are added.
Languages that run in a browser may be run from the js console while on this page. Otherwise, you'd probably have to download this page. Multi-language solutions, e.g. w... |
In one of our projects at work, we recently discovered a particularly large method for generating a 6 character string from a 15 character alphabet. A few of us claimed "I bet we can get that in one line" which started a little internal game of code golf.
Your task is to beat us, which I have no doubt won't take long!
... |
Inspired by this question on AskUbuntu.
Your job is extremely simple. Take the PATH environment variable (echo $PATH) and export it such that each entry (separated by the : character) is on its own line.
For example, if the PATH is /bin:/usr/bin:/usr/local/bin, your program should output:
/bin
/usr/bin
/usr/local/bin
... |
The 3x3 Hexa Prime Square Puzzle
Introduction
We consider 3x3 squares of hexadecimal digits (from 0 to F) such as:
2 E 3 1 F 3
8 1 5 7 2 7
D D 5 B B 9
We define a 3x3 Hexa Prime Square (HPS3) as such a square for which all hexadecimal numbers read from left to right and from top to bottom are odd primes (i.e.... |
A standard (but disputed) test of self-awareness is the mirror test: An animal is considered self aware if it can recognize itself in the mirror.
Your task is to write a program that is self-aware according to this test. More exactly:
The program reads input in whatever form is suitable for your language.
If the input... |
Do you have any tips for code-golfing in 05AB1E, a golfing language created by Adnan?
Your tips should be at least somewhat specific to 05AB1E.
Please post one tip per answer.
|
Backstory
Disclaimer: May contain made up information about kangaroos.
Kangaroos traverse several stages of development. As they grow older and stronger, they can jump higher and longer, and they can jump more times before they get hungry.
In stage 1, the kangaroo is very little and cannot jump at all. Despite this, is... |
Using the the ten inferences of the Natural Deduction System prove DeMorgan's laws.
The Rules of Natural Deduction
Negation Introduction: {(P → Q), (P → ¬Q)} ⊢ ¬P
Negation Elimination: {(¬P → Q), (¬P → ¬Q)} ⊢ P
And Introduction: {P, Q} ⊢ P ʌ Q
And Elimination: P ʌ Q ⊢ {P, Q}
Or Introduction: P ⊢ ... |
Consider a regular grid, where each cell has integer coordinates. We can group the cells into (square-shaped) "rings" where the cells in each ring have the same Chebyshev distance (or chessboard distance) from the origin. Your task is to take such a cell coordinate and rotate that cell by one position counter-clockwise... |
This is a challenge inspired by Chebyshev Rotation. I suggest looking at answers there to get inspiration for this challenge.
Given a point on the plane there is a unique square (a rectangle with equal sides) that is centered on the origin and intersects that point (interactive demo):
Given a point p and a distance d,... |
The idea is simple. You've to create a "visualised" letter-replacement, by providing 3 strings (input can be comma separated, separate inputs, or as an array). The first segment is the word you want to correct, and the second segment is the letters you want to replace, and the third segment is the replacement for the l... |
You must produce a function which nests a string s inside an array, n times
>>> N("stackoverflow",2)
[['stackoverflow']]
Parameters:
s - An ascii string
n - An integer >= 0
Rules
Shortest code wins.
The output will be a nested array, list or tuple (or similar type based off an array)
Test Cases
>>> N("stackoverflo... |
Connect Four is a game where two players take turns to drop disks into columns of a vertically mounted grid, and attempt to connect four disks orthogonally or diagonally. When a column is chosen, the disk falls to the lowest empty position in that column, so any game may be completely specified by the size of the grid ... |
Input into your program a black and white image. (png, jpg, etc)
Convert the image to a 2D matrix of pixels, where each index is the grayscale value of the image.
Take each index of the matrix and average the 8 pixels around it. Then replace that index with the average.
For example if you had:
120 80 60
20 10 30
40 ... |
(Note: This is a spin-off of my previous challenge Find the Swirling Words!)
Definition of Infinity Word:
If you connect with curves all the characters of an Infinity Word on the alphabet (A-Z) you obtain the infinity symbol ∞ like in the diagrams below.
All the even connection must be down, all the odd connections mu... |
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... |
In the game Yahtzee, players take turns rolling 5 6-sided dice up to three times per turn, possibly saving dice between rolls, and then selecting a category they wish to use for their roll. This continues until there are no more categories (which happens after 13 turns). Then, players' scores are tallied, and the playe... |
Given a list of N non-negative integers, output those numbers with each left-padded by spaces to a length of N. (Alternatively, return a character/string list.) You may assume that N is greater than or equal to the number of digits of the largest number in the list. Trailing spaces are allowed in the output.
You may al... |
Assume you're writing in one method, (or whatever you call them) with 3 inputs: the first string, a character that contains a +, - or * symbol, and the second string.
Example in Java:
public String strCalc(String str1, char sym, String str2) {
//code...
}
What it should return:
str1 sym str2 ans
A + A = B
... |
To "function nest" a string, you must:
Treat the first character as a function, and the following characters as the arguments to that function. For example, if the input string was Hello, then the first step would be:
H(ello)
Then, repeat this same step for every substring. So we get:
H(ello)
H(e(llo))
H(e(l(lo)))
H(... |
What general tips do you have for golfing in Starry? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Starry (e.g. "remove comments" is not an answer).
Please post one tip per answer.
|
From Wikipedia:
The centroid of a non-self-intersecting closed polygon
defined by n vertices (x0,y0),
(x1,y1), ...,
(xn−1,yn−1) is the point (Cx,
Cy), where
and where A is the polygon's signed area,
In these formulas, the vertices are assumed to be numbered in order of
their occurrence along the polygon... |
This question wants you to golf batch programms. In Batch you can use
set x=averylongbatchcommand
%x% arg1
which expands to
set x=averylongbatchcommand
averylongbatchcommand arg1
Your task is it to expand these statements.
As you can also use set for arithmetic purposes like this:
set x = 0
set /a x= %x%+1
you sho... |
Monopoly Board
For this code-golf challenge we will be building the board game Monopoly.
Rules:
Take no input.
Output a 11x11 board where each ASCII character forming the board is the first letter of each space of the U.S. version of the Monopoly board.
The characters must be separated by spaces.
Go should start in th... |
The Eulerian number A(n, m) is the number of permutations of [1, 2, ..., n] in which exactly m elements are greater than the previous element. These are also called rises. For example, if n = 3, there are 3! = 6 permutations of [1, 2, 3]
1 2 3
< < 2 elements are greater than the previous
1 3 2
< > 1 ...
2 1 3
> ... |
This programming puzzle is inspired by another question which has been asked here yesterday but which was deleted by the author...
The challenge:
Create an executable binary (Windows .EXE or Linux binary) using Visual C# (or your favorite C# IDE) which prints the following text to the standard output:
Main() is the mai... |
Given a number N, draw a left aligned NxN board of numbers, leaving 1 blank (as a space) (I will show diagrams with N=5)
2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
Your job is to construct the Sieve of Eratosthenes, step by step. First, start with 2. It's prime, so leave it there, and re... |
The challenge is to write codegolf for the permanent of a matrix.
The permanent of an \$n\times n\$ matrix \$A = a_{i,j}\$) is defined as
$$\text{perm}(A) = \sum_{\sigma \in S_n} \prod^n_{i=1} a_{i,\sigma(i)}$$
Here \$S_n\$ represents the set of all permutations of \$[1, n]\$.
As an example (from the wiki):
$$\text{per... |
We've all been burned by the grammar police on the internet. What we need is a regex that can be used in place of "there", "their", and "they're". This would shift burden of grammar parsing from the writer to the reader (a sort of "client-side" grammar, if we you will). So, here's what I have to start with:
the([re]|[i... |
Using the shortest JS (ES5) code possible, as measured in number of characters, gather all the ids on a page for foobar elements into a comma-delimited string. For example:
<div>
<foobar id="456"></foobar>
<foobar id="aaa"></foobar>
<foobar id="987"></foobar>
<div>
Should give "456,aaa,987"
You cannot use ES6 o... |
There's a river and there are wolves and chickens on one side of the river. They have a raft and they all need to get to the other side. However, the raft cannot travel on its own. The raft will sink if more than two animals are on it. None of the animals want to get wet because the river's cold and dirty. None of the ... |
...counted!
You will pass your program a variable which represents a quantity of money in dollars and/or cents and an array of coin values. Your challenge is to output the number of possible combinations of the given array of coin values that would add up to the amount passed to the code. If it is not possible with t... |
Let's define f(n) as the maximal number of regions obtained by joining n points around a circle by straight lines. For example, two points would split the circle into two pieces, three into four, like this:
Make sure when you are drawing the lines, you don't have an intersection of more than two lines.
Your task
Given... |
Can these rectangles fill a rectangular space?
Given a bunch of rectangles, you are asked whether or not they can be arranged to fill a rectangular space.
Specs
Given a bunch of arbitrary m x n rectangles; 0 <= m, n <= 1000, determine whether or not it is possible to arrange them so that they cover exactly a rectangula... |
This problem is "inspired" from a question that was originally asked on Quora (not for code golfing). I just want to make it a challenge for you guys (and my first problem submission here).
Given an array of integer elements v and an integer d (we assume that d is lower or equal to the array's length), consider all th... |
Consider the natural sequence up-to 6 (disregard 1):
2,3,4,5,6
We start scanning from the left (in this case from 2), search for a number divisible by 2 (here 4) and then remove both the numbers from the list (here 2 & 4), such that the list reduces to:
3,5,6
We continue the same process, here leftmost is 3, so we... |
Your task is to print this exact text:
אבגדהוזחטיכךלמםנןסעפףצץקרשת
(You are allowed to print a trailing newline)
SHA256 hash of the UTF-8 encoding of the text:
0ab6f1e0bf216a0db52a4a5a247f95cba6f51496de7a24dfd01f3985dfcf6085
Base64 encoding:
15DXkdeS15PXlNeV15bXl9eY15nXm9ea15zXnted16DXn9eh16LXpNej16bXpden16jXqdeq
Ru... |
It is Friday and I am tired, so let's do a quick one! Take no input, however you should output all thirteen different numbered cards in a standard deck of cards. You should output 2 through Ace (Suit agnostic).
Each card has a top that is denoted with a space and ten _ and another space .
The second row from the to... |
This is a code golf challenge I thought of with a mathematical bent. The challenge is to write the shortest code possible such that it is an open question whether or not the code terminates. An example of what I mean could be the following piece of python code, adapted from an anwser to this cs stackexchange question.
... |
The Goldbach conjecture states that every even number greater than two can be expressed as the sum of two primes. For example,
4 = 2 + 2
6 = 3 + 3
8 = 5 + 3
However, once we get to 10 something interesting happens. Not only can 10 be written as
5 + 5
but it can also be written as
7 + 3
Since 10 can be expressed as t... |
Your task is to generate a random digit following these steps:
First, generate 10 random digits to make a binary number, 50% 0, and 50% 1:
010011001
If it is all zeros, generate a new one.
Convert this to decimal:
153
For each digit, write that amount of alternating 0s and 1s (first digit = 1s, second digit = 0s, thi... |
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... |
Fairly obviously, you have to print the Greek alphabet. But I thought I'd make it slightly more interesting, so there's a twist: when your program is ran with an argument (anything), it should output the Greek alphabet in lowercase.
Information
Greek alphabet (Capitals): ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ
Greek alphabet (Lower... |
The challenge is to write the fastest code possible for computing the permanent of a matrix.
The permanent of an n-by-n matrix A = (ai,j) is defined as
Here S_n represents the set of all permutations of [1, n].
As an example (from the wiki):
In this question matrices are all square and will only have the values -1 a... |
A "triplet bracket" (that I made up for this challenge) is one of the following:
(...+...)
[...:...]
{...|...}
<...-...>
A balanced triplet bracket string (BTBS for short) is either an empty string, two BTBSes concatenated, or one of the above triplet brackets with each ... replaced with a BTBS.
Your task is to write ... |
Given an array of any depth, draw its contents with borders of +-| around each subarray. Those are the ASCII characters for plus, minus, and vertical pipe.
For example, if the array is [1, 2, 3], draw
+-----+
|1 2 3|
+-----+
For a nested array such as [[1, 2, 3], [4, 5], [6, 7, 8]], draw
+-----------------+
|+-----+--... |
I don't know about you all but I'm not preparing for Halloween––never did never will––but, my neighbor is, so we'll help her out.
She needs help figuring out which brand of candy she has, but she has so much candy she would not be able to finish before Halloween.
She has:
Snickers
KitKat
Starburst
GummyBears
Twix
Inp... |
This is different from Print the Greek alphabet! because it is in words.
This is different from "Hello, World!" because the output is different and much longer, leading to different techniques.
This is different from We're no strangers to code golf, you know the rules, and so do I because the output is different and mu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.