instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Write a quine, that when run, creates itself in the current directory, in a source file named itself. We will be using Windows in this, so the file name (and therefore quine) must have the following limitations:
None of these characters \ / : ? * < > |
Fewer than 211 255 characters
Limitations and assumptions
Your c... | stackexchange_codegolf |
The code should take text from standard input:
The definition of insanity is quoting the same phrase again and again and not expect despair.
The output should be a PNG file containing the word cloud corresponding to that text:
The above word cloud was created using a specialized online application and it filtered the... | stackexchange_codegolf |
Given 4096 16-bit integers, only four of which are unique and others appeared twice (so 2050 different integers exist). Find the four uniques.
To time precisely and limit RAM usage, your program will be run on a 12MHz 8051(with 128B RAM). I'll test with a random case generated by some code to test, but we aim at the wo... | stackexchange_codegolf |
Goal
Write a program or function that takes a positive integer n and randomly generate a legal series of pitches (henceforth called a Pitch string) of length n.
Input
A non-zero, positive integer n <= 100
Output
Return a random string, or list of characters, that represent a possible, valid pitch string of length n. Th... | stackexchange_codegolf |
Your friend Jack is a picky eater. He only likes certain foods, and he only likes to eat a certain amount of them each day. Despite this, Jack has very strict calorie and macronutrient goals that he strives to meet with his diet. To complicate things further, Jack's cravings change day by day, and he will only eat the ... | stackexchange_codegolf |
Challenge
Make a triangle of numbers like below.
How to?
Let say we get a numbers in the form of ab, for example 12. We then create a triangle like below:
Sorry for my bad drawing!
First we have 12, and we take sum of the two numbers 1 and 2, which is 3. In case the sum of two numbers are greater than 9, we just take ... | stackexchange_codegolf |
You are provided with a non-empty array \$A\$ of integers, all greater than 0. But what good is an array if the elements do not sum up to the number \$N\$ (also provided as input)...
So to change that, you can pick any integer of your choice present in the array and replace any of its digits with a different digit betw... | stackexchange_codegolf |
Your task is to write a program which given an array and a number, you need to split the array into chunks with size is number.
Rules
Your program will receive an array A , as well as a positive integer n. The array should then be split into chunks of length n, if the length of the string isn't divisible by n any left... | stackexchange_codegolf |
The title says it all; Given a number in the binary (base-2) number system, output the same number expressed in unary (base-1).
You should take the binary number as a string (optionally with a separator), list, or equivalent structure of digits, using any number or digit you like for the digits. The unary output can us... | stackexchange_codegolf |
Conways' Game of Life is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are:
Any live cell with 2 or 3 living neighbours (the 8 cells immediately around it) lives ... | stackexchange_codegolf |
The challenge is this:
You are given a url that is as follows:
http://sub.example.com/some/dir/file.php?action=delete&file=test.foo&strict=true
There can be either http or https, there can be any number of subdomains or directories, and the end file can have any name.
You are to create a full program (that can be comp... | stackexchange_codegolf |
Background
A checkered tiling of a rectangular grid is a tiling using some polyominoes, where each region can be colored either black or white so that no two polyominoes sharing an edge has the same color. In graph-theoretic terms, the chromatic number of the adjacency graph is 2.
Terminology adapted from a Fillomino v... | stackexchange_codegolf |
Given a string containing only letters, output the length of the longest run of consecutive alphabetical letters the word contains, where order does not matter. An example algorithm may sort the word, remove duplicates, and then output the length of the longest run.
Test Cases
watch -> 1
stars -> 3
antidisestablishment... | stackexchange_codegolf |
The task
A string S is constructed with the following process:
Start with S being the empty string.
Insert at some position of S a string of the form ds, where d is a nonzero digit and s is a string of d lowercase ASCII letters. We say ds is a constituent of S.
Go to step 2 or stop.
Your task is to take such a string... | stackexchange_codegolf |
Negadecimal, also known as base -10, is a non-standard positional numeral system.
Take the number \$1337_{10}\$. In decimal, this has the value one thousand three hundred thirty seven, and can be expanded to:
$$1\cdot10^3+3\cdot10^2+3\cdot10^1+7\cdot10^0$$
$$(1000)+(300)+(30)+(7)$$
In negadecimal, instead of \$10^n\$, ... | stackexchange_codegolf |
Chaim Goodman-Strauss, Craig Kaplan, Joseph Myers and David Smith found the following simple (both objectively and subjectively) polygon that tiles the plane, but only aperiodically:
Indeed they found a one-parameter family of such aperiodic monotiles or "einsteins". The edges of all tiles in this family meet at 90° o... | stackexchange_codegolf |
The challenge
Given two integers as input (x and y), output x as a string with as many leading zeroes necessary for it to be y characters long without the sign.
Rules
If x has more than y digits, output x as string without modification.
Output as integer is not accepted, even if there are no leading zeroes.
When x is ... | stackexchange_codegolf |
A bag, also called a multiset, is an unordered collection. You can call it a set that allows duplicates, or a list (or an array) that is not ordered/indexed. In this challenge, you are asked to implement bag operations: addition, difference, multiplication, division, counting and equality test.
Operations
The specified... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost).
Santa is delivering presents to an infinite two-dimensional grid of houses each 1 unit apart. The delivery begins delivering... | stackexchange_codegolf |
In this code golf, you need to get the closest number from another one in a list.
The output may be the closest number to the input.
Example:
value: (Input) 5 --- [1,2,3] --- 3
And, the program may work with negative numbers.
Example:
value: (Input) 0 --- [-1,3,5] --- -1
value: (Input) 2 --- [1, 5, 3] --- 1 (Because... | stackexchange_codegolf |
Print this text:
_________
| |
| |
| |
|_________|
Shortest code wins. Notice the space at the start of the first line.
| stackexchange_codegolf |
In this variant of the Four fours puzzle your should use up to x x's (and no other number) and a defined set of operations to reach every number from 0 to 100. If x = 4 then you can use up to four 4s and this question becomes the classic four fours puzzle (except you can use up to four 4s rather than having to use exac... | stackexchange_codegolf |
Consider this nested array
[[1,2,4],[1,2,3],[2,3]]
In each subarray in which 1 appears, a 2 appears. You might say that 1's presence is dependent on 2's presence.
The converse is not true, as 2 appears in a subarray without 1.
Additionally, 3 is dependent on 2, and 4 is dependent on 1 and 2.
Task
Given a list of lists ... | stackexchange_codegolf |
Challenge
Create a GUI Keyboard with as few characters as possible.
Example
Because this was an assignment in one of my courses, I can't show the source code. However, here is a screen shot of my keyboard.
In this example, my keys were of type JButton and I used a Midi Synthesizer to produce the sound (with the defau... | stackexchange_codegolf |
Consider a non-empty binary matrix M and a natural number n. For the purposes of this challenge, M is said to have blockiness n if it can be built using adjacent square blocks of size n, where each block has equal entries; and it cannot be formed using square blocks of any larger size. Intuitively, n can be thought of ... | stackexchange_codegolf |
Introduction
The task is simple. When given a number, output the most logical rectangle. To explain what a logical rectangle is, I provided some examples:
Input: 24.
All possible rectangles have the form A x B, (A and B are both positive integers). So, all possible rectangles for 24 are:
1 x 24
2 x 12
4 x 6
From this... | stackexchange_codegolf |
Concept
In what ways can you scramble the English alphabet so that it can still be sung to the tune Twinkle Twinkle Little Star without ruining the tune?
Rules
Swapping
Let's just assume the letters contained in each of the following sets can be swapped freely by default without ruining the tune:
{ A, J, K }
{ B, C, ... | stackexchange_codegolf |
EDIT
It appears that there has been some confusion following my typo in the original post which used a lowercase o to define the plane and then an uppercase later. Unfortunately this bug did not get picked up in the Sandbox. Since many members have written answers with both and since the typo was my fault I will allow ... | stackexchange_codegolf |
It is widely known that Santa Claus delivers presents to houses all over the world in December. However, not many people know what he does during the rest of the year. You see, Santa enjoys a jolly good prank, and he'll often find himself pranking entire cities when he's not busy making or delivering toys.
One place t... | stackexchange_codegolf |
Need to write a JS function compare(a,b) for numbers which return
1 when a > b, 0 when a == b, -1 when a < b.
Also following properties should hold:
compare(NaN, NaN) = 0
NaN is bigger than any other number, so compare(NaN, any) = 1 and compare(any, NaN) = -1.
compare(-0.0, 0.0) = -1 and compare(0.0, -0.0) = 1.
Other ... | stackexchange_codegolf |
This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet:
Print all Integers from 1 to 10 inclusive in ascending order to standard output.
Your output format can be whatever your language supports. This includes arbitrary separators (commas, semicolons, newlines, combinations of th... | stackexchange_codegolf |
NOTICE: This challenge is now closed: I will no longer be updating the leaderboard and will not change the accepted answer. However, you are free to run the controller and update the leaderboard yourself, if you wish.
Join the chat!
Introduction
Good evening, traders! You are all traders for the golfing company PPCG.... | stackexchange_codegolf |
Assumption
A cigarette can be made by combining four cigarette butts. Cigarette butts last infinitely until smoked.
Explanation
Say you have 31 butts. That means, you can make 7 cigarettes from 28 butts and have 3 left over.
Now, these 7 cigarettes will yield 7 butts when you're done smoking them. That means you have 3... | stackexchange_codegolf |
This is the robbers' thread to a cops-and-robbers challenge. Click the link to find the cops' thread.
In the cops' thread of this challenge, answerers will be writing programs which output two numbers, \$x\$ and \$y\$. As robbers, your goal will be to crack their submissions. To do this, you find a program in the ... | stackexchange_codegolf |
In this challenge, you'll create some programs which behave similarly to genes. When you run one, it will return one of its two "alleles" (a half of its source code), and concatenating any two alleles from your programs will result in a new, functioning program (which returns its own alleles).
As an example, say you wr... | stackexchange_codegolf |
You are a Computer Science professor teaching the C programming language. One principle you seek to impart to the students is modularity. Unfortunately, past classes have tended not to get the message, submitting assignments with the entire program inside main(). Therefore, for this semester you have issued strict modu... | stackexchange_codegolf |
Inspired by the recent craze over another two character language, ;#
Intro
According to community consensus, acceptable answers on this site must use programming languages that, at minimum:
Can determine if a natural number is prime
Can add two natural numbers together
Can represent a list/tuple of numbers, as well as... | stackexchange_codegolf |
Challenge
In this challenge, the input will be an ordered set of numbers and the program should be able to tell if the set of numbers is an Arithmetic Sequence.
Input
The input will be a list separated by ,(comma) or , (comma+space).
The minimum length of the list should be 3 elements.
Output
The Output can be a Boo... | stackexchange_codegolf |
Your challenge is to write a code-golf HTTP server that accepts GET requests. It obviously doesn't have to be fully featured, but it must serve files from a directory.
Rules:
The HTTP server must listen on TCP port 36895 (0x901F)
It must serve files from /var/www on *NIX systems (e.g. Linux), or C:\hgolf on Windows.
Y... | stackexchange_codegolf |
Challenge
Factory workers are usually very hard-working. However, their work is now being commonly replaced with machines.
You have to write a program that takes a number as input. It will print out a factory of 10 workers 10 times. Every time, each worker has a 1/input chance of being 'fired' and replaced by a machine... | stackexchange_codegolf |
This is the robbers' thread. The cops' thread is here.
Your challenge is to crack a cop's submission by finding an input that makes it halt. You don't have to find out why, or all inputs that make it halt if there's more than one, or the input the cop intended, just one input will do.
Once you have cracked a submission... | stackexchange_codegolf |
It is easy to describe a finite state machine that recognizes multiples of 9: keep track of the digit sum (mod 9) and add whatever digit is accepted next. Such a FSM has only 9 states, very simple! By the equivalence between FSM-recognizability and regular languages, there is a regular expression for multiples of 9. Ho... | stackexchange_codegolf |
Inspired by this
Task
Your task is to output the average character of your code.
What is an average character?
Say we have a string golf().
We then take the ASCII value of each separate symbol, so our string is 103 111 108 102 40 41, and calculate the average of those values, rounded to an integer. In our case the aver... | 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 |
Task
The task is to write a script that accepts a number from 1 to 20 inclusive. It will then check if the number has a character that is found in every number that was entered before it. If the number has a character in common it will ask for another number. However if the number does not have a character in common wi... | stackexchange_codegolf |
Challenge
Given a tic-tac-toe board in any format, determine if it is valid or not. If a board can be the result of a tic-tac-toe game, then it is valid. For example, this board is valid:X O X
O X O
X O XOn the contrary, this board is invalid:
X X X
X X O
O O O
Input
A full (9/9) tic tac toe board (the outcome, not th... | stackexchange_codegolf |
Given (by any means) two different natural numbers (of any reasonable size), output (by any means) the square of their sum as in the examples below:
Given 4 and 3, output:
12 12 12 12 9 9 9
12 12 12 12 9 9 9
12 12 12 12 9 9 9
16 16 16 16 12 12 12
16 16 16 16 12 12 12
16 16 16 16 12 12 12
16 16 16 16 12 12 12
... | stackexchange_codegolf |
Introduction
tl;dr
In this challenge you have to calculate the moon's phase for a given date.
This challenge is inspired by the game psycho social audiovisual experiment "Superbrothers: Sword & Sworcery EP". In S:S&S EP the moon's phases are important to the outcome of the adventure as some events occur only at a spec... | stackexchange_codegolf |
Introduction
This is the evolution of this previous challenge which was about checking satisfieability of normal formulae in conjunctive normal form (CNF). However, this problem is NP-complete and watching algorithms finish is just boring, so we're gonna simplify the problem!
Specification
Input
You may tune the follow... | stackexchange_codegolf |
For this problem you are given an \$n \times n\$ matrix of integers. The task is to find a pentagon in the matrix with maximum sum. The pentagon must include part (or all) of the x and y axes as two of its sides starting from the top left cell.
All the sides except one must be horizontal or vertical. The remaining si... | stackexchange_codegolf |
Wow, time really flies! It's already been one year since the debut of the Code Golf Stack Exchange site design. Let's celebrate this milestone with a code golf challenge... to imitate the site logo!
Golf a program that outputs a graphic of a medal enclosed in curly braces {}, along with two lines of text containing COD... | stackexchange_codegolf |
Inspired by Bake a slice of Pi
Challenge
Given input 3 <= n <= 100 and 3 <= y <= n, construct an n x n matrix of the decimal portion of pi (14159...), starting in the top left. Then, take the upper-right triangle of size y x y and concatenate it together. Output the resulting number.
For example, for input n = 5, y = 3... | stackexchange_codegolf |
In this challenge, your past self comes back to help or hurt someone else!
The task is simple: write a full program, not a function, that prints the first code submission on this site submitted by the previous user, in the language of your first answer. (In the case that your first answer was purely prose, for example ... | stackexchange_codegolf |
Introduction
According to the Riemann Hypothesis, all zeroes of the Riemann zeta function are either negative even integers (called trivial zeroes) or complex numbers of the form 1/2 ± i*t for some real t value (called non-trivial zeroes). For this challenge, we will be considering only the non-trivial zeroes whose ima... | stackexchange_codegolf |
Something unusual: a code golf question with a purpose.
I occasionally find myself in scenarios resembling the following:
Suppose you have two computers, A and B. Both of them have a fresh copy of Windows 10 installed. It comes with all the usual stuff, like notepad and paint and a browser, but no extras, like a Linu... | stackexchange_codegolf |
Inspired from Is this site down or is it just me?
Challenge
You have to print if a website server is online or not, for you.
Input
The domain name, like codegolf.stackexchange.com
Output
1/True if online
0/False if offline
Rules
Any kind of web access is allowed
URL shorteners allowed
Except 2 no. Rule, all standa... | stackexchange_codegolf |
I have a set of colored plastic cups. They come in four colors: green, yellow, pink, and blue. When I put them on my shelf, I like to stack them in a certain pattern. Your job is, given a list of any number of four distinct values (to represent the four cup colors), output a visual representation of how I would stack t... | stackexchange_codegolf |
This is a version of this question which should not have such a straightforward solution and so should be more of an interesting coding challenge. It seems, for example, very likely there is no easy to find closed form solution, even though we have only increased the bound by one from the previous version. Having said ... | stackexchange_codegolf |
Title stolen inspired by Greg Hewgill's answer to What's the difference between JavaScript and Java?
Introduction
Java and JavaScript are commonly used languages among programmers, and are currently the most popular tags on Stack Overflow. Yet aside from similar names, the two have almost nothing in common.
In honor of... | stackexchange_codegolf |
Write a program that accepts HTTP requests on any port of your choice above 1024, and responds to requests on any URL of your choice with its own source code. It must work with, at least, Firefox and Chrome. The code should be delivered as text/plain (removed requirement because none of the answers but one met it) with... | stackexchange_codegolf |
Given a decimal integer n as input, output the smallest (in terms of absolute value) decimal integer m such that the absolute value of n-m is a binary integer (composed only of 1s and 0s).
n and m can be any integer, positive or negative.
Example
Let n = 702. The closest binary integer is 1000 = |702 - (-298)|, so m = ... | stackexchange_codegolf |
Task
You will be given a set of circles in the plane with their centers on the line y=0. It is guaranteed that no pair of circles has more than one common point.
Your task is to determine into how many regions into which the circles divide the plane. A region is an inclusion-maximal contiguous set of points not interse... | stackexchange_codegolf |
Your task is to write a program that performs case conversion from plain text, and other case formats, into one of the specified formats below. Inputs will be either plain lowercase text, or one of the detailed cases below. You must remove non-alphabetic characters except (space), _ (underscore) and - (hyphen), then ... | stackexchange_codegolf |
It frustrates me that when you say "base 16", the 16 is in base 10. We need a base neutral way of writing down numbers when favoring a specific base would be inappropriate.
How it works
We define <n> to be the nth prime. So <1>=2, <2>=3, <3>=5. Note that every positive integer can be uniquely represented by the product... | stackexchange_codegolf |
Given π to an arbitrary number of places, your challenge is to locate indices of π where the index (1,2,3,4...) and the string of numbers from that index carry the same value for the length of the index.
That sounds complex, so let's look at an example!
Indices will count from +1 upwards through natural whole integers,... | stackexchange_codegolf |
Today, your task is to write a program (or a function) that accepts a string and outputs (or returns) four integers.
Input
The input string is a CSS3 selector, and can contain basically any Unicode character.
Output
The output represents the CSS specificity of this selector.
The first number is always 0 (because it'... | stackexchange_codegolf |
Implement a CipherSaber encryption program, as described below. Guidelines:
The smallest entry, in bytes, wins.
However, in a departure from code-golf norms, you are welcome to post interesting entries, even if they aren't serious golf entries.
An entry would typically be a program that takes the plaintext from sta... | stackexchange_codegolf |
This is a code-golf question.
Given integers s and n the task is to output all arrays of length n which take values from -s to s. The only twist is that you must output them in the following order.
The all zeros array of length n.
All arrays of length n with elements from -1 to 1 excluding any array you have outputt... | stackexchange_codegolf |
Inspired by this challenge (thanks @cairdcoinheringaahing for the title!), your task is to take two printable ASCII strings and multiply them element-wise with the following rules.
How does it work?
Given two strings (for example split and isbn) you will first, truncate the longer one such that they have equal length a... | stackexchange_codegolf |
This Stack Snippet draws an aliased white rectangle on a black background given parameters for its dimensions, position, angle, and the grid dimensions:
<style>html *{font-family:Consolas,monospace}input{width:24pt;text-align:right;padding:1px}canvas{border:1px solid gray}</style><p>grid w:<input id='gw' type='text' ... | stackexchange_codegolf |
Recently I had a Maths test and noticed that a certain number on the test matched an interesting pattern. The number (28384) matched a generic digit sequence that looks like this
(n)(x)(n+1)(x)(n+2)(x)(n+3) etc...
where n and x are single digit integers. The sequence can begin with either x or n and end with either x ... | stackexchange_codegolf |
Background
Perfect shuffle algorithms like Fisher-Yates shuffle don't produce great results when it comes to music playlist shuffling, because it often produces clusters of songs from the same album. In an attempt to solve this problem, Spotify introduced an interesting shuffle algorithm in 2014. At the end of the arti... | stackexchange_codegolf |
Since Halloween is coming up I thought I might start a fun little code golf challenge!
The challenge is quite simple. You have to write a program that outputs either trick or treat.
"The twist?" you may ask. Well let me explain:
Your program has to do the following:
Be compilable/runnable in two different languages. D... | stackexchange_codegolf |
This is a cross-post of a problem I posted to anarchy golf: http://golf.shinh.org/p.rb?tails
Given two integers \$ n \$ and \$ k \$ \$ (0 \le k \le n) \$, count the number of combinations of \$ n \$ coin tosses with at least \$ k \$ tails in a row.
For example, if \$ n = 3 \$ and \$ k = 2 \$, the answer is \$ 3 \$:
HHH... | stackexchange_codegolf |
Task
Given a finite permutation output its inverse.
You may take input and output in any reasonable format equivalent to a list of natural numbers. You may choose to use 0 indexing or 1 indexing. Your input and output format should be the same. You may assume a permutation has at least 1 element.
This is code-golf so... | stackexchange_codegolf |
The below pattern will form the basis of this challenge.
/\
\/
/\
/ \
/ \
/\/ \/\
\/\ /\/
\ /
\ /
\/
/\
\/
Given an input width and height, each >=1, output the above ASCII art pattern repeated that many times, joining (and overlapping) at the small diamond... | stackexchange_codegolf |
You will need to evaluate the definite integral (bounded by \$a\$ and \$b\$) of a certain polynomial function that takes the form of:
$$\int_a^b \left( k_n x^n + k_{n-1} x^{n-1} + \cdots + k_2x^2 + k_1x + k_0 \: \right) dx$$
Normally, this can be done using the fundamental theorem of calculus and power rules. For examp... | stackexchange_codegolf |
Background
Ramanujan's number, \$1729\$, is called a taxi-cab number due to the (possibly apocryphal) tale of Hardy boarding a cab to visit Ramanujan in hospital having this number, which seemed bland to him.
It's since known as the most famous of a class of integers known as "taxicab numbers" which are expressible as ... | stackexchange_codegolf |
Stackylogic is a programming language I made up in a previous challenge: Run Stackylogic. Read that post for full details and examples, but here is how it works paraphrased:
Stackylogic takes 0's and 1's for input and outputs a single 0
or 1 upon completion.
A program consists of lines that only contain the characte... | stackexchange_codegolf |
Write a program that takes a string as input and modifies it by reversing the string in its place by mirroring the position. The first position goes to last, second to second last and so it goes on. In simple words, the string would be mirrored.
"In Place" means the program should use \$O(1)\$ additional memory regardl... | stackexchange_codegolf |
Quote notation is a way of expressing rational numbers based on the concept of \$p\$-adic numbers, written in the form \$x'y\$.
The quote indicates that the number to it's left (\$x\$) is "repeated" infinitely to the left, then prefixed to the number on the right (\$y\$). For example \$3' = \: ...3333\$ and \$764'31 = ... | stackexchange_codegolf |
As you probably know, a Fibonacci Number is one which is the sum of the previous two numbers in the series.
A Fibonacci Digit™ is one which is the sum of the two previous digits.
For instance, for the series beginning 1,1, the series would be 1,1,2,3,5,8,13,4,7,11,2... The change occurs after the 13, where, instead of ... | stackexchange_codegolf |
We have a challenge to calculate the hyperfactorial and one to count the trailing zeros of the factorial, so it seems logical to put them together and count the trailing zeros in the hyperfactorial.
As a recap, the hyperfactorial of a number, H(n) is simply Πiⁱ, that is, 1¹·2²·3³·4⁴·5⁵·…·nⁿ. It can be defined recursiv... | stackexchange_codegolf |
Specification
Write the shortest possible code in any language that does the following:
It takes two arguments, x and y, and generates x + y lines of text.
The first x lines should consist of y nested pairs of square brackets separated by a space surrounding a single digit, which cycles from 1 to 9, then 0 to 9, etc. f... | stackexchange_codegolf |
The original "Blue Eyes" puzzle is given here (and below).
A group of people with assorted eye colors live on an island. They are
all perfect logicians -- if a conclusion can be logically deduced,
they will do it instantly. No one knows the color of their eyes. Every
night at midnight, a ferry stops at the islan... | stackexchange_codegolf |
Yesterday while playing with my kid I noticed the number in his toy train:
So we have $$4281$$ that can be split into $$4-2-8-1$$ or $$2^2-2^1-2^3-2^0$$
So simple challenge: given a non-negative number as input, return consistent truthy and falsey values that represent whether or not the string representation of the n... | stackexchange_codegolf |
Objective
Given two Chinese ideographs meaning basic colors, output the ideograph that means the color resulting from mixing them.
Basic colors
The basic colors are:
靑(U+9751; blue)
赤(U+8D64; red)
黃(U+9EC3; yellow)
白(U+767D; white)
黑(U+9ED1; black)
Mixed colors
Mixing 靑(blue) and 赤(red) yields 靘(U+9758; purple).
Mix... | stackexchange_codegolf |
Write a program that outputs all possible Tic Tac Toe positions including the corresponding game outcome. Avoid duplicate output of equal positions.
The program takes no input.
Rules:
A position output must consist of 9 characters, using X and O for the taken squares, and an arbitrary non-whitespace character for the ... | stackexchange_codegolf |
A typo is said to have occurred if:
A character is missing.
A character is extra.
A character is replaced with another wrong character.
For the purpose of this challenge, only lowercase characters and spaces are used.
Input will be a dictionary of words, followed by one line of input. You need to find the (minimum) n... | stackexchange_codegolf |
Given the output of the cop's program (o), the byte-count (n) and the number of unique bytes (c) used, come up with a corresponding piece of code that is n bytes long with c unique bytes which matches the cop's output o.
This is the robbers thread. Post solutions that you cracked here.
The COPS thread is located here.... | stackexchange_codegolf |
The challenge is simple: Read 3 letters from a system input¹ and convert them to numbers (A-1, B-2, C-3...Z-26)². Print each of those numbers in the order the letters were inputted in, each on a new line and then the sum of all 3 numbers, on its own line as well.
NOTE: There will be no extra input characters, only 3 le... | stackexchange_codegolf |
This challenge is based on the idea of Plouffle's Inverter.
Write a program in any language that does the following:
Takes as input a non-negative rational number X written in decimal, for example 34.147425.
Returns a mathematical expression using only non-negative integers, whitespace, parentheses, and the following ... | stackexchange_codegolf |
I'm trying to solve a CSS challenge. It contains a rotated leaf shape (looks like an eye). Score for the challenge depends on amount of characters of the code. Here's my way to make a leaf shape:
div {
width: 200px;
height: 200px;
border-radius: 99% 0;
rotate: 45deg;
background: #d9d9d9;
}
<div></div>
He... | stackexchange_codegolf |
Definition
The chain rule with two functions state that:
D[f(g(x))] = f'(g(x)) * g'(x)
Or, alternatively:
D[f1(f2(x))] = f1'(f2(x)) * f2'(x)
The chain rule with three functions state that:
D[f(g(h(x)))] = f'(g(h(x))) * g'(h(x)) * h'(x)
Or, alternatively:
D[f1(f2(f3(x)))] = f1'(f2(f3(x))) * f2'(f3(x)) * f3'(x)
Et ce... | stackexchange_codegolf |
Given N integers, output the sum of those integers.
Input
You may take the integers in any reasonable format, including:
stdin
arguments
an array or list
Rules
Your code must not include the characters + or -.
Standard loopholes apply. Take note of Abusing native number types to trivialize a problem.
This is code-... | stackexchange_codegolf |
If you have read in your childhood a Geronimo Stilton's book, I am sure that you remember the style of the text, sometimes the words were decorated for making the act of reading more funny for kids: example.
But when you are an adult you don't have that little entertainment in your readings... why?
In a nostalgic attac... | stackexchange_codegolf |
English is such an inefficient language. We've got enormous words when
there are plenty of two or three letter words we never used! As
computer scientists, every keystroke matters. We need to be more
efficient. Just think of how many words we could have had! In fact,
don't think about it, tell me.
Given a string (or li... | stackexchange_codegolf |
Given an ordered list of 2 or more 2D cartesian points, output a truthy value if either the path touches itself or self-intersects; otherwise output a falsy value if it does not touch itself or self-intersect.
You may assume that consecutive points in the list are distinct.
Examples:
(0,0), (1,0) -> falsey
(0,0), (1,0)... | stackexchange_codegolf |
In this challenge, submissions will be programs or function which, when given an emoticon such as :-), :(, or :D, will rate their happiness from 0 to 3.
An emoticon will be one of the following:
:(: 0
:|: 1
:): 2
:D: 3
Emoticons may also have noses (a - after the :).
Test cases:
:( -> 0
:-| -> 1
:D -> 3
:-) -> 2
:|... | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.