instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
And then the King said: You fought bravely, Knight, and your deed will not be forgotten for centuries. For your valor I grant you this castle and the lands around it. Things rush me, and I can not take you to the castle. Therefore, I will give you the way from this place to the castle. Now go and come back after the de... | 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 |
Description
Chicken McNugget numbers are numbers that can be expressed as a sum of \$6\$, \$9\$ or \$20\$ - the initial sizes of the famous Chicken McNuggets boxes sold by McDonald's. In that sum, a number may occur more than once, so \$6 + 6 = 12\$ is such a number too, and the number must "contain" at least one of th... | stackexchange_codegolf |
Introduction
We have 22 Collatz conjecture-related challenges as of October 2020, but none of which cares about the restrictions on counter-examples, if any exists, to the conjecture.
Considering a variant of the operation defined in the conjecture:
$$f(x)=
\cases{
\frac{x}{2}&for even x \cr
\frac{3x+1}{2}&for odd x
}... | stackexchange_codegolf |
I was surprised to not find this asked already, though there is a great question on darts checkouts: Darts meets Codegolf
Your challenge is to calculate which scores are not possible with 'n' darts below the maximum score for 'n' darts. E.g. for n=3, the maximum possible score is 180 so you would return [163,166,169,17... | stackexchange_codegolf |
Introduction
The Sierpinski Arrowhead Curve is a curve that's limit is Sierpinski's Triangle.
It first starts like this:
_
/ \
Then, each line is replaced with a rotated version of the first one:
_
/ \
\ /
_/ \_
Next:
_
/ \
\ /
_/ \_
/ \
\_ _/
_ \ / _
/ \_/ \_/ \
Your task
Given a ... | stackexchange_codegolf |
Create a program with the lowest amount of characters to reverse each word in a string while keeping the order of the words, as well as punctuation and capital letters, in their initial place.
By "Order of the words," I mean that each word is split by a empty space (" "), so contractions and such will be treated as one... | stackexchange_codegolf |
The Bible is one of the most influential books ever written, and commonly cited as the best selling book of all time. It was written by approximately 40 different authors over hundreds of years before being compiled into it's current form. But what's interesting about The Bible is the way it's divided up. It is split u... | stackexchange_codegolf |
Background
Consider an \$n\times n\$ grid, where each cell is either empty (denoted by .) or a wall (denoted by #). We say that two cells are adjacent if they share an edge (a corner is not enough). A path is a sequence of distinct empty cells \$s_0,s_1,\ldots,s_k\$ such that cells \$s_i\$ and \$s_{i+1}\$ are adjacent ... | stackexchange_codegolf |
This question is tricky (and in particular harder than Which big number is bigger?), for those who like more challenging puzzles.
Input
Integers a1, a2, a3, a4, a5, b1, b2, b3, b4, b5 each in the range 1 to 10.
Output
True if a1^(a2^(a3^(a4^a5))) > b1^(b2^(b3^(b4^b5))) and False otherwise.
^ is exponentiation in this... | stackexchange_codegolf |
Background: Too many illegal immigrants from Blandia are crossing the border to Astan. The emperor of Astan has tasked you with digging a trench to keep them out, and Blandia must pay for the expenses. Since all typists have been furloughed until the trench is arranged, your code must be as short as possible.*
Task: Gi... | stackexchange_codegolf |
What to do?
Starting from a, count in the sequence:
a, b, c, d, ... , y, z, aa, ab, ac, ... , ay, az, ba, bb, bc, ... , zy, zz, aaa, aab, aac, ... , zzy, zzz, aaaa, aaab, aaac, ...
Input
The input, n, will an integer representing how far to count.
Output
The output should be n space-separated strings following the abo... | stackexchange_codegolf |
Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer #RRGGBBAA. But Android developers may prefer #AARRGGBB. When handling AAS file format, #AABBGGRR is needed. That's too confusing. Maybe we need a program... | stackexchange_codegolf |
A little while back, data was frequently stored on punched card. A typical card would have 80 columns of 12 possible 'punch' positions. A plethora of encodings was used, each for their own specific purpose.
These days we like to think of a byte as 8 bits. In this challenge, you're tasked to convert an 8-bit byte to a 1... | stackexchange_codegolf |
A directed graph G is given with Vertices V and Edges E, representing train stations and unidirectional train routes respectively.
Trains of different train numbers move in between pairs of Vertices in a single direction.
Vertices of G are connected with one another through trains with allotted train numbers.
A hop is ... | stackexchange_codegolf |
Task:
Given an integer input, figure out whether or not it is a Cyclops Number.
What is a Cyclops number, you may ask? Well, it's a number whose binary representation only has one 0 in the center!
Test Cases:
Input | Output | Binary | Explanation
--------------------------------------
0 | truthy | 0 | only ... | stackexchange_codegolf |
Problem
Recreate the UI from a torrent program
Given no input, output the following:
+----------+----------+----------+
|a.exe |##########|seeding |
+----------+----------+----------+
|b.exe 10% |# |leeching |
+----------+----------+----------+
|c.exe |##########|seeding |
+----------+----------+--... | stackexchange_codegolf |
I recently solved a coding challenge in one of the challenge papers that my IT teacher gave to us. It was a seemingly simple, but fun challenge, so I thought it will make fun golfing.
The task
Given an input of a 2x2 matrix that contains 4 strictly positive integers (i.e. non-negative and non-zero), like this:
$$\begin... | stackexchange_codegolf |
Given a permutation of the alphabet and an intended "word", determine if the word was guessed in a game of Hangman, where the permutation is the list of guesses.
For example, given ASTNORDYUVKFMCLWIHEBQGPJXZ as the permutation, and ASTRONAUT as the word, we know that the word was guessed. Only 2 letters (DY) were wrong... | stackexchange_codegolf |
The "prime ant" is an obstinate animal that navigates the integers and divides them until there are only primes left!
Initially, we have an infinite array A containing all the integers >= 2 : [2,3,4,5,6,.. ]
Let p be the position of the ant on the array. Initially, p = 0 (array is 0-indexed)
Each turn, the ant will mo... | stackexchange_codegolf |
Inspired by a challenge from the OUCC 2022 Seniors competition.
Background
Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attacking players each have one soft ball they can throw at the defenders. Teams ge... | stackexchange_codegolf |
Context
In APL, trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we need in order to have a sound train.
Task
Given the sequence of function arities in the train, determine if the train is va... | stackexchange_codegolf |
The task
Given a folded and cut in places snowflake, "unwrap" it and output the result
Input
The base folded snowflake, without any cuts, looks like:
|\
| \
| \
| \
| \
| \
| \
| \
|________\
And the input will always resemble this.
No changed or added symbols will go out of the range of this tria... | stackexchange_codegolf |
Introduction
Given five points in the plane, your task is to compute the area of the ellipse passing through these points.
You can assume that exactly one non-degenerate ellipse can be constructed with the given input values.
Rules
Input is 10 integers in any convenient form, corresponding to the x and y coordinates of... | stackexchange_codegolf |
A redox reaction is a chemical reaction in which elements transfer electrons. One element loses electrons, while another gains electrons. Oxidation is the process where an element loses electrons, and reduction is the process where an element gains electrons. Since electrons have a negative charge, the oxidation number... | stackexchange_codegolf |
Background
Conway immobilizer problem is a puzzle that reads like the following:
Three positions, "left," "middle," and "right," are marked on a table.
Three cards, an ace, a king, and a queen, lie face up in some or all
three of the positions. If more than one card occupies a given
position then only the top ca... | stackexchange_codegolf |
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 |
Challenge
Write code that, given an English word, outputs the number of syllables it has. Scoring will be determined by a combination of code length and accuracy.
Rules
The accuracy of the solution should be measured against this CSV file (which countains syllable counts for all the 52,439 entries in the CMU Pronounc... | stackexchange_codegolf |
What general tips do you have for golfing in ///? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to /// (e.g. "remove unnecessary whitespace" is not an answer). Tips for itflabtijtslwi and Lines are on-topic and valid here as well.
Please post one tip per ... | stackexchange_codegolf |
tl;dr: Output the values where the reduced prime factorization leader changes.
Every positive integer has a unique prime factorization. Let's call the reduced prime factorization just the list of multiplicity of the prime factors, ordered by the size of the factors. For instance, the reduced prime factorization of 1980... | stackexchange_codegolf |
Base: part 1
This is part 2, Strongly suggest you go try out the first one if you haven't tried it.
Story
As one of the solvers, You've managed to get to the door of the base heaven. In front of the door stands the base guard @lyxal, they were angry that you all just left the encoded text on the ground, they demand tha... | stackexchange_codegolf |
Bob got kidnapped and is stuck in a maze. Your job is to help him find a way out. But since it is a very dark and scary maze, he can't see anything. He can only feel walls when he runs in to it, and knows when he has found the exit, but doesn't know anything more that.
Since he has to run your program by memory, it has... | stackexchange_codegolf |
Inspired by this accidental misspelling
If you could read the title, then you already know what the challenge is about. If not, then I'll tell you. Easy: simply take each word (single space delimited), and swap the positions of the first two letters. You may assume that the input will contain only lowercase ASCII let... | stackexchange_codegolf |
Here is a simple challenge for you: You must produce this ASCII representation of a chess board. White is represented by uppercase characters, and black is represented by lowercase. Empty tiles are represented by a .. Here is the full board:
rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR
Since... | stackexchange_codegolf |
Your challenge is to find the file extension of a provided filename:
hi.txt -> txt or .txt
carrot.meme -> meme or .meme
lol (undefined behavior)
what..is..this..file -> file or .file
.bashrc -> bashrc or .bashrc
T00M@n3KaPZ.h0wC[]h -> h0wC[]h or .h0wC[]h
agent.000 -> 000 or .000
You must get the text from the last . ... | stackexchange_codegolf |
Exchange the Stacks!
Write a program that can exchange any character from two stacks. In this challenge, a stack is a tower of characters. An example stack is below:
1
a
4
d
*
c
3
There are two stacks involved in the challenge and both are inputted when the program runs. The program will also be given an argument of w... | stackexchange_codegolf |
Write a program or function that, given two ASCII strings A and B, will produce strings A' and B' where the common substrings are reversed in their place. The process for finding A' is as follows:
A' is initially empty.
If the first character of A is in B, find the longest prefix of A which is a substring of B. Remove... | stackexchange_codegolf |
There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever.
Your task is to create a program that gives the next word in sequence giv... | stackexchange_codegolf |
Summary
We already have a challenge for the minimal number of characters for Turing completeness. But what about the minimal maximum byte?
Challenge
For a language of your choice, find a subset of characters that allows your language to be Turing complete with the minimal maximum byte value.
Example
If your language is... | stackexchange_codegolf |
This is the cops' thread to a cops-and-robbers challenge. Click the link to find the robbers' thread.
The challenge here is very simple. Create two programs of the same size, in the same language, which output (using 1 standard output method) two different natural numbers, \$x\$ and \$y\$. Submit both programs, bot... | stackexchange_codegolf |
Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. In other words, if there are more than 1 duplicated numbers, return the number for which the second occurrence has a smaller index than the second occurrenc... | stackexchange_codegolf |
NATO phonetic alphabet is a spelling alphabet that associate to each of the 26 letters of the English alphabet one word (table below) that is easy to understand over the radio or telephone. For example, if you want to communicate the word CAT over the telephone, you do the following spelling:
CHARLIE ALFA TANGO
But wha... | stackexchange_codegolf |
Given a positive integer nesting level n and string s of printable ascii characters( to ~, output a program which, when run in the same language, outputs a program which outputs a program . . . which outputs the string s.
A total of n programs should be generated, all of which should be run in the same language as your... | stackexchange_codegolf |
This is the robbers' thread. The cops' thread is here.
Your challenge is to take an uncracked submission from the cops' thread and try to find the original unredacted program. Please comment on the cop's submission when you've cracked their code.
| stackexchange_codegolf |
Given a non-empty list of digits 0 though 9, output the smallest number that can be produced by an expression formed by reordering these digits and introducing exponentiation signs ^, with adjacent digits getting concatenated as multi-digit numbers. Exponentiation is evaluated as right-associative.
For example, [4, 2, ... | stackexchange_codegolf |
At the Code-Golf™ Psychological Society, you are delighted to present a new method of measuring mental age: Abstract Capacity™.
To get the Abstract Capacity of a person, you take their actual age divided by 4, take their IQ divided by 9, then add the two values together. Then, round this sum down to find the Abstract C... | stackexchange_codegolf |
Produce Graham's Number in Magic the Gathering using the fewest number of cards and without using any infinite combos.
Rules:
Producing Graham's number means do anything that requires Graham's number to represent the game state. For example, you could produce Graham's number 2/2 zombie tokens, have Graham's number li... | stackexchange_codegolf |
Background
A Hamiltonian path is a path on a graph that steps through its vertices exactly once. On a grid, this means stepping through every cell exactly once.
On a square grid, a Chess King can move to a horizontally, vertically, or diagonally adjacent cell in one step.
Challenge
Count the number of Hamiltonian paths... | stackexchange_codegolf |
The year 2013 had an interesting property: the digits are consecutive when sorted (0123). Let's call this type of number a sortable number: a non-negative integer whose base-10 digits are consecutive after sorting. Unfortunately, this won't happen again until 2031, and after that, not until 2103. Your challenge is to w... | stackexchange_codegolf |
The recent volume of MAA's Mathematics Magazine had an article "Connecting the Dots: Maximal Polygons on a Square Grid" by Sam Chow, Ayla Gafni, and Paul Gafni about making (very convex) \$n^2\$-gons where each vertex is a different point of the \$n \times n\$ grid.
One is not allowed to have two consecutive segments ... | stackexchange_codegolf |
Any two separate nodes in a binary tree have a common ancestor, which is the root of a binary tree. The lowest common ancestor(LCA) is thus defined as the node that is furthest from the root and that is the ancestor of the two nodes.
The following are binary trees and the lowest common ancestors of the some of their n... | stackexchange_codegolf |
Instead of normal binary, you must count from 1 to an input in negabinary concatenated to negaquaternary.
Here's an example, put in the form of an array:
[11, 1102, 1113, 100130, 101131, 11010132, 11011133, 11000120, 11001121, 11110122, 11111123, 11100110, 11101111, 10010112, 10011113, 10000100, 10001101, 10110102, 101... | stackexchange_codegolf |
How, you can’t remember the 6 or 7-digit phone number that appeared on the TV screen for a second?! Using the special technique described below, you will turn into a walking phonebook!
Obviously, the number 402 is easier to remember than the number 110010010, and the number 337377 is easier to remember than the number ... | stackexchange_codegolf |
A Flow Snake, also known as a Gosper curve, is a fractal curve, growing exponentially in size with each order/iteration of a simple process. Below are the details about the construction and a few examples for various orders:
Order 1 Flow Snake:
____
\__ \
__/
Order 2 Flow Snake:
____
____ \__ \
\__ \__/ / __
... | stackexchange_codegolf |
Introduction:
After I posted two rainbow-related challenges: Codegolf Rainbow : Fun with Integer-Arrays 1 and Codegolf Rainbow : Draw in Black-and-White 2, the following comment was made by @ChrisM in the ASCII (Draw in Black-and-White) challenge:
Maybe you know this and it's by design (I know that rainbows are not rh... | stackexchange_codegolf |
In this challenge you will be simulating a frog jumping from lily-pad to lily-pad in a pond. A frog's jump distance is uniquely determined by the size of the lily pad it jumps from. So for example there are lily-pads that let a frog jump 1 unit, lily-pads that let a frog jump 2 units etc. A frog can never jump more ... | stackexchange_codegolf |
Introduction
cowsay is a Unix command made by Tony Monroe, written in Perl. It outputs a picture of a cow saying given text. For example:
________________________
< Typical cowsay output! >
------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
... | stackexchange_codegolf |
The bank has been broken into, and all the local mafia thugs have an unusual alibi: they were at home playing Connect 4! In order to assist with the investigation, you are asked to write a program to validate all the Connect 4 boards that have been seized in order to check that the positions are indeed positions from ... | stackexchange_codegolf |
Haplology
Haplology is a linguistic term:
the omission of one occurrence of a sound or syllable that is repeated within a word, for example probly for probably.
For this challenge, it means specifically, replacing any sequences of two or more letters that are repeated two or more times with just one copy.
For example... | stackexchange_codegolf |
Four-In-A-Row AI Tournament
Today, we will be playing a Four-In-A-Row tournament. However, it is not us humans playing... instead, we must have our computers battle instead! This challenge is completely in C#.
Rules
Basic Game Rules
If you have never played, there are simple rules. 2 players take turns putting pieces i... | stackexchange_codegolf |
Your task is to calculate the total number of key-presses required to enter a given text on an old cellphone.
The keymaps are:
1:1
2:abcABC2
3:defDEF3
4:ghiGHI4
5:jklJKL5
6:mnoMNO6
7:pqrsPQRS7
8:tuvTUV8
9:wxyzWXYZ9
0:<space><newline>0
To type exaMPle TExt 01 , you would press 33 99 2 6666 77777 555 33 0 8888 33333 99 ... | stackexchange_codegolf |
Let's introduce a simplified variant of the well known Spider Solitaire.
From Wikipedia:
The main purpose of the game is to remove all cards from the table, assembling them in the tableau before removing them. Initially, 54 cards are dealt to the tableau in ten piles, face down except for the top cards. The tableau pi... | stackexchange_codegolf |
My two kids like to play with the following toy:
The colored areas with the shapes inside can be touched and the turtle then lights the area and plays a sound or says the name of the color or the shape inside. The middle button changes the mode. There is one mode in which the areas play different musical notes when to... | stackexchange_codegolf |
Keep Talking and Nobody Explodes is a local multiplayer game where one player has control over a virtual "bomb", and has to be guided by another player, the "expert", who has access to a bomb defusal manual. One of the modules to be disarmed in the game is the keypad module, which is what we'll be dealing with in this ... | stackexchange_codegolf |
Everybody loves geometry. So why don't we try and code golf it? This challenge involves taking in letters and numbers and making shapes depending on it.
The Input
The input will be in the form of (shapeIdentifier)(size)(inverter).
But what are shapeIdentifier, size, and inverter?
The shape identifier is the identifie... | stackexchange_codegolf |
There is a helicopter flying 500 meters from the ground. It can fly up 100 meters, which takes 1.0 secs. Or if it doesn't fly up it will fall 200 meters, which also takes 1.0 secs - This means if the instruction is anything other than "Fly" the helicopter falls. Build a program that takes input of a list of instruction... | stackexchange_codegolf |
This is the logo for LAPACK, a widely used software library for numerical linear algebra.
Your task is to print the logo (color and matrix brackets not required) as this exact string. Trailing newline is allowed.
L A P A C K
L -A P -A C -K
L A P A -C -K
L -A P -A -C K
L A -P -A C K
L -A -P A C -K
| stackexchange_codegolf |
Given a number x, find the sum of all primes up to that number.
The input will always be a positive number, bigger than 2. An upper limit isn't defined, so data types can be ignored. Use whichever you want.
This is a code-golf, so the shortest code in bytes wins.
Example for 5:
2 + 3 + 5 = 10
Test cases:
Input
Ou... | stackexchange_codegolf |
Inspired from a real problem; we were looking at this table and said "Hey, now that's a good codegolf problem."
The KOOS Jr. scores converts from a raw number to a percentile score given this table:
Raw summed score Interval score
(0-28) (0 to 100 scale)
0 100.000
1 91.975
... | stackexchange_codegolf |
This thinking exercise is inspired from Super Chafouin's question "Just Repeat Yourself" in which the phrase "Do not repeat yourself!" had to be outputted using code that was basically a series of doubled characters, inclusive of newlines, so code like:
((zz==0011))&&((mm++&&mm++&&mm++&&mm++&&mm++&&nn--&&nn--&&nn--&&n... | stackexchange_codegolf |
Code a program or function to construct an interactive canvas on the screen of at least 400 pixels x 400 pixels in size. The canvas can be any color you wish, bordered or borderless, with or without a title bar, etc., just some form of obvious canvas.
The user will click on two distinct areas of the canvas and the prog... | stackexchange_codegolf |
You are given four integers: \$e,s,b\in\{0,1\}\$ and \$S\in \{0,1,2,4\}\$, where \$e,s,b,S\$ stand for egg, sausage, bacon and spam respectively.
Your task is to figure out whether the corresponding ingredients match a valid entry in the following menu:
[e]gg | [s]ausage | [b]acon | [S]pam
-------+-----------+--------... | stackexchange_codegolf |
Inspired by this question.
Champernowne's constant is an infinite decimal number that consists of "0." followed by all natural numbers concatenated together. It begins like so: 0.123456781011121314151617181920212223242526272829303132333435363738394041424344454647484950, etc. The digits of Chamernowne's constant are se... | stackexchange_codegolf |
One of many unique features of the Malbolge programming language is its highly unintuitive OP operator, referred to only as "op" in the documentation and source code but popularly known as the "crazy" operator. As described by Ben Olmstead, the creator of the language, in its documentation: "don't look for pattern, it'... | stackexchange_codegolf |
Permutations of a set have a natural order called lexicographic order in which two permutations are compared by comparing the first position at which they differ. For the purposes of this question we're working with base 64 and the order of the digits is
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/... | stackexchange_codegolf |
We often see music videos on Youtube. Many Youtube channels that host music videos are "powered by VEVO". Those can be easily identified by both embedding VEVO at their video thumbnails and appending VEVO to their channel name.
Now write some code to test whether a string given by user is a VEVO user account or not.
Re... | stackexchange_codegolf |
A portmanteau word is a combination of two words that takes part of each word and makes them into a single new word. For example, lion + tiger => liger.
Let's write a program to generate portmanteaus from a pair of input words. Computers aren't the best at English, so we'll need to establish some rules to ensure that t... | stackexchange_codegolf |
Pretty simple challenge here. Who can make the fastest algorithm (lowest time complexity) to determine whether or not the circle is "boxed in" given the following setup?
Input: Your program receives a pair of numbers (a,b) that denotes the position of a circle on a grid like this with arbitrary dimensions:
Where a-1 i... | stackexchange_codegolf |
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 |
Find X
I was inspired by math questions in which one is asked to "Find X" for a given shape. Originally, I was just going to have the challenge be to print the x and y location of the character 'x' in a String. But I supposed that would be too simple. So I considered the context they were normally in, and decided findi... | stackexchange_codegolf |
As the title says, your task is to print the largest string using the shortest code without taking any input value.
Rules
The program must take no input and print the largest string to STDOUT
The string must contain only ASCII Characters. If you don't know the ASCII Characters, take a look at the table
No Loops are a... | stackexchange_codegolf |
Challenge Description
You have to show a simulation of rain in terminal.
In the example given below its adding 100 raindrops at random (use the default random function which your language offers) coordinates, waiting for 0.2 seconds and then redrawing again until the given time expires. Any character can be used for r... | stackexchange_codegolf |
The one-dimensional version of this problem was pretty easy, so here's a harder 2D version.
You are given a 2D array of land heights on standard input, and you have to figure out where the lakes will form when it rains. The height map is just a rectangular array of the numbers 0-9, inclusive.
8888888888
5664303498
648... | stackexchange_codegolf |
Challenge:
The concept is simple enough: write a full program to output its own code golf score!
Output should only be the byte count of your program and a trailing bytes.
BUT WAIT..... there is one restriction:
Your source code can not include any of the digits from your byte count
So if your score is 186 bytes, you... | stackexchange_codegolf |
Introduction:
In my recent Strikethrough the Word Search List challenge I mentioned the following:
When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one.
In some cases I do them in reversed order as a change of pace, although that doesn't matter too much r... | stackexchange_codegolf |
Similar to this question, but this is a crossword variation!
Instead of only one letter per grid square, you can have one or two.
Input:
A 2d array, or whatever works in your language.
You can assume valid inputs
Any array size must work
Output:
An array of all the words
Across and down
All words must be joined to... | stackexchange_codegolf |
A family of sets is called laminar if for any two sets \$A\$ and \$B\$ in the family one of the following is true:
\$ A \subseteq B \$
\$ A \supseteq B \$
\$ A \cap B = \emptyset \$
Or less mathematical:
A laminar set is a list of lists that satisfies the following condition: If two elements of the top level list hav... | stackexchange_codegolf |
Challenge
The challenge is to write a program that takes the coefficients of any n-degree polynomial equation as input and returns the integral values of x for which the equation holds true. The coefficients will be provided as input in the order of decreasing or increasing power. You can assume all the coefficients to... | stackexchange_codegolf |
Background
Flow Free is a series of puzzle games whose objective is to connect all the same-colored pairs of dots on the grid. In this challenge, we consider the original game on a rectangular grid (no variations like bridges, warps, or hexagonal grids).
A puzzle in Flow Free might look like this:
Puzzle Solution
...... | stackexchange_codegolf |
Background
If you do much code golfing, you're likely aware of the bitwise XOR operation. Given two integers, it gives another integer with 1s in the bits where the two inputs differ. So, for example, 1010 XOR 0011 = 1001.
It turns out to be very useful in game theory, where it's better known as the "nim sum". If you ... | stackexchange_codegolf |
Pyth is a golfing language based on Python. It uses prefix notation, with each command having a different arity (number of arguments it accepts).
Your task is to write a syntax checker for a (non-existent) Pyth-like language, Pith.
Pith's syntax
Pith only has 8 single-char commands:
01234()"
01234 each have arity of t... | stackexchange_codegolf |
The string tut-tutut-tut-tuttut-tut can be constructed with overlapping or concatenated instances of the word tut-tut:
tut-tutut-tut-tuttut-tut
tut-tut
tut-tut
tut-tut
tut-tut
The string tut-tututut-tutut-tut cannot:
tut-tututut-tutut-tut
tut-tut^
|tut-tut
| tut-tut
... | stackexchange_codegolf |
Smallfuck is a brainfuck-like language with 1-bit cells. It has the following instructions:
> Increment the pointer
< Decrement the pointer
* Flip the current bit
[ If the current bit is not set, jump to the instruction after the matching ]
] If the current bit is set, jump to the instruction after the matching [
... | stackexchange_codegolf |
Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The Fibonacci sequence is almost one example of this type of sequence for F(0) = 0, F(1) = 1, but it's excluded because of the positive integer requirement. Any two initial values will yield a different sequence. For example F(0) = 3... | stackexchange_codegolf |
Sound synthesizers use envelope generators to control how certain parameters of the sound (such as overall loudness) change with time. In many synthesizers an envelope is defined by four parameters, as represented in the following figure from Wikipedia:
Attack time (A): time taken for the envelope to reach its maximum... | stackexchange_codegolf |
Related: Name the poker hand
A straight flush is a poker hand containing five cards of sequential rank, all of the same suit. As part of a straight flush, an ace can rank either above a king or below a two. An ace can rank either high (e.g. A♥ K♥ Q♥ J♥ 10♥ is an ace-high straight flush) or low (e.g. 5♦ 4♦ 3♦ 2♦ A♦ is ... | 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 |
It turns out that my toaster is a tad broken. It lost WiFi (You know, it's one of those newfangled smart toasters), and its been going bonkers! Since it no longer works, I've been having to hack into my breakfast's source code and run Plate.bread.toastAs(3); every morning. Will you help?
My toaster takes one input: the... | stackexchange_codegolf |
Challenge
Predict the distance between the Sun and the nth planet when using any formula that gives the same result as the Titius–Bode law: d=(3*2^n+4)/10.
BUT WAIT... there is one restriction:
Your source code can not include any of the Titius–Bode law's digits
So, your program can not contain the characters 0, 1, 2,... | stackexchange_codegolf |
Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (A______). Easy enough right? Well here's the catch, your code must also output a second separate sequence when the name of the sequence in the code is changed to the name of the second sequence.
Input Out... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.