instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
"Baby Shark" is a children's song about a family of sharks. Having long been popular as a campfire song, it has been popularized since the mid-2000s by social media, online video and radio. - Wikipedia
Write program that takes no input, and writes the following text to the standard output or an arbitrary file:
Baby S... | stackexchange_codegolf |
A quine is a program that produces output that's identical to the program's source code. On this website, we generally only care about proper quines (at the time of writing, the current definition is "some part of the output is encoded by a different part of the program").
What advice do you have for writing proper qui... | stackexchange_codegolf |
Part 1 of the task is here
Flags Mashup Bot is a small Twitter bot that generates a new country name based on two random country names and tweets the result every couple of minutes.
Task
Your task is to replicate what the bot does by writing a script or a function based on the following criteria:
The input is two cou... | stackexchange_codegolf |
In mathematics, matrix multiplication or the matrix product is a binary operation that produces a matrix from two matrices. The definition is motivated by linear equations and linear transformations on vectors, which have numerous applications in applied mathematics, physics, and engineering. In more detail, if A is an... | stackexchange_codegolf |
This challenge is based on, and contains test cases from, a programming course I took at Aalto University. The material is used with permission.
Two and a half years ago there was a challenge about spoonerisms in English. However, in Finnish spoonerisms are much more complicated.
Spoonerisms in Finnish
In Finnish, the ... | stackexchange_codegolf |
Let's say you have a stack, which at the start contains a b c in this order (a is on the top). You are given the required output stack, in any reasonable format (a list, a string, etc.), e.g. [a, c, b] (here a is on the top, below it c and below it b). You can also take the input reversed if you want, e.g. [b, c, a] wh... | stackexchange_codegolf |
How to spot them
Take a positive integer k. Find its divisors. Find the distinct prime factors of each divisor. Sum all these factors together. If this number (sum) is a divisor of k (if the sum divides k) then, this number k, is a BIU number
Examples
Let's take the number 54
Find all the divisors: [1, 2, 3, 6, 9, 18, ... | stackexchange_codegolf |
Oreoorererereoo
Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability).
Rules
The input is lowercase, a non-empty string with no whitespace containing any combination of the strings "o" and "re", and contain... | stackexchange_codegolf |
Sandbox post
In this code-golf challenge, you are provided with a series of y values at even x-values as well as a console width and height. The desired output is an ASCII-art representation of a ribbon plot of the y-values scaled to the desired size. If all values are positive or negative, the x-axis should be display... | stackexchange_codegolf |
Fennel is a lispy language which compiles to Lua.
From its page:
Fennel is a programming language that brings together the speed, simplicity, and reach of Lua with the flexibility of a lisp syntax and macro system.
I am looking for general tips for golfing in this language. Tips should be specific to Fennel, "Remove ... | stackexchange_codegolf |
When dealing with long numbers when code golfing, getting the length of your code down can be difficult, so do you have any tips for making a number shorter and easier to manage?
For example, the following Pyth code prints "Hello world", but at 44 bytes, that is unsatisfactory:
Vcjkj85942000775441864767076 2 7=k+kCiN2... | stackexchange_codegolf |
Something I found while looking through some old files. It seemed like a neat idea for a code golf challenge.
The intro
One of the most popular events at the annual Cyclist's Grand Competition for Charity (CGCC) is the rocket bike parcours. The rules are simple: Inspect the parcours and place a bet on wheather is it po... | stackexchange_codegolf |
Given a single positive odd integer as input, return a converging zigzag as a list of strings, list of lists of characters, or newline-separated string, in this form:
#
#
#
#
#
#
#
#
#
#
#
You can replace # with any consistent non-whitespace character. Trailing whitespace on each line is allowed... | stackexchange_codegolf |
For this challenge, a slice of a string is defined as an upper and lower index that can "cut" a piece of a string. All characters from the string in the range [start, end) (or [start, end] if you don't speak practlang) are part of that slice. If the upper index exceeds the string's length, the overflow is ignored. For ... | stackexchange_codegolf |
The aim of this post is to gather all the tips that can often be applied to radiation-hardening challenges.
Please only post answers which can apply to a large number of languages, and one tip per answer.
| stackexchange_codegolf |
The barfoos, a hypothetical alien species, go about charity in an interesting way.
Every morning, barfoo Specialists come up with an ordered list of causes to donate to, and for each cause they recommend what quantity of resources should be donated.
That wasn't the weird part. Here's the weird part:
A random civilian b... | stackexchange_codegolf |
You host the Olympic Games, and need to build a fantastic pool for the sake of the occasion, but the supervisors often change their mind regarding the dimensions, and need a quick way to rebuild it with the requested size!
Given two integers, L and x, your task is to build a swimming pool of length L and x lanes.
How ... | stackexchange_codegolf |
The Narrative
You are a bad musician. You never bothered to learn how to count rhythms. To remedy this shortcoming, you decide to write a program that will tell you how to count in any given time signature. You are still a bad musician, but you can at least pretend that you can count rhythms.
The Objective
Given a time... | stackexchange_codegolf |
Introduction
Today we're gonna take care of the bane of first-year linear algebra students: matrix definiteness! Apparently this doesn't yet have a challenge so here we go:
Input
A \$n\times n\$ symmetric Matrix \$A\$ in any convenient format (you may also of course only take the upper or the lower part of the matrix)... | stackexchange_codegolf |
The question's pretty much described by the title: write a program or function that takes a positive integer n as input, and returns the smallest positive output which has all integers from 1 to n as factors. (Another way of looking at this is that you're looking for the least common multiple of the integers from 1 to ... | stackexchange_codegolf |
Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted.
An IPv4 address is a 32-bit numeric address written as four numbers separated by periods. Each number can be zero to 255.
We need to write a... | stackexchange_codegolf |
For example, let's look at the following ASCII art:
/\ - encloses a total of 2 cells - half a cell per slash
\/
/\ - encloses 4 cells fully and half of 8 cells, for a total of 8
/ \
\ /
\/
Your challenge is to write a program that determines (and outputs) the total area enclosed by ASCII art composed only of... | stackexchange_codegolf |
Given an integer \$N\$ consider a permutation \$p=p_1,p_2,p_3,\ldots\$ of \$1,\ldots,N-1\$. Let \$P = p_1 , p_1+p_2 \bmod N, p_1+p_2+p_3 \bmod N, \ldots\$ be its prefix sums modulo \$N\$. Sometimes \$P\$ will be a permutation of \$1,\ldots,N-1\$ itself.
For example, \$N=4: p=3,2,1 \rightarrow P=3,1,2\$
Negative example... | stackexchange_codegolf |
We are going to bring down an imaginary building with a series of explosions. Our building is a 5x5 matrix of integers ranging 1-9, each representing a single brick.
The challenge is to set of a series of explosions to bring down our building as much as we can, why not! Each brick that is connected (horizontally, verti... | stackexchange_codegolf |
Challenge
Given the number of an XKCD comic, output the title text of that comic (the mouseover text).
However, the program must throw an error when given the numbers 859 or 404.
Rules
The number given will always be an existing comic (except 404).
Your program must not throw an error for any other numbers than 859 or... | stackexchange_codegolf |
There already is a Brainfuck interpreter question, but it is from 2011 and not up to date with current site standards and vague in places. I have proposed reposting this in chat, and it was well-received. Here goes.
Objective
Given the Brainfuck code and the program's input as input, run the Brainfuck code. As there ar... | stackexchange_codegolf |
This is a rewrite of the (currently closed) "Debunking Stroustrup's debunking of the myth “C++ is for large, complicated, programs only”" challenge.
Challenge
Write the shortest program or function that will:
Download http://www.stroustrup.com/C++.html, and
List all URLs contained in the HTML document.
A "URL" for th... | stackexchange_codegolf |
This post is loosely inspired by this mathoverflow post.
A Vanisher is any pattern in Conway's Game of life that completely disappears after one step. For example the following pattern is a size 9 Vanisher.
An interesting property of Vanishers is that any pattern can be made into a vanishing one by simply adding mo... | stackexchange_codegolf |
We are doing a PCG challenge at work, and I'm submitting answers in C#. This is a modification of the "M'Kay" challenge. My solution has been deemed correct by the requirements, I'm just trying to shrink it further if possible.
A filler word is an apparently meaningless word, phrase, or sound that marks a pause or h... | stackexchange_codegolf |
Your code may not contain the letter "e", but must count the number of "e"s in the inputted string and output that as a number. Bonus points if you use a language that is not a codegolf language and a language that actually uses the letter e (unlike brainfuck) --- not a required criteria.
| stackexchange_codegolf |
Inspired by a real-life scenario, which I have asked for an answer to here: https://superuser.com/questions/1312212/writing-a-formula-to-count-how-many-times-each-date-appears-in-a-set-of-date-ran
Given an array of timespans (or startdate-enddate pairs), output a count of how many timespans cover each day, for all days... | stackexchange_codegolf |
Recently I've been playing a game called Alcazar. It is a board puzzle game where your goal is to enter from one door, pass through all squares, and exit through another door. The only rules are:
Enter once, leave once;
Pass through all squares;
Do not pass through a square more than once
The image below shows an exa... | stackexchange_codegolf |
Background
Tetris Grand Master 3 has a hidden grading system based on the shape of the stack at the end of the game, which is called Secret ">" Stacking Challenge. It consists of entirely filling the lowest rows except for the zigzag pattern which starts at the left bottom cell and spans the entire width:
#
.#########
... | stackexchange_codegolf |
Challenge:
Given two integers \$a\$ and \$b\$, with lengths \$A=length(a), B=length(b)\$, output an ASCII-art of the \$a^{th}\$ root of \$b\$, including the answer rounded to \$A\$ amount of decimal places.
The size of the ASCII-art root also depends on \$A\$ and \$B\$.
Example:
\$a=123\$, \$b=1234\$
____
123 /123... | stackexchange_codegolf |
Given Color codes in CMYK, convert it to RGB value.
Input:
string of 4 integers(ranging from 0-100) separated by space
86 86 0 43
28 14 0 6
0 41 73 4
Output:
#141592
#ABCDEF
#F49043
Shortest code wins!
HINT: For converting CMYK to RGB you may use formula such as:
Red = 255 x (1 - Cyan/100) x (1 - Black/100) ... | stackexchange_codegolf |
Al wanted to use my computer to do some simple calculations, so I lent him the use of my R terminal for a bit. He complained though, saying it wasn't set up how he liked it. I said "No problem Al, set it up how you like and I'll just revert it later." This suited Al, and I left him to it. Al isn't a big fan of online R... | stackexchange_codegolf |
In the old DOS operating system, a number of characters were provided to draw boxes. Here is a selection of these characters and their code points:
B3 B4 BF C0 C1 C2 C3 C4 C5 D9 DA
│ ┤ ┐ └ ┴ ┬ ├ ─ ┼ ┘ ┌
You can use these characters to draw boxes like this:
┌─────────┐
│ │
└─────────┘
Boxes can be at... | 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 |
Problem adapted from the book Fortran 77 by Donald M. Monro
Introduction
Digital plotting machines are widely used to produce various forms of drawings, graphs and other pictorial results. Most such machines can move their pens only in certain directions, usually as single steps in the X and Y direction or both. A typi... | stackexchange_codegolf |
In math, a permutation σ of order n is a bijective function from the integers 1...n to itself. This list:
2 1 4 3
represents the permutation σ such that σ(1) = 2, σ(2) = 1, σ(3) = 4, and σ(4) = 3.
A square root of a permutation σ is a permutation that, when applied to itself, gives σ. For example, 2 1 4 3 has the squa... | stackexchange_codegolf |
I like the Hilbert Curve.
Your task for this challenge is to take an image (strictly a square image where all the sides are a power of two pixels wide) and unravel it line by line in a zig-zagging fashion and ravel it back up in a pseudo-Hilbert curve.
Unraveling
To unravel you will start with the pixel in the upper l... | stackexchange_codegolf |
This challenge requires a small amount of knowledge about chess. A description of the details required can be found at the bottom if you are not familiar with chess or want a refresher.
For a certain board configuration consisting only of queens we can say that each queens threat number is the number of other queens i... | stackexchange_codegolf |
Your task
In your language of choice: create a program that outputs 1
This 1 may either be a string or value equivalent to the number one.
The shifting catch
If you take the unicode codepoint (or whatever codepoint encoding your languages uses if not UTF) for each character in your program, and shift each of those valu... | stackexchange_codegolf |
Tonight is card game night! You are the dealer and your task is to write a program to deal the cards to the players.
Given an array of cards and the number of players, you need to split the array of cards into a hand for each player.
Rules
Your program will receive an non-empty array A , as well as a non-zero positive... | stackexchange_codegolf |
Given an input n, output the value of the Fransén-Robinson constant with n digits after the decimal place, with rounding.
Rules
You may assume that all inputs are integers between 1 and 60.
You may not store any related values - the constant must be calculated, not recalled.
Rounding must be done with the following cr... | stackexchange_codegolf |
What is the shortest regular expression equivilant to the following?
ENERO|GENER|GENNAIO|IANUARI|IANUARII|IONAWR|JAANUARIL|JANAIRU|JANAR|JANNEWARIS|JANUAR|JANUARI|JANUARIE|JANUARO|JANUARY|JANUWALE|JANVIER|JANVYE|JENUWARI
The shortest regex, in bytes, wins.
If you are worried about what flavor of regex we are using, th... | stackexchange_codegolf |
Given a MM/DD date (12/24) and a start/end date range (11/01 - 06/24), figure out if the date is within the listed date span.
Date ranges can be sequential (05/01 - 11/01) or wrap around to the next year (11/01 - 05/01).
Examples:
12/24 is in 11/01 - 06/24 = True
06/24 is in 11/01 - 06/24 = True
06/24 is in 06/24 - 06... | stackexchange_codegolf |
Description
Your task is to implement a simple UNIX command parser and file system. Your program will have to implement a file system that can be modified via commands.
The starting directory of your file system is an empty root directory /, with no subdirectories or files. Your program must be capable of handling the ... | stackexchange_codegolf |
Given one of the following inputs: Sweet Onion Chicken Teriyaki
Oven Roasted Chicken
Turkey Breast
Italian BMT
Tuna
Black Forest Ham
Meatball Marinara output a number from 1-7 (or 0-6) representing the day of the week that you get that deal, starting with Monday as the lowest number. Input can be all lowercase or uppe... | stackexchange_codegolf |
Given a list of positive integers, give the longest contiguous sublist which contains at most 1 pair of identical items. In the case of a tie return any of the solutions.
This is code-golf so the goal is to minimize your source code with answers being scored in bytes.
Test cases
[] -> []
[1,2,3] -> [1,2,3]
[1,2,2,3] -... | stackexchange_codegolf |
Preface
As I was shooting an archery 900 round earlier today (10 ends at 6 arrows an end, and 10 ends at 3 arrows an end, for a total of 90 arrows and a maximum score of 900), I thought of this challenge.
In archery (assuming that you are shooting on a FITA supplied target face [the piece of paper that you shoot at]), ... | stackexchange_codegolf |
With the US election going on right now, I noticed that there is one (completely meaningless, but still) thing which Trump can still achieve and which is out of reach for Biden: Having the won states being connected.
Task: Given a list of strings of two-letter abbreviations (see below) for US states, determine whether ... | stackexchange_codegolf |
Slightly more than an inverse of this.
In: Multi-line DSV data and a single delimiter character. The DSV may be taken as a file, a filename, line-break separated string, list of strings, etc. All records have the same number of fields, and no field is empty. Data does not contain the delimiter character and there is no... | stackexchange_codegolf |
The fast growing hierarchy is a way of categorizing how fast functions are growing,
defined the following way (for finite indices):
\$ f_0(n)=n+1 \$
\$ f_k(n)=f_{k-1}^n(n)\$ with \$f^n\$ meaning repeated application of the function f
Examples
f0(5) = 6
f1(3) = f0(f0(f0(3))) = 3+1+1+1= 6
f2(4) = f1(f1(f1(f1(4)))) = 2*... | stackexchange_codegolf |
Lisp programmers boast that Lisp is a powerful language which can be built up from a very small set of primitive operations. Let's put that idea into practice by golfing an interpreter for a dialect called tinylisp.
Language specification
In this specification, any condition whose result is described as "undefined" may... | stackexchange_codegolf |
Your task is given an input string of the full/short name of a CS:GO (Counter-Strike: Global Offensive, a computer game) rank return an integer from 1-18 representing the rank number. A higher number means you are a higher rank and so "better" at CS:GO.
Input
A string representing either the full name or short name of ... | stackexchange_codegolf |
I saw Tom Scott's video on FizzBuzz https://www.youtube.com/watch?v=QPZ0pIK_wsc
so I felt to write my own more "complex" version,this is what I came up with, its very flexibly and easy to scale, and its easy to add more if cases that can trigger functions.
"The challenge": Write a semi-compact "complex FizzBuzz" that c... | stackexchange_codegolf |
I don't like typing, so I draw my mazes in a very simple format:
# #####
# #
# ### #
# # # #
# # #
##### #
Isn't it a-maze-ing? Of course, I think all mazes should look 3d, similar but not he same as this challenge, for maximum a-maze-ingness, so I (grudgingly) manually updated the maze to look like this:
+-----... | stackexchange_codegolf |
About Functional-Basic
Functional-Basic (FB for short) is a language that only allows numbers and lists. Basic features, such as the if statement are missing in an attempt to simplify the language.
Everything in this language is immutable. input is always assigned to the script input, which can be either a number or a ... | stackexchange_codegolf |
This was originally a pure mathematics question, but I think I've got the best chance for an answer here.
The Challenge
For concreteness, consider Peano Arithmetic (PA). For some language L of your choosing, construct a computer program of length at most N bits in L such that:
If it terminates, it outputs a number th... | stackexchange_codegolf |
The following is the rhombus sequence.
1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
Your task is to output this, taking no input and using standard output methods (STDOUT, list of numbers or list of strings, etc.).
There's a hitch. You may only use up to one loop - no neste... | stackexchange_codegolf |
Given two strings of digits, determine which string, if any, has the earliest digit which is lower than the other string's digit at the same index.
Do note that this differs from alphabetization, as shown in the following examples:
Examples
Given inputs 12345000 and 1233999999, the second string would have the earliest... | stackexchange_codegolf |
Given two strings of digits, determine which string, if any, has the earliest digit which is lower than the other string's digit at the same index.
Do note that this differs from alphabetization, as shown in the following examples:
Examples
Given inputs 12345000 and 1233999999, the second string would have the earliest... | stackexchange_codegolf |
Choose any five characters your language supports. There are 5! = 5×4×3×2×1 = 120 ways these can be arranged into a 5-character string that contains each character once; 120 permutations.
Choose your characters such that, when each of the 120 strings is run in your language, the 120 outputs produced will be as many uni... | stackexchange_codegolf |
A parity bit, is one of the simplest forms of a checksum. First, you have to pick the parity, even or odd. Let's say we pick even. Now, we need a message to transmit. Let's say our message is "Foo". This is written in binary as:
01000110 01101111 01101111
Now, we count the total number of 1's in there, which is 15. Si... | stackexchange_codegolf |
I've invented an SQL-like language. Let's call it SelectQL. You can't INSERT anything, you can only SELECT, and I don't have the time for an interpreter. How about you help?
The Challenge
Write a full program or a function that takes in a database of tables and a valid SelectQL SELECT string, interprets the string, and... | stackexchange_codegolf |
Inspired by Is this Flow Free puzzle trivial? by @Bubbler. Lengthy chunks of this challenge are borrowed from there. This may be one step of a solution for the linked challenge, depending on chosen strategy.
Challenge
Given an array of digits 1-9 and a padding character of your choice, output the border of the shape ma... | stackexchange_codegolf |
Objective
Given a permutation of 4 distinct items, classify the permutation by the normal subgroup(s) it belongs.
Input/Output Format
You gotta choose the followings as the hyperparameters for your submission:
The 4 distinct items.
The permutation serving as the identity permutation.
The input format is to accept a... | stackexchange_codegolf |
Task
Implement a kind of "some users are typing" system, which can be found in Discord and some other chat clients.
If 1 user (say, Bubbler) is typing, output Bubbler is typing...
If 2 users (say, Bubbler and user) are typing, output Bubbler and user are typing...
If 3 or more users are typing (say, Bubbler, randomuse... | stackexchange_codegolf |
Cops section
The robbers section can be found here.
Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.
Challenge
Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4... | stackexchange_codegolf |
Challenge
Create a function or program that, when given an integer size, does the following:
If size is equal to 1, output
H H
HHH
H H
If size is greater than 1, output
X X
XXX
X X
where X is the output of the program/function for size - 1
(If you prefer, you may have the base case correspond to 0, so long as you spe... | stackexchange_codegolf |
The Challenge
Your task is to create a program or function that outputs the following with no input:
a
bb
ccc
dddd
eeeee
ffffff
ggggggg
hhhhhhhh
iiiiiiiii
jjjjjjjjjj
kkkkkkkkkkk
llllllllllll
mmmmmmmmmmmmm
nnnnnnnnnnnnnn
ooooooooooooooo
pppppppppppppppp
qqqqqqqqqqqqqqqqq
rrrrrrrrrrrrrrrrrr
sssssssssssssssssss
tttttttttt... | stackexchange_codegolf |
Challenge
Given a non-empty string S of length L consisting entirely of printable ASCII chars, output another string of length L that consists entirely of printable ASCII chars, but is not equal to S.
For the purposes of this challenge, a printable ASCII char is one between U+0020 and U+007E, inclusive; that is, from ... | stackexchange_codegolf |
A great Python golfing tip is to omit needless spaces. But if you are like me, you don't always have the time to search for which spaces to remove. If only there was a way to speed up the process...
Task
Given a single line of Python, as input, return/output a new line which omits all needless spaces. The table below s... | stackexchange_codegolf |
Inspired (like 2 others) by this chat message. (and to some extent, my CMC)
Given a string as an input, your task is to check whether or not that string is a number.
What is a number?
This is a list of all input formats that are "numbers":
Integers: An integer is a string made entirely of characters from 1234567890, w... | stackexchange_codegolf |
Task
Given two strictly positive integers n and d as input, determine whether n is evenly divisible by d, i.e., if there exists an integer q such that n = qd.
You may write a program or a function and use any of the our standard methods of receiving input and providing output.
The output should be a truthy or a falsy v... | stackexchange_codegolf |
Challenge:
Find the number of ways to climb some stairs with n steps and with some limitations. You should be able to run the tests below on TIO https://tio.run/ without timing out. – 60 seconds. (Typically a fraction of a second is well within reach for most languages if a good optimizing strategy is applied).
The in... | stackexchange_codegolf |
In a popular image editing software there is a feature, that patches (The term used in image processing is inpainting as @mınxomaτ pointed out.) a selected area of an image, based on the information outside of that patch. And it does a quite good job, considering it is just a program. As a human, you can sometimes see ... | stackexchange_codegolf |
This challenge is about writing code to solve the following problem.
Given two strings A and B, your code should output the start and end indices of a substring of A with the following properties.
The substring of A should also match some substring of B with up to one substitution of a single character in the string.
... | stackexchange_codegolf |
Given an integer \$ n \ge 2 \$, you need to calculate \$ \lfloor n \log_2(n) \rfloor \$, assuming all integers in your language are unbounded.
However, you may not ignore floating-point errors - for example, in python lambda n:int(n*math.log2(n)) is an invalid solution, because for example for n=10**15, int(n*math.log2... | stackexchange_codegolf |
Create a cat program, a.k.a a program that takes an input and prints it.
...Except, the program will randomly take characters away from your input and print that instead.
Each character in the input should have generally equal odds to be removed with the program, though, as it is hard to make that, the odds for each ch... | stackexchange_codegolf |
Suppose A and B are two good friends. A has borrowed \$n\$ dollar from B. Now B wants the money back from A and A is also ready to give it. But the problem is A has only \$x\$ dollar notes and B has \$y\$ dollar notes. They both want to keep the number of notes in exchange as low as possible.
As an example if \$n=37\$,... | stackexchange_codegolf |
Rolling a 1x1x2 block
This challenge is inspired by the game Bloxorz. Like that game, there is a 1x1x2 block, which may be moved on a square grid in any of the four cardinal directions. It moves by rotating 90 degrees about one of its edges which is touching the ground. Initially, the block is standing upright on a sin... | stackexchange_codegolf |
You've received a coded message from your ally that you know is encoded with the VIC cipher. As you know that the VIC cipher is notoriously convoluted, you want to write a program that will decode the VIC cipher but is small enough to hide from the enemy if you are captured, and thus uses as few bytes as possible.
Your... | stackexchange_codegolf |
This is a good beginner challenge and a good time killer.
I only said a -natural- log because the title was too short, this has nothing to do with logarithms.
Given 2 variables:
The number of ants n.
The width of the log w.
Output a log of width w with n ants (Example shown w=3, n=6)
| |
| \O/ \O/ \O/ |
... | stackexchange_codegolf |
Lets define a non-empty, unsorted and finite matrix with unique numbers as follow:
$$N = \begin{Bmatrix} 4&5&7\\1&3&6 \end{Bmatrix}$$
Lets define 4 matrix moves as:
↑* (up): Moves a column up
↓* (down): Moves a column down
→* (right): Moves a row to the right
←* (left): Moves a row to the left
The asterisk(*) repre... | stackexchange_codegolf |
As of 27/12/20, the challenge is over as no new answers were posted on the 26th. With an astounding 55 points (and 21 answers), the winner is pppery!
A quick shout out to the top 5 scorers as well:
1st. pppery with 55 points across 21 answers
2nd. tsh with 50 points across 21 answers
3rd. SunnyMoon with 21 points acr... | stackexchange_codegolf |
Introduction
Busy Beavers are programs (specifically Turing Machine programs) that aim to output the most ones as possible, while having the least states as possible and halting.
Challenge
Your challenge is to make a busy beaver, which outputs as many ones as possible, but also outputs a second busy beaver. That secon... | stackexchange_codegolf |
Write a sorting algorithm for a list of integers that has an average performance of O(n^2).
This is code-golf, so the shortest code in bytes wins.
RULES:
The characters wasted for the declaration of the list are not counted
(e.g. var c = new List<int>() { 4, 2, 1, 3 }; is not counted)
Builtins to sort a list are not ... | stackexchange_codegolf |
Given an integer \$N\$, print or return integers \$a\$, \$b\$, and \$c\$ that satisfy all of the following conditions, if such integers exist:
\$a \times b + c = N\$
\$a\$, \$b\$, and \$c\$ are all prime
\$a > b > c\$
If no valid combination of integers exist, you should return nothing, 0, None, an empty list, or rai... | stackexchange_codegolf |
In this code golf challenge, you will verify hashtags!
#What_your_code_should_do
Input is a string. Output a truthy value if it is a valid hashtag, and a falsy value otherwise.
We define a string as a valid Hashtag if ...
It starts with a hash (#).
It doesn't have a number right after the hashtag (e.g. #2016USElection... | stackexchange_codegolf |
4, 32, 317, 3163, 31623, 316228, 3162278, 31622777, 316227767, 3162277661, 31622776602, 316227766017, 3162277660169, 31622776601684, 316227766016838, 3162277660168380, 31622776601683794, 316227766016837934, 3162277660168379332, 31622776601683793320, 316227766016837933200, 3162277660168379331999, 31622776601683793319989... | stackexchange_codegolf |
Challenge
The challenge is to implement the bottom encoding (only encoding, not decoding). There is a wide variety of existing implementations in the bottom-software-foundation org.
Bottom is a text encoding where each character is separated into multiple emoji.
Unicode escape(s)
Character
Value
U+1FAC2
200
... | stackexchange_codegolf |
A Belphegor number is a number of the form \$(10^{n+3}+666)*10^{n+1}+1\$ (1{n zeroes}666{n zeroes}1) where \$n\$ is an non-negative integer. A Belphegor prime is a Belphegor number that is also prime.
The \$n\$ values of the first few Belphegor primes are 0, 13, 42, 506 (A232448)
Task
Write a program that either:
take... | stackexchange_codegolf |
Story
There is a woman, named Sarah, whom likes smooth horse rides. She's going to go for a ride down a path too thin to pass any other horses she may come across - and so that her ride can be as smooth as possible she does not want to have to change speed though she would prefer to get to her destination as fast as p... | stackexchange_codegolf |
Following this question: Tut-tut-tut-tut-tut
Write a program that writes "tut-tut-tut" without using the characters "t", "u" or "-" in the code itself.
This is code golf, shortest code in bytes wins.
| stackexchange_codegolf |
Minecraft has a fairly unique lighting system. Each block's light value is either one less than the brightest one surrounding it, or it is a light source itself. Your task is to write a method that takes in a 2D array of light source values, and then returns a 2D array with spread out lighting, where 0 is the minimum v... | 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 |
The string
abaaba
Is a palindrome, meaning it doesn't change when it's reversed. However we can split it in half to make two palindromes
aba aba
We could also split it up this way:
a baab a
And all three of those are palindromes.
In fact there are only two ways to split the string into smaller strings such that non... | stackexchange_codegolf |
One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after the Unix shell utility cat it is of course much less powerful than the real thing, which is normally used to print (and c... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.