instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Write a program that prints out the syntax error message of the compiler or interpreter. The error message should be misleading so that code maintainers will take days to find out that the error was faked, that means, you should obfuscate (and hide your intention). Also, the error must be as exact as possible, and shou... | stackexchange_codegolf |
On a toroidal square grid (you can wrap around) where each cell indicates one direction (^ > v <) if we pick a cell and start to walk following these directions, we will eventually get stuck in a loop.
We may end up in a different loop, depending on our starting cell.
Not all the cells we encounter constitute our term... | stackexchange_codegolf |
You know those letterboards outside old-style cinemas which show upcoming films - perhaps you have a miniature one in your home?
If you've operated one, you'll know that you can normally add letters from either side of a row. But the slots (in which you slide letters) are thin, so it's impossible to swap the order of ... | stackexchange_codegolf |
Background
Conway criterion is a method to test if a given polygon can tile (i.e. cover without overlapping) an infinite plane. It states that a polygon can tile the plane if the following conditions are met:
The given polygon does not have any holes in it.
It is possible to choose six consecutive1 points \$A,B,C,D,E,... | stackexchange_codegolf |
Write a function that takes an ASCII-printable-only (all charcodes ∈ [32..126]) string input x and provides an ASCII-printable-only output string f(x), such that for every x
f(f(x))=x
f(x) is all-numeric (all charcodes ∈ [48..57]) iff x is not all-numeric
You can assume input is not empty and never provide empty outp... | stackexchange_codegolf |
This is the first part of a three part challenge. The next parts will be released on August 13 and 14.
This challenge series was inspired by another challenge series. You can view the original one at Random Golf of the Day #1: Shuffle an Array.
Instructions
Your goal in this code golf is to reverse a URL, but not full... | stackexchange_codegolf |
Today, you're going to be writing Polish. No, not Polish notation—Polish, the actual language spoken in Poland.
Given a number and a noun, output a Polish sentence telling me that there are that many of that thing, using the appropriate template below.
The input consists of an integer in the range from 0 to 200, and a ... | stackexchange_codegolf |
You probably know Conway's Game of Life, the famous cellular automaton invented by mathematician John Conway. Life is a set of rules that, together, allow you to simulate a two-dimensional board of cells. The rules decide which cells on the board live and which ones die. With some imagination, you could say that Life ... | stackexchange_codegolf |
This proposal had few attention for 8 months (though an answer was posted in the sandbox at that time), so I decided to post it anyway.
Introduction
Napier's bones is a calculation tool, which helps speeding up the calculation of multiplication, division and digit-by-digit square root extraction by turning n-digit-by... | stackexchange_codegolf |
Inspired by a bug in a solution to this challenge, your challenge is to produce this exact text:
ZYXWVUTSRQPONMLKJIHGFEDCBA
YXWVUTSRQPONMLKJIHGFEDCBA
XWVUTSRQPONMLKJIHGFEDCBA
WVUTSRQPONMLKJIHGFEDCBA
VUTSRQ... | stackexchange_codegolf |
Introduction
A recursive acronym is an acronym that contains or refers to itself, for example:
Fish could be a recursive acronym for Fish is shiny hero, notice how that also contains the acronym itself. Another example is Hi -> Hi igloo. Or even ppcg paints -> ppcg paints cool galaxies pouring acid into night time star... | stackexchange_codegolf |
Introduction
You have to simulate playing golf over an input string that represents the green. The 2-character substring () represents the hole, and is guaranteed to appear only once in the string.
This is a sample green:
ABCDEFGHIJKLM()NOPQRSTUVWXYZ
The simulation consists of outputting the characters that the ball f... | stackexchange_codegolf |
For those who didn't know, Sigma is a Greek letter which is heavily used in mathematics as the summation sign. Given a string representing an expression depending on \$k\$ that we will denote \$E(k)\$, compute the sum of the results for \$E(k)\$, for each \$k\in\{1,2,3,4,5\}\$. Concisely, you should find \$S\$ such th... | stackexchange_codegolf |
Weather conditions at airports are reported to pilots in METAR (METeorological Aerodrome Report) format. This format could be described as being "golfed." Here are some examples:
METAR KPDX 241653Z 16003KT 1/4SM R10R/4500VP6000FT FG SCT000 01/M01 A3040 RMK AO2 SLP293 FG SCT000 T00061006 $
METAR PAMR 241753Z 00000KT 10... | stackexchange_codegolf |
In the burial place of King Silo of Asturias there is an inscription that reads SILO PRINCEPS FECIT (King Silo made this).
The first letter is found in the very middle, and from there one reads by going in any non-diagonal direction radiating outward. The final letter is found on all four corners. In this challenge,... | stackexchange_codegolf |
Task
A date can be compactly represented in a 6-character string in the format ddmmyy where the first two characters (dd) represent a day, the 3rd and 4th characters (mm) represent a month and the last two characters (yy) represent a 20XX year. Given a string with 6 characters in [0-9] determine if it represents a vali... | stackexchange_codegolf |
Given a non-negative number n, sort the digits of n by their first occurrence in pi.
Input can be taken via function cli argument, or STDIN and as a string, char[] or integer. You may output via return value, exit status or STDOUT.
| stackexchange_codegolf |
Write a proper quine whose every rotation is itself a proper quine.
For example, if your source code is abcdef, then:
abcdef would output abcdef
bcdefa would output bcdefa
cdefab would output cdefab
defabc would output defabc
efabcd would output efabcd
fabcde would output fabcde
A rotation "is made by splitting a str... | stackexchange_codegolf |
In your favorite programming language, create an application that restarts itself once, after n seconds.
You need to find a way to restart after exiting the program. EG: run cmd to do it for you. Make sure it waits an amount of seconds specified by the user before restarting
For clarification: You can run a second prog... | stackexchange_codegolf |
Imagine you place a knight chess piece on a phone dial pad. This chess piece moves from keys to keys in an uppercase "L" shape: two steps horizontally followed by one vertically, or one step horizontally then two vertically:
+-+
|1| 2 3
+-+
`-------v
| +-+
4 | 5 |6|
| +-+
|
... | stackexchange_codegolf |
A number is a de Polignac number if and only if it is odd and cannot be represented in the form p + 2n where n is a non-negative integer and p is a prime integer.
Task
Write some code that takes a positive integer and determines if it is a de Polignac number. You may output two distinct values one for true and one for... | stackexchange_codegolf |
In the game Hearthstone there is a playing board containing friendly and enemy minions, and two heroes - yours and the enemy's.
To generalize and simplify, we will assume it's your turn, the opponent has 0-7 minions with given health values on the board, and is at H life points. We will ignore our side of the board ent... | stackexchange_codegolf |
What is elementary cellular automata?
Since I'm not sure I'll be able to explain this so that somebody who has never heard of this is able to understand, I'm giving an explanation from https://mathworld.wolfram.com/ElementaryCellularAutomaton.html
Elementary cellular automata have two possible values for each cell (0 ... | stackexchange_codegolf |
Spreadsheet Columns
In most spreadsheet programs, columns go A, B, C, ... X, Y, Z. After this comes AA, AB, AC ... AX, AY, AZ, BA and so on.
Your task is to convert one of these strings in to a column number. You must support inputs up to the maximum length of your language, to a minimum of 3.
Test Cases:
A => 1
B ... | stackexchange_codegolf |
I thought this would be a fun challenge for everyone and I'm curious to see the solutions people come up with.
Print the "12 Days Of Christmas" lyrics
On the first day of Christmas,
my true love gave to me,
A partridge in a pear tree.
On the second day of Christmas,
my true love gave to me,
Two turtle doves,
And a... | stackexchange_codegolf |
Counting Gems
Background
My jewel box just fell down! There're too many gems of different shape on the ground. And your task is to count number of a certain type of gem.
I/O
Your code should take two inputs S and G, which could be a string with newlines, an array of lines, a two-dimensional array of characters, a text... | stackexchange_codegolf |
Given an ascii-art road and the time it took me to cross it, tell me if I was speeding.
Units
Distance is in the arbitrary unit of d. Time is in the arbitrary unit of t.
The road
Here is a simple road:
10=====
The 10 means 10 d per t. That is the speed limit for the road. The road has 5 =s, so its d is 5. Therefore, i... | stackexchange_codegolf |
Introduction
In the prisoner's dilemma, two partners in crime are being interrogated, and have the choice to either betray their partner or stay silent.
If both prisoners betray each other, they both get 2 years in prison.
If neither betrays (both stay silent), they both get 1 year in prison.
If only one betrays and t... | stackexchange_codegolf |
A recent SO question asks for a convenient one-liner to generate a list of numbers and their negative counterparts in Python.
Given two integers \$1≤a≤b\$, generate all the integers \$x\$ such that \$a≤|x|≤b\$. The result may be printed or returned in any order or structure, as putting the result into a list and sortin... | 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 |
JonoCode9374 had almost completely implemented my language EnScript except for the CHS command. I was impatient of waiting for them to implement this command, so I chose to put this question here.
Challenge:
Write a solution that takes an input and returns the chased output. Standard loopholes are forbidden.
This is th... | 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 |
Introduction
Help! I accidentally dropped my TI-84 calculator out my window (don't ask how) and it broke. I have a math test tomorrow and the only calculator I can find is one with these buttons:
7 8 9 +
4 5 6 -
1 2 3 *
0 = /
My math test is a review test on evaluating expressions. I need a program to take an expres... | stackexchange_codegolf |
Round away from zero
Inspired by Round towards zero.
Given a number input via any reasonable method, round the number "away from zero" - positive numbers round up, and negative numbers round down.
If you intend to take the input as a string (via STDIN, for example), you should be able to handle numbers with or without ... | stackexchange_codegolf |
A number is whole if it is a non-negative integer with no decimal part. So 0 and 8 and 233494.0 are whole, while 1.1 and 0.001 and 233494.999 are not.
Input
A floating-point number in the default base/encoding of your language.
For example, the default integer representation for Binary Lambda Calculus would be Churc... | stackexchange_codegolf |
Vyxal is a stack-based language, meaning that everything operates by popping and pushing values onto a stack. It has a bunch of useful flags, one of which is r.
Running a Vyxal program with the r flag causes functions to take their elements in reverse order.
For example, the program 5 3 - means: Push 5 to stack, push ... | stackexchange_codegolf |
Scores
This section will be filled in as submissions are entered.
Normal
1. bopjesvla Perl 54
2. edc65 Javascript (ES6) 91
3. name language score
4. name language score
5. name language score
Bonus Round
1. name language score
2. ... | stackexchange_codegolf |
Maybe some of you already know this game: you have a collection of jelly beans of different colors. For every color, the bean can have different tastes, some are good and some are bad, and you cannot tell them apart. You have to pick a bean of a given color, and pray you have select a good one.
So, write the shortest p... | stackexchange_codegolf |
This challenge will be based on an R language trivia: every release is named and it's a reference to Peanuts comic strips (see here and here).
Task
Given a release name, output its number.
For reference, use the below list:
Great Pumpkin 2.14.0
December Snowflakes 2.14.1
Gift-Getting Season 2.14.... | stackexchange_codegolf |
The world is full of Turing-complete programming languages. Just about every useful language (and most useless ones) are Turing-complete. Some even became Turing-complete by accident. Often this is great, since every Turing-complete language supports the same power of universal computation. But the power of Turing ... | stackexchange_codegolf |
Consider compass-and-straightedge construction, where you can construct new points from existing ones by examining intersections of straight lines and circles constructed with one of the following two options:
Draw the unique infinitely long straight line passing through points \$(x, y)\$ and \$(x', y')\$
Draw the uni... | stackexchange_codegolf |
Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate).
Input:
A positive integer n >= 1.
Output:
n lines of asterisks, where every new line has one asterisk more than the line before, and starting with one asterisk in the first line.
Test case (n=5):
*
**
... | stackexchange_codegolf |
The brainiacs at New Scientist tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again to make ABLEST." (https://twitter.com/newscientist/status/1379751396271124480)
This is of course correct. It is not, however,... | stackexchange_codegolf |
The challenge is to write a program which outputs all characters of the Unicode table from n to z range.
For code "0000" is the first in order and you must skip all blank Unicode combinations.
For example, let n = 134 and z = 300, you must save or print all unicode characters between 0134 and 0300.
The output of the pr... | stackexchange_codegolf |
Just over seven years ago, everybody suddenly stopped talking about the Maya people. It is time to rectify that!
For clarification, I am talking about the Mesoamerican Long Count Calendar. Your program will have as input a date in the Gregorian Calendar, and as output the corresponding date from the aforementioned Meso... | stackexchange_codegolf |
How many of you that still use your own knuckle to determine whether a month is having a full 31 days or less?
You job is to write a program to count how many months, in a month range, are having a full 31 days and how many are having less than 31 days by "counting the knuckles".
Courtesy: amsi.org.au
Input
A pair of... | stackexchange_codegolf |
Definition
The rank of a word is defined as the position of the word when all the possible permutations (or arrangements) of its letters are arranged alphabetically, like in a dictionary, no matter if the words are meaningful or not.
Let us consider these two words - "blue" and "seen". To begin with, we would write all... | stackexchange_codegolf |
256-color Xterm-compatible terminals add 240 colors on top of the usual 16 system colors. Colors 16-231 use 6 levels (0, 95, 135, 175, 215, 255) of red, green, and blue, ordered lexicographically. Colors 232-255 are simply 24 levels of gray (8...238 by 10s). To get a better idea of what I'm talking about, see this tabl... | stackexchange_codegolf |
This challenge is inspired by this very nice answer by TidB.
In TidB's answer, every eight character is in the correct order: gnilwoB edoC (Code Bowling backwards). The other strings however are were in a strange, random order.
Your challenge is to fix this.
Take a (non-empty) string and a positive integer n as input.... | stackexchange_codegolf |
To quote http://brainfuck.org/utm.b:
A tag-system transforms strings over an alphabet A = {a[1], a[2], ... a[n], a[n+1]} as follows: a positive integer m is chosen, and so is a function P that maps each a[i] for 1<=i<=n to a string P(a[i]) over the alphabet A. Now:
if the string being transformed has fewer than m ele... | stackexchange_codegolf |
Help! I just logged into Stack Exchange, but I forgot what my password is! I need a way to work it out before I log off.
Luckily, I'm an excellent hacker. Not only was I able to find my password's hash, but I also found Stack Exchange's hashing algorithm! It takes the ASCII value of each digit multiplied by that digit... | stackexchange_codegolf |
Your input is a ragged list of possibly empty lists of non-negative integers. For example, [[2,0],[[]],[[[],[1],[]],[]]] is a valid input. This input is a "compressed" ragged list. What this means is that when we have a list of numbers, we interpret those as a list of indices, indexing the output.
For example, if I=[[2... | stackexchange_codegolf |
We've recently reached the threshold of 10,000 questions on PPCG. Hooray! Let's celebrate this with a simple challenge.
Input
Two integers \$A\$ and \$B\$, both in \$[1..9999]\$, such that \$A+B<10000\$.
Task
Your task is to add one single digit to one of these integers or one single digit to both of them such that \$A... | stackexchange_codegolf |
Today's challenge is simple: Without taking any input, output any valid sudoku board.
In case you are unfamiliar with sudoku, Wikipedia describes what a valid board should look like:
The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid (... | stackexchange_codegolf |
The challenge today is very simple. The task is to determine the TI calculator for which the submitted datafile was made.
The datafiles always start with a string **TI, the version (described below), and other data you can ignore.
Now, the versions you need to recognize are:
95* => TI-95
92P => TI-92+
92* => TI-92
89* ... | stackexchange_codegolf |
Write a single line program two or more characters long that contains no line terminators and takes no input. For example, your program might be:
MyProgram
When your program is arranged into the shapes a clock's hands make at 12, 3, 6, and 9 o'clock, it needs to output the corresponding hour number. No other times nee... | stackexchange_codegolf |
Echo the following in as few bytes as possible:
I'm Slim Shady. Yes, I'm the real Shady.
All you other Slim Shadys are just imitating.
So, won't the real Slim Shady please stand up?
Please stand up. Please stand up.
The following five words must appear EXACTLY ONCE in your code:
I'm
Slim
Shady
real
stand
| stackexchange_codegolf |
Let's continue the fibonacci based challenges stream, here's the next one:
Task
Draw a Fibonacci spiral ascii-art of n segments where starting from the first term:
each nth segment has a length of nth Fibonacci term.
each segment is joined to the end of the previous, rotated by 90 degrees taking the end of previous s... | stackexchange_codegolf |
I just discovered this site and this is my first question, I hope I'm doing it correctly.
The challenge is the following, you must write a code that prints all the prime numbers of \$n\$ digits. Since this problem is computationally complicated, I think that one way to simplify it is to give a number \$m\$ that will be... | stackexchange_codegolf |
Interpret DOGO
DOGO is a lesser known programming language. While the original DOGO (a joke language from a Usenet post) has never been implemented, a language resembling it has been created. The commands for the language are:
+===========+================================================================+
| Command | ... | stackexchange_codegolf |
I want an n*n table that is filled with black or white and the following conditions are satisfied in it:
All cells of a 2*2 square in this table should not be the same color.
All black and white cells must be connected horizontally or vertically.
Acceptable examples:
Can anyone design a function that takes n as inpu... | stackexchange_codegolf |
The robber's thread is here
The cops task is to write a function or program that, when given an input of itself, outputs a finite deterministic string. If the program is given a different input, it should return a different output.
Rules:
Submissions consist of
Language name
If any flags are used, they should be r... | stackexchange_codegolf |
There seems to be this ongoing craze about people tediously learning new keyboard layouts like Dvorak or Neo because it supposedly makes them more productive. I argue that switching keyboard layouts is a bad idea, because it can take you months to get up to speed, and when you're finially 5% faster than the rest, you'r... | stackexchange_codegolf |
Given a positive integer \$n\$ and another positive integer \$b\$ (\$1 < b < 36\$), return the number of digits/length of \$n\$ in base \$b\$
1597 16 -> 3
1709 9 -> 4
190 29 -> 2
873 24 -> 3
1061 27 -> 3
289 26 -> 2
1575 34 -> 3
1135 15 -> 3
1161 22 -> 3
585 23 -> 3
1412 23 -> 3
1268 14 -> 3
714 12 -> 3
700 29 -> 2
100... | stackexchange_codegolf |
In this game of cops and robbers, each cop will make a vault: a program that stores a secret, and requires a key to unlock. The robbers should find a way to get the vault to reveal its secret without knowing the key.
Cop rules
Cops will write two short segments of code:
A vault, which takes a key and secret, then allo... | stackexchange_codegolf |
This is a challenge in which two people, 1 and 2, are running for office. People deterministically vote in certain ways in the world of 1 and 2, which can allow for the candidates to figure out the results before the election.
NOTE: this is not meant to refer to any outside elections or other political events.
Two peop... | stackexchange_codegolf |
This is a repost of Evolution of “Hello World!”, originally written by user Helka Homba
It should not be closed as a duplicated, due to meta consensus here.
The original was asked over two years ago and was last active more than six months ago. I have permission from Helka Homba to post this here
Since the original, ma... | stackexchange_codegolf |
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 |
There are a lot™ of pokemon. One of the defining characteristics of pokemon is their type, of which every1 pokemon has up to two types, a primary type and an optional secondary type. There are mechanical implications to each type, and so it is very useful to know what type a given pokemon is during battle. But there's ... | stackexchange_codegolf |
This challenge is based on the game Layerz.
Given, on stdin or as a function argument, a 2D rectangular array of cells where each cell contains either a blank (you may choose to use 0s instead of blanks at no penalty), a 1, a 2, a 3, or a 4; find a way to divide it into valid regions (as defined below) such that each n... | stackexchange_codegolf |
Beal's Conjecture has a million dollar prize if you prove/disprove it.
It states that if where A, B, C, x, y, and z are positive integers with x, y, z > 2, then A, B, and C have a common prime factor.
The challenge is to write a program that searches for a counter example to disprove this!
Rules
Write a program sear... | stackexchange_codegolf |
Challenge
Write a program or function that takes in 4 non-negative integers, A, B, C, and D, that represent two fractions, A/B and C/D, where B and D are non-zero and A <= B and C <= D.
Output an ASCII art depiction of the fractions made of |x- characters on two lines as follows:
The lines will always be the same, min... | stackexchange_codegolf |
Output or display the following three lines of text, exactly as they are shown below. A trailing newline is accepted.
bC#eF&hI)kL,nO/qR2tU5wX8z
A!cD$fG'iJ*lM-oP0rS3uV6xY9
aB"dE%gH(jK+mN.pQ1sT4vW7yZ
That block of text is the same as the one below, but where the n'th column is rotated n times downward:
!"#$%&'()*+,-./... | stackexchange_codegolf |
Your challenge is, given a series of notes, print the fingerings that minimize the amount of movements you need to make (explained below).
My not standard way of transforming fingerings to text:
The | line separates the left and right hand. Use 1 for the index finger, 2 for the middle finger and 3 for the ring finger. ... | stackexchange_codegolf |
If you're like me (and/or use Windows), You should have found this issue quite disturbing.
You plug in a hard drive (2TB for my occasion), and realize it doesn't show as 2TB, but a bit smaller size which is clearly not 2TB.
Over some research, I found it was because of Microsoft's mistake. Mistyping Binary prefix as De... | stackexchange_codegolf |
I was messing around with infinite resistor networks (long story) when I came across the following interesting recursive pattern:
|-||
|---
Each instance of this pattern is twice as wide as it is tall. To go from one level of the pattern to the next, you break up this rectangle into two sub-blocks (each of which is a ... | stackexchange_codegolf |
Guidelines
Task
Given a DNA strand, return its RNA complement (per RNA transcription).
Both DNA and RNA strands are a sequence of nucleotides.
The four nucleotides found in DNA are adenine (A), cytosine (C),
guanine (G) and thymine (T).
The four nucleotides found in RNA are adenine (A), cytosine (C),
guanine (G) and ur... | stackexchange_codegolf |
The challenge is to golf a program when given a string composed of any number of asterisks, then a comma, than any number of asterisks, say which side has more.
The asterisk-strings can be empty.
Output
0 for ties.
1 for the left.
2 for the right.
Examples
Input: ***,**** Output: 2
Input: ***, Output: 1
Input: ***,*** ... | stackexchange_codegolf |
The city defines a dog as any living entity with four legs and a tail. So raccoons, bears, mountain lions, mice, these are all just different sizes of dog.
Given an ASCII-art image of an animal, determine if that animal is a dog.
Rules
An animal is a dog if it has four legs and a tail.
The foot of a leg starts with one... | 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 |
We all often hear the idiom "walk through the array" to mean "map the function over the following array". However, I need it done (now!), so I want you to run through the array.
How do I run?
Imagine there's a wild pack of wolves behind you
Running through an array is like walking through one, except you can skip over... | stackexchange_codegolf |
When using Markup, like on the SE network, an indentation of four spaces before a line of text denotes it as part of a code block, as I hope you know. If you don't, here's an example (with . representing a space):
....Code
....More code
results in
Code
More code
The problem is, when you copy-paste code into an answer,... | 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 |
The one dimensional twitter waterflow problem is this:
You are given an array that represents a hill in the sense that the ith entry is the height of the ith location of the hill. When it rains, water logs in the hills, and you need to figure out how much water would log.
For example, after raining, the array 2 5 3 4 3... | stackexchange_codegolf |
Brainf**k is the most famous esoteric programming language and is the inspiration for hundreds of other esoteric languages. In fact, there are quite a few languages that are so heavily based off of Brainf**k that the only difference is the characters used. Your challenge is to interpret one of these languages.
Brainf**... | stackexchange_codegolf |
You work in a kitchen which has a peculiar rule. When you mix something into a pot you must always add at least one new ingredient.
So you can add pasta, oil, salt then pesto, but not pasta, pesto, salt and oil since pesto already contains salt and oil. You only have one pot per dish, so you can't mix ingredients in on... | 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 |
This is my attempt to pair code-shuffleboard with code-golf.
You need to write a full program or function that sums all codepoints of the input string. If there is no input, you can output any number, including 0.
Rules
The input will always be in printable ASCII.
The sum of the codepoints of your source must be exact... | stackexchange_codegolf |
(Similar: Through the bases)
Normally, our number system is base ten, with the digits 0123456789. However, we can increase or decrease the base count (so hexadecimal uses 0123456789abcdef and octal uses 01234567.
Your goal is: given a string, interpret it in all bases 2-36 for which it's valid, compute the total, and e... | stackexchange_codegolf |
The challenge
Given a 2d string representing the bottom of a boat as an input, you must determine whether or not the boat will float. This 2D string can be in whatever format is most convenient. (String with newlines, list of string, list of list of chars, etc.) Print a truthy value if it will float, and a falsey value... | stackexchange_codegolf |
(Note: this is an easier spin-off of my previous challenge Find the Infinity Words!, which is a spin-off of my other previous challenge Find the Swirling Words! :) )
Definition of a Wavy Word:
If you connect with curves all the characters of a Wavy Word on the alphabet (A-Z) you obtain the path of a wave continuously ... | stackexchange_codegolf |
In my Economics class, my friends and I like to come up with ways to rearrange the digits in the date (in MM/DD/YY) format to create a valid mathematical equation. For the most part, we are allowed to use addition, subtraction, multiplication, division, parentheses, and exponentiation in addition to concatenation.
Your... | stackexchange_codegolf |
An ordinary N-digit combination lock consists of N rotating discs. Each disc has digits 0-9 inscribed in order, and you need to turn them to the correct password to open it. Obviously, if you don't know the password, you will need to try at most 10N times before unlocking it. That's not interesting.
So let's consider ... | stackexchange_codegolf |
TikZ is a Latex package used for drawing precise images in Latex documents. It has a massive specification and a boatload of features that may be useful for graphical-output style questions.
What tips do people have for golfing in TikZ? As always, tips should be specific to to TikZ (e.g. "Remove comments" is not an a... | stackexchange_codegolf |
I think everyone is familiar with the game of darts. For those that don't understand the scores, here is a useful link.
The board
A dartboard can be compared to a pie cut in 20 pieces.
Each piece is divided in 4 sections.
a small outer ring called "double" (points x2)
a big ring called "single" (points x1)
another sma... | stackexchange_codegolf |
Your task is to convert a given positive integer from Arabic numeral to Roman numeral.
Things get difficult when you count to 4000.
The romans did this by adding a line above a symbol to multiply that symbol by 1 000. However, overlines aren't exactly displayable in ASCII. Also, there are double overlines to multiply a... | stackexchange_codegolf |
In this game of cops and robbers, each cop will make a vault: a program that stores a secret, and requires a key to unlock. The robbers should find a way to get the vault to reveal its secret without knowing the key.
Cop rules
Cops will write two short segments of code:
A vault, which takes a key and secret, then allo... | stackexchange_codegolf |
Over is a higher-order function in multiple languages such as APL (⍥). It takes 2 functions and 2 values as arguments, applies the first function to both values, then applies the second to their result. For example, using ⍥ to represent Over:
1 ²⍥+ 2
We would first calculate ² of each argument: 1² = 1 and 2² = 4. We t... | stackexchange_codegolf |
Not to be confused with this question.
You need to draw a times table (also known as Cremona's method for cardioid generation) as shown in this video. The number \$n\$ and \$k\$ will be the inputs.
In the video n and k are 2 and 10 respectively.
How to draw?
Draw a circle, divide its perimeter into equal spaced parts... | stackexchange_codegolf |
Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: je, tu, il, elle, nous, vous, ils, elles; followed by a space, the... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.