instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$.
There are almost always multiple possible outputs; you should output at least one of them, but you can output more.
You can assume this is possible with the input... | stackexchange_codegolf |
The autokey cipher is closely related to the Vigenère cipher (both were invented by Blaise de Vigenère). Decryption involves the encrypted message and the key. For simplicity, let us assume all characters in the message and key are lowercase letters (no spaces, numbers or symbols etc.).
How to decrypt the cipher
Conve... | stackexchange_codegolf |
The goal of this challenge is to produce an animation of a chain drive system, comprised of a set of sprocket gears connected together by a chain.
General Requirements
Your program will be given a list of sprockets, specified as (x, y, radius) triplets.
The resulting chain drive system is comprised of these sprockets, ... | stackexchange_codegolf |
This is a throwback challenge. You will choose an old computer system and an old language created for that system.
The challenge
Pick an old computer system that was made before the year 2000. In a programming language that was created to run on that system, print said system's logo.
Example systems, their languages, a... | stackexchange_codegolf |
Your task is to turn a square root like this:
√12
into a form like this:
2√3
For our purpose, we only need to output the left number here:
2
Test cases
4 -> 2
9 -> 3
12 -> 2
13 -> 1
108-> 6
Specifications
You may assume for the input that \$n>0\$. \$n\$ has to be as large as possible.
If the number is already a ... | stackexchange_codegolf |
Task
Your task is to take an array of numbers as input, and produce a new one where each number has been shifted both right and left, leaving 0s if no number fills a spot. This process can be represented graphically like this:
[x]
/ | \
[x, 0, x]
This is done with every number in the list, with overlapping number... | stackexchange_codegolf |
Challenge
You need to generate a program or function that takes in a positive integer N, calculates the first N terms of the Fibonacci sequence in binary, concatenates it into a single binary number, converts that number back to decimal, and then outputs the decimal as an integer.
For example
1 -> [0] -> 0 to decimal o... | stackexchange_codegolf |
Ouput the following banner:
_____ _ _____ _ __
/ ____| | | / ____| | |/ _|
| | ___ __| | ___ | | __ ___ | | |_
| | / _ \ / _` |/ _ \ | | |_ |/ _ \| | _|
| |___| (_) | (_| | __/ | |__| | (_) | | |
\_____\___/ \__,_|\___| \_____|\___/|_|_|
The code ... | stackexchange_codegolf |
Introduction
I've seen throughout the code-golf challenges several simple tasks involving JSON, such as interpreting JSON strings with RegExs, and almost every other manipulation I could think of.
In a binding for AppleScript that I was using for a Node project, I noticed that objects would be returned in a strange wa... | stackexchange_codegolf |
Inspired by this example of using d3js, I challenge you to create a canvas (or your language-of-choice equivalent) in which the mouse pointer trails will be displayed, with the following twist:
The Twist
You should not display the trails of where the mouse pointer was, but the "trails" of where it will (might) be in f... | stackexchange_codegolf |
Cops thread (read first)
Robbers, your task is to find a Shue program p that when given the cops input i, outputs a program h, which outputs "Hello Shue!". The length of your p has to be less than or equal to the length of the cop's p. The robber with the most cracks wins.
| stackexchange_codegolf |
The challenge is to calculate the digit sum of the factorial of a number.
Example
Input: 10
Output: 27
10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27
You can expect the input to be an integer above 0.
Output can be of any type, but the answer sh... | stackexchange_codegolf |
Given a string containing some parentheses and some other ASCII printable characters, like this: (abc((123))(k)) your task is to remove any sets of parentheses that are redundant.
A set of parentheses is redundant if:
It encloses another set of matching parentheses, like ab((123)), or
It encloses the entire string, li... | stackexchange_codegolf |
Background
A magic square is an n×n matrix consisting of one of each of the integers from \$1\$ to \$n^2\$ where every row, column, and diagonal sum to the same value. For example, a 3×3 magic square is as follows:
4 9 2
3 5 7
8 1 6
Here, each row, column, and diagonal sum to the magic sum of 15, which can be calculat... | stackexchange_codegolf |
Write a program or function that, when given a string, filters out as many distinct bytes as it can and returns the cleaned string. However, since your program hates them, none of these bytes can be present in your own code.
Your score will be the number of distinct bytes your program filters out from the input, with t... | stackexchange_codegolf |
The brainiacs at New Scientist tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again to make ABLEST." (https://twitter.com/newscientist/status/1379751396271124480)
This is of course correct. It is not, however,... | stackexchange_codegolf |
This is a code-golf, so keep your code small!
The objective is to create a function that receives 3 arguments:
Rows(int): The max number of an item in each array;
Cols(int): The max number of dimensions (sub-arrays);
Val(*): The starting value in each item;
This function should return a multidimensional array with... | stackexchange_codegolf |
Much harder than Can this pattern be made with dominoes?
Challenge
A grid of width \$w\$ and height \$h\$ is given, filled with 1s and 0s. You can place a domino somewhere on the grid only if both cells are 1. You cannot overlap dominoes. What is the maximum number of dominoes you can fit in the given grid?
The worst-c... | stackexchange_codegolf |
Sometimes, I will think it is one day of the week (e.g Friday) when in reality, it's earlier in the week (e.g Tuesday).
Your challenge is to display the number of days my estimates are off by.
Challenge
Given a day of the week I think it is, and the day of the week it actually is, output/return the number of days betwe... | stackexchange_codegolf |
Uilta is a minority tungusic language spoken in the far east of Russia.
A neat thing about Uilta is that it has pitch accent which can be predicted by a computer program. In this challenge we are going to take Uilta a word and determine where the accent peak is.
Let me explain how this can be done.
Phonemes
The first ... | stackexchange_codegolf |
Your task is to take an array of numbers and a real number and return the value at that point in the array. Arrays start at \$\pi\$ and are counted in \$\pi\$ intervals. Thing is, we're actually going to interpolate between elements given the "index". As an example:
Index: 1π 2π 3π 4π 5π 6π
Array: [ 1.1, 1... | stackexchange_codegolf |
Recreational languages win at code golf too much. This challenge is simple, when using higher level functions.
The task is as follows:
Given any valid url, which is guaranteed to result in a valid HTML document (for example https://en.wikipedia.org/wiki/Ruby_on_Rails, which has 9 images), count the number of images di... | stackexchange_codegolf |
Introduction
Ah, INTERCAL...
As much as I'd like encourage everyone to Try it Online, text output is just painful.
According to the docs it uses the "Turing Text Model".
While an... interesting concept, using it is about as much fun as shooting yourself in the foot.
And what do we do with a task like this? Automate it.... | stackexchange_codegolf |
Encrypting Challenge
Your encrypting program must be able to do following things:
Input password
Generate random key
Encrypt random key with set key
Then, the decrypting program must be able to these things:
Input encrypted password
Input encrypted random key
Decrypt random key
Decrypt password with decrypted random ... | stackexchange_codegolf |
As it turns out, Python allows for 1j for to be compressed to 1jfor. However, jfor sounds like xnor. Since all similar-phonic phrases have something in common, there must be some property shared between jfor and xnor.
If we look at the ASCII representation of the first two characters of jfor in binary, we see:
j: 110... | stackexchange_codegolf |
This is a Google interview question, see here for a youtube link.
The task:
Find 2 integers from an unordered list that sum to a given integer.
Given an unordered list of integers, find 2 integers that sum
to a given value, print these 2 integers, and indicate success (exit 0). They don't need to be any particular num... | stackexchange_codegolf |
You've recently made an account on a dodgy gambling site, where for a fee of 25 dollars, they will pay you back a random amount between 0 and 50 dollars. After getting around 5 dollars twice, you decide to prove the site is a scam. After accessing their external firewall with the default password, you find your way ont... | stackexchange_codegolf |
Write a program using the fewest bytes of source code which given a list of strings finds all elements which are still in the list when any character is deleted.
For example, given a list of all English words boats would be output because oats, bats, bots, boas, boat are all English words and thus would be in the list.... | stackexchange_codegolf |
https://www.youtube.com/watch?v=6vAhPeqlODg
Ok—jig's up—this one's only related to smash in name, but it'll give you something to burn your time with while you wait 'til December 7th
Given a color string s of form #rgb(in hex, so #000000 to #ffffff, dont worry about the three digit ones: #123) you must average the rgb ... | stackexchange_codegolf |
Shortest answer wins.
It must be sorted, and in 24hr time. The final line does not have a comma.
Output should be as follows:
'00:00',
'00:30',
'01:00',
'01:30',
'02:00',
'02:30',
'03:00',
'03:30',
'04:00',
'04:30',
'05:00',
'05:30',
'06:00',
'06:30',
'07:00',
'07:30',
'08:00',
'08:30',
'09:00',
'09:30',
'10:00',
'10:3... | stackexchange_codegolf |
Pip is an imperative golfing language with infix operators. It also borrows some features from functional and array programming.
What general tips do you have for golfing in Pip? I'm looking for approaches and tricks that are commonly useful for code golf and are specific to Pip (e.g. "remove comments" is not an answer... | stackexchange_codegolf |
Upside-Down Pyramid Addition is the process of taking a list of numbers and consecutively adding them together until you reach one number.
When given the numbers 2, 1, 1 the following process occurs:
2 1 1
3 2
5
This ends in the number 5.
YOUR TASK
Given the right side of an Upside-Down Pyramid (Ascen... | stackexchange_codegolf |
Challenge
Given a positive integer, return the product of its divisors, including itself.
This is sequence A007955 in the OEIS.
Test Cases
1: 1
2: 2
3: 3
4: 8
5: 5
6: 36
7: 7
8: 64
9: 27
10: 100
12: 1728
14: 196
24: 331776
25: 125
28: 21952
30: 810000
Scoring
This is code-golf, so the shortest answer in each language... | stackexchange_codegolf |
Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length l and height h without ever having 3 consecutive Xs in a row diagonally, horizontally, or vertically.
This is a code-golf challenge so shortest code wins!
Input
A single line containing values l and h, representing the length and heigh... | stackexchange_codegolf |
New to code golf and enjoying it. I have a problem that I cannot figure out and am curious if others can solve it.
Start with two dictionaries, y and z:
y = {'a': 1, 'c': 3, 'e': 5, 'g': 7}
z = {'b': 2, 'd': 4, 'f': 6, 'h': 8}
y and z both map length-1 strings to numbers, where each number is between 1 and 26 (inclusi... | stackexchange_codegolf |
Background
In Boggle, a round is scored by adding up the points for each unique word a player has found (i.e. any word that more than one player has found is worth 0 points). The points are calculated based on the number of letters in each word, as follows:
3 letters: 1 point
4 letters: 1 point
5 letters: 2 points
6 le... | stackexchange_codegolf |
Van der Waerden's theorem says that
For any given positive integers r and k, there is some number N such
that if the integers {1, 2, ..., N} are colored, each with one of r
different colors, then there are at least k integers in arithmetic
progression all of the same color. The least such N is the Van der
Waer... | stackexchange_codegolf |
Growing up, my first console game system was an Atari 2600 and I will always have a love for some of those games I so enjoyed as a child. Many of the graphics are still memorable, perhaps even iconic.
It turns out that these sprites are very simplistic bitmaps, 8 pixels wide with variable height where the binary repre... | stackexchange_codegolf |
If we have a finite list of elements we can determine the probability of any one element being drawn at random as the number of times it occurs divided by the total number of elements in the list.
For example if the list is [2,3,2,4] the probability of drawing 2 is \$\frac 1 2\$ since there are \$2\$ 2s and \$4\$ eleme... | stackexchange_codegolf |
Select any word from https://websites.umich.edu/~jlawler/wordlist with length greater than 1. For each letter on that word, remove it and check if any rearrangement of the remaining letters is present in the wordlist. If it is, this rearrangement is a child anagram of the original word.
For example, theism:
removing t... | stackexchange_codegolf |
It seems as of recent, there have been a lot a Jimmys falling to their death, as can be seen here, and here where you were asked to determine if Jimmy would fall. It is time we put a stop to this madness and try to save Jimmy.
Jimmy has three body parts /, o, and \ arranged like this
/o\
Platforms are represented with... | stackexchange_codegolf |
Definition
A dollar word is a word where when each of its letters is given a cent value, from a = 1 to z = 26, and the letters are summed, the result is 100. Here is an example on CodeReview, and here is a list of dollar words I found online.
Input
Input will be alphabetical from a-z, in your one language's text dataty... | stackexchange_codegolf |
So I got kinda bored and was wondering if it was possible to make this code shorter without modifying anything except a file named coin.py...
from random import*;c=['heads','tails'];print('u win'if choice(c)==input(' / '.join(c)+': ')else'u lose')
The program asks the user for either "heads" or "tails", if the result ... | stackexchange_codegolf |
"Buzzing" Bill is a well respected beaver. He is the hardest working in his home dam. He was a strong beaver and was able to lift more logs than anyone at the dam. Unfortunately Buzzing Bill's career came to an end in a tragic accident. Being such a prominent figure in his town, the Beaver newspaper wanted to write a ... | 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 |
Print or return the following string:
R******* *R****** **R***** ***R**** ****R*** *****R** ******R* *******R
*....... .*...... ..*..... ...*.... ....*... .....*.. ......*. .......*
*....... .*...... ..*..... ...*.... ....*... .....*.. ......*. .......*
*....... .*...... ..*..... ...*.... ....*... .....*.. ......*. ...... | stackexchange_codegolf |
Consider this file path:
C:/Users/Martin/Desktop/BackupFiles/PC1/images/cars/new.png
Your goal is to write a program that will return the file path starting from the folder after the last folder that contains a number till the filename. So, for the above file path, the program should return images/cars/new.png.
One or... | stackexchange_codegolf |
Lucky dice rolls
In pen and paper roleplaying games dice are used for various chance calculations. The usual way to describe a roll is \$n\textbf{d}k\$ where \$n\$ is the number of dice and \$k\$ is the number of faces on a die. For example \$3d6\$ means that you need to roll the classical 6-sided die 3 times (or roll ... | stackexchange_codegolf |
To solve the Halting Problem you are given a description of a program, and must determine whether or not it will ever finish. You can never do this for all programs. Yet for programs like (in brainf***):
>
It obviously will halt, and for programs like:
+[]
It obviously will not. Your challenge is to "solve" the halti... | stackexchange_codegolf |
The other day we were writing sentences with my daughter with a fridge magnet letter. While we were able to make some(I love cat), we didn't have enough letters to make the others (I love you too) due to an insufficient amount of letters o (4)
I then found out that while one set included 3 e letters it had only 2 o let... | stackexchange_codegolf |
As we all know, modern operating systems have thread schedulers that can pick different orders to schedule your threads based on internal logic which your code is not privy to. Normally you architect your multithreaded code to ensure that this nondeterminism imposed on you does not meaningfully affect your output.
The ... | stackexchange_codegolf |
A superpermutation on n symbols is a string which contains every permutation of n symbols in its body. For instance, 123121321 is a superpermutation on three symbols because it contains 123, 132, 213, 231, 312 and 321 as substrings.
The Challenge
Given a string composed of n unique symbols (and, optionally, n), output ... | stackexchange_codegolf |
Note: This is based on Two roads diverged in a yellow wood (part 2), a previous challenge of mine. Because of the popularity of that question and Two roads diverged in a yellow wood (part 1), I wanted to make a third. But the first 2 were too easy (a 2-byte answer on the first, a 15-byte answer on the second.) So I ma... | stackexchange_codegolf |
This is cops-and-robbers. This is the Cops thread. For the robbers thread, go here.
I've noticed a number of OEIS (On-line Encyclopedia of Integer Sequences) challenges since I joined the site. It seems only fair that we have a cops-and-robbers challenge that determines who is the master of online integer sequences, on... | stackexchange_codegolf |
Given a string consisting of only printable ascii (letters, numbers, symbols, and spaces), how many keystrokes are required minimally to type out this string from scratch?
That is, current text is initially an empty string and should end up being equal to the input string. These are the allowed actions and their cost i... | stackexchange_codegolf |
Let us define a sequence. We will say that \$a(n)\$ is the smallest number, \$x\$, that has the following properties:
\$x\$ and \$n\$ are co-prime (they share no factor)
\$x\$ does not appear earlier in the sequence
\$|n - x| > 1\$
Unlike most sequences the domain and range of our sequence are the integers greater t... | stackexchange_codegolf |
So,
My friend has come up with this interestng question, that is, given two numbers x and y deciding whether their difference: x-yis 0 or less without using any conditionals. The code should return 0 if they are 0 or less, or the result of the subtraction otherwise.
My attempt (In Pseudo-Java):
try {
Math.log(x-y);
} c... | stackexchange_codegolf |
We can arrange the positive integers like this:
1_| 2 | 5 | 10
4___3_| 6 | 11
9___8___7_| 12
16 15 14 13
That is, in L-shaped brackets expanding down and right infinitely.
Then, we can read it off with the antidiagonals:
1 2 5 10
/ / /
4 3 6 11
/ / /
9 8 7 12
/ / /
16 15 14 13
For the above, we rea... | stackexchange_codegolf |
Introduction
All these snakes everywhere! I've had enough, and have decided that I much prefer camels. Therefore, I want you to convert my snakes to camels for me.
Challenge
Turn any snake_case string into a camelCase string.
Capitals should be returned to lowercase before the conversion occurs.
Test Cases
In: camel_c... | stackexchange_codegolf |
Problem
Given a positive integer n where n < 100
Output a diamond pattern as follows:
Input n=1
/\/\
\/\/
Input n=2:
/\ /\
//\\/\/\//\\
\\//\/\/\\//
\/ \/
Input n=3:
/\ /\
//\\ /\ /\ //\\
///\\\//\\/\/\//\\///\\\
\\\///\\//\/\/\\//\\\///
\\// \/ \/ \\//
\/ ... | stackexchange_codegolf |
Context
The water buckets riddle or the water jugs riddle is a simple riddle that can be enunciated in a rather general form as:
Given \$n > 0\$ positive integers \$a_1, a_2, \cdots, a_n\$ representing the capacities (in units of volume) of \$n\$ buckets and a positive integer \$t \leq \max(a_1, a_2, \cdots, a_n)\$, fi... | stackexchange_codegolf |
This originally came from Give the best Chaitin incompleteness bound, but I realized that there was a fragment of this problem which still potentially gives a good coding challenge.
First Order Logic With Equality
First, I will need to fix an encoding of first order formulas ('For all x there exists y such that ...'). ... | stackexchange_codegolf |
Black Box is a board game, Your task is to reveal all clues.
What is black box
Black box is a board game with hidden atoms, Your task is given input, All atoms, reveal all clues.
I/O
Input
The atoms can be any 1-char that is not newline (Used for separator) Like this.
O....
...O.
..O..
.....
....O
Output
When the code... | stackexchange_codegolf |
Because we haven't had enough of these, let's do another weird language!
+ increments the accumulator
- decrements the accumulator
# outputs the character with the codepoint of the accumulator modulo 127, and then resets the accumulator
$ is like # but it doesn't reset the accumulator
% reads a single character of inp... | stackexchange_codegolf |
Consider the following triangle.
1
23
456
7891
01112
131415
1617181
92021222
324252627
2829303132
33343536373
839404142434
4454647484950
51525354555657
585960616263646
5666768697071727
37475767778798081
As you probably noticed, the first row is of length 1, and each row thereafter is 1 digit longer than to the previo... | stackexchange_codegolf |
Make an upside down triangle of positive integers. Every number in the triangle must be distinct. Each number is the summation of its two parents (similar to how Pascal's triangle is constructed, but upside-down). Construct it in such a way that the bottom number is minimized.
For example, for input n = 4, here is a po... | stackexchange_codegolf |
What tips do people have for golfing in TeX/LaTeX? Please post one tip per answer, each at least somewhat specific to TeX/LaTeX.
Context: I noticed this answer and that there is no tips question for TeX/LaTeX, so I'm creating this one. There's some overlap with the narrower question tips for golfing in TikZ (as TikZ i... | stackexchange_codegolf |
Challenge
Winter is fast approaching with many places receiving the first layers of snow for the 15/16 season, so why don't we break out the snow machines and code ourselves some snow?
Given a integer n via STDIN, output an ASCII representation Beta's snowflake (as described below) at level n.
Beta's Snowflake
The snow... | stackexchange_codegolf |
Given an integer n, decompose it into a sum of maximal triangular numbers (where Tm represents the mth triangular number, or the sum of the integers from 1 to m) as follows:
while n > 0,
find the largest possible triangular number Tm such that Tm ≤ n.
append m to the triangular-decomposition representation of n.
subt... | stackexchange_codegolf |
Task
You are playing Hangman, and your opponent uses a simple but effective strategy: Each turn, from the remaining letters, they guess the letter that appears most frequently across all possible words. When multiple letters appear with the same maximum frequency, your opponent selects randomly among them.
That is, yo... | stackexchange_codegolf |
Near the middle of the semester in chemistry, we get problems like:
Convert 1.283850057 to Scientific Notation
and
Convert 3.583✕106 to Standard Notation
This is just stupid busy work for people who already know how to do this. So…
The Challenge
Given an input in any reasonable, convenient format, in either standar... | stackexchange_codegolf |
Awhile back I encountered a simple programming puzzle to determine whether a string was a pangram, or a perfect pangram. (Although it's worth noting that this particular challenge gave a different meaning than the standard definition of a "perfect pangram," to mean any sentence where every letter appears n times for so... | stackexchange_codegolf |
Given the signal level L in the range 0-4. Your program should draw the following ASCII art.
When L=0:
....
....
.... ....
.... ....
.... .... ....
.... .... ....
.... .... .... ....
.... .... .... ....
.... .... .... ....
When L=1:
....
... | stackexchange_codegolf |
For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run into a bit of ... | stackexchange_codegolf |
A reflexicon is a self-descriptive word list that describes its own letter counts. Take for example the one found by Ed Miller in 1985 in English:
Sixteen e’s, six f’s, one g, three h’s, nine i’s, nine n’s, five o’s, five r’s, sixteen s’s, five t’s, three u’s, four v’s, one w, four x’s
This reflexicon contains exactl... | stackexchange_codegolf |
Story
I need to remember a lot of passwords and don't want to use the same one for multiple websites so I came up with a rule, but the rule shouldn't be transparent so what I do is:
Think of a long word or concept such as breadpudding.
Replace the first letter with the site we are logging into. If we are logging into ... | stackexchange_codegolf |
This challenge is based off of Helka Homba's question Programming a Pristine World. From that question, the definition of a pristine program is:
Let's define a pristine program as a program that does not have any errors itself but will error if you modify it by removing any contiguous substring of N characters, where ... | stackexchange_codegolf |
Overview
Given a list of digits, find the fewest operations to make 100
Input
A string of digits, which may or may not be in numerical order. The order of the digits cannot be changed, however plus (+) or minus (-) operators may be added between each so that the total sum is equal to 100.
Output
The number of operators... | stackexchange_codegolf |
Related but different.
Part II
Taken from the book: Marvin Minsky 1967 – Computation:
Finite and Infinite Machines, chapter 14.
Background
As the Gödel proved, it is possible to encode with a unique positive integer not just any string
but any list structure, with any level of nesting.
Procedure of encoding \$G(x)\$ i... | stackexchange_codegolf |
All Aboard the ASCII Train!
o O O ___ ___ ___ ___ ___ ___ ___ ___ ___
o | C | | O | | D | | E | | | | G | | O | | L | | F |
TS__[O] |___| |___| |___| |___| |___| |___| |___| |___| |___|
{======|_|"""""|_|"""""|_|"""""|_|"""""|_|"""... | stackexchange_codegolf |
I am looking for either suggestions or examples of more famous sayings written in code! If you have a website or database of them, please link that below your favorite one!
Examples:
while(!(succeed = try()))
if(lifegivesyou == lemons) {makelemonade();)
| stackexchange_codegolf |
Description
Let a permutation of the integers {1, 2, ..., n} be called minimally interpolable if no set of k+2 points (together with their indices) fall on a polynomial of degree k.
That is,
No two points fall on a horizontal line (0-degree polynomial)
No three points fall on a line (1-degree polynomial)
No four poi... | stackexchange_codegolf |
Note 2: I accepted @DigitalTrauma's 6-byte long answer. If anyone can beat that I will change the accepted answer. Thanks for playing!
Note: I will be accepting an answer at 6:00pm MST on 10/14/15. Thanks to all that participated!
I am very surprised that this has not been asked yet (or I didn't search hard enough). Ei... | stackexchange_codegolf |
The challenge is simple: given two parameters, x and y, output y staircases with x steps. For example:
f(3,1) - 1 staircase with 3 steps.
_
_|
_|
f(5,2) - 2 staircases with 5 steps.
_ _
_| _|
_| _|
_| _|
_| _|
Make sure you output the staircases just like,... | stackexchange_codegolf |
Definition
If you take the sequence of positive integer squares, and concatenate them into a string of digits (i.e. 149162536496481100...), an "early bird" square is one that can be found in this string ahead of its natural position.
For example, 72 (the number 49), can be found at an offset of 2 in the string, althoug... | stackexchange_codegolf |
Challenge
You are given an array \$a\$ of integers. With a move you can increase or decrease an element of the array by 1. Your task is to equalize the array, that is make all the elements of the array equal by performing some moves. But that's not enough! You also want to make as few moves as possible.
Input
A non-em... | stackexchange_codegolf |
I know there have been a lot of challenges about "the two best code-golfers in the world", but this one is a bit more unique, being Round 1 in a series of (future) challenges involving the two of them.
Your task is to write a program or function that returns two different non-whitespace ASCII strings, corresponding to... | stackexchange_codegolf |
The formatting order of dates is one of the most complex and divisive issues the world faces today. Some of us vehemently argue that Month/Day/Year is appropriate, considering that's how we say dates out loud. Others loudly proclaim that Day/Month/Year is best, because it puts the terms in ascending order of the durati... | stackexchange_codegolf |
Given a position with a row of rooks and/or empty spaces, output how many different rook moves are possible. A rook can move left or right to an empty space, but not to one that requires passing over another rook. When a rook moves, the other rooks remain in place.
For example, from this position, 6 moves are possible:... | stackexchange_codegolf |
Background
Often, when storing a number in binary with some maximum, we simply round the maximum to the next power of two then allocate the number of bits nececairy to store the whole range. Lets call the result of this method \$S(x, m)\$ where x is the number and m is the maximum.
While not bad, the naive has a few bi... | stackexchange_codegolf |
Introduction
A sequence of numbers is passed in as the input. The program has to generate the lowest degree polynomial possible. This was my first programming project in college and it would be interesting to see how much smaller the solution could have been.
Challenge
The input is a list of integers separated by a com... | stackexchange_codegolf |
The rule is:
a, b, c, d, e is an integer from 0 to 1000, no relation between a, b, c, d, e so a can equal to b or c, ...
can not use more than 3 loops (it can be 3 nested loops or 3 normal loops, or 2 nested loops + 1 normal loop, ...)
you need to find all the answers for (a, b, c, d, e) that is:
a + b + c + d + e = ... | stackexchange_codegolf |
You are given two regexes and your task is to determine if the strings matched by the first regex are a subset of the strings matched by the second regex.
For this we are going to use a limited mathematical definition of a regex. A regex is defined recursively as one of:
ε - This matches only the string ""
0 - This ma... | stackexchange_codegolf |
To celebrate the island's next Founder's Day, colored filters (fuchsia, chartreuse, and aquamarine*) have been installed in every lighthouse. All lighthouses begin operation with their fuchsia filter, and they are all on the same color cycle: FCA, FCA, ... Each lighthouse changes its color filter after every ON blink,... | stackexchange_codegolf |
Chess960, a.k.a. Fisher random chess, is a variation of the game of chess.
In classic chess the starting positions are always the same. In chess960 they vary.
Before each game of chess960 one random number from 0 to 959 is drawn. Both players then arrange their pieces in the same way according to this number from a loo... | stackexchange_codegolf |
The goal of this challenge is to compare how well different programming languages support functional programming, by seeing how much code it takes to implement BLC8, the simplest functional programming language
BLC8 is the bytewise variant of Binary Lambda Calculus, as described in my 2012 IOCCC entry at https://www.io... | 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 |
In this challenge, you must parse a list of lists, into a simpler list format.
This challenge is based on my sadflak parser. In my sadflak parser, it has all the () removed, replaced with the sum of the ()s at the start of the list, to make the program run faster.
To parse into a Sad-List, you have to do this (python i... | stackexchange_codegolf |
Challenge
Write the shortest snippet of code possible such that, when N copies of it are concatenated together, the number of characters output is N2. N will be a positive integer.
For example if the snippet was soln();, then running soln(); would print exactly 1 character, and running soln();soln(); would print exactl... | stackexchange_codegolf |
Notwen wants to study the kinematics of bodies thrown from big heights in a uniform gravitational field but unfortunately he doesn't have the technical possibility to go to sufficiently high places and observe the objects while falling. But who doesn't want to see advances in science so... Let's help Notwen build a gra... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.