instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Background
So, nowadays the popular Prisoner's Dilemma variant is the Prisoner's Trilemma, where there are three options. I can easily see that being increased, so I figured
Why settle for three options, when we can have INFINITE options?
Therefore, I created the Floating Point Prisoner's ?Lemma.
Equations:
Each roun... | stackexchange_codegolf |
You have played \$N\$ matches in some game where each match can only result in one of the two outcomes: win or loss. Currently, you have \$W\$ wins. You want to have a win percentage of \$P\$ or more, playing as few matches as possible. Output the minimum win streak that you need. Assume the current win streak is at \$... | stackexchange_codegolf |
Challenge
Write a complete program that prints out the time it took to execute a certain part of itself. That part must include a process whose total number of operations (and therefore execution time) is dependent on a user-substituted numeric value - this can be denoted in any way in your code (uppercase N for exampl... | stackexchange_codegolf |
Overview
The cover of a book will be provided in the following ASCII format:
______
| |
| |
| |
| |
------
The input can be in any reasonable format (eg. a list of strings, a nested list of characters, etc.)
Inside the "borders" of the cover, other printable ascii characters might appear, which contribute ... | stackexchange_codegolf |
In this form of the game Tic-Tac-Chec, the goal is to move chess pieces to get four-in-a-row. Your goal here is to figure out if a position has a winning move.
Rules
The rules are similar, but not identical, to those of Tic-Tac-Chec.
The board is 4 by 4 squares. Each player has a rook, bishop, knight, and queen. On you... | stackexchange_codegolf |
Today's challenge:
Given an ordered list of at least 3 unique integer 2D points forming a polygon, determine if the resulting polygon is Rectilinear.
A polygon is rectilinear if every interior angle is a right angle. The edges do not necessarily have to be purely vertical or horizontal (parallel to the x or y axis), ... | stackexchange_codegolf |
Definitions:
A palindrome is a string which reads the same backward or forward (not counting spaces or special characters), such as "madam" or "Sorel Eros".
A date is said to be a palindrome when its dd-mm-yyyy format is a palindrome (or any other local representation).
Two strings are said to be anagrams when the co... | stackexchange_codegolf |
Cops' Thread
Your challenge is to find an uncracked, unsafe cop on the cops thread, and find an input value for which their code does not do as specified by the challenge.
You must use values within the bounds specified by the cop and the challenge - if a float breaks their program but they specified integers only, it... | stackexchange_codegolf |
Python string parsing has quite a few edge cases. This is a string:
"a"
Putting 2 strings immediately after each other implicitly concatenates them, so this is also a string:
"a""a"
However, if you put 3 quotes in a row, it will create a "triple quoted string" which can only be ended by another 3 quotes in a row. A t... | 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 |
Background
The systematic chemical symbol is defined as such for \$ 118 < n < 1000 \$:
The first letter corresponds to the first digit, capitalized.
The second letter corresponds to the second digit.
The third letter corresponds to the third digit.
This can be generalized for all \$ n > 0\$:
For each digit, get the ... | stackexchange_codegolf |
Write a program that encodes given text into its own text, provided as input, without disrupting its logic. The program must also work as a decoder, restoring the original message from its text. It must retain its encoding/decoding functions after transformation.
More formally speaking, the required program P must perf... | stackexchange_codegolf |
Dedicated to Martin Gardner, taken from his book
Background
In the old days, the Slavs had a divination method for finding out whether a girl would get married. The girl would clutch six straws in her hand so that the ends would poke out the top and bottom of her fist. Then her friend would join together the ends of pa... | stackexchange_codegolf |
Convert a string containing digits as words into an integer, ignoring leading zeros.
Examples
"four two" -> 42.
"zero zero zero one" -> 1.
Assumptions
Submissions can assume that:
The input string is comprised of space-separated digit words.
All words are valid (in the range "zero".."nine") and lowercase. Behaviour ... | stackexchange_codegolf |
Lighthouses on an island have blink codes that let ships know which lighthouse they are seeing. Input should be strings of S and L. Here is a (Python) example of codes for 4 lighthouses as a list of strings:
['SLS', 'SLL', 'SSS', 'LSL']
where:
S = short ON (1 sec)
L = long ON (3 sec)
Long and short ON's are both follo... | stackexchange_codegolf |
Challenge
This challenge is pretty simple: Output the total number of possible Tweets. Given the fact that \$1{,}114{,}112\$ Unicode characters exist, and Tweets can be up to \$280\$ characters long, we calculate this number like so:
$$\sum_{l=1}^{280}1{,}114{,}112^l$$
Calculated, this number becomes:
13806352273767118... | stackexchange_codegolf |
Carry sort is an \$O(n)\$ "sorting" algorithm. Here's how it works. The algorithm moves left to right along a list. As it traverses a list it "carries" a single item, the largest item it has encountered so far. Once it encounters a larger item it picks up that item and drops the item it is already carrying in place. W... | stackexchange_codegolf |
Recursion is actually quite powerful, sometimes its doesn't look like that child problem of itself exist, but recursion is just helpful.
One case per answer.
| stackexchange_codegolf |
Challenge
Given input in the form <n1>, <n2> where number can be -1, 0, or 1, return the corresponding cardinal direction. Positive numbers move East in the x-axis and South in the y-axis, Negative numbers move West in the x-axis and North in the y-axis.
Output must be in the form South East, North East, North. It is c... | stackexchange_codegolf |
Challenge
You just bought a brand new chair! Problem is, you have no idea how to control it so you'll need to write a program to do it for you.
You can only sit in the unadjusted chair for so long. So your code will need to be as short as possible.
Examples
5,3,2,2,1
O
|
|
| _
| |
|_|_
|
|
O
3,5,2,3,5
O
| _... | stackexchange_codegolf |
You are given a string composed with the characters 0123456789+*(). You can assume that string is always a valid mathematical expression.
Your task is to remove the unnecessary parentheses, assuming multiplication has higher priority than addition.
The parentheses should be removed only when they are not needed structu... | stackexchange_codegolf |
In mathematics, the factorial, shortened "fact" of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example, 5! is 1 * 2 * 3 * 4 * 5 = 120
The factorial of 0 is 1, according to the convention for an empty product.
These are the regular facts we are used to. ... | stackexchange_codegolf |
Challenge
In this simple challenge, you have to print the public IP address of google.com.
Rules
You have to output either the IPv6 or IPv4 address, and do it by somehow using internet.
Output does not strictly need to be the IP address, your answer will be valid if the correct IP address is somewhere in the output, ... | stackexchange_codegolf |
Introduction
A circle-tangent polynomial is a polynomial of degree \$N\ge3\$ or above that is tangent to the unit circle from inside at all of its N-1 intersection points. The two tails that exits the circle are considered tangent at their intersection points from inside as well. You may consider such polynomials are w... | stackexchange_codegolf |
Objective
Use any editor or IDE (vim, emacs, IntelliJ, etc) to write a valid "Hello, World" program in any C-like language. The "!" is optional, but you get style points if you use it. You may use publicly available plugins, a publicly available vimrc, etc, but you may not write or make modifications to them specifical... | stackexchange_codegolf |
Brain-flak is a stack-based turing-tarpit language, written collaboratively between me, DJMcMayhem, and 1000000000.
Some users are very experienced in the mysterious ways of Brain-Flak. So I thought it a good idea to set up this question as a way for us, and hopefully others too, to share our knowledge with the commun... | stackexchange_codegolf |
Barbrack
Your task is to write a program or function that takes a non-negative integer (in decimal or any other convenient base for your language), and output a number in the numbering system Barbrack.
What's that?
Barbrack is a numbering system I made up that can represent non-negative integers. Zero is represented wi... | stackexchange_codegolf |
Your job will be to write a function or a program, that will take an integer n>0 as input and output a list of the edges of the n-dimensional hypercube. In graph theory an edge is defined as a 2-tuple of vertices (or corners, if you prefer), that are connected.
Example 1
A 1-dimensional hypercube is a line and features... | stackexchange_codegolf |
A palindrome is a word that is its own reverse. I will define the left palindromic root of a word as the shortest prefix of the word for which the shortest possible palindrome that begins with that prefix is the original word. So the left palindromic root of racecar is race and the left palindromic root of ABBA is ABB.... | stackexchange_codegolf |
Create a function or program that takes two inputs:
A list of integers that shall be sorted (less than 20 elements)
A positive integer, N, saying how many comparisons you should take
The function shall stop, and output the resulting list of integers after N comparisons. If the list is fully sorted before N comparison... | stackexchange_codegolf |
Write the shortest possible code which converts tabs to spaces in the input. Tab size should be supplied as a parameter or be hardcoded in the code in a single place.
Spaces on output should point to the right column, e.g. (\t represents a tab character):
a\tb
aa\tb
aaa\tb
aaaa\tb
should become (for tab size 4):
a b... | stackexchange_codegolf |
This code golf challenge is to show directions through numbers.
When the user enters a number, then that means a direction change as follows:
0 means stay still
1 means forward (initially from left to right and initially start with `:`)
2 means turn right
3 means turn left
4 means go backward
I will show you an exampl... | stackexchange_codegolf |
In crossword terminology, the grid is the region into which the crossword answers are inserted, consisting of white and black squares. The crossword answers, called entries, are inserted into contiguous sequences of white squares in a row or column, separated by black squares.
For straight (American) crosswords, the g... | stackexchange_codegolf |
Challenge
Robin likes having his variables declaration in the shape of an arrow. Here's how he does it:
Input any number of strings
Order them by ascending length
Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best):
5 or 4
3 2
1 1
2 3
4 ... | stackexchange_codegolf |
I remember this was exam question long long long time ago.
There is a file say MyFile.txt, it can be any size and contains aphanumeric only
your task is to revese the words
example : "Go beyond the traditional laptop with Surface Laptop. It's backed by the best of Microsoft, including Windows and Office"
It should be "... | stackexchange_codegolf |
As a terrible Latin student for several years I have learned to hate many things about Latin. However there is one thing I love.
Latin scansion.
Scansion is the act of determining the meter of a particular line of poetry. For Latin this means demarcating each syllable in the line as "light" or "heavy".
In Latin scans... | stackexchange_codegolf |
Summary
A new string manipulation language has been made, using only the characters $+#-!*|@>! Your task is to implement an interpreter for it in as few bytes as possible.
Input
A string, which is a single line of this language. This can be taken in any reasonable way (stdin, function parameter, command line argument e... | stackexchange_codegolf |
Code-Bowling Challenge
Write a program or function that produces the same output, no matter how you re-arrange the source code. (Output can't be an error)
Pangram Scoring
Your score is the amount of unique characters in your source code.
A program with source code AJB would have a score of 3
A program with source ... | stackexchange_codegolf |
Let \$Z\$ be either the integers, the positive integers, or the non-zero integers; pick whatever's convenient. Give two functions \$f\$ and \$g\$, each \$Z \to Z\$, such that:
\$f(g(a)) = g(f(a))\$, for infinitely many integers \$a\$, and
\$f(g(b)) \ne g(f(b))\$, for infinitely many integers \$b\$.
Rules
Many of the ... | stackexchange_codegolf |
Write a term on the pure untyped lambda calculus that, when applied to a church-encoded list of numbers, returns it with its numbers sorted in ascending or descending order. Church lists and numbers must be encoded as folds for their usual ADTs:
-- Usual ADTs for Lists and Nats (in Haskell, for example)
data List a = C... | stackexchange_codegolf |
In this challenge, you'll take an answer as input, and print the answer before it. If the answer passed as input is the first answer, print your own submission's source. You'll be passed any answer in the chain up to and including your own answer, but none after it in the chain.
For example, if the first submission is ... | stackexchange_codegolf |
Your task, at the moment that you choose to accept it, is to write a program that, when given a string and a PCRE-regex, calculates the minimum Levenshtein distance to another string that matches the regex (fully). All strings, as well as the regexes, should be in the Latin-1 character set.
This is code-golf, so the sh... | stackexchange_codegolf |
Task
Your task is to write whole program, which will align given input to a block of given size.
Input:
40
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea ... | stackexchange_codegolf |
the goal
Build an optimizing Brainfuck implementation. Whether it is a compiler, an interpreter, a JIT compiler, or whatever else is up to you.
scoring
A reference implementation (bfi) will be given. Each implementation will run the same program (mb.b) also given at the end.
Your score is
time spent to run `mb.b` trans... | stackexchange_codegolf |
Note: this challenge has been posted on the sandbox.
Introduction
This challenge is inspired by 2009 Putnam B1, a problem in an undergraduate mathematics competition. The problem is as follows:
Show that every positive rational number can be written as a quotient of products of factorials of (not necessarily distinct... | stackexchange_codegolf |
Background
MENACE (Machine Educable Noughts And Crosses Engine) is a rudimentary shallow machine learning algorithm for the game Noughts and Crosses, created by British computer scientist Donald Michie in the 1960s. It was originally implemented with 304 matchboxes, each labelled with a board position and containing co... | stackexchange_codegolf |
I have a colleague at work that works from home every Tuesday and Thursday. At around 8:00 AM he sends us a message with the following text:
Hello today I'm working from home
In order to relieve him from the burden of doing this every day he stays at home, we would like to automate this task for him.
The challenge
Wr... | stackexchange_codegolf |
I'm tired, but I can't seem to fall asleep. Help me count sheep.
Given an input N (positive integer), make N sheep jump over an ascii fence, like the sample below. Only one frame should be displayed at once:
o |-|
──|-|── 0
o|-|
──|-|── 0
o
|-|
──|-|── 0
|-|o
──|-|── 0
|-| o
──|-|── 0
o |-|
──|... | stackexchange_codegolf |
You are an employee of Microteque, a leading Silicon Valley startup creating smart microwave ovens for all kinds of strange places. Your customers can get their microwaves printed with patterns to match their kitchens, campers, man caves; even the kitchens of large nation-state facilities have shiny new branded microwa... | stackexchange_codegolf |
Most everyone here is familiar with Pascal's Triangle. It's formed by successive rows, where each element is the sum of its two upper-left and upper-right neighbors. Here are the first 5 rows (borrowed from Generate Pascal's triangle):
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
We're going to take Pascal's Triangle and p... | 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 |
A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a permutation:
$$
\pi(1) = 3,\quad
\pi(2) = 4,\quad
\pi(3) = 1,\quad
\pi(4) = 2
$$
We can also have permutations on infinite s... | stackexchange_codegolf |
Bobby's booby-trapped safe requires an n-digit code to unlock it. Alex has a probe which can test combinations without typing them onto the safe. The probe responds Fail if no individual digit is the same as that in its corresponding position in Bobby's code. Otherwise it responds Close, including when all digits are c... | stackexchange_codegolf |
Note: There are some rude words in this question.
There's an implicit puzzle posed in this classic Monty Python sketch (you can also ready the script online).
Various phrases are described as being 'woody' or 'tinny', and one is described as being 'PVC'.
Given a phrase, respond with its type according to the following... | stackexchange_codegolf |
Task
Write a polyglot in two languages that when run, outputs the name of the language it is run in. Additionally, this program must also output the other language's name if the source code is reversed
Example:
Program ABC in language foo outputs foo. ABC in language bar outputs bar. CBA in language foo outputs bar, an... | stackexchange_codegolf |
Inspired by @AviFS.
Given a string containing brackets, e.g.
[xyz]]abc[[def]hij[
You can parse through it with a stack of brackets. When you find an open bracket, push a value to the stack, when you find a close bracket, pop from the stack. If you make these values indices, you know where you need to remove brackets.
... | stackexchange_codegolf |
Related
You are a manager at a large number factory. You want to show everyone your business is doing well, by showing randomly chosen samples. Unfortunately, your business is not doing that well. But luckily, you have a bit of ingenuity...
Write a program or function that when given an array of unique, positive numbe... | stackexchange_codegolf |
Inspired (you don't need to know them for this challenge) by the Pumping Lemma for various languages, I propose the following challenge:
choose some basis \$B \geq 2\$ and an integer \$n \geq 0\$
write a program/function \$P\$
partition* \$P\$ into some strings \$s_i \neq \epsilon\$, st. \$P = s_n | \cdots | s_i | \cd... | stackexchange_codegolf |
Inputs:
current hour: from 0 to 23 (inclusive)
delta of hours: [current hour] + [delta of hours] = withing the range of Integer
Output:
delta of days: the value which shows difference in days between day of current hour and day of sum [current hour] + [delta of hours]
Scoring
Answers will be scored in bytes with ... | stackexchange_codegolf |
Input
A string S of length between 10 and 16 inclusive. The characters are taken from the 95 printable ASCII characters, byte values 32 (0x20) to 126 (0x7E) ( to ~)
Output
Your code must compute and output all strings within Levenshtein distance 2 of S. You can have duplicates as long as you also have all the differen... | stackexchange_codegolf |
This question is based on what I came up with to answer another question.
Sometimes the questions here ask to draw some ASCII art. One simple way to store the data for the art is RLE (run-length encoding). So:
qqqwwwwweeerrrrrtttyyyy
becomes:
3q5w3e5r3t4y
Now to draw a big ASCII art you maybe be getting data like t... | stackexchange_codegolf |
The Laver tables provide examples of programs which have not been shown to terminate in the standard axiomatic system of mathematics ZFC but which do terminate when one assumes very large cardinal axioms.
Introduction
The classical Laver tables An are the unique finite algebras with underlying set {1,...,2n} and an ope... | stackexchange_codegolf |
Definition: a prime power is a natural number that can be expressed in the form pn where p is a prime and n is a natural number.
Task: Given a prime power pn > 1, return the prime p.
Testcases:
input output
9 3
16 2
343 7
2687 2687
59049 3
Scoring: This is code-golf. Shortest answer in bytes wins.
| stackexchange_codegolf |
tinylisp is, in its essence, a very stripped-down version of Lisp, as the name suggests. It was made by @DLosc for an "interpret this language" challenge, which can be found here. It features a small amount of builtins, which can be used to create practically anything.
There is a repository for the "official" tinylisp ... | stackexchange_codegolf |
Introduction
Factorials are one of the most frequently used examples to show how a programming language works.
A factorial, denoted \$n!\$, is \$1⋅2⋅3⋅…⋅(n-2)⋅(n-1)⋅n\$.
There is also the superfactorial (there are other definitions of this, but I chose this one because it looks more like the factorial), denoted \$n$\$,... | stackexchange_codegolf |
Challenge
Given a positive integer N, output the sum of the first N reciprocals as an exact fraction, which is represented as a pair of integers in a consistent order representing numerator and denominator.
Rules
Output must be exact.
Output should be as a pair of integers in a consistent order representing numerator ... | stackexchange_codegolf |
Given a word, get the indexes of each letter in the alphabet.
For example: uncopyrightable becomes: [21, 14, 3, 15, 16, 25, 18, 9, 7, 8, 20, 1, 2, 12, 5]
Convert these indexes to the given numeral system.
For example, if the radix is 36, then the array above would become:
['l', 'e', '3', 'f', 'g', 'p', 'i', '9', '7',... | stackexchange_codegolf |
Challenge
Given a (floating-point/decimal) number, return its reciprocal, i.e. 1 divided by the number. The output must be a floating-point/decimal number, not just an integer.
Detailed specification
You must receive input in the form of a floating-point/decimal number...
...which has at least 4 significant digits o... | stackexchange_codegolf |
Input:
A positive integer n consisting of digits in the range 0-9.
Challenge:
If d is the highest digit in the integer, assume the base of the number is d+1. E.g. if the integer is 1256 then you shall assume it's in base-7, if it's 10110 then you shall assume it's base-2 (binary), and if it's 159 then it's decimal.
Now... | stackexchange_codegolf |
Terminology
An increasing number is one where each digit is greater than or equal to all the digits to the left of it (ex. 12239)
A decreasing number is one where each digit is less than or equal to all the digits to the left of it (ex. 95531)
A bouncy number is any number that is not increasing or decreasing. Since th... | stackexchange_codegolf |
The specification of the "estimated" sign used by the European Union Directive (U+212e in Unicode, which you may not simply print for this challenge) is quite precise.
To copy some restrictions from this question: Render the symbol to file or screen using vector or raster graphics. If your output is rasterised, your i... | stackexchange_codegolf |
You are given two strings \$a\$ and \$b\$ consisting of characters from a to z in lowercase. Let \$n\$ be the length of \$a\$. Let \$m\$ be the length of \$b\$. Let \$a'\$ be the string \$a\$ repeated \$m\$ times. Let \$b'\$ be the string \$b\$ repeated \$n\$ times. Check whether \$a'\$ is lexicographically less than \... | stackexchange_codegolf |
In any programming language, create a program that takes input and animates the text being typed on a keyboard.
The delay between each character should be varying to simulate true typing on a keyboard. The delay shall be 0.1, 0.1, 0.5, 0.1, 0.1, 0.5 ... seconds, until the last character is printed. The final output sha... | stackexchange_codegolf |
For a 2 dimensional array we will define the elements in either the first row or the last column to be the largest "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted:
\$
\begin{bmatrix}
\color{red}{\underline 1} & \color{red}{\underline 2} & \color{red}{\underline 4}... | stackexchange_codegolf |
Yabasic, or Yet Another Basic is a dialect of basic created by Marc-Oliver Ihm that may be run on Windows, Unix and PAL versions of the Sony PlayStation 2. Development for this language is ongoing.
Helpful Resources
Yabasic Official Website
Yabasic Manual
Yabasic Wikipedia Page
Yabasic GitHub
Yabasic PS2 Documentatio... | stackexchange_codegolf |
This is a little codegolf challenge from codingame.com. I was wondering how much Python3 code is necessary (but of course answers are not limited to Python3).
Input
The first line contains one positive integer n. The second line contains n positive integers. Each consecutive integers on the second line are separated by... | stackexchange_codegolf |
Fast and Golfiest Robbers Thread
Welcome to the first season of Fast and Golfiest, a cops-and-robbers challenge! I designed this challenge to encourage competitive coding for efficiency (fastest algorithm) to become more popular on the site.
The rules are simple. The cops choose problems from LeetCode, a competitive co... | stackexchange_codegolf |
Your challenge is to write a program that constantly prompts for input, and when input is given, output that five seconds* later. However, your program must continue prompting for input during that time.
Since this is a bit confusing, here's a demo.
<pre id=x></pre><input id=h onchange='var k=this;(()=>{let a=k.value... | stackexchange_codegolf |
Pokerface
Introduction
Leo enjoys playing poker, but his job at Tech Inc. is too demanding for him to learn how to play well. Leo, being a computer scientist, is not discouraged. He decides to take more time than it would have taken to just learn poker, and use it to write a poker bot to help him play better. But now L... | stackexchange_codegolf |
Oof! You've been coding the whole day and you even had no time for Stack Exchange!
Now, you just want to rest and answer some questions. You have T minutes of free time. You enter the site and see N new questions. To write an answer for each you'll need ti minutes. Of course, as a dedicated reputation gatherer, you wa... | stackexchange_codegolf |
I want you to make a gui window like this:
* if you're thinking, the [quit] button closes the window
in any language using minimum "different" characters..
AND remember that the gui window must use native widgets instead of custom icons and buttons
like I have Windows 8, so my GUI window looks like this:
If you didn'... | stackexchange_codegolf |
Inspired by a tweet by Nathan W. Pyle
There is, now, a standard method of converting your boring, normal human name into a mysterious, ethereal Ghost Name™️. Ably described by Mr Pyle...
Use your first name:
a - add “t” after it
e - add “boo” after it
h - becomes “s”
n - add “oo” after it
r - add “eee” after it... | stackexchange_codegolf |
According to this site a general rule recommended by The U.S. Government Printing Office Style Manual is
Capitalize all words in titles of publications and documents, except
a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and
nor.
This might not be true as I'm unable to find such a recommendation i... | stackexchange_codegolf |
Please participate in the meta discussion about reopening this challenge before casting a vote.
Introduction
This challenge was inspired by semicolon-#.
Deadfish is a non-Turing-complete programming language, created by Jonathan Todd Skinner. It has an accumulator register and contains 4 commands, i, d, s, and o, sta... | stackexchange_codegolf |
Imagine for a second that you can compose a tree out of dots.
.
...
.....
.......
.........
...........
.............
...............
...
...
This tree is 13 dots tall.
Now imagine for a second that your filesystem looked like these dots. Your task in this challenge is to make a... | stackexchange_codegolf |
This:
is a Glider.
In Conway's Game of Life, the glider is a famous pattern that rapidly traverses across the board. For today's challenge, we are going to draw an ASCII art Game of Life Board, and place a glider on it.
The board we are starting with is this:
|_|_|_|_|_|_|_|_|_|_|
|_|_|_|_|_|_|_|_|_|_|
|_|_|_|_|_|_|_|... | stackexchange_codegolf |
Write a program that takes two lists of strings and generates a javascript regex that fully matches all the strings in the first list and matches none of the strings in the second list.
To be specific when for all stings in the first list str.match(/[your-output]/) must produce a match for the full string and for all s... | stackexchange_codegolf |
Surreal Numbers are one way of describing numbers using sets. In this challenge you will determine the value of a surreal number.
Intro
A surreal number consists of two sets: a left and right. The value of the surreal number must be greater than all numbers in the left set and less than all numbers in the right set. We... | stackexchange_codegolf |
Following last year's event, we're doing Code Golf Advent Calendar 2022!
On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes for solving them fast ... | stackexchange_codegolf |
In Pokémon there are 18 types:
Normal Fighting Flying Poison Ground Rock
Bug Ghost Steel Fire Water Grass
Electric Psychic Ice Dragon Dark Fairy
A Pokémon can have single or dual typing. For example, Pikachu is Electric, and Tyranitar is Rock/Dark. The order of the types does not ma... | stackexchange_codegolf |
Introduction
For my 5th KOTH, I present to you a challenge based on the well-known game Battleship with a few twists. You'll only command one ship, whose type you'll be able to select between the 5 "traditionnal" classes, but you'll be able to undertake multiple actions each turn, including moving! This is played as a ... | stackexchange_codegolf |
The idea of this challenge is to find all the words from a dictionary on a grid of letters. Your input should come from stdin or function arg and will come in the following format:
[your dictionary as a list of space sep words]
[a grid of letters]
Example:
The cool car
looc
thea
jopr
Rules for finding a match
A matc... | stackexchange_codegolf |
let S, a and b each represent a string
Goal: Write a standard string replace function where the you replace all occurrences of a in a string S with b so long as a is not already part of an instance of b
for example, if we have the string S = My oh my that there is a big ol' that
and we wanted to do a fancy replace with... | stackexchange_codegolf |
This is the robbers' thread. The cops' thread is located here.
Robber rules
Should work for all keys and secrets
Should require the same number or fewer guesses as the cop's fault, to prevent brute forcing
Does not need to be the same as the cop's intended fault
Multiple cracks may be made for the same cop, as long as... | stackexchange_codegolf |
To be able to challenge the Elite-4 of top programmers, you need to show your badges first, that qualify you as a potential programmer-master. However, there's a twist. Once you show a badge, it is collected, which means you can't re-show it. So better come prepared! There are n badge collectors, each has a known list ... | stackexchange_codegolf |
This is a cops-and-robbers challenge, the robbers' thread is here
You can change the word code into golf by changing a letter at a time in four steps:
CODE
COLE
COLD
GOLD
GOLF
Today, we’ll be doing the same thing with programs.
Your challenge is to:
choose a programming language
write two programs / functions, one th... | stackexchange_codegolf |
A Fermi-Dirac Prime is a prime power of the form \$p^{2^k}\$, where \$p\$ is prime and \$k \geq 0\$, or in other words, a prime to the power of an integer power of two. They are listed as integer sequence A050376. While a normal prime factorization generally does not contain a set of distinct primes (for example \$24=2... | stackexchange_codegolf |
Given a string of parentheses ( and ), find the length of the longest substring that forms a valid pair of parentheses.
Valid pairs of parentheses are defined as the following:
An empty string is a valid pair of parentheses.
If s is a valid pair of parentheses, then (s) is also a valid pair of parentheses.
If s and t a... | stackexchange_codegolf |
Problem source: https://oj.vnoi.info/problem/backtrack_j
We have these two shapes:
#.
##
and
.#
##
Let's call the first shape the L and the second shape the flipped L.
On a 4x4 board, there are 16 cells. Each cell can be either free or occupied. In all the illustrations, # represents an occupied cell and . represents... | stackexchange_codegolf |
Once upon a time long long ago... when there was no money or stocks yet, people were trading sheep. Even before (but close to) the invention of abacus, the great-grandfather of Warren Buffet decided it was hard to keep track of sheep. He wanted to collect all his belongings and clear all his debt, so that he could inve... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.