instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro. I am an evil farmer, and to drive up the price of wheat in my area, I've decided to burn the fields of all the farmers around me. I would really like to see the fields go up in flames (...
stackexchange_codegolf
You're given a n-by-m matrix of integers, where n,m > 3. Your task is to find the 3-by-3 sub-matrix that has the lowest mean, and output this value. Rules and clarifications: The integers will be non-negative Optional input and output format The output must be accurate up to at least 2 decimal poins (if it's non-integ...
stackexchange_codegolf
Define a 1-indexed sequence as follows: A083569(1) = 1 A083569(n) where n is an integer greater than 1, is the smallest integer m not occurring earlier such that m+n is a prime number. Your task is to take in n and return A083569(n). n A083569(n) 1 1 2 3 3 2 4 7 5 6 6 5 7 4 8 9 9 8 10 13 11 12 12 ...
stackexchange_codegolf
A "qruine" if you will :) Design a QR code that legibly spells with its pixels (or the space between them) the text that it scans to. For example, this QR code scans to the letter A, and also spells out A in white: There are 4 categories, one for each mode of QR code: numeric, alphanumeric, byte, and kanji. Please sta...
stackexchange_codegolf
ALERT: IN CASE YOU DOUBT, NO PUN ON "QUINE" IS INTENDED In regulated horse-racing for gambling, bets called Quinella bets exist and in which a person bet on the first two places of a race. In racecourses, usually there is a display which shows the odds of a specific combination as below: (This picture is a cropped p...
stackexchange_codegolf
Given two numbers, print a page with an "X" in the specified location (±10%). The numbers must be either percentages or fractions of the page's print area dimensions, e.g. [25,75] or ["15%","0%"] or [0.33,1]. You do not have to consider margins. Just remember to state which number is width, and which is height, and whi...
stackexchange_codegolf
Write a program that outputs its source code in reverse when run, and outputs its source forwards when I reverse the source. If your program is "abcd", when run with no arguments it should output "dcba", and when I run the program "dcba" it should output "abcd." This is a quine challenge, so both your forwards and reve...
stackexchange_codegolf
It's 22022 and the Unicode consortium is having a problem. After the writing system of the ⮧⣝Ⅲⴄ⟢⧩⋓⣠ civilization was assigned the last Unicode block, the consortium members have been scrambling to find a new encoding to replace UTF-8. Finally UTF-∞, a proposal by Bob Rike, was adopted. UTF-∞ is backwards compatible wit...
stackexchange_codegolf
There is a rectangular 2D array containing viruses denoted by 'v', antidote1 denoted by 'a', and antidote2 denoted by 'b' (there are no values other than 'v', 'a' and 'b'). Antidote1 can kill neighboring viruses in horizontal and vertical directions only, but antidote2 can kill neighboring(if any) viruses in horizontal...
stackexchange_codegolf
To increase data safety at our company, we are planning to start using Gray code numbers (where successive values differ by only one bit) instead of classical binary ones. Please help us to make a program that converts numbers to Gray code (single number to single number), but the program needs to be safe as well. This...
stackexchange_codegolf
Program Write a program to display repeating terms of a given sentence. Explanation The program must output the repeating terms of two or more letters from the given input (input is a sentence separated by spaces without any punctuation except the full-stop indicating the end.) Repeated terms may not span across or in...
stackexchange_codegolf
Initech are setting up an office of 36 employees in a soul-crushingly efficient square of cubicles, 6 desks long and 6 desks deep. Management has bought wireless keyboards in bulk from a cheap, international wholesaler. IT are quickly discovering that the wireless keyboards only operate on 3 different radio frequenci...
stackexchange_codegolf
A digit addition generator of an integer n is any integer x that satisfy the equation x + s(x) = n, with s(x) being the sum of the digits of x. (We will work under base 10 for convenience.) For example, a digit addition generator for 29 would be 19, because 19 + (1 + 9) = 29. Some numbers have more than one generator. ...
stackexchange_codegolf
Background A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail". Challenge Given a string a, and a word t, capitalise the correct letters of the w...
stackexchange_codegolf
Challenge The goal is to output Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo. Context. (Maybe another interesting challenge could be printing all of the other examples? This would probably use similar logic but involve either a function or just a for loop.) Rule(s) You cannot output anything other t...
stackexchange_codegolf
Challenge: Write a function or program that accepts a list of boolean values and returns all of the ranges of True's. Test Cases: f [F] = [] f [T] = [[0,0]] f [T,T,F,T] = [[0,1],[3,3]] f [F,T,T,F,F,T,T,T] = [[1,2],[5,7]]...
stackexchange_codegolf
Challenge Write a program that compresses and decompresses ASCII text losslessly. It should be specialized to work well with palindromes, including case-insensitive and punctuation-insensitive palindromes. The best compression with the smallest source wins. Scoring total_bytes_saved / sqrt(program_size) - Highest score...
stackexchange_codegolf
Input: An array containing three integers: 0, 1 and 2 in any order (i.e. [2, 0, 1]) And a string of length >= 2 only containing alphabetic letters (both lower- and uppercase) and digits (i.e. a1B2c3) Output: Based on the array we sort and output the string. How does this work? The array indicates the order precedenc...
stackexchange_codegolf
Challenge: Given a list of multi-line strings, overlap them (in the top-left) and output the result. Example: Input: ["aaaa\naaaa\naaaa\naaaa","bb\nbb\nbb","c"] Output: cbaa bbaa bbaa aaaa Challenge rules: Input-format is flexible. You are allowed to get the input as a 2D list of lines (i.e. [["aaaa","aaaa","aaaa","a...
stackexchange_codegolf
Parenthetical names Your challenge is to build a program that puts parentheses around the 'title' part of names. For example, Sonic the Hedgehog is converted to Sonic (the Hedgehog). Rules: Around every the that passes the following rules, an opening parentheses will be added before the the and a corresponding closing...
stackexchange_codegolf
One reason why ISO8601 is the best date string format, is that you can simply append as much precision as you like. Given 2 integers representing seconds and nanoseconds that have passed since 1970-01-01T00:00:00, return an ISO8601 string as described below. Output: The standard output format without timezone looks lik...
stackexchange_codegolf
Given a list of countries in alphabetical order, put them in the same order as they are given in the song "Yakko's World". Specifically, you are given the following list of countries* exactly: Abu Dhabi, Afghanistan, Albania, Algeria, Algiers, Angola, Argentina, Australia, Austria, Bahamas, Bahrain, Bangladesh, Barbado...
stackexchange_codegolf
Input a datetime, format the datetime in YYYY-MM-DD HH:mm:ss format using 30-hour clock time. The 30-hour clock time works as: After 6 a.m., it is same as 24-hour clock time Before 6 a.m., it use date for previous day, and plus Hours by 24. For more examples, you may checkout the testcases. Rules To simplify the que...
stackexchange_codegolf
Suppose we have an array \$\texttt{ps}\$ of length \$n\$ with pointers pointing to some location in the array: The process of "pointer jumping" will set every pointer to the location the pointer it points to points to. For the purpose of this challenge a pointer is the (zero-based) index of an element of the array, thi...
stackexchange_codegolf
Input A binary string \$s\$ of length \$n\$ and a positive integer \$k \leq n\$. Output The number of binary strings with Levenshtein distance exactly \$k\$ from the string \$s\$. Example outputs Each example gives the largest possible output for the given \$(n, k)\$ pair. k=1, s=1010, output=14 k=2, s=1010, outupt=55...
stackexchange_codegolf
Closely related: How high can you count? Challenge In your programming language of choice, write as many different identity programs/functions as possible, under the following constraints: Each program should be a function or full program that is one of the following: A function that takes a single positive integer ...
stackexchange_codegolf
You are given a bunch of ASCII test-tubes, your task is to reduce number of test-tubes used. Each test tube looks like this: | | | | | | |~~| | | | | | | | | |__| Obviously, ~~ is the water level. Test-tube can be also empty, in which case there are no ~~ characters inside. Single tube can contain up to 8 water...
stackexchange_codegolf
I'm looking out of my attic window into my neighbor's yard. They have a dog chained to a post in the center of the yard. The dog runs around the yard but is always on the end of its chain, so it ends up leaving a track in the dirt. Normally this track would be perfectly circular, but my neighbors have some other pole...
stackexchange_codegolf
A perfect power is a number of the form \$a^b\$, where \$a>0\$ and \$b>1\$. For example, \$125\$ is a perfect power because it can be expressed as \$5^3\$. Goal Your task is to write a program/function that finds the \$n\$-th perfect power, given a positive integer \$n\$. Specs The first perfect power is \$1\$ (which...
stackexchange_codegolf
In this challenge you are to write a program or function, that takes a string as input and outputs one of two possible values. We will call one of these values truthy and one falsy. They do not need to actually be truthy or falsy. For an answer to be valid it must meet four additional criteria When you pass your pro...
stackexchange_codegolf
Super simple challenge today, or is it? I feel like we've heard a fair bit about double speak recently, well let's define it in a codable way... Double speak is when each and every character in a string of text is immediately repeated. For example: "DDoouubbllee ssppeeaakk!!" The Rules Write code which accepts one ...
stackexchange_codegolf
What general tips do you have for golfing in Clean? Please post only ideas that can be applied to code golf problems in general, and are at least somewhat specific to Clean. If you've never heard of Clean, you can find out more here. Or, you can join the chat room.
stackexchange_codegolf
You want to open a new zoo. It'll be amazing. But being the cheapskate that you are, you only want to afford three-letter animals (everyone knows that an animal's cost is proportional to the length of its name). There goes your dream of making people pay to see an elephant. But suddenly you have a brilliant idea. If yo...
stackexchange_codegolf
Multiplicative Persistence Multiply all the digits in a number Repeat until you have a single digit left As explained by Numberphile: Numberphile "What's special about 277777788888899?" Numberphile "Multiplicative Persistence (extra footage)" Example 277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872 ...
stackexchange_codegolf
Given an ASCII art with simple closed paths using | and - (pipes and dashes), output a random point inside the boundary. Eg. given: ---- ---- | |- --- => |12|- --- | | | | |345| |6| ----- --- ----- --- Any point 1-6 should have an equal probability of being printed. Specs T...
stackexchange_codegolf
colors.rgb("blue") yields "#0000FF". colors.rgb("yellowish blue") yields NaN. colors.sort() yields "rainbow" Using the rules set out in the image and its title text (quoted here), create a program that accepts all the given input and displays the appropriate output. Input can be taken with stdin or nearest equivale...
stackexchange_codegolf
Given the following Python "reference implementation" of non-terminating FizzBuzz: i=1 while True: if i%15 == 0: print("FizzBuzz") elif i%3 == 0: print("Fizz") elif i%5 == 0: print("Buzz") else: print(i) i += 1 We can represent its output as an infinite array of char...
stackexchange_codegolf
Given a list or delimited string, output a list or delimited string with the first character of each word one word later. For this challenge, a "word" consists of only all printable ASCII characters, except the space, newline, and tab character. For example, take the string "Good afternoon, World!" (space-delimited): 1...
stackexchange_codegolf
The task is simple, given an integer n of how many lines the next n lines is and, a multi-line input, output the resulting 90 degree tilted grid in a clockwise formation. E.g. Input: 2 c d o e Output: o c e d I/O format: Input will have spaces in between them Input always contains alphabetical characters except the ...
stackexchange_codegolf
Your task is to build a program that identifies the shape of the input. The shapes to be identified can be any of the following: Square To be identified as a square, the source must have lines of all equal length, and the same number of lines as characters per line (newline characters excluded). An optional trailing ne...
stackexchange_codegolf
This is the robbers' thread. For the main rules to this challenge see the cops' thread In this challenge, robbers will choose a cop's vulnerable or safe post and try to figure out a pair of languages such that they print the correct results for the 4 programs. When you find a solution post an answer of it here and lea...
stackexchange_codegolf
Given an input integer from 1, 2, ..., n, the task to write code to make a number as close as possible (as measured by absolute distance) to e using only the four mathematical operations +, -, *, / and parentheses (brackets). You can use any of the integers up to n once but don't have to use all the numbers and you are...
stackexchange_codegolf
⢣⠃⢎⠆⣇⡇⡯⡂⠈⡏⢰⢵⢐⡭⢸⠪⡀⢸⢐⡭⠀⢹⠁⢎⠆⢸⣱⢸⡃⢎⠰⡱⢸⣱⢸⡃⠈⡏⢸⡃⡱⡁⢹⠁⢸⡀⡇⡗⢅⢸⡃⠈⡏⢸⢼⢸⢐⡭⠀ ⣇⢸⡃⢹⠁⢹⠁⣟⢸⢕⢐⡭⠀⡮⡆⡯⡂⣟⠀⡯⠰⡱⢸⣸⢸⢕⠀⣏⡆⢎⠆⢹⠁⣪⠅⢸⢼⢸⠰⣩⢸⢼⠀⡮⡆⡗⢼⢸⣱⠀⢎⠆⡯⠀⢇⠇⡮⡆⡯⡂⡇⡮⡆⣟⡆⣇⢸⡃⠸⡰⡸⢸⢸⣱⠈⡏⢸⢼⠀ ⢎⠆⡗⢼⢸⡃⢸⡃⡗⠔⡇⡯⠂⢹⠁⢣⠃⠸⡸⢸⡃⡯⡂⢹⠁⡇⢎⢰⢵⢸⡀⢸⡀⡇⡗⢼⢸⡃⢐⡭⢸⡃⡯⠂⡮⡆⡯⡂⡮⡆⢹⠁⣟⢐⡭⠀⢎⢸⢼⢰⢵⢸⢕⢰⢵⠰⡁⢹⠁⣟⢸⢕⢐⡭⠀ ⡮⡆⢐⡭⢸⠕⢰⢵⠰⡁⣟⠀⡇⣪⠅⢈⣝⢸⡃⡯⡂⢎⠆⠸⡰⡸⢸⢸⣱⠈⡏⢸⢼⠀ ⣪⠅⢎⠆⢸⠈⡏⠀⣇⠰⡱⠰⡱⢸⠪⡀⣪⠅⢸⡀⡇⡗⢅⢸⡃⠸⡰⡸⠰⡱⢸⢕⢸⣱⢐⡭⠀⡮⡆⡯⡂⣟⠀⣪⠅⣟⢸⠕⢰⢵⢸⢕⢰⢵⠈⡏⢸⡃⣏⡆⢸⣳⠘⡜⠀...
stackexchange_codegolf
In informatics, we often use trees in lots of different forms and representations. The three major methods of serialising binary trees are prefix, infix and postfix notation. For example, the following binary tree:   (source: Dutch Olympiad in Informatics, finals, 2012/13) can be represented in prefix notation as abrx...
stackexchange_codegolf
An ordinary N-digit combination lock consists of N rotating discs. Each disc has digits 0-9 inscribed in order, and you need to turn them to the correct password to open it. Obviously, if you don't know the password, you will need to try at most 10N times before unlocking it. That's not interesting. So let's consider ...
stackexchange_codegolf
Now with BONUS for run-time placement. Write a program to fill a text box with the identifiers used in your program while keeping your program small. With all the identifiers you have used (excluding those you created) in your program, fill a 12x6 box with as many as you can. You get extra points for identifiers that ...
stackexchange_codegolf
(inspired by this question over on Math) The Definitions Given an n x n square matrix A, we can call it invertible if there exists some n x n square matrix B such that AB = BA = In, with In being the identity matrix of size n x n (the matrix with the main diagonal 1s and anything else 0), and AB and BA representing usu...
stackexchange_codegolf
(Follow-up to my question about swapping bits with their neighbours.) Task Given a positive integer x = (2a · 3b) · (5c · 7d) · (11e · 13f) · …, print the integer obtained by swapping the exponents in this factorization for each successive pair of primes, y = (2b · 3a) · (5d · 7c) · (11f · 13e) · … A061898 in the OEIS....
stackexchange_codegolf
In this challenge you are supposed to fill a grid 10x10 with numbers from 1 to 100 (each number once) following this rules: Number 1 must be on the bottom row Number 100 must be on the upper row Two consecutive numbers must be one next to the other (diagonals doesn't count) The grid must be random It's not necessary ...
stackexchange_codegolf
Let's create a N×N grid of spaces and underscores that can be used to visually determine if a number is prime. (N may be any positive integer.) This grid has three simple rules: The nth column contains the repeated pattern of n - 1 underscores followed by one space. This pattern starts at the first row and is stopped,...
stackexchange_codegolf
Let's assume that $$ f(x) = \frac{Ax+B}{Cx+D} $$ Where, \$x\$ is a variable and \$A\$,\$B\$,\$C\$,\$D\$ are constants. Now we have to find out the inverse function of \$f(x)\$, mathematically \$f^{-1}(x)\$, To do this first we assume, $$ y = f(x) \\\rightarrow y=\frac{Ax+B}{Cx+D} \\\rightarrow Cxy+Dy=Ax+B \\\rightarrow...
stackexchange_codegolf
So, there's a famous children's rhyme... This is the house that Jack built. This is the malt That lay in the house that Jack built. This is the rat That ate the malt That lay in the house that Jack built. This is the cat That killed the rat That ate the malt That lay in the house that Jack built. This is the do...
stackexchange_codegolf
Input : Two decimal integers m and n that respectively give the number of rows and columns of the table. m and n are greater than or equal to 1. Output : A table in HTML that has m rows and n columns. The table should be displayable by a modern browser of your choice. Most browsers will display everything properly even...
stackexchange_codegolf
In my previous bioinformatics challenge, I asked you to mutate a DNA sequence. This time, I'd like you to evaluate how likely a mutation, or a series of mutations, is. The two types of substitutions are transitions and transversions, and due to the chemical structure of DNA bases, transitions are more likely to occur t...
stackexchange_codegolf
Your program must find all the words in this wordlist that contain all the vowels (a e i o u y). There are easy ways to do this, but I am looking for the shortest answer. I will take any language, but I'd like to see Bash. Here is an example (could be much improved): cat wordlist.txt | grep "a" | grep "e" | grep "i" | ...
stackexchange_codegolf
The Mongolian language has "vowel harmony". In short the vowel harmony means that certain vowels are not allowed to be placed next to each other in a word. This means that suffixes of words have to care about the vowels present in the words they attach to and need to resolve to a vowel that matches the harmony of the...
stackexchange_codegolf
Carry sort is an \$O(n)\$ "sorting" algorithm. Here's how it works. The algorithm moves left to right along a list. As it traverses a list it "carries" a single item, the largest item it has encountered so far. Once it encounters a larger item it picks up that item and drops the item it is already carrying in place. W...
stackexchange_codegolf
Do you know the book Murderous Maths, in the Horrible Science series? In the book, the Laplace Princess' "ridiculous" cipher might be interesting enough and simple enough to be a code-golf challenge. Task The original cipher looks like this: Please read primes elephant help you me like cold The nth word is only meani...
stackexchange_codegolf
All good coders know some good sorting algorithms like quicksort or merge sort. There is also slow sorting algorithms, e.g. bubble sort and insertion sort. But those are such easy to implement and so, so efficient. Too efficient. Your task is to create very slow sorting algorithm. Please attach the Big O notation of y...
stackexchange_codegolf
This challenge is inspired by a board game I played some time ago. The story of this challenge doesn't necessarily have to be read, the goal of the challenge-section should explain everything necessary. The Story People are locked inside a large room with a human-devouring monster. The walls of the room are enchanted, ...
stackexchange_codegolf
I have a lot of java projects and I am often making new ones. I have a few helper classes (Vector, Logger, etc.) and it takes a lot of time correcting the first line to the correct package, I would really need a little program to help me fix it automatically. Your program will first take the name of the package the fi...
stackexchange_codegolf
Multiplicative Persistence Multiply all the digits in a number Repeat until you have a single digit left As explained by Numberphile: Numberphile "What's special about 277777788888899?" Numberphile "Multiplicative Persistence (extra footage)" Example 277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872 ...
stackexchange_codegolf
Introduction: Pete likes doing word search puzzles. Despite that, he has trouble searching for words vertically, (anti-)diagonally, or reversed. Because of that, he'll always search for the words left-to-right, and rotates the entire puzzle in increments of 45 degrees clockwise. In addition to that, he'll also always s...
stackexchange_codegolf
To celebrate the 2497th anniversary of the Greek victory at Salamis in 480 BC. Draw the lambda blazon. The lambda blazon was the lambda painted on greek shields like so: Puzzle: Given a positive odd integer n, produce an ascii art image of the above shield. Specifications: n=1: ( /\ ) n=3: ( /\ ) | / \ | ( /...
stackexchange_codegolf
What is the shortest way to secure a site with Javascript? I am new to Code Golfing, and this is what I've come up with so far. I bet that this could be improved though: Challenge: Make a script which redirects http:// to https:// with the least bytes of code Attempts: Original code (150ish BYTES!): if (window.locati...
stackexchange_codegolf
Related to AoC2017 Day 18, Part 2. (Anyone want to add Duet to esolangs?) Duet is an assembly-like language that involves two processes running the same program simultaneously. Each process of Duet operates with 26 registers named a to z, all initialized to zero, except for the register p which contains the process ID...
stackexchange_codegolf
This challenge is the second of a series of fastest-code problems that should be written in the GOLF CPU. You can find the first here For this problem, you are given the volume of a cuboid (A rectangular cube). Each of the side lengths are integers. You must return the number of distinct cuboids that have that volum...
stackexchange_codegolf
What is the shortest way of generating a random string with a given length and with only alphanumeric characters allowed? example of a random string: with N = 9 output would be aZua7I0Lk the given length N can be assumed to be always greater than 0 if necessary you can assume 256 as a maximum value for N, but solution...
stackexchange_codegolf
Provided that the input is a monotone sequence of three or more integers: Output -2 if the sequence strictly decreases. Example: [7,4,3,2] Output -1 if the sequence monotone decreases but is neither strict nor constant. Example: [6,5,5] Output 0 if the sequence is constant. Example: [0,0,0] Output +1 if the sequenc...
stackexchange_codegolf
Task You will be given a positive integer and you must output a "self-complementary graph" with that many nodes. If you don't know what a self-complementary graph is the wikipedia article wont help you much so below are two explanations, a technical and a non-technical one. Non-Technical A graph is a set of nodes that...
stackexchange_codegolf
Write a program that outputs Do not repeat yourself! Your program code must respect the following constraints : its length must be an even number each character that is in position 2n (where n is an integer > 0) must be equal to the character in position 2n-1. The second character of the program is equal to the firs...
stackexchange_codegolf
Challenge: Given a list of multi-line strings, overlap them (in the top-left) and output the result. Example: Input: ["aaaa\naaaa\naaaa\naaaa","bb\nbb\nbb","c"] Output: cbaa bbaa bbaa aaaa Challenge rules: Input-format is flexible. You are allowed to get the input as a 2D list of lines (i.e. [["aaaa","aaaa","aaaa","a...
stackexchange_codegolf
Behold! The Crystal Maze™ Time Matrix! 0 1 2 3 4 5 6 7 8 9 10 1 0 5 10 15 20 25 30 35 40 45 50 2 0 10 20 30 40 50 60 70 80 90 100 3 0 15 30 45 60 75 90 105 120 135 150 4 0 20 40 60 80 100 120 140 160 180 200 5 0 25 50 75 100 125 150 175 200 2...
stackexchange_codegolf
Recently, I created a binary word search that got me working with grids. It was fun, so I wanted to create some more similar content. Meet Pythagoras' Golfing grid: Each of d, e, f, g, h, i, j, k and T represent a numeric value. Now consider an orthogonal triangle along the lower diagonal of this grid (so the vertical...
stackexchange_codegolf
Given an input integer n > 1, output an ASCII-art octagon with side lengths composed of n characters. See examples below: n=2 ## # # # # ## n=3 ### # # # # # # # # # # ### n=4 #### # # # # # # # # # # # # # # # # #### n=5 ##### ...
stackexchange_codegolf
This time, you are working on a regex. Your regex is meant to approximately full-match the base-10 representations of primes \$0 \le p < 1000\$, while ignoring any non-numeric string or composite in the range. You can full-match 2, 53 or 419, but not 0, 82 or example. The approximately is important -- a minimum of 900 ...
stackexchange_codegolf
Sokobunny 1 You love buns! You love them so much, that you chased one down a bunburrow. The burrows are like mazes, and YOU WANT TO CATCH THE FLUFFBALLS!!!! However, the buns are smart! You can't catch the bun by by chasing after it, as you wait out of politeness for the buns. Taken from the game Paquerette Down the Bu...
stackexchange_codegolf
We know that f is a polynomial with non-negative integer coefficients. Given f(1) and f(1+f(1)) return f. You may output f as a list of coefficients, an ASCII formatted polynomial, or similar. Examples: f(1) f(1+f(1)) f 0 0 0 1 1 1 5 75 2x^2 + 3 30 3904800 4x^4 + 7x^3 + 2x...
stackexchange_codegolf
So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have fun! Challenge: write efficiently and securely a program that creates an array of n threads that communicate with each o...
stackexchange_codegolf
Let's go for a rollercodester ride The objective of this challenge is to create a program that is run recursively through several languages of your choice. The output of the first iteration becomes the code for the second iteration, et. cetera. You choose the language sequence, but each unique language may be used onl...
stackexchange_codegolf
For the purposes of this challenge, a polyphthong is defined as a contiguous slice of a String, that only contains vowels, and has length at least 2. Given a non-empty String as input, your task is to output all the polyphthongs it contains. For example, "abeoic" has the following contiguous slices (space-separated): a...
stackexchange_codegolf
The challenge Given point and a path of points, say whether or not the point is in the polygon that is created by the path. Also return true if the point is on an edge of the polygon. Input A list of pairs of integers. The first 2 integers represent the point. The remaining pairs (3rd and 4th, 5th and 6th etc.) represe...
stackexchange_codegolf
The reason for this question is because I made a deadlineless bounty and I need a tips question to link in the bounty Vyxal 3 is the third major version of the Vyxal golfing language. As it is significantly different to Vyxal 2, the tips there don't apply. Therefore, what tips and tricks do you have for golfing in Vyxa...
stackexchange_codegolf
Your task is to write a program that receives a base 10 number from 0 to 99 and outputs the German name of that number with non-ASCII characters replaced with ASCII equivalents. German number names 0 -> null 1 -> eins 2 -> zwei 3 -> drei 4 -> vier 5 -> fuenf 6 -> sechs 7 -> sieben 8 -> acht 9 -> neun 10 -> zehn 11 -> e...
stackexchange_codegolf
For the purpose of this challenge, a smaller-base palindrome (SBP) is a number which is palindromic in a base between 1 and itself (exclusive), and is not a repdigit in the same base. For example, 5 is a SBP because it is a palindrome in base 2 (101). The first few SBPs are 5,9,10,16,17,20,21,23,25,26,27,28,29,33... ...
stackexchange_codegolf
A Norwegian Birth Number consists of 11 digits, composed the following way: DDMMYYiiikk DD is the day (from 01-31) MM is the month (from 01-12) YY is the year (from 00-99). It's not differentiated between 1900 and 2000 iii is the "individual number" kk are two control digits iii is determined by birthyear and gender...
stackexchange_codegolf
Today, we're going to make an ASCII hexagon. You must write a program or function that takes a positive integer n, and outputs a hexagon grid of size n, made up of asterisks. For example, a hexagon of size 2 looks like this: * * * * * * * While a hexagon of size 3 looks like this: * * * * * * * * * * * * * * * *...
stackexchange_codegolf
A biquadratic number is a number that is the fourth power of another integer, for example: 3^4 = 3*3*3*3 = 81 Given an integer as input, output the closest biquadratic number. Here are the first 15 double-squares: 1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, 14641, 20736, 28561, 38416, 50625 This is code-golf s...
stackexchange_codegolf
For your hard thing to do, you must make a thing for a computer to do that finds out if some words are explained in a simple way. Something is explained in a simple way if it only uses the ten hundred most used words. If not, it is explained in a hard way. This can be a full computer thing or part of a computer thing. ...
stackexchange_codegolf
The challenge Given a positive integer N, compute the proportion of N-step walks on a plane that don't intersect themselves. Each step can have any of the 4 possible directions North, East, South, West. A walk intersects itself if it visits a previously visited point. Examples N=1: a single-step walk obviously doesn'...
stackexchange_codegolf
In any programming language, make a program that outputs infinite subsequent powers of two, starting at any power of two with finite integer exponent. There does not need to be a seperator between outputs. Note: it only has to theoretically output infinite subequent powers of two given infinite integer size (so you can...
stackexchange_codegolf
For this challenge a "binary tree" is a rooted tree where each node has 0 children (leaf) or 2. The children of a node are unordered, meaning that while you might draw the tree with left and right children there isn't a distinction between them and mirroring the tree or a sub-tree does not produce a new tree. In this...
stackexchange_codegolf
How do I remove all duplicates from list and order it based on count? s = ["foo", "this", "lem", "foo", "lem"] s = ["foo", "ebh", "wosv", "wosv", "ebh", "4whcu"] #should return >>> ["foo", "lem", "this"] >>> ["ebh", "wosv", "foo", "4whcu"] Rules: Must be shorter than the below code in terms of byte size. Order must b...
stackexchange_codegolf
Introduction Finding the closest power to a number is a common enough problem. But what if you need both the next-highest and next-lowest power? In this challenge you must find the closest powers to a given number - the 'power sandwich' if you will, where the given number is the filling and the powers are the bread. Mm...
stackexchange_codegolf
I have a number like this: n = 548915381 The output should be the sum of every second digit of that number. In this case 26: 4+9+5+8 = 26 Rules: This is a code-golf, so the shortest code in bytes wins. The input consists only of numbers bigger than 10 (at least 2 digits) but smaller than a 32-bit integer. The input ...
stackexchange_codegolf
The following is an unfolded milk carton: +-----+-\|/-+-----+-\|/-+-+ | | / \ | | / \ | | +-----+/---\+-----+/---\+-+ | | | | | | | | | | | | | | | | | | +-----+-----+-----+-----+-+ \ / \ / \ / \ / \_/ \_/ \_/ \_/ This is a code-golf kolmo...
stackexchange_codegolf
Everybody loves golfing code. Code is written in English (eh...). Therefore, everybody loves golfing English! Your task is to write a program or function that takes a string as input, and then returns or prints the golfed version. There will be no newlines or tabs in the input. This is how you golf a string. The order...
stackexchange_codegolf
Write a program that prints "Hello, World!". But also, if you take only the first, third, fifth, etc. characters of your program, the resulting program should still print "Hello, World!". If your program is: abc def It should output "Hello, World!", but so should acdf No solutions with fewer than 2 characters.
stackexchange_codegolf
Background MENACE (Machine Educable Noughts And Crosses Engine) is a rudimentary shallow machine learning algorithm for the game Noughts and Crosses, created by British computer scientist Donald Michie in the 1960s. It was originally implemented with 304 matchboxes, each labelled with a board position and containing co...
stackexchange_codegolf
Given a sorted list of unique positive floats (none of which are integers) such as: [0.1, 0.2, 1.4, 2.3, 2.4, 2.5, 3.2] Evenly spread out the values that fall between two consecutive integers. So in this case you would get: [0.333, 0.666, 1.5, 2.25, 2.5, 2.75, 3.5] (I have truncated the values 1/3 and 2/3 for ease of...
stackexchange_codegolf