instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Your challenge is very simple: output the previous answer, in reverse.
However, as with this similarly-titled question, there's a catch: in this case, you can only use characters from the answer before the last. For example:
Let's say the first answer looks like this:
1 - Python
print('hi!')
And the second answer loo... | stackexchange_codegolf |
While looking at the ARM instruction set, you notice that the ADD instruction has the so-called "Flexible second operand", which can be abused for quick multiplication. For example, the following instruction multiplies register r1 by 17 (shifting it left by 4 bits and adding to itself):
ADD r1, r1, r1, LSL #4
; LSL mea... | stackexchange_codegolf |
The absolute value of a number \$x\$ is normally written as \$|x|\$. The left and right side of the absolute value uses the same symbol, so it is not immediately obvious how to parse nested absolute values e.g. \$||1-2|+|3-|4-5|||\$
Your goal is to parse such an expression containing nested absolute values:
The express... | stackexchange_codegolf |
Task
Write a function or program that takes n as a parameter and prints the first n self-divisors.
Definition of Self-divisor
A positive integer is called a “self-divisor” if every decimal digit of the number is a divisor of the number, that is, the number is evenly divisible by each and every one of its digits.
Exampl... | stackexchange_codegolf |
Introduction
Yesterday I saw a birthday puzzle. Congrats!!
Also this week I watched an episode of the TV show Bones where a dead body was found buried under a tree. To calculate the time of death, they counted the tree rings.
Tree rings form because trees grow slower during the winter and faster during the summer. Thus... | stackexchange_codegolf |
Objective
To flip the rows and columns of a table in a code-golf challenge.
Instructions
You will be passed a "table" of 3 arrays/lists with 3 items each as input. Your job is to flip the rows and columns on it by writing a program that can do this efficiently and creatively. You will flip the "table" according to the ... | stackexchange_codegolf |
You are given 6 numbers: 5 digits [0-9] and a target number. Your goal is to intersperse operators between the digits to get as close as you can to the target. You have to use each digit exactly once, and can use the following operators as many times as you want: + - * / () ^ sqrt sin cos tan. For example, if I'm give... | stackexchange_codegolf |
A simple pedometer can be modeled by a pendulum with two switches on opposite sides—one at x=0 and one at x=l. When the pendulum contacts the far switch, the ambulator can be assumed to have taken half a step. When it contacts the near switch, the step is completed.
Given a list of integers representing positions of th... | stackexchange_codegolf |
"nimi ale lon toki pona" is a song by YouTuber jan Misali which lists 137 common words in the constructed language Toki Pona. This challenge is not a duplicate of "How high can you count?" or "Alphabet printing challenge" because instead of numbers or single characters, it outputs random (to many programming languages)... | stackexchange_codegolf |
Help! I printed a bunch of rational numbers with no spaces or other delimiters other than the / in the fractions. There is, however, good news! All the numbers are positive. There are no improper fractions, every numerator is less than its denominator and any integers are represented directly, not as fractions. Any non... | stackexchange_codegolf |
Introduction
The telephone numbers or involution numbers are a sequence of integers that count the ways \$n\$ telephone lines can be connected to each other, where each line can be connected to at most one other line. These were first studied by Heinrich August Rothe in 1800, when he gave a recurrence equation where th... | stackexchange_codegolf |
You should write a program or function which given a string as input outputs or returns a string or list of the lowercase letters in the order they find their uppercase pair.
The input is a string consisting of the characters [a-zA-Z] space and newline representing a torus (rectangular grid with wrap around for rows an... | stackexchange_codegolf |
GHC command line errors can be horrible, lets make them as bad as possible. To disincentivize very long programs use the following formula to calculate your "score".
(# of bytes of GHC output) / 2^(8 + # of bytes of code)
Template Haskell is banned as there is probably a TH configuration where you can replicate an err... | stackexchange_codegolf |
I am working on a code to print all semimagic squares [1] of a given size. I am working with the following definition:
An \$n\times n\$ consists of numbers \$1,2,\cdots, n^2\$.
All numbers must be distinct.
Sum of each row and each column is equal.
According to Ripatti A. (2018) [1]:
\$n\$
number of semimagic squ... | stackexchange_codegolf |
Make program that takes the list from the files from STDIN, and aligns it nicely, just like ls command from coreutils. For example, assuming the following list (taken from The ASCII Collab, which takes place in the chatroom on this site).
alligator
ant
bear
bee
bird
camel
cat
cheetah
chicken
chimpanzee
cow
crocodile
de... | stackexchange_codegolf |
This question is about moving stacks around in the card game FreeCell, but here it will be presented more abstractly.
Given three integers \$0\le n,m<10000,0<k<10000\$.
There are \$m+2\$ columns, \$m\$ of them empty and two of them contain cards (from bottom to top) \$[0,-2,k]\$ and \$[0,-3,k-1,k-2,\cdots,1,0]\$. Besid... | stackexchange_codegolf |
Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded.
Cubax is composed of N³ smaller cubes (elements) linked together in a kind of doubly linked chain. The chain h... | stackexchange_codegolf |
We're graduating to a full site soon, and there's only one thing left to do before graduation: pull a senior prank! I think we should do a variation on the classic "fill a hallway with cups of water" gag.
Challenge
Your program will read in text and output that text, covered in upside-down cups of water. An upside-down... | stackexchange_codegolf |
Seeing that the current language for Learn You a Lang for Great Good is Piet, and that we don't seem to have a tips page for Piet yet, I decided to make one.
Piet is a stack-based esoteric programming language in which the programs are meant to resemble abstract drawings.
What are some general tips for golfing in Piet?... | stackexchange_codegolf |
Introduction
My grandpa is a fan of James Bond, but he is always unsure on how to rank his favourite actors. As such, he is always making lists, which is a lot of work. He asked me to produce a program that will make his life easier, but I do not have time for that, I have to work! So I will count on you guys.
Challeng... | stackexchange_codegolf |
Adapted from tips for restricted-source in Python
Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the zsh language. While we already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep within the ... | stackexchange_codegolf |
Related, both rope, nail and falling, but reversed and some other differences
Consider a loop of rope hanging on n nails on a row. Given a table showing whether the rope would fall down when each possible set of nails were removed, please provide a possible roping way. You may assume such a solution exist.
Here, "fall ... | stackexchange_codegolf |
This is a code-shuffleboard answer-chaining challenge, where the answers will aim to, together, output the lyrics to this beloved 80s song.
This is the full lyrics of the song, line by line. The first answer will contain a program that will output the first line of the song (We're no strangers to love). The second wil... | stackexchange_codegolf |
As you may or may not know, Valentine's day is getting close. So today, my task for you is:
Write a heart-shaped quine
Rules:
Code should look like an identifyable heart shape, i.e. Has two round parts on top and a pointy bottom. It does NOT have to be filled in, but this is not disallowed.
Standard Quine rules apply ... | stackexchange_codegolf |
Now that we know how to Square a Number my Way, we need an inverse operation, a way to Square Root a Number my Way. To square a number my way, you simply stack it on top of itself a number of times equal to the number of digits it contains, and then take read off every number that is formed both vertically and horizon... | stackexchange_codegolf |
Write code that outputs the smallest integer \$n > 5\$ such that \$\frac{\sqrt{\log_2{n}}}{(\log_2 {\log_2 n})^2} > 1\$. Your code may have at most one digit in its source code. You can use your chosen digit more than once however.
By digits we are only counting the ASCII characters between 0x30 and 0x39 (inclusive).
| stackexchange_codegolf |
Your task is to make a program that measures how fast you can type the letters of the English alphabet.
The program shall only accept lowercase letters a to z in alphabetical order.
Each letter is echoed as typed on the same line (without new line or any other separators between letters).
If you type an invalid char... | stackexchange_codegolf |
Let us consider a regular n-sided polygon where all of the sides are equal in length with n being a natural number larger than or equal to three. All of the vertices lie on the unit circle (circle of radius one centered at the origin) and one of the vertices is always at the coordinate (x,y)=(1,0). Now let's draw all p... | stackexchange_codegolf |
It was a warm summer evening...
when my stupid car decided to break down in the middle of the road on my way back from the supermarket. I pushed it to the sideline and decided to walk home. I opened the trunk to take out the grocery and remaining stuff. It was then that I noticed the items were not evenly bagged. Some ... | stackexchange_codegolf |
Task
Using any type of parallelisation, wait multiple periods, for a total sleep time of at least a minute (but less than a minute and a half).
The program/function must terminate within 10 seconds and return (by any means and in any format) two values: the total elapsed time, and the total executed sleep time. Both ti... | stackexchange_codegolf |
Given two strings as input, return the result of XORing the code-points of one string against the code points of the other.
For each character in the first input string, take the code-point (e.g. for A, this is 65) and XOR the value against the corresponding index in the second string and output the character at the co... | stackexchange_codegolf |
GPA Calculator
(GPA = Grade Point Average)
You are a stressed out college student during finals week. Instead of studying for your exams coming up, you decide it is best to determine what GPA you will have at the end of the semester. This way you have data to back up your decision of staying up all night to get that A ... | stackexchange_codegolf |
This challenge is about finding the perfect match between your program sourcecode and the output from your program.
Scoring table for the output:
Each letters (a-z|A-Z) :
`a` or `A` 1 points
`b` or `B` 2 points
...
`z` or `Z` 26 points
Scoring for the sourcecode:
... | stackexchange_codegolf |
Introduction (may be ignored)
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the fifth challenge in this series (links to the first, second, third and fourth challenge).
I... | stackexchange_codegolf |
Make a quine but with a twist.
Statement
The quine prints its code but puts its first character at the end.
(You can do it in reverse but include that note in your answer)
The output must then be a program which is also an solution.
Example: Assume your code was foobar, running it will return oobarf which will be anoth... | stackexchange_codegolf |
Challenge
The goal is to output Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
Context. (Maybe another interesting challenge could be printing all of the other examples? This would probably use similar logic but involve either a function or just a for loop.)
Rule(s)
You cannot output anything other t... | stackexchange_codegolf |
A field in mathematics is a set of numbers, with addition and multiplication operations defined on it, such that they satisfy certain axioms (described in Wikipedia; see also below).
A finite field can have pn elements, where p is a prime number, and n is a natural number. In this challenge, let's take p = 2 and n = 8,... | stackexchange_codegolf |
The Narrative
You are a bad musician. You never bothered to learn how to count rhythms. To remedy this shortcoming, you decide to write a program that will tell you how to count in any given time signature. You are still a bad musician, but you can at least pretend that you can count rhythms.
The Objective
Given a time... | stackexchange_codegolf |
Introduction
git diff is a great way to export patches of the source code, and its outputs are colorized if you don't pass extra arguments to it.
However, when you want to review the exported file with colored output, it would be pretty hard. colordiff is an option, but it acts like the diff program itself, also, it is... | stackexchange_codegolf |
We are all used to the old-school telephone keypad, right? For reference, here is what it looks like:
Given a String consisting only of lowercase ASCII letters and single spaces, your task is to return the number of taps one should make in order to type down the full String with a telephone keypad as the one above.
F... | stackexchange_codegolf |
This is a successor to my previous Code Golf challenge, which may be found here.
This time, you are trying to determine what the contents of colors.txt should be.
Your task is to take from the input the path to an image and a number of colours, and write to colors.txt a list of that many colors chosen for that image.
R... | stackexchange_codegolf |
Can you imagine solving the New York Times crossword puzzle without any clues? Maybe not with all of the creativity and new words and phrases appearing in modern crosswords, but with a fixed word list there's some hope. In this challenge, you create a crossword puzzle grid in which this is theoretically possible.
The... | stackexchange_codegolf |
On Unix-like systems, the ls command lists files. GNU's version of ls also colors them according to their properties and the environment variable LS_COLORS. The main file property that ls bases its colors on is the file's mode. In this challenge, you will determine what keys from LS_COLORS ls should look for a given mo... | stackexchange_codegolf |
Executive summary
Given input k, find a partition of integers 1 to n into k sum-free subsets for the largest n you can within 10 minutes.
Background: Schur numbers
A set A is sum-free if its self-sum A + A = { x + y | x, y in A} has no elements in common with it.
For every positive integer k there is a largest integer ... | stackexchange_codegolf |
Challenge
Create the image of a progress pride flag.
Output
Dimensions
Rules
Your program must create the image and not just load it from a website
The colours can be just your language's default if it is very difficult / impossible to load RGB values, else they should be: red: (255,0,0), orange: (255,140,0), yello... | stackexchange_codegolf |
Challenge
Given an integer, n, as input where 36 >= n >= 2, output how many Lynch-Bell numbers there are in base n.
The output must be in base 10.
Lynch-Bell Numbers
A number is a Lynch-Bell numbers if:
All of its digits are unique (no repetition of digits)
The number is divisible by each of its digits
It doesn't cont... | stackexchange_codegolf |
Inspired by this tweet where a user stated the following:
it's insane how much code would be cleaned up if JS got pipes and pattern matching
i often do this since it's the best way to make use of TS inference and pattern matching would make it less hacky
const result = (() => {
if (scenario1) {
return {
t... | stackexchange_codegolf |
Task is pretty simple. Your program should take a number N from 1 to 20 and draw the following ASCII art.
When N=1:
_____
| | |
| | |
| | |
| | |
| | |
| | |
| | |
|_|_|
\ /
\-/
v
When N=2:
_______
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| ... | stackexchange_codegolf |
Given two non-empty 01 strings, check if there is string containing both given strings, and their first appearance end at same position.
Test cases:
01, 1 => true (01)
0, 00 => false (0 would at least come 1 character earlier)
01, 11 => false (can't meet on same position)
01, 0 => false (can't meet on same position)
11... | stackexchange_codegolf |
Write a program/function that finds the amount of fuel needed to escape Earth's gravity well given the exhaust velocity of the fuel and the amount of mass to transport using the Tsiolkovsky rocket equation:
$$\Delta v = v_\text{exhaust}\ln\dfrac{m_\text{start}}{m_\text{end}}$$
where
\$\Delta v\$ is the change in veloc... | stackexchange_codegolf |
Your task is to make a program that takes in an integer n > 1, and outputs the roll of a single n-sided die. However, this dice follows the rules for exploding dice.
When you roll the die, check what value you rolled. If you got the maximum for that kind of die (on a standard d4 that would be 4, or 6 on a d6, etc.), ro... | stackexchange_codegolf |
This challenge is about computing the chromatic number of special types of graphs.
Input
The input will consist of two integers.
A positive integer \$n > 1\$.
A distance \$d < n\$.
Task
The two inputs values will define a graph with \$2^n\$ nodes. Each node corresponds to a different binary array of length \$n\$. Tw... | stackexchange_codegolf |
Given two positive reals \$a\$ and \$b\$, output some positive reals \$r_i\$, such that \$\sum r_i=a\$ and \$\prod\left(r_i+1\right)=b\$. You can assume that it's possible. You can also assume that your float type have infinite precision.
Test cases:
2,3 => 2
2,4 => 1,1 or 1/2,(sqrt(57)+9)/12,(9-sqrt(57))/12 or etc.
2,... | stackexchange_codegolf |
Definition
From the description on OEIS A006345:
To find a(n), consider either a 1 or a 2. For each, find the longest repeated suffix, that is, for each of a(n)=1,2, find the longest sequence s with the property that the sequence a(1),...,a(n) ends with ss. Use the digit that results in the shorter such suffix. a(1) =... | stackexchange_codegolf |
Background
A maximal domino placement (MDP) on a rectangular grid is a non-overlapping placement of zero or more dominoes, so that no more dominoes can be added without overlapping some existing domino.
Alternatively, it can be thought of as a tiling using dominoes and monominoes (single square pieces) so that no two m... | stackexchange_codegolf |
I like ascii art and I get bored a lot, so I found some ascii characters and started to make random things, 8-bit mario castle, mazes, and arches. I found that the arches could easily be stacked in a neat way.
╔═══════╗
║╔═════╗║
║║╔═══╗║║
║║║╔═╗║║║
╨╨╨╨─╨╨╨╨
Challenge
Create a program, function, or any other standard... | stackexchange_codegolf |
Task
Given a list of integers a1, a2, …, ak (k ≥ 2) and a positive integer m, write a function or a complete program that calculates the next m numbers of the list. Assume that ai = P(i) where
P(x) = bk-1 xk-1 + bk-2 xk-2 + … + b0
is the unique polynomial of minimum order which fits the points.
Description
Input
If t... | stackexchange_codegolf |
There are two types of people in this world: users and admins. Let's find out who the real admins are.
The task is simple:
If the script is run with elevation, print 'True' and only 'True' (only trailing newlines permitted as extra). If the script is run as an unelevated user, print 'False' and only 'False', exceptions... | stackexchange_codegolf |
Near the middle of the semester in chemistry, we get problems like:
Convert 1.283850057 to Scientific Notation
and
Convert 3.583✕106 to Standard Notation
This is just stupid busy work for people who already know how to do this. So…
The Challenge
Given an input in any reasonable, convenient format, in either standar... | stackexchange_codegolf |
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... | stackexchange_codegolf |
You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but cannot be longer than 8 characters.
Your goal is to output all dates between 6th of December 1919 and 5th of December 2019 which fit the input in these formats:
day - month - year (dmy)
mont... | stackexchange_codegolf |
A barcode of EAN-13 symbology consists of 13 digits (0-9). The last digit of this barcode is its check digit. It is calculated by the following means (the barcode 8923642469559 is used as an example):
Starting from the second digit, sum up all alternating digits and multiply the sum by 3:
8 9 2 3 6 4 2 4 6 9 5 5 9
|... | stackexchange_codegolf |
Shocking news: Dr. Mad J Scientist has released a proof of P = NP to the world. But the proof is nonconstructive, and she's keeping the algorithm to herself.
Worry not. Without even looking at her proof, we can still (almost) write a computer program that solves NP-complete problems in polynomial time.
The Problem
Inpu... | stackexchange_codegolf |
Objective
Given an expression involving ternary values, evaluate it into a ternary value.
Ternary Values
The three truth values in question are the values of Haskell's Ordering, namely LT, EQ, and GT. They stand for "less-than", "equal-to", and "greater-than", respectively. Furthermore, they themselves have an order; L... | stackexchange_codegolf |
Pascal's triangle is generated by starting with 1 and having each row formed from successive additions. Here, instead, we're going to form a triangle by alternating multiplication and addition.
We start row 1 with just a solitary 1. Thereafter, addition is done on the odd rows, and multiplication is done on the even r... | stackexchange_codegolf |
What is the shortest selector (by character count) to select ALL html elements on a web page, without using asterisk (*)? Some examples are the following:
a,:not(a) /*9 chars*/
:nth-child(n) /*12 chars*/
:link,:not(:link) /*17 chars*/
| stackexchange_codegolf |
You will receive an integer less than 2000000000 and bigger than -2000000000 and you have to test what type(s) of number this is out of:
Factorial
Square
Cube
Prime
Composite
Triangular
Positive
Negative
Here is a definition of all the different types of numbers:
Factorial - A number That is equal to the product of a... | stackexchange_codegolf |
There are quite a few means in mathematics, such as the arithmetic mean, the geometric mean, and many others...
Definitions and Task
Note that these are the definitions for two positive integers*:
The root mean square is the square root of the sum of their squares halved ().
The arithmetic mean is their sum, halved ()... | stackexchange_codegolf |
Given the equation of a non-parabolic conic section, output its characteristics.
Spec
Some info on conic sections:
for more info visit Wikipedia
From an equation of the form \$ax^2+bx+cy^2+dy+E=0\$, it is possible to derive the type of conic section using a combination of square completion and simple arithmetic.
For t... | stackexchange_codegolf |
A donut distribution (for lack of a better term) is a random distribution of points in a 2-dimensional plane, forming a donut-like shape. The distribution is defined by two parameters: the radius r and spread s, in which the distance to the origin follows a normal (Gaussian) distribution around r, with a standard devia... | stackexchange_codegolf |
Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro.
My boss has gotten a new toy robot, and he wants me to help program it. He wants to be able to enter simple arrow instructions to get it to move. These instructions are: ^ (for move fo... | stackexchange_codegolf |
Hexcells is a game based off of Minesweeper played on hexagons. (Full disclosure: I have nothing to do with Hexcells. In fact I don't really like the game.) Most of Hexcells rules can be pretty easily expressed in Generalized Minesweeper (Minesweeper played on an arbitrary graph). The one that is most difficult is th... | stackexchange_codegolf |
You're driving a car in an infinite city whose blocks are pentagons arranged in the order-4 pentagonal tiling. At each step, you proceed to the next intersection and choose whether to continue left, right, or straight. A sequence of choices that returns you to your initial state (street segment and direction) is called... | stackexchange_codegolf |
Given two strings \$A\$ and \$B\$ with edit (Levenshtein) distance \$x\$, find a third string with edit distance \$a\$ to \$A\$ and edit distance \$b\$ to \$B\$ so that \$a+b=x\$ and \$a=int(x/2)\$ (that is half of \$x\$ rounded down to the nearest integer).
The input is the two strings \$A\$ and \$B\$ and their edit d... | stackexchange_codegolf |
John has made an array of numbers which are important to him. Unfortunately, John lost the array.
Luckily, he knows some details about the array. You will receive each of these sets of details (which are lists of 3 integers).
Each detail is the sum of a section of the list. Each has the numbers a, the starting index... | stackexchange_codegolf |
A screen consists of some LED segments like such:
The screen can be split into several(maybe one) component. Each component is a segment like above, with varying lengths. These components can be used to display any amount, including 0, of digits, as long as the component is large enough.
Every digit except 1 needs two... | stackexchange_codegolf |
This question was profoundly inspired by Joe Z's question.
But, with a twist...
So, now that it's almost 2017, it's time for a code question involving the number 2017.
Your task is to make a program that counts up from 0, printing each number until it reaches 2017. without using any of the characters 012345678 or 9 in... | stackexchange_codegolf |
Given a the name of a state of the United States as a string (with case), return the number of votes the state has in the Electoral College. Write a full program or function, and take input and output through any default I/O method.
A list of all inputs and outputs (source):
[['Alabama', 9], ['Alaska', 3], ['Arizona', ... | stackexchange_codegolf |
Print or return the following text:
Hello world! The quick brown fox jumps over a lazy dog.
However, your submission will not be scored in bytes. Instead, primarily it will be scored by the width in pixels of the program when written in Arial in a 12pt font. In particular, the score is:
$$ (\text{visual width in px}) ... | stackexchange_codegolf |
In Dungeons and Dragons, some of the most important atributes of a character are the ability scores. There are 6 ability scores, for the six abilities. The abilities are Strength, Dexterity, Constitution, Intelligence, Wisdom and Charisma.
When determining the scores for a character, I use the following procedure: Roll... | stackexchange_codegolf |
Chess960, a.k.a. Fisher random chess, is a variation of the game of chess.
In classic chess the starting positions are always the same. In chess960 they vary.
Before each game of chess960 one random number from 0 to 959 is drawn. Both players then arrange their pieces in the same way according to this number from a loo... | stackexchange_codegolf |
Related to AoC2017 Day 18, Part 2. (Anyone want to add Duet to esolangs?)
Duet is an assembly-like language that involves two processes running the same program simultaneously. Each process of Duet operates with 26 registers named a to z, all initialized to zero, except for the register p which contains the process ID... | stackexchange_codegolf |
Your task is to calculate the square root of 2 using Newton's Method - with a slight twist. Your program is to calculate an iteration using Newton's Method, and output the source code for the following iteration (which must be able to do the same).
Newton's method is fairly exhaustively described on Wikipedia
To calcul... | stackexchange_codegolf |
Remove one stick and output the stack updated.
Description
You can remove only sticks on top( completely drawn).
You can assume:
there are 5 sticks on the table.
there's one and only one stick you can remove.
sticks are recognizable : there aren't overlapping sticks on the same orientation and there aren't sticks join... | stackexchange_codegolf |
Introduction
A childhood game designed to help children learn to count in french in Canadian schools is played as follows:
Students go around the room counting up to 11
A number greater than 11 cannot be said
A student can say either 1, 2, or 3 numbers
If a student says the number 11 then they are removed from the nex... | stackexchange_codegolf |
In these previous challenges[1][2] I've been dealing with "mushroom forests". To help with these I draw little diagrams of the forests to help. In this challenge we are going to reverse engineer the data from these diagrams.
To recap ha! mushroom forests are a list of pairs of non-negative integers. Each pair repres... | stackexchange_codegolf |
Background
The newest version of the C standard, C23, adds preprocessor macros like INT_WIDTH, ULONG_WIDTH, and SIZE_WIDTH that tell you the bit width of various integer types (here, int, unsigned long, and size_t, respectively). However, while the majority of us are stuck with pre-C23 compilers/standard libraries, it... | stackexchange_codegolf |
I designed a language in which pointer arithmetic is the main tool of programming.
Here are some examples.
(print 0 to 8)
=9[>1=9-*-1.>-1-1]
(print 1 to 10 with spaces in between, character literal extension used)
=1[.>1=10-*-1[>1=' '!>-2+1;-2];1]='\n'!
(compute the factorial of 10)
=10>1=*-1-1[>-1**1>1-1]>-1.
(prin... | stackexchange_codegolf |
Simple challenge: The code must be both valid Lisp and valid Fortran, and must print out "hello world" in both.
Note: I've sunk about 5 hours into this at this point, I'm not even sure it's possible at this point...
Details:
Must be in a single source file.
Any version of Fortran and any Lisp are allowed (specify whic... | stackexchange_codegolf |
What is the best BrainFuck code (in terms of code size) to print 'A' 1000 times ?
My approach is:
set 'A' to p[0]
set 255 to p[1] to display 255 'A', 3 times
set 235 to p[1] to display 235 'A'
This is not effective but I cannot find a way to use tow counters simultaneously like a multiplication
Is there a better appr... | stackexchange_codegolf |
Background Information
Inspired by this answer on Arqade SE
Minecraft has rails which allow you to move minecarts around on them for transporting players, entities, and items. There are many types of rails, but today we're only interested in regular rails, which are also the only type that can curve.
When you place dow... | stackexchange_codegolf |
Objective
Given two Chinese ideographs meaning basic colors, output the ideograph that means the color resulting from mixing them.
Basic colors
The basic colors are:
靑(U+9751; blue)
赤(U+8D64; red)
黃(U+9EC3; yellow)
白(U+767D; white)
黑(U+9ED1; black)
Mixed colors
Mixing 靑(blue) and 赤(red) yields 靘(U+9758; purple).
Mix... | 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 |
You are to create a program which, when given a positive integer \$n\$, outputs a second program. This second program, when run, must take a second positive integer \$x\$ and output one of two distinct values depending on whether \$x\$ is divisible by \$n\$. Those values must be consistent for a given \$n\$ but can be ... | stackexchange_codegolf |
Challenge: I want to know about the real roots of polynomials. As a pure mathematician, I care about the existence of such roots, rather than their numeric values.
The challenge is to write the shortest program that takes a polynomial, of degree at most 4, and simply returns how many distinct real roots said polynomial... | stackexchange_codegolf |
You met a 4-th dimensional being who challenged you to a game of dice. The rules are simple: each player rolls 3 6-sided dice and takes the sum of each combination of 2 dice. The player with the highest sum wins. If the first-highest sum is a tie, consider the second-highest sum, and so on.
Your opponent's dice look no... | stackexchange_codegolf |
The aim of this challenge is to write a program that satisfies the following conditions:
The program is not palindromic, or essentially palindromic (meaning that it is possible to remove characters to make it a palindrome without changing the effects of the program).
The program is not an involution (meaning that it d... | stackexchange_codegolf |
Several Mathematica functions have system-defined short forms, e.g., /@ for Map. Many of them are listed here: https://reference.wolfram.com/language/tutorial/OperatorInputForms.html
However, there also exist some system-defined short forms for function-option combinations. E.g., Log2@ninstead of Log[2, n] and Log10@... | stackexchange_codegolf |
Write a program or function that takes in a string of the characters -=o. where the -=o's and .'s always alternate, character to character. The string will have an odd length greater than one and always start and end in one of -=o.
Basically, the input will look like a line of emoticon faces that share eyes in various ... | stackexchange_codegolf |
In as few bytes as possible, sort the input, a delimited string OR list/vector/array of words, words contain printable ASCII except space (ASCII values 33-126) into a numbered list, table, or something resembling a table, by length.
Table rules are as follows:
Order is mandatory, direction is optional, either labelled... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.