instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
The following is an unfolded milk carton:
+-----+-\|/-+-----+-\|/-+-+
| | / \ | | / \ | |
+-----+/---\+-----+/---\+-+
| | | | | |
| | | | | |
| | | | | |
+-----+-----+-----+-----+-+
\ / \ / \ / \ /
\_/ \_/ \_/ \_/
This is a code-golf kolmo... | stackexchange_codegolf |
For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run into a bit of ... | stackexchange_codegolf |
Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milk-white, one black, one dappled and one yellow. The number of bulls is greater than the number of cows, and the relations between them are as follows:
White bulls \$=... | stackexchange_codegolf |
The Challenge
In this challenge, you are supposed to write a program or function that takes in a String, which will contain the simplified Markdown-like Markup, and outputs the corresponding HTML Markup.
The Input
You can take input in whatever way you wish to. The type of the input should be String.
The Output
You c... | stackexchange_codegolf |
Let's solve this user's homework; I think it's an interesting exercise!
Input
Two 3-digit natural numbers.
Outputs
Two 2-digit numbers. In each of the output numbers, one digit is taken from one input number, and the other from the other number. The choice is independent. The first output number should be the minimal p... | stackexchange_codegolf |
Being a Haskell hacker, I prefer pointfree notation over pointful. Unfortunately some people find pointfree notation hard to read, and I find it hard to get the correct number of parentheses when I write in pointful.
Help me convert code written in pointfree to pointful notation!
About
In pointfree notation we use poin... | stackexchange_codegolf |
We all know what a quine is. An inverted quine is a non-empty program that prints the inverse of its source code without reading its source code, and consists solely of printable-ASCII characters (space through ~).
Here, “inverse of the source code” means the following: the output of your program must contain each pri... | stackexchange_codegolf |
This is the inverse of Let's do some "deciph4r4ng"
In this challenge, your task is to encipher a string. Luckily, the algorithm is pretty simple: reading from left to right, each typical writing character (ASCII range 32-126) must be replaced by a number N (0-9) to indicate that it is the same as the character N+1 pos... | 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 |
Your task
Given two positive integers \$x\$ and \$d\$ (such that \$d<x\$), output the 5th term of the \$d\$th difference of the sequence \$n^x\$
Example
Let's say we are given the inputs \$x=4\$ and \$d=2\$.
First, we get the series \$n^4\$:
\$0^4 = 0\$
\$1^4 = 1\$
\$2^4 = 16\$
\$3^4 = 81\$
...
These are the first 10... | stackexchange_codegolf |
Time for a new typography challenge! It’s a common problem when copy-pasting between various document formats: hyphenation. While it reduces the raggedness of a left-aligned layout or evens spacing in a justified layout, it’s a complete pain when your PDF is not properly constructed and retains the hyphens in the layou... | stackexchange_codegolf |
Task description
In number theory, the Carmichael function λ takes a positive integer n and returns the least positive integer k so that the k-th power of each integer coprime to n equals 1 modulo n.
Given a positive integer n, your solution must compute λ(n). The shortest code in bytes wins.
Your program should theore... | stackexchange_codegolf |
Challenge
Given a sequence of non-negative integers, create a function that output a descendant pyramid where the children are the sum of both parent numbers.
The result is outputted as an string using tab \t.
Note: trailing tabs on each line are not required
1\t\t2\t\t3\n\t3\t\t5\t\n\t\t8\t\t results in
1 2 ... | stackexchange_codegolf |
Challenge
You need to generate a program or function that takes in a positive integer N, calculates the first N terms of the Fibonacci sequence in binary, concatenates it into a single binary number, converts that number back to decimal, and then outputs the decimal as an integer.
For example
1 -> [0] -> 0 to decimal o... | stackexchange_codegolf |
The alphanumeric characters have ASCII-values:
0-9 -> 48-57
A-Z -> 65-90
a-z -> 97-122
Your challenge is to take an integer as input, and output how many characters can be made using consecutive digits of that number. The character codes may be overlapping. 666 should result in 2, since you have 66 twice.
Test c... | stackexchange_codegolf |
My Downgoat avatar has several distinct features
These features can however also apply to any other animal.
Specification
Given an image of an animal (technically can be anything), you must apply the Downgoat properties to it.
Border pixels are the outer most pixels of the image.
The background color is defined as th... | stackexchange_codegolf |
I have previously posted a challenge, smallest number of steps for a knight in chess.
Now I would like to go a step further by adding the possibility to choose your piece.
If you place a piece on any square of a chessboard, what is the smallest number of steps to reach every possible position?
Rules
It is an 8 by 8 bo... | stackexchange_codegolf |
In this fastest-code challenge, you are provided with a set of \$n\$ identical blocks and need to determine how many unique buildings can be constructed with them. Buildings must satisfy the following rules:
No overhangs - each block must either be on the ground or supported by one or more blocks directly underneath i... | stackexchange_codegolf |
Given a positive integer n, output the 2^n binary sequences of length n sorted in the following precise ordering.
Test cases:
0:
0 or 1 (defining this is a matter of debate)
1:
0
1
2:
00
01
10
11
3:
000
001
010
100
011
101
110
111
4:
0000
0001
0010
0100
1000
0011
0101
1001
0110
1010
1100
0111
1011
1101
1110
1111
e... | stackexchange_codegolf |
A celebration of the many faces of APL
Given a string among those in column 1 or column 2 of the below table, return the string's neighbor to its right. In other words, if given a string in column 1 then return column 2's string on that row, and if given a string in column 2 then return column 3's string on that row.
T... | stackexchange_codegolf |
You work at a bakery and every day you make exactly 100 bagels. However your customers are not as reliable and every day a random number of bagels will be ordered. So sometimes you will run out of bagels and sometimes you will have leftovers.
Now leftover bagels will still be good for 1 more day. After a day on the ... | stackexchange_codegolf |
Background
Many esoteric programming languages don't have numbers built in at literals, so you have to calculate them at runtime; and in many of these cases, the number representation can be quite interesting. We've already had a challenge about representing numbers for Underload. This challenge is about representing n... | stackexchange_codegolf |
Given a string, replace all left-double-quotes into two backticks and all right-double-quotes into two single-quotes.
Left-quotes means the quotes that starts a quote. Right-quotes means the quotes that ends a quote. Quotes cannot be nested. You may assume that there are an even number of double-quotes in the string.
E... | stackexchange_codegolf |
Given a real number, convert it to a list of lists, with the negative sign (if any) becoming an empty list, the integer part becoming a list of digits, and the fractional part (if any) becoming a list of digits. The digits must be actual numbers, not strings.
Examples
0 → [[0]]
123 → [[1,2,3]]
-123 → [[],[1,2,3]]
123.4... | stackexchange_codegolf |
Each element on the periodic table of the elements has an atomic weight. For example, boron (element 5) has an atomic weight of 10.81. Your challenge is to write a program which takes as input the atomic number of an element and outputs its atomic weight.
Your program only needs to support elements up to and including ... | stackexchange_codegolf |
Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed to create a compressed string.
For example, given the string "the fox" and the encoder characters " abcdefghijklmnopqrstu... | stackexchange_codegolf |
This time I will give you an easy challenge:
Print the Om sign with \$\pi\$!(Sorry for many challenges with \$\pi\$)
Here is the om sign drawn using pi numbers:
59 0 64
230781
3.14159
26 502884
535 83279 1971
89 433 6939
79 44 937
... | stackexchange_codegolf |
Inspired by Using LaTeX to compact a list of numbers, this challenge is to output a compact list of numbers, given a range, as follows:
Input: 1,2, 3,4,5,8,11, 12,13
Output: 1-5, 8, 11-13
Input: 20,21,45,56,75, 76,77,78
Output: 20-21, 45, 56, 75-78
Input: 4,5
Output: 4-5
Input is always comma separated numbers, some... | stackexchange_codegolf |
Yes, the good old GIF. Loved for its versatility, hated for its patents and partly obsoleted due to its limitations (and patents), GIF consists, at the core, of a color palette and a palette-indexed image compressed using the LZW algorithm.
Your task is to write a program that reads an image in ASCII PPM format ("P3" m... | stackexchange_codegolf |
Or, "Swap the first and last letters of each word"
Your challenge is to, given a string of alphabetical ASCII characters as well as one other character to use as a delimiter (to separate each word), swap the first and last letters of each word. If there is a one-character word, leave it alone.
The examples/testcases us... | stackexchange_codegolf |
Given a single integer x where 0 <= x <= 91 output a stack of bottles of beer with that many bottles (and shelves) missing. For simplicity sake I'll only show the first 6 bottles and what it would be for each of the first inputs.
Here's the stack of bottles, each number is the bottle you should remove for that input (1... | stackexchange_codegolf |
Challenge
Create a function or program that, when given an integer size, behaves the following way:
If size is equal to 1, output
┌┐
└┘
If size is greater than 1, apply the following substitutions :
Source
Target
┌
┌┐└┌
┐
┌┐┐┘
└
┌└└┘
┘
┘┐└┘
Note: this is basically a Unicode box-drawing version of the... | stackexchange_codegolf |
Wholly surprised this hasn't been posted already, given the large number of chess puzzles on the site. While I thought of this myself, credit to Anush for posting it to the sandbox back in March. But I figured it's been long enough that I could go ahead and do so myself.
A checkmate in chess is a position in which the ... | stackexchange_codegolf |
Introduction
Today I went fishing alone with my canoe, unfortunately I fell asleep and the stream brought me away, I lost my oars, now it's night and I am lost in the ocean! I can't see the coast so I must be far away!
I have my cell phone but is malfunctional because it got wet by the salty water, I can't talk or he... | stackexchange_codegolf |
A positive integer \$x\$ is an \$n\$-perfect number if \$\sigma(x) = nx\$, where \$\sigma(x)\$ is the divisor sum function. For example, \$120\$ is a \$3\$-perfect number because its divisors sum to \$360\$:
$$360 = 3\times120 = 1+2+3+4+5+6+8+10+12+15+20+24+30+40+60+120$$
and
$$926073336514623897600 = 6\times1543455560... | stackexchange_codegolf |
If we take the natural numbers and roll them up counter clock-wise into a spiral we end up with the following infinite spiral:
....--57--56
|
36--35--34--33--32--31--30 55
| | |
37 16--15--14--13--12 29 54
| | | | |
38 17 ... | stackexchange_codegolf |
Think of cleave as the conceptual inverse of map. If map applies a function to each number in a list...
map([1, 2, 3], x -> x * 5) -> [5, 10, 15]
then cleave applies each function in a list to a number.
cleave(5, [x -> x * 2, x -> x - 1, x -> x * x]) -> [10, 4, 25]
More formally, given:
\$n\$, an integer, and
\$L\$, a... | stackexchange_codegolf |
In my previous bioinformatics challenge, I asked you to mutate a DNA sequence. This time, I'd like you to evaluate how likely a mutation, or a series of mutations, is.
The two types of substitutions are transitions and transversions, and due to the chemical structure of DNA bases, transitions are more likely to occur t... | 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 |
Write a program or function that takes in a rectangular grid of text where every cell is either an A or a B. All the A cells will form a simply-connected shape, i.e. they will all be orthogonally connected with no holes (diagonally neighboring letters do not count as connected). Likewise, all the B cells will form anot... | stackexchange_codegolf |
or: Build a vertical quine
Inspired by Take a stand against long lines.
Your task is to build a vertical quine with as short a line length as possible.
Scoring
Shortest line length (excluding newlines) wins, with code-golf criteria as a tie-breaker.
Line length is determined as the longest line in your program excludin... | stackexchange_codegolf |
(This is part 1 in a two-part challenge.)
Your task is to solve a Hexasweep puzzle.
A Hexasweep puzzle is set out on a grid of diamonds arranged in hexagonal shapes, of which the board looks like a hexagon, like so:
_____
/\ \
_____/ X\____\_____
/\ \ / XX /\ \
/X \____\/____/X \____\
\ X/... | stackexchange_codegolf |
Problem
John bought 5 apples. You are given the weights of every group of four apples, and must then find the weights of the apples themselves.
For example, if all apples without the first one weigh 798 g, without the second - 794 g, without the third - 813 g, without the fourth - 806 g, and without the fifth - 789 g, ... | stackexchange_codegolf |
Challenge
Peter has risen again to save us from the duplicate challenges!
Peter Taylor is dead, and there's no doubt about it (well, apart from the huge amount of doubt we have... but just ignore that). In his memory, you must write a program which determines whether a given user is alive or dead.
Further Information
A... | 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 |
This is a rewrite of the (currently closed) "Debunking Stroustrup's debunking of the myth “C++ is for large, complicated, programs only”" challenge.
Challenge
Write the shortest program or function that will:
Download http://www.stroustrup.com/C++.html, and
List all URLs contained in the HTML document.
A "URL" for th... | stackexchange_codegolf |
Your goal is to alternate uppercase and lowercase letters, while ignoring non-alphaneumeric characters.
Input => Output
abc => aBc OR AbC
a c => A c OR a C
abc123abc => AbC123aBc OR aBc123AbC
Shortest answer wins.
| stackexchange_codegolf |
When making phone calls internationally, phone numbers are prefixed with a code indicating what country the number is located in. These codes are prefix codes, meaning that no code is a prefix of another.
Now, earlier today you missed a call, and you're kind of curious where that call might have come from. So you want ... | stackexchange_codegolf |
Write a program or function that listens for incoming TCP traffic on port N. It offers a simple service: it calculates sum of IP address fields of incoming connection and returns.
Program or function reads integer N from arguments or stdin. It listens to incoming TCP connections on port N. When someone connects to that... | stackexchange_codegolf |
Introductions
A 2×n Boolean matrix can be represented as a string of the four characters . ':.
The string has an "upper row" and a "lower row", with dots representing 1s and empty spaces representing 0s.
For example, the 2×6 matrix
1 0 1 0 0 1
0 0 0 1 0 1
can be represented as ' '. :.
Your task is to take a matrix in ... | stackexchange_codegolf |
The Hilbert curves are a class of space-filling fractal curves where every bend in the path is at a right angle and the curve as a whole fills up a square, with the property that sequences of consecutive segments are always displayed as contiguous blocks.
Traditionally, the curve is drawn as a series of very squiggly l... | stackexchange_codegolf |
I've recently stumbled upon a Russian site called acmp.ru, in which one of the tasks, HOK, asks us to find the LCM of two positive integers. The full statement, translated to English is as follows:
The only line of the input contains two natural numbers A and B separated by a space, not exceeding 46340.
In the only l... | stackexchange_codegolf |
Based on this question from Code Review.
Given precisely three positive integers, return the product of all of the distinct inputs. If none of the inputs are distinct, return 1. That is, implement the function:
\$ f(a,b,c) = \cases{1 & $a = b = c $ \\ a & $ b = c $ \\ b & $ a = c $ \\ c & $ a = b $ \\ a b c & otherwise... | stackexchange_codegolf |
I have a combinatorics problem that I'd like to put on the OEIS—the problem is that I don't have enough terms. This code challenge is to help me compute more terms, and the winner will be the user with the submission containing the greatest number of terms.
The Problem
Suppose I give you a triangular array of light bu... | stackexchange_codegolf |
Here you can see g-code parser, written in JavaScript to use in microcontroller (like espruino). But you can run it in browser, because it don't use any specific features.
function gcode(str){
//Removes comment, parses command name and args
const [,f,args] = (str.match(/^([GM]\d+) ([^;]+)/) || [,"",""]);
//A1.2... | stackexchange_codegolf |
Congratulations to Dennis who won both the cops' and the robbers' challenge! Calvin's Hobbies has already delivered on his promise and wrote this challenge for Dennis for winning the robbers' challenge.
Notice: This challenge is closed for further cop answers as of 2015-09-01 02:00:00 UTC. Any new answers posted wil... | stackexchange_codegolf |
This thinking exercise is inspired from Super Chafouin's question "Just Repeat Yourself" in which the phrase "Do not repeat yourself!" had to be outputted using code that was basically a series of doubled characters, inclusive of newlines, so code like:
((zz==0011))&&((mm++&&mm++&&mm++&&mm++&&mm++&&nn--&&nn--&&nn--&&n... | stackexchange_codegolf |
Summary
The goal of this challenge is to create an undone image-version of a 15-puzzle / sliding puzzle also called taquin in french.
Details:
Given an input composed of:
an image,
an integer n,
an other integer r,
your program, or function, or anything else that fits, must output the same image (i.e. same size and f... | stackexchange_codegolf |
Goal
In light of the World Series being around the corner, I need a program that can read the box scores and tell me what inning it is. This is complicated slightly because baseball uses an odd method to record the score. They don't write down the at-bat team's score for the inning until they've scored a run (and are s... | stackexchange_codegolf |
Inspiration
Given a positive integer \$1 \le n \le 9\$, output all positive \$n\$-digit integers \$i\$ for which the following is true:
Each digit from \$1\$ to \$n\$ appears exactly once in \$i\$. Therefore, \$i\$'s digits are a permutation of the digits from \$1\$ to \$n\$.
\$i\$ is divisible by \$n\$
Removing the r... | stackexchange_codegolf |
Given a list of positive integers that contains at least 3 distinct entries, output a permutation of that list that isn't sorted in ascending or descending order.
Examples
1,2,3 -> 2,1,3 or 3,1,2 or 1,3,2 or 2,3,1
1,2,3,3 -> 2,1,3,3 or 3,1,2,3 or 1,3,2,3 etc..
Thanks @Arnauld and @NoOneIsHere for the title!
| stackexchange_codegolf |
I just had a lesson in school about alkanes and figured it would probably make for a great code golf challenge! Don't worry, it isn't as complicated as it may look!
A Quick Rehash
(Please Note: To keep this brief, not all information is 100% accurate.)
Alkanes are strings of carbon and hydrogen. Every carbon atom has 4... | stackexchange_codegolf |
Here's a challenge inspired by Programming Praxis:
http://programmingpraxis.com/2009/02/19/flavius-josephus/
Write a function josephus(n,m) that returns a list of n people,
numbered from 0 to n-1, in the order in which they are executed, every
mth person in turn, with the sole survivor as the last person in the
list.
... | stackexchange_codegolf |
This is a somewhat proof-golf-like cops-and-robbers challenge. This is the robbers' thread; the cops' thread is here.
Robbers
The cops will post abstract rewriting systems. Your task is to crack their submissions by proving that the target string either can or can not be reached from the source string by applying their... | stackexchange_codegolf |
Binary search is an algorithm that looks for an element in a sorted data-structure by constantly dividing the search space in half.
Rosetta Code
A binary search divides a range of values into halves, and continues to narrow down the field of search until the unknown value is found. It is the classic example of a "divi... | stackexchange_codegolf |
The Task:
Given a .txt file with frames of ASCII art each separated by a \n (see this example if you are unclear) output a motion picture with frame with 1 frame per second.
Note that there is a trailing \n on the final frame.
Each frames dimensions will be:
X<80
Y<20
The Rules
The Previous frame must be cleared bef... | stackexchange_codegolf |
I'm trying to solve a CSS challenge. It contains a rotated leaf shape (looks like an eye). Score for the challenge depends on amount of characters of the code. Here's my way to make a leaf shape:
div {
width: 200px;
height: 200px;
border-radius: 99% 0;
rotate: 45deg;
background: #d9d9d9;
}
<div></div>
He... | stackexchange_codegolf |
"First they came..." is a poem by Martin Niemöller:
First they came for the Socialists, and I did not speak out-
Because I was not a Socialist.
Then they came for the Trade Unionists, and I did not speak out-
Because I was not a Trade Unionist.
Then they came for the Jews, and I did not speak out-
Because I was not a... | stackexchange_codegolf |
The Quine-McCluskey algorithm merges disjunctors in a disjunction like
$$
\lnot x_0 \land \lnot x_1 \land \lnot x_2 \land \lnot x_3 \lor\\
x_0 \land \lnot x_1 \land x_2 \land \lnot x_3 \lor\\
\lnot x_0 \land x_1 \land x_2 \land \lnot x_3 \lor\\
\lnot x_0 \land \lnot x_1 \land \lnot x_2 \land ... | stackexchange_codegolf |
Challenge
Create a function or program that, when given an integer size, does the following:
If size is equal to 1, output
H H
HHH
H H
If size is greater than 1, output
X X
XXX
X X
where X is the output of the program/function for size - 1
(If you prefer, you may have the base case correspond to 0, so long as you spe... | stackexchange_codegolf |
Your task is to make a bidirectional compressor. It takes a list of bytes as input and returns a list of bytes as output. It has the property than whenever it is iterated twice it returns the original input.
In other words, if f is your program as a function, then f(f(x))=x for all x.
Now, since this is a "compressor",... | stackexchange_codegolf |
Objective
Given a nonempty unordered list of positive integers, decide whether they can be added, negated, or multiplied to yield a single zero. Each given number must be used exactly once.
There is a taboo. Do not multiply zero to anything. Adding zero to anything is OK.
Examples
Truthy
List, Solution
[1,1], 1-1
[1,1,... | stackexchange_codegolf |
Minesweeper is a puzzle game where mines are hidden around a board of nondescript tiles with the goal of identifying the location of all mines. Clicking on a mine loses the game, but clicking on any other tile will reveal a number from 0-8 which signifies how many mines directly surround it.
Given a number, you must di... | stackexchange_codegolf |
Background
Adler-32 is a 32-bit checksum invented by Mark Adler in 1995 which is part of the widely used zlib library (also developed by Adler). Adler-32 is not as reliable as a 32-bit cyclic redundancy check, but – at least in software – it is much faster and easier to implement.
Definition
Let B = [b1, ⋯, bn] be a b... | stackexchange_codegolf |
We consider two integers to be similar if, when written in decimal, have the same length, and if we compare characters in any two positions for both decimal strings, the comparison results (less, equal or greater) must be the same in both strings.
Formally, for two number that can be written as decimal strings \$a_1a_2... | stackexchange_codegolf |
Given two integers greater than one, A and B, output four mathematical expressions in this order:
The plain expression A^B (A to the power B). e.g. if A = 2 and B = 3, 2^3.
The expansion of A^B in terms of repeated multiplications of A. e.g. 2*2*2.
The expansion of A^B in terms of repeated additions of A. e.g. 2+2+2... | stackexchange_codegolf |
Executive summary
Given input representing two vectors and their respective "weights", produce output that also represents the weighted sum of those vectors.
Challenge
The input will consist of one or more lines of the following characters:
exactly one occurrence of the digit 0, which represents the origin in a two-di... | stackexchange_codegolf |
I have a number like this:
n = 548915381
The output should be the sum of every second digit of that number. In this case 26:
4+9+5+8 = 26
Rules:
This is a code-golf, so the shortest code in bytes wins.
The input consists only of numbers bigger than 10 (at least 2 digits) but smaller than a 32-bit integer.
The input ... | stackexchange_codegolf |
Yesterday, as part of a IQ-style test, I got this interesting question:
The time on a 24-hour clock is 11:43. What is the least number of minutes I should wait before the same digits are on the screen again (in any valid 24-hour time order)?
The answer's 91 minutes, if you were wondering!
This stuck in my mind, and ... | stackexchange_codegolf |
Print or return the following string:
R******* *R****** **R***** ***R**** ****R*** *****R** ******R* *******R
*....... .*...... ..*..... ...*.... ....*... .....*.. ......*. .......*
*....... .*...... ..*..... ...*.... ....*... .....*.. ......*. .......*
*....... .*...... ..*..... ...*.... ....*... .....*.. ......*. ...... | stackexchange_codegolf |
Construct a full program which outputs Hello, World!. The score of your submission will be equal to the sum of all of the ASCII values of the distinct characters. The lowest score wins!
Rules
It must be a full program which takes no input
It must only print to STDOUT, nothing else
It must be strictly less than 1000 by... | stackexchange_codegolf |
Objective:
A guru once said a perfect code selfie is best shot diagonally from upper left corner. A code selfie is almost like a Quine - but rotated 45 degree clockwise.
Your mission is to code a program that outputs a code selfie.
Rules:
You can use any programming language.
Your programs should not take any input fr... | stackexchange_codegolf |
Platforms are stretches of - characters separated by one or more characters.
For example:
------ -- ------ -
The above has 4 platforms sizes 6, 2, 6 and 1.
Platforms that are not supported will fall. To be supported platforms need Jimmies.
Jimmies look like this:
\o/
They are three units wide. Don't ask me what ... | stackexchange_codegolf |
Write a program that takes one integer input n and one format letter and outputs n autograms in the format This sentence contains ? "A"s, ? "B"s ... and ? "Z"s.
Each question mark ? represents the number of times the the following letter appears in the text
All numbers will be written as text. To make it equally unfai... | stackexchange_codegolf |
Write a program that, given any 'n' number of strings of 'm' length, returns 'm' number of 'n'-length strings, with this condition:
Every new string should contains the letters at the same index of the others strings
For example, the first output string must contain the first letter of all the input strings, the second... | stackexchange_codegolf |
The Levenshtein distance between two strings is the minimum number of single character insertions, deletions, or substitutions to convert one string into the other one. Given a binary string \$S\$ of length \$n\$, we are a interested in the number of different strings of length \$n\$ which have distance at most \$3\$ ... | stackexchange_codegolf |
Write some code that acts as a cat program. That is, to input a string and output it as is. But the normal reversion of your code must output the normal reversion of the input string. And the visual reversion of your code must output the visual reversion of the input string.
The normal reversion is the reversed charact... | stackexchange_codegolf |
You will be given two pieces of input: a string in run-length encoded format defining the running track, and a capital letter representing the lane to start from. For example, the string "3a4A6b5B" expands to "aaaAAAAbbbbbbBBBBB". You then use the expanded string to create a track, as such:
A) aaaAAAA
B) bbbbbbBBBBB
... | stackexchange_codegolf |
Aside of nursing my child, Vitsy, and dabbling in the art of code golf, I also am an avid dubstep fan, listening to all the new dubstep that Monstercat puts out as regularly as I can. I also share a random dubstep of the day, though not regularly, in the Nineteenth Byte. This last bit is what this challenge relates to;... | stackexchange_codegolf |
Posted from sandbox
The Intro
What is an ACU? This challenge is based on the concept of money and since this is an international community, we all use different currencies, so in keeping with our spirit of inclusiveness, I have invented a new currency called Arbitrary Currency Units (ACUs) specifically for this challen... | stackexchange_codegolf |
Let's go for a rollercodester ride
The objective of this challenge is to create a program that is run recursively through several languages of your choice. The output of the first iteration becomes the code for the second iteration, et. cetera.
You choose the language sequence, but each unique language may be used onl... | stackexchange_codegolf |
Background
In France, and probably in the rest of the European Union, any food available for sale must list the ingredients that compose it on its packaging, in weight percentage descending order. However, the exact percentage doesn't have to be indicated, unless the ingredient is highlighted by the text or an image on... | stackexchange_codegolf |
Let's define a simple language that operates on a single 8-bit value.
It defines three bitwise operations (code explanation assumes 8-bit value variable):
! Negate the least significant bit (value ^= 1)
< Wrapping left-shift (value = value << 1 | value >> 7)
> wrapping right-shift (value = value >> 1 | value << 7)
In... | stackexchange_codegolf |
Challenge :
Given a string representing a mathematical expression return the result
Input :
A string representing a mathematical expression : '1 + 2 - 3 * (2/3 * 1)'.
Output :
The result after performing all operations.
Operators :
Possible operators
+ ---> plus
- ---> minus
* ---> multiplication
/ -... | stackexchange_codegolf |
This is an ascii-art challenge where you will draw ascii-art showing a person "jumping" off the top of a building.
The building
Input given will be a group of rectangular buildings. You may assume buildings are not "stacked on top of each other", hence only one row of buildings. This is the standard format of a buildi... | stackexchange_codegolf |
Given a matrix of integers \$M\$ and a list of four integers \$L\$, find the sub-matrix \$N\$ whose corners are given by \$L\$ and return the sum of its elements.
Suppose you're given the list \$L = [-8, -3, 2, 9]\$ and the following matrix \$M\$. The numbers in the list are highlighted in blue to illustrate:
$$
\begi... | stackexchange_codegolf |
Note: This challenge only allows answers in compiled languages
Task
Your task is pretty simple, make two different programs that when compiled result in the same output.
Scoring
Here is where the fun comes in. Your score will be the number of unique bytes present in exactly one program. For example if your two progra... | stackexchange_codegolf |
This is a successor to a previous challenge.
Input
An integer \$1 \leq n \leq 5\$.
Task
Your code should produce all strings that satisfy the following properties:
Your string should contain exactly two each of the first \$n\$ letters of the alphabet.
It should not contain the same letter twice in a row
It must start ... | stackexchange_codegolf |
After all assignments are submitted, a dictionary is created that maps student number to the hash of their file.
This dictionary, or hashmap, or mapping (whatever your language calls it) will look as follows:
{100: "aabb", 104: "43a", 52: "00ab", 430: "aabb", 332: "43a"}
The key is the student number, and the value is ... | stackexchange_codegolf |
This is a tips question for golfing in Python.
In Python golfing, it's common for a submission to be a function defined as a lambda. For example,
f=lambda x:0**x or x*f(x-1)
computes the factorial of x.
The lambda format has two big advantages:
The boilerplate of f=lambda x:... or lambda x:... is shorter than the de... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.