instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Background
The move-to-front transform (MTF) is a data encoding algorithm designed to improve the performance of entropy encoding techniques.
In the bzip2 compression algorithm, it is applied after the Burrows–Wheeler transform (as seen in Burrows, Wheeler and Back), with the objective of turning groups of repeated cha... | stackexchange_codegolf |
This is the Robbers thread. For the Cops challenge, see here
As the robbers, your job is to crack the cops' answers. Choose an uncracked, unsafe cop answer and attempt to figure out which languages, in which order, the cop used.
Note that a crack is valid even if the languages are different. So long as the the language... | stackexchange_codegolf |
99 Varieties of Dosa is a popular chain of roadside dosa stalls across South India. This is inspired by a combination of this chain and the classic CodeGolf challenge "99 Bottles of Beer".
Recreate the variant of the menu of the popular '99 Varieties of Dosa' listed below.
(Note: Despite the name, the list contains 10... | stackexchange_codegolf |
Given a binary number A as input with d > 1 digits, output a binary number B with d digits according to the following rules for finding the nth digit of B:
The first digit of B is zero if the first and second digits of A are equal; otherwise, it is one.
If 1 < n < d, then if the (n-1)th, nth and (n+1)th digits of A ar... | stackexchange_codegolf |
Katlani is a constructed language being designed in chat. In this challenge, your goal is to print the largest dictionary of katlani nouns possible in 400 bytes or less.
Task
In 400 bytes or less, your program should print a list of katlani nouns. You can choose to output them as a list/array in your language, or as a ... | stackexchange_codegolf |
Introduction
The arithmetic mean is defined as being equal to the sum of the numerical values of each and every observation divided by the total number of observations. Symbolically, if we have a data set containing the values a1,…,an. The arithmetic mean A is defined by the formula
Objective
The challenge here is, gi... | stackexchange_codegolf |
The goal is, having taken a string as input, duplicate each latin letter and "toggle" its case (i.e. uppercase becomes lowercase and vice-versa).
Example inputs & outputs:
Input Output
bad bBaAdD
Nice NniIcCeE
T e S t Tt eE Ss tT
s E t sS Ee tT
1!1!1st! 1!1!1sStT!
n00b nN00bB
(e.g... | stackexchange_codegolf |
There is a Sioux village. It has a totem:
__
___| |___
\/ \ / \/
/\ ``| |`` /\
/^^\ | | /^^\
/ /\ \ | | / /\ \
''''''''''''''''''''''''''''
The totem lets the Sioux mastering the weather for helping in their different tasks. Help the villagers p... | stackexchange_codegolf |
We all know of, or at least have heard of, brainfuck, one of the most famous and influential esoteric languages. While these days most implementations use an infinite tape, the original compiler by Urban Müller had a tape of 30000 cells. A little known fact* is that there is actually a special value at the end of the t... | stackexchange_codegolf |
The set of all polynomials with integer coefficients is countable.
This means that there is a sequence that contains each polynomial with integer coefficients exactly once.
Your goal is it to write a function or program that outputs such a sequence.
Example (you may use another sequence):
// list of integers [i -> Z(i)... | stackexchange_codegolf |
Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this file one character at a time, and at each step must guess the next character.
This is code-challenge. Your score will be
2... | stackexchange_codegolf |
Introduction
Alice is a 2-d language by Martin Ender which has two different execution modes, cardinal and ordinal. When the instruction pointer passes through a mirror (either / or \), it switches from one mode to the other one.
In this challenge we will focus on ordinal mode, where commands operate on strings and the... | stackexchange_codegolf |
Given an input of a Pig,
SickPig,
DeadPig,
QuinePig, or
DeafPig program, choose one of those
"languages" randomly and interpret the input as that "language."
First, randomly choose between one of the five members of the "Pig series":
Pig
If the choice was Pig, mimic the reference
interpreter by doing the following:
F... | stackexchange_codegolf |
The Holy Grail Layout in CSS, is a full height, 3 column layout which consists of a fluid central column, and two side columns with fixed widths.
Your Task is Simple!
Reverse it, make a fixed width central column, and two fluid width columns to the sides. The point is for them to take All available space both verticall... | stackexchange_codegolf |
Bitshift Variations in C Minor by Robert Miles is a Code Golf music piece written in C (with some additional bash commands). It was originally presented in a 2016 Computerphile video Code Golf & the Bitshift Variations. You can listen to clean renderings of it here (by Lucia Ceionia).
The original 2016 source code pres... | stackexchange_codegolf |
In this challenge about prefix code, we learnt that prefix codes are uniquely concatenable.
That means, they can be joined together without separator, and without ambiguity.
For example, since [1,2,45] is a prefix code, I can join them together without separator as such: 1245245112145, and there will be no ambiguity.
H... | stackexchange_codegolf |
Overview
Your goal is to implement RC4 encryption. RC4 encryption, invented by Ron Rivest (of RSA fame), was designed to be secure, yet simple enough to be implemented from memory by military soldiers on the battlefield. Today, there are several attacks on RC4, but it's still used in many places today.
Your program s... | stackexchange_codegolf |
The Ship of Theseus is an old question that goes something like:
If a ship has had all of its original parts replaced, is it still the same ship?
For this golf, we're going to slowly replace "parts" on a "ship", and see how long it takes to get a whole new ship.
Task
A ship is comprised of at least two parts. The par... | stackexchange_codegolf |
There are already 30 challenges dedicated to pi but not a single one asks you to find the nth decimal, so...
Challenge
For any integer in the range of 0 <= n <= 10000 display the nth decimal of pi.
Rules
Decimals are every number after 3.
Your program may be a function, or a full program
You must output the result in ... | stackexchange_codegolf |
I want to read two strings on separate lines, each string the same length and containing only 0's and 1's, and determine if the first is the one's complement of the second. How succinctly can this be done in Python3? (Sorry to specify the language, but this is for my son who's studying Python)
A list comprehension see... | stackexchange_codegolf |
In the language Nim, the rules for differentiating identifiers are slightly more relaxed than most other languages. Two identifiers are equivalent or address the same variable if they follow these rules:
the first character of both are the same (case sensitive)
both strings are the same (case insensitive) after removi... | stackexchange_codegolf |
My parents have an home theater device. The remote is broken making it incredibly difficult to navigate rightwards in a menu. Most the time it doesn't work but when it does it moves rightwards incredibly quickly.
This is obviously frustrating but it is most frustrating when you want to enter a movie title which requi... | stackexchange_codegolf |
In this challenge you will receive a list of non-negative integers. Each one represents a mushroom with a cap of that radius centered at that location. So a 0 means that it occupies no space at all, a 1 means that its cap only occupies space above it, a 2 means it occupies space above it and one unit to the left and ... | stackexchange_codegolf |
So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have fun!
Challenge: write efficiently and securely a program that creates an array of n threads that communicate with each o... | stackexchange_codegolf |
We all know scoring by characters is ripe for abuse. Let's prove this.
The Challenge
Output the following:
"m8V}G=D@7G1lAI,v08`
#(hNb0A8T!g;==SVaG5~
g"jUF!bmRY(3I@na?2S{
fJVzo/GQYU%ybpfUq3aG
Yza[jc,WJ$bP^7r};Da}
V-!Z+Nk:`/poc}d/X:G\
sWX{dbAUv6,i]%RG$hRp
),bd+?/{U1tU[;<;u.Nk
ZFPIOzJ/HimL!nexc,ls
HM%k3D$n2|R,8L?'eI_n
qs.... | stackexchange_codegolf |
Create a program that interprets the programming language Bucket.
Bucket works on two buckets: the first can hold A and the second can hold B units of liquid. The things you can do with these buckets are:
f: fill bucket A
F: fill bucket B
e: empty bucket A
E: empty bucket B
p: pour units of liquid from A to B until one... | stackexchange_codegolf |
From the infinite triangular array of positive integers, suppose we repeatedly select all numbers at Euclidean distance of \$\sqrt{3}\$, starting from 1:
$$
\underline{1} \\
\;2\; \quad \;3\; \\
\;4\; \quad \;\underline{5}\; \quad \;6\; \\
\;\underline{7}\; \quad \;8\; \quad \;9\; \quad \underline{10} \\
11 \quad 12 \q... | stackexchange_codegolf |
The task is simple, post 2 code snippets that perform the same task, where one seems very optimized at first glance, but actually is significantly slower than the other.
Only one rule:
Both snippets must finish with the exact same output (for the same given input, if any).
| stackexchange_codegolf |
I didn't invent this challenge, but I find it very interesting to solve.
For every input number, e.g.:
4
Generate a range from 1 to that number:
[1 2 3 4]
And then, for every item in that list, generate a list from 1 to that number:
[[1] [1 2] [1 2 3] [1 2 3 4]]
Then, reverse every item of that list.
[[1] [2 1] [3 2... | stackexchange_codegolf |
A void list is a list that at no level contains any non-list objects. Or if you prefer a recursive definition
The empty list is void
A list containing only other void lists is void
All void lists have a finite depth.
Here are some examples of void lists (using python syntax):
[]
[[]]
[[],[]]
[[[]]]
[[[]],[]]
[[],[[]... | stackexchange_codegolf |
Your task is simple. Determine if one string equals the other (not address, the value) without the use of equality operators (such as ==, ===, or .equal()) or inequality (!=, !==) anything similar for other languages. This means anywhere! You may not use these operators anywhere in the code. You may however, you use to... | stackexchange_codegolf |
Introduction
Write a solver for integer linear programming.
Challenge
Your task is write a solver for integer linear programming (ILP). In ILP, linear inequalities of a set of unknowns (all of which are integers) are given, and the goal is to find the minimum or maximum of a linear function.
For example, for the inequa... | stackexchange_codegolf |
Look at these photographs of natural scenes, with one of the RGB channels taken out of them:
Source (with red): https://en.wikipedia.org/wiki/File:Altja_j%C3%B5gi_Lahemaal.jpg
Source (with green): https://commons.wikimedia.org/wiki/File:2007_mather-lake_hg.jpg
Source (with blue): https://commons.wikimedia.org/wiki/F... | stackexchange_codegolf |
NDos' Numeral System
NDos' numeral system is a numeral system invented by me. It represents every nonnegative integer by a binary tree. Given a nonnegative integer \$n\$:
If \$n=0\$, it is represented as the empty tree.
Otherwise, the tree has a root. With the binary expansion of \$n\$:
The left sub-tree of the root... | stackexchange_codegolf |
1300 years ago, the English theologian Bede earned the honorific by which he is now known ("The Venerable Bede") by, among other things, convincingly computing the date of Easter for a number of years. This required reconciling the old, Jewish, lunar calendar with the newer solar one, a task made all the more challengi... | stackexchange_codegolf |
This challenge, while probably trivial in most "standard" languages, is addressed to those languages which are so esoteric, low-level, and/or difficult to use that are very rarely seen on this site. It should provide an interesting problem to solve, so this is your occasion to try that weird language you've read about!... | stackexchange_codegolf |
Challenge
Your task is to encode an integer as a string of ASCII characters, then successfully decode it after said string has been randomly shuffled.
You will write two programs/functions, which will be referred to as Encoder and Decoder.
Encoder
Input: an integer \$n\$ in the range \$[0,2^{31}-1]\$.
Output: a string... | stackexchange_codegolf |
Context
After "Computing a specific coefficient in a product of polynomials", asking you to compute a specific coefficient of polynomial multiplication, I wish to create a "mirror" challenge, asking you to compute a specific coefficient from polynomial division.
Polynomial division
Let us establish an analogy with inte... | stackexchange_codegolf |
Given a set of substrings, such as [ca, ar, car, rd], it's possible to create infinitely many strings by concatting them together. Some examples of this for the given substrings could be:
ca
caar
card
rdca
carrd
rdrd
...
One interesting property of this set of substrings is that any string can only be constructed in o... | stackexchange_codegolf |
Challenge
Given a whole number divisible by 9 and one missing digit, find the missing digit.
The missing digit may be represented by any character other than the digits 0-9 as long as it is consistent.
If the missing digit could be 0 or 9, output something to signify so.
Assume the user is intelligent enough to put onl... | stackexchange_codegolf |
Fizz Buzz is a common challenge given during interviews. The challenge goes something like this:
Write a program that prints the numbers from 1 to n. If a number is
divisible by 3, write Fizz instead. If a number is divisible by 5,
write Buzz instead. However, if the number is divisible by both 3 and
5, write FizzBuzz... | stackexchange_codegolf |
In this challenge you will take a an ascii art image of a highway like so
| | | | | |
| | | |
| | | | | |
| | | |
| | | | | |
| | | |
| | | | | |
And you need to put rain across its lanes like so
|\\\|\\\| |\\|\\|
|\\\\\\\| |\\\\\|
|\\\|\\\| |\\... | stackexchange_codegolf |
Here is a very simple language definition:
A Variable is any string that does not contain ^, <, >, !, or ?
The empty string is a valid variable identifier
The value of every variable starts at 0.
A Statement is one of (var is a Variable, P is a Program):
var^ -> changes var to be equal to 1 more than itself
v... | stackexchange_codegolf |
Given a string, you've to split it into groups of three characters (by padding _ at the end).
Related, but still it's different.
Sample I/O:
'abcde' -> 'abc', 'de_'
'1234' -> '123', '4__'
'' -> [] or falsey value
'Three spree!' -> 'Thr', 'ee ', 'spr', 'ee!'
6 MB string
This is a code-golf, so fewest bytes wil... | stackexchange_codegolf |
Task
Given a representation of a line, output the number of quadrants that that line passes through.
Valid Representations of a Line
You can represent a line as
Three signed integers A, B, and C which share no common factor and where A and B are not both zero, representing the line Ax + By = C,
Four signed integers X1... | stackexchange_codegolf |
Background
Conway immobilizer problem is a puzzle that reads like the following:
Three positions, "left," "middle," and "right," are marked on a table.
Three cards, an ace, a king, and a queen, lie face up in some or all
three of the positions. If more than one card occupies a given
position then only the top ca... | stackexchange_codegolf |
Here are the first 100 numbers of a sequence:
1,2,33,4,55,66,777,8,99,11,111,12,133,141,1515,1,11,18,191,22,222,222,2232,24,252,266,2772,282,2922,3030,31313,3,33,33,335,36,377,383,3939,44,441,444,4443,444,4455,4464,44747,48,499,505,5151,522,5333,5445,55555,565,5757,5855,59559,6060,61611,62626,636363,6,66,66,676,66,666,... | stackexchange_codegolf |
Print a tower block with the shortest possible code.
Input:
The input defines how many floors the tower block has. One floor contains a window on either side of the door. The window is made up of 3x3 hashes.
An example of a 4 storey tower block is below:
=====================
)V V V V V V V V V V(
)V ... | stackexchange_codegolf |
Introduction
In most interpreted languages, there is an operation that will run code generated at runtime. It generally requires alphanumeric characters to refer to this operation. Write a program, using as few alphanumeric characters as possible, that is able to download and execute any string in the language you're w... | stackexchange_codegolf |
Gemtext is a very simple markup format used by the alternative web protocol Gemini. Write a Gemtext to HTML converter.
From the Wiki:
A line of text is a paragraph, to be wrapped by the client. It is is
independent from the lines coming before or after it.
A list item starts with an asterisk and a space. Again, the r... | stackexchange_codegolf |
Pretty soon it's going to be 50 years since IBM unveiled its System/360 family of computers. These were the first to use the EBCDIC character set.
To mark the occasion, let's see who can write the shortest program capable of converting "ordinary" text to and from EBCDIC code page 037. We'll be using a translation table... | stackexchange_codegolf |
Given the measures of two of the interior angles of a triangle (x and y; the other angle can be easily calculated with 180 - x - y), draw a line segment that cuts this triangle into two isosceles triangles. You need to output the angle measures of both of your triangles.
However, because the base angles are the same, y... | stackexchange_codegolf |
Your task is to generate a graph with 54 vertices, each corresponds to a facet on a Rubik's cube. There is an edge between two vertices iff the corresponding facets share a side.
Rules
You may choose to output an adjacency list, adjacency matrix, edge list, or any reasonable format to represent a graph in an algorithm... | stackexchange_codegolf |
This code-challenge is based on OEIS sequence A261865.
\$A261865(n)\$ is the least integer \$k\$ such that some multiple of \$\sqrt{k}\$ is in the interval \$(n,n+1)\$.
The goal of this challenge is to write a program that can find a value of \$n\$ that makes \$A261865(n)\$ as large as you can. A brute-force program ... | stackexchange_codegolf |
A binary relation on a set \$X\$ is simply a subset \$S \subseteq X \times X\$; in other words, a relation is a collection of pairs \$(x,y)\$ such that both \$x\$ and \$y\$ are in \$X\$. The number of different relations grows quickly with the size of the set: if \$X\$ contains \$n\$ elements, there are \$2^{n^2}\$ bin... | stackexchange_codegolf |
Task
Provide two programs/functions A and B (not necessarily in the same language) with the following properties:
Either program, when given its own source code as input, produces an accepting output.
Either program, when given the other program's source code as input, produces a rejecting output.
It doesn't matter w... | stackexchange_codegolf |
This task is simple: Write a program or function that outputs the list of all musical notes (using English note names) from A♭ to G♯.
All notes without a name consisting of a single letter (i.e. black notes on a musical keyboard) should have their name printed twice, once as the sharp of a note, once as the flat of one... | stackexchange_codegolf |
Adapted from this StackOverflow question
In this challenge you will take a list of lists of integers, e.g.
A = [[1,2],[3,4],[5],[]]
And an additional single integer (e.g. n = 7). If you were to add n to the front of one of the lists in A there would be as many ways to do that as there are lists in A. In this example ... | stackexchange_codegolf |
July 1st is Canada day (yay Canada)! Or is it? It seems that the Wikipedia page for this day has a lot of Canada related content, but is there another day which is more Canadian?
Your task is to write a program or function which takes a date (month and day) as input and returns or outputs the number of mentions of "Ca... | stackexchange_codegolf |
Given a list of positive integers such as [69, 420], your challenge is to generate the sequence of numbers that can be formed by concatenating numbers from the above set, in ascending numerical order.
For example, with [69, 420] the sequence begins:
69
420
6969
42069
69420
420420
Note that elements of the sequence sho... | stackexchange_codegolf |
I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question
Introduction
Your challenge today is to output the lyrics of "99 bottles of beer":
99 bottles of beer on the wall, 99 bottles of beer.
Take one down... | stackexchange_codegolf |
Simpler version of this
Task
You must create a program that outputs a triangle of a given size N.
A triangle is made of 3 identical triangles
A triangle of size N should be made of N lines
A triangle's line starts from 1 star, and increases by 2 stars each line
Test Cases:
1 ->
*
* *
3 ->
*
***
*****
... | stackexchange_codegolf |
CGCC hasn't always had MathJax. Back in the dark ages, it would have been necessary to write \$x^2\$ as x² (the horror!). In this challenge, you will be given some math which may include superscripts, and you should convert it to MathJax.
Input:
Input will consist of one or more letters a to z, some with superscripts. ... | stackexchange_codegolf |
A Harshad number is a number that is divisible by the sum of its digits. This is obviously dependent on what base the integer is written in. Base 10 Harshad numbers are sequence A005349 in the OEIS.
Your Task:
Write a program or function that determines whether a given integer is a Harshad number in a given base. ... | stackexchange_codegolf |
I know, a bit late.
Challenge
Your challenge is, given a date, output if it's not an Advent Sunday, or the Advent Sunday of the year.
Rules
The \$4^\text{th}\$ Advent is determined by the Sunday before Christmas day (the \$25^\text{th}\$ of December). The \$3^\text{rd}\$ Advent is the Sunday before the \$4^\text{th}\$... | stackexchange_codegolf |
Setting the Scene:
It is an average afternoon, as you unwind after a long day by engaging in your favorite pastime: answering the plethora of captivating questions on PPCG. It hasn't been a good day for you; those damned Pyth programmers keep getting best answer and it's killing your vibe. Suddenly, you notice a new qu... | stackexchange_codegolf |
Pyth is perhaps the most successful general-purpose golfing language. Though it is somewhat in decline as a result of newer languages, from 2014 to 2016 Pyth's concise syntax, constant updates, overloading, and (for its era) many builtins made it a favorite for the majority of questions.
Pyth code is often difficult to... | stackexchange_codegolf |
Conways' Game of Life is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are:
Any live cell with 2 or 3 living neighbours (the 8 cells immediately around it) lives ... | stackexchange_codegolf |
You are starting up a cryptocurrency exchange website which supports conversion from USD to two currencies, foo-coin and bar-coin. Write a program that takes the exchange rate for each coin to USD as arguments and outputs the maximum value of USD that cannot be completely divided into the two currencies (assuming these... | stackexchange_codegolf |
Challenge
Write the shortest code that can sum all the time durations that appear in the stdin. The program must only consider the strings that match with one of the following patterns and ignore the rest.
HH:MM:SS (it will be interpreted as HH hours, MM minutes and SS seconds)
H:MM:SS (it will... | stackexchange_codegolf |
Write a program that accepts HTTP requests on any port of your choice above 1024, and responds to requests on any URL of your choice with its own source code. It must work with, at least, Firefox and Chrome. The code should be delivered as text/plain (removed requirement because none of the answers but one met it) with... | stackexchange_codegolf |
Rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you wish to accept it, is to write a program/function that outputs/returns its input/argument¹. The tricky part is that if I transpose your source code², the output/result must be transposed too.
You may choose which kind of 2D data your so... | stackexchange_codegolf |
Disclaimer: This challenge is inspired by a coding error I once made.
Okay, time for a maths lesson. A normal mean average looks like this:
Work out the sum of all numbers in a list
then divide by the size of the list.
But what if we don't know all the numbers at the time we're working out the average? We need a way ... | stackexchange_codegolf |
Produce Graham's Number in Magic the Gathering using the fewest number of cards and without using any infinite combos.
Rules:
Producing Graham's number means do anything that requires Graham's number to represent the game state. For example, you could produce Graham's number 2/2 zombie tokens, have Graham's number li... | stackexchange_codegolf |
Given an array where each number represent a color. After iterating each item in the array (for each item in the iteration the pointer can also point to the second-item-to-the-right), and the two colors in the iteration is the same, do the following checking:
If there is a different color between the pointed colors, th... | stackexchange_codegolf |
Given two inputs, a distance \$d\$ and a number \$n\$ output a list of \$n\$ random colors which each have distance \$d\$ from the previous.
Background
A random walk is a path which is defined by choosing a random direction and (usually) fixed distance to go at each step. We will be taking a random walk through the RGB... | stackexchange_codegolf |
You should write a program or function which takes a non-negative integer N as input and outputs or returns two integers (negative, zero or positive) X and Y.
Integers are meant in the mathematical sense as there are infinitely many of them.
The implemented function has to be bijective. This means that for every N it h... | stackexchange_codegolf |
Given a pattern of squares on a grid, determine if it is possible to create that pattern with non-overlapping dominoes. In case you are not familiar, a domino is a rectangular shape created by joining exactly two squares at their edges.
Examples
For the pattern on the left, O represents an occupied cell on the grid and... | stackexchange_codegolf |
Your job is to output the html of the current version (at the time of this writing) of the Wikipedia page for Kolmogorov complexity: https://en.wikipedia.org/w/index.php?title=Kolmogorov_complexity&oldid=781950121&action=raw (backup)
This is code-golf, so the shortest code wins.
| stackexchange_codegolf |
Based on this challenge.
In the rhythm game osu!, the difficulty modifier "Double-time" actually only increases the speed by 50%.
Your task, is to write a program that outputs a positive even integer (higher than 0), and when each byte/character (your choice which) in your source code is duplicated, it should output th... | stackexchange_codegolf |
Symbolic Differentiation 2: Back on the Chain Gang
Task
Write a program that takes in a certain sort of function from stdin and differentiates it with respect to x, using the chain rule.* The input function will be a string of the following form:
"trig_1 trig_2 trig_3 ... x"
where trig_n is a trigonometric function si... | stackexchange_codegolf |
I've invented an SQL-like language. Let's call it SelectQL. You can't INSERT anything, you can only SELECT, and I don't have the time for an interpreter. How about you help?
The Challenge
Write a full program or a function that takes in a database of tables and a valid SelectQL SELECT string, interprets the string, and... | stackexchange_codegolf |
I am exploring a unique approach to the classic problem of Reverse Polish Notation on code.golf. Unlike the conventional solutions, my focus lies on leveraging the eval function in GolfScript. This twist was inspired by a comment in a related thread, where the absence of eval was deemed a limitation.
"It's a shame no ... | stackexchange_codegolf |
Given a universe of \$v\$ elements, a Kirkman triple system is a set of \$(v-1)/2\$ classes each having \$v/3\$ blocks each having three elements, so that
every pair of elements appears in exactly one block
all classes are partitions of the universe.
Kirkman's schoolgirl problem corresponds to the \$v=15\$ case.
Fif... | stackexchange_codegolf |
This is 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. The tricky part is that if I make your source code palindrome via duplicating reversed source code after the original code, the output... | stackexchange_codegolf |
The input for the continuous knapsack problem is as follows.
For each item 1...n we are given a positive weight and profit. Overall we are also given a positive capacity which is the maximum weight we can carry.
The goal is to pick items so that the profit is maximized without exceeding the capacity. This is hard if ... | stackexchange_codegolf |
Background
We've had challenges before on Fibonacci
coding and Zeckendorf
representation. These representations follow naturally from Zeckendorf's
theorem, which states
that every positive integer can be represented uniquely as the sum of one
or more distinct, non-consecutive Fibonacci numbers. For example:
$$
\begin... | stackexchange_codegolf |
Write a Manufactoria program that will accept the empty input tape. But don't do it quickly! I mean, write the program quickly, but don't let it run quickly. The slower the program, the better, as long as it terminates eventually. The example program below takes 3:51 (the "total time" reported by the simulator).
h... | stackexchange_codegolf |
This challenge is from a game, Keep Talking And Nobody Explodes.
This is like one of those toys you played with as a kid where you have to match the
pattern that appears, except this one is a knockoff that was probably purchased at
a dollar store. – From the manual
Objective
The Simon Says module consists of 4 colored ... | stackexchange_codegolf |
Given a natural number \$n\$, return the \$n\$-th Leyland number.
Leyland Number
Leyland numbers are positive integers \$k\$ of the form
$$k = x^y + y^x$$
Where \$x\$ and \$y\$ are integers strictly greater than 1.
They are enumerated in ascending order.
EDIT: @DigitalTrauma suggested I include following "definition":
... | stackexchange_codegolf |
I got the spontaneous idea of making a series of challenges of users that have helped and continue to help the PPCG community be an enjoyable place for everyone, or maybe just specifically for me. :P
If you convert Dennis's name to an array of 1s and 0s where each consonant is 1 and each vowel is 0, the array is [1, 0,... | stackexchange_codegolf |
The challenge is simple:
Create a pie-chart based on a number of input values.
The input will be a list of positive numbers, decimal or integers, and the output will be a pie-chart where each of the input values are represented by separate colors, and a percentage value outside each of the areas.
Rules:
The colors mus... | stackexchange_codegolf |
In a now deleted stackoverflow question, someone posted the following:
Write a program or function to print alternating patterns in * and # based on a given integer n. Some examples:
Input: n=1
Output:
*
Input n=5
Output:
*####
###**
***##
###**
*####
Input: n=8
Output:
*#######
######**
***#####
####****
****####
##... | stackexchange_codegolf |
Let's for once do something useful.
Given the text from a Try It Online codegolf submission, produce the equivalent Chat Mini Challenge submission, which is of the form
Language, N bytes: [`code`](URL)
or (if submission is a single byte – TIO will add a trailing s on the first line only if needed)
Language, 1 byte: [`... | stackexchange_codegolf |
The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It contains nearly 280000 sequences of mathematical interest.
Examples of sequences:
positive integers (A000027)
prime numbers (A000040)
Fibonacci numbers (A000045)
Your task is to write a program or function that displ... | 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 |
Challenge
Create 2 programs A and B
The output of program A is exactly program B
The output of program B is exactly program A
Neither program should depend on inputs to yield the correct output
A and B are not identical programs
A and B are of different programming languages
Neither program may be equivalent to i... | stackexchange_codegolf |
Related: Program my microwave oven. Inspired by Generate lazy microwave input.
The lazy value of the non-negative integer N is the smallest of the integers that are closest to N while all their digits are identical.
Return (by any means) the lazy value of a given (by any means) N.
N ≤ the largest integer that your lang... | stackexchange_codegolf |
The challenge is to create a program that solves any one of the HQ9+ problems while looking like another language.
Note: This is not a golf challenge.
Rules:
The program must perform one of the following tasks when run.
Print "Hello, World!"
Print its entire source.
Print the lyrics to "99 Bottles of Beer on the Wall... | stackexchange_codegolf |
Challenge:
In a hypothetical scenario, the countdown timer for a race has random intervals between the counts, to prevent premature starting, e.g.
3 (0.82 seconds pass), 2 (0.67 seconds pass), 1
Input:
nothing
Output:
Write a program (or function) that prints the 3 numbers with a random time interval from 0.50 seco... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.