instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
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 |
Your task is, given a array of numbers, that is strictly increasing, output the crate stack. The input is an array of positive integers which represents which layer has how many crates there are. So the first number is the top layer and so on. The sum of the array is the size of the crate.
Since the array order follows... | stackexchange_codegolf |
A cannonball is fired so that in the first eyeblink of its flight it ascends by N treetops, during the second eyeblink by N-1 treetops, etc until it reaches the highest point of its trajectory. Then it starts falling by 1, 2, etc treetops per eyeblink until it hits the ground. At the same time the cannonball is moving ... | stackexchange_codegolf |
Robbers thread
Your task is to create a method for hiding information in an image. You will post three encoded messages of your choice (keep them classy), each with its associated image. Reveal the messages for the first two images and do not reveal the third. Robbers have the task of determining what your third hidden... | stackexchange_codegolf |
A twin of this.
FizzBuzz is where a range of positive integers is taken, and numbers divisible by 3 are replaced with "Fizz", divisible by 5 with "Buzz" and divisible by 15 with "FizzBuzz". For example, FizzBuzz from 1 to 10 is 1, 2, Fizz, 4, Buzz, Fizz, 7, 8, Fizz, Buzz.
Your challenge is to, given a list of Fizzes, B... | stackexchange_codegolf |
I like to think of a 10-adic number as a number that goes infinitely to the left, or an integer modulo a very very large power of 10.
Things carry infinitely to the left and vanish. To see what I mean, note that ...6667 * 3 = 1 in the 10-adic land, since the "2" that carries to the left goes to infinity.
Addition and m... | 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 |
A palindrome is a string that is the same forwards and backwards, such as "racecar".
Write a program in some language L, that takes any program P1 in language L as input, and outputs a palindromic program P2 in language L that does the same thing as P1.
You do not need to worry about handling input programs with syntax... | stackexchange_codegolf |
Simple challenge: The code must be both valid Lisp and valid Fortran, and must print out "hello world" in both.
Note: I've sunk about 5 hours into this at this point, I'm not even sure it's possible at this point...
Details:
Must be in a single source file.
Any version of Fortran and any Lisp are allowed (specify whic... | stackexchange_codegolf |
Write a function that takes an ASCII-printable-only (all charcodes ∈ [32..126]) string input x and provides an ASCII-printable-only output string f(x), such that for every x
f(f(x))=x
f(x) is all-numeric (all charcodes ∈ [48..57]) iff x is not all-numeric
You can assume input is not empty and never provide empty outp... | stackexchange_codegolf |
The trumpet is a valved aerophone instrument, usually pitched in B♭. The sound is made when the player vibrates their lips to displace air inside the instrument. That vibration is acquired by setting one's mouth in a specific way, called the embouchure. Different embouchures, with tighter or looser lips, produce differ... | stackexchange_codegolf |
This challenge is to take an alphabetical string as input and to apply the following conversion:
The first of each type of character of the string must stay, and must be immediately followed by an integer representing how many of these characters were in the original string. Any repeating characters must be omitted.
Al... | stackexchange_codegolf |
Task
A date can be compactly represented in a 6-character string in the format ddmmyy where the first two characters (dd) represent a day, the 3rd and 4th characters (mm) represent a month and the last two characters (yy) represent a 20XX year. Given a string with 6 characters in [0-9] determine if it represents a vali... | stackexchange_codegolf |
Task
Take in 3 inputs. The length of the wall, the height of the wall and the coverage of the paint. Output how many tins of paint are required.
Output
Since there's no way to purchase 1/3 tin of paint, you'll need to round the amount of paint tins up to the nearest integer.
Assumptions/Stipulations
Only 1 coat of pai... | stackexchange_codegolf |
Given an \$m \times n\$ matrix of integers A, there exist a \$m \times m\$ matrix P, an \$m \times n\$ matrix D, and an \$n \times n\$ matrix Q such that:
\$A = P D Q\$.
P and Q are unimodular matrices (i.e. matrices which are invertible and whose inverses are also integer matrices);
D is diagonal;
each diagonal entry... | stackexchange_codegolf |
Challenge:
To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points.
Example:
(0,0), (3,3) -> (1.5,1.5)
(-1,-1), (1,1) -> (0,0)
(-7,3), (2,-2) -> (-2.5,0.5)
(3, 1), (-5,9) -> (-1,5)
Rules:
The input an... | stackexchange_codegolf |
Input:
2 numbers, x and y.
Output:
Output a text block where x is the width of the text block and y is the height of the text block. Then there will be a straight line going from the top left to the bottom right and to show it, there should be a # where the line should cross.
The # should be generated using the straigh... | stackexchange_codegolf |
"Talk" is a baroquified accumulator-based language that is created in response to Dennis's quote on talk.tryitonline.net.
Waiting for someone to create an esolang called talk.
. The "Talk" language has 4 commands:
00 If the accumulator is 0, set the accumulator to 0.
01 If the accumulator is 0, set the accumulator t... | stackexchange_codegolf |
Titin is a protein found in muscle tissue. It is a pretty big protein, and its full chemical name is giant as well. Comprising 189819 characters, the full name of titin would take about 3.5 hours to pronounce. Your task is to output this entire name!
Details
The full name can be found here: Gist (this file does not inc... | stackexchange_codegolf |
Given (on STDIN, as command line arguments, or as function arguments) two distinct non-empty strings, find and return the shortest substring of the first string which is not a substring of the second. If no such substring exists, you may return the empty string, return any string which isn't a substring of the original... | stackexchange_codegolf |
Given a multidimensional array, find the recursive alternating sum. An alternating sum is simply the sum of an array, where every other item (starting with the second) is negated. For example, the alternating sum of [7, 1, 6, -4, -2] is the sum of [7, -1, 6, 4, -2], or 14. In this challenge, you'll take the alternating... | stackexchange_codegolf |
Given an input string of length 2 or longer consisting solely of alphabetical characters [A-Z] or [a-z] (your choice if they're all uppercase or all lowercase), output a continuous string of characters forming a double diamond pattern.
The input string starts on the center line and extends down-and-right at a diagonal ... | stackexchange_codegolf |
S. Ryley proved following theorem in 1825:
Every rational number can be expressed as a sum of three rational cubes.
Challenge
Given some rational number \$r \in \mathbb Q \$ find three rational numbers \$a,b,c \in \mathbb Q\$ such that $$r= a^3+b^3+c^3.$$
Details
Your submission should be able to compute a solution f... | stackexchange_codegolf |
Challenge:
Given an integer \$n\$, guaranteed to be \$\geq2\$ and a power of 2, we are going to draw multiply boards either side-by-side or below one another, where the first has dimensions of \$n\$ by \$n\$; the second \$\frac{n}{2}\$ by \$\frac{n}{2}\$; the third \$\frac{n}{4}\$ by \$\frac{n}{4}\$; etc.; until the fi... | stackexchange_codegolf |
Given 2 random circle sections, return how many times they intersect. Rules/clarifications are as below.
You are provided 10 total values,
The center (x,y) of the circle section
Angles of the circle (i.e. (0,90) would be a quarter circle "facing" the top-right corner.
The radius of the circle section
The circle s... | stackexchange_codegolf |
Where's Waldo is a searching game where you are presented an image of some scene, and your goal is to find a man named Waldo in the picture.
Here are a couple pictures showing what Waldo looks like. He always wears a red and white striped sweater and hat, blue pants, brown shoes and hair. He can be with or without acce... | stackexchange_codegolf |
The λ-calculus, or lambda calculus, is a logical system based on anonymous functions. For example, this a λ-expression:
λf.(λx.xx)(λx.f(xx))
However, for the purposes of this challenge, we'll simplify the notation:
Change λ to \ (to make it easier to type): \f.(\x.xx)(\x.f(xx))
The . in lambda headers is unnecessary,... | stackexchange_codegolf |
This challenge is related to some of the MATL language's features, as part of the May 2018 Language of the Month event. Associated challenge: Function clipboard: copy.
Introduction
MATL's function clipboard stores ("copies") the inputs to the four most recent calls to normal, input-taking functions. Normal functions a... | stackexchange_codegolf |
Given two different positions on a chess board and the type of piece, output the minimum number of moves it will take for that piece to go from one position to another.
Rules
The given piece can be King,Queen,Rook,Knight and Bishop. (This input can be taken as any 5 unique characters)
The 2 positions can be taken in an... | stackexchange_codegolf |
Consider a function plot like this:
###########
#################
####################
... | stackexchange_codegolf |
The program should start out with 2 separate files, here named "a" and "b". "a" and "b" should be what I am calling inverse quines: "a", when run, should output "b"'s source code, and "b", when run, should output "a"'s source code, for example:
./a
#source code of b, optionally followed by newlines
./b
#source code of ... | stackexchange_codegolf |
Problem: We have a two dimensional matrix of positive integer cells. On each turn any non-zero cell with a neighbor (top/bottom/left/right) of zero decreases by 1. We want count to the number of non-zero cells present and add them up across all turns.
Is there a faster solution than to use a priority queue?
Is there a... | stackexchange_codegolf |
Background
One-hundred and thirteen years ago, amateur cryptographer Félix Delastelle published his work on the four-square cipher, a digraphic substitution cipher that accepts two permutations of a 25-letter alphabet as keys and encodes messages consisting of those letters.
Like most pen-and-paper ciphers, the four-sq... | stackexchange_codegolf |
Not a new one:
Input
N, being n, 0 ≤ n ≤ 5.
Output
N times "Hello World."
Example:
Input
3
Output
Hello World.
Hello World.
Hello World.
These 2 are my best solutions:
First
public class Out
{
public static void main(String[] a) throws Exception
{
java.io.OutputStream o = System.out;
... | stackexchange_codegolf |
Over is a higher-order function in multiple languages such as APL (⍥). It takes 2 functions and 2 values as arguments, applies the first function to both values, then applies the second to their result. For example, using ⍥ to represent Over:
1 ²⍥+ 2
We would first calculate ² of each argument: 1² = 1 and 2² = 4. We t... | stackexchange_codegolf |
Your task is to write a program/function to scale up an image (list of strings) by a factor of n.
Specs
You will receive two inputs: an image, and a positive integer.
The image will only contain ASCII printable characters (U+0020-U+007F).
Scoring
This is code-golf. Shortest solution in bytes wins.
Testcases
Testcase ... | stackexchange_codegolf |
You have played \$N\$ matches in some game where each match can only result in one of the two outcomes: win or loss. Currently, you have \$W\$ wins. You want to have a win percentage of \$P\$ or more, playing as few matches as possible. Output the minimum win streak that you need. Assume the current win streak is at \$... | stackexchange_codegolf |
This is my first question in Code golf I found it in stack-overflow (originally in JavaScript however all languages are acceptable):
Render on screen NxN (where N in range 1-16) grid where each cell have black boundary and red number inside - cells are numerated in hex starting from left-upper corner to bottom-right. E... | stackexchange_codegolf |
One day in July 2020, I made the following C program:
#define A m]
a[9999],*m=a;main(){for(2[A=4[A=1;;){for(;4[A;putchar(6[m-=3]+48));
for(puts(a);7[A;2[A=4[A,4[A=1)if(4[A+=3[m+=3]-1,9<(3[A=2[A+=3[A))++
5[A,7[A=1,3[A-=10;}}
with three superfluous newlines removed, it's 167 bytes and it prints the fibonacci sequence (a... | stackexchange_codegolf |
The Bible is one of the most influential books ever written, and commonly cited as the best selling book of all time. It was written by approximately 40 different authors over hundreds of years before being compiled into it's current form. But what's interesting about The Bible is the way it's divided up. It is split u... | stackexchange_codegolf |
For this challenge, submissions should be a program or function shaped like a right triangle, which produces a right triangle of the same size.
What is a right triangle?
For this challenge, a right triangle consists of 1 or more lines, each containing a number of characters (assume all non-newline characters are the sa... | stackexchange_codegolf |
Write a function or program that determines the cost of a given string, where
the cost of each character equals the number of how many times the character has occurred up to this point in the string, and
the cost of the string is the sum of its characters' costs.
Example
For an input of abaacab, the cost is computed... | stackexchange_codegolf |
Related
Given a piece of ascii art and a factor to enlarge it by, which will always be an odd number >1, replace each character with the corresponding ascii-art, resized to fit on a grid the size of the input number:
Character
What to do
\
\ \ \A line of \ to the length of the enlarging factor, padded to fo... | stackexchange_codegolf |
Create a function (or closest equivalent, or full program) that takes an list of some datatype (your choice) that may be nested and a string (in either order), and generalizes the lisp c[ad]+r functions.
Functions are provided which perform compositions of up to four car and cdr operations. Their names consist of a C,... | stackexchange_codegolf |
This is a very crude text encoding algorithm I came up with the other day. It won't work if the text has more than 256 different characters in it – but it does support Unicode, at least in my Python implementation.
The algorithm:
Find all the unique characters in the text. Let's call this list, unique-chars.
Break the... | stackexchange_codegolf |
You're a mouse. Your mouse friends have all been captured, and are unconscious and trapped in a maze that has only one entrance/exit. You happen to have a perfect map of the maze, so you can plot a solution to rush in and carry them all to safety. However, the maze is guarded with a security system that will trigger an... | stackexchange_codegolf |
Given a string, determine if it is an int, a float or neither.
Examples
123 - int
62727.0033 - float
644c.33 - neither
Your code should output a different value depending on which it is. For example it could return "i" for int, "f" for float and "n" for neither.
Details
The following are floats:
1.00 -0.0 1.0
The fo... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
There's a good news and a bad news.
Good news: you got a Christmas present from Santa. (Already?! Christmas is two weeks away!)
Bad news: the present is locked with a laser lock. And a note next to it says:
Only the ones who can prope... | stackexchange_codegolf |
This is a simple task. Given a positive or negative real number, round it to the next whole integer closer to zero.
The challenge
Take input through any reasonable form (stdin, function, etc.) of one positive or negative real number.
Round this number "towards zero" - this means if it is positive you will round down,... | stackexchange_codegolf |
To celebrate Rounded Pi Day, you must take advantage of today's date to make a program that takes in a circle's diameter and outputs its circumference by multiplying the diameter by 3.1416, where 3.1416 must be obtained using today's date.
Input 3
Output 9.4248
etc.
Does not take the date as input. You do not have to ... | stackexchange_codegolf |
An Armstrong number (AKA Plus Perfect number, or narcissistic number) is a number which is equal to its sum of n-th power of the digits, where n is the number of digits of the number.
For example, 153 has 3 digits, and 153 = 1^3 + 5^3 + 3^3, so 153 is an Armstrong number.
For example, 8208 has 4 digits, and 8208 = 8^4 ... | stackexchange_codegolf |
The oldest Polish salt mine, located in Bochnia*, was started in year 1248, which we can consider a magical number. We can see that it's equal to 4 digits from the sequence of exponentiations: .
As the date is actually 4 digits from the sequence, we could make it longer. We could repeat the process until we reach infin... | stackexchange_codegolf |
The challenge below requires you to be familiar with formal parser theory. If you don't know what the question is asking because you don't know what the terms mean, context-free grammars and first/follow sets are covered in a lot of university courses.
I can recommend this Stanford course, in particular handouts 08 and... | stackexchange_codegolf |
Your task is, to count how many pluses I have.
What Pluses?
The no plus: 0 Points
-
The naïve Plus: 1 Point
+
The double Plus: 2 Points
+
+++
+
The mega double plus: 3 Points
+
+++
+
+ + +
+++++++++
+ + +
+
+++
+
Pluses of higher order than 3 must be ignored.
Rules
Input will ... | stackexchange_codegolf |
A quote from MO.SE answer:
Although it is well known that Conway was able to quickly calculate the day of the week of any given date, it is less well known that one part of the algorithm is easy to remember and useful in practice: In any given year, the following dates all fall on the same day of the week: 4/4, 6/6, 8... | stackexchange_codegolf |
Note: this challenge involves downloading and sifting through HTML webpages. If your language cannot handle this you might not want to participate in this challenge.
Introduction
There are always discussions over in The Nineteenth Byte Chat about who leads the starboard. So, lets help everyone out and count the total a... | stackexchange_codegolf |
I got this challenge from Codingame and am curious about better solutions than mine:
Given a width via standard input draw a hollow square of '#' in given width and length.
Example:
5 results in
#####
# #
# #
# #
#####
I used python to solve this so i am particulary interested in other python code. But please fe... | stackexchange_codegolf |
This problem is an extension of what happens to me on a regular basis: I have to have $1.00 in coins and have to be able to give change to somebody. I discovered rather quickly that the ideal coins to have were 3 quarters, 1 dime, 2 nickels, and 5 pennies. This is the smallest number of coins (11 total) that allows me ... | stackexchange_codegolf |
Reversible computation refers to computation in which little or no information is deleted. Reversible computation a major component of quantum computation, and reversible computation is potentially many times more energy efficient than conventional computation. I want to know how easy it is to compute the conjugacy of ... | stackexchange_codegolf |
Sandbox
Your challenge is to write a program that when first run, will do one of the actions below at random with equal chances of both:
A cat program
A standard cat program: read everything from STDIN and put it on STDOUT (or your language's closest equivalent).
Do nothing and halt
This shouldn't output anything.... | stackexchange_codegolf |
Given an integer, output five perfect cubes whose sum is that integer. Note that cubes can be positive, negative, or zero. For example,
-10 == -64 - 64 + 64 + 27 + 27
so for input -10 you could output [-64, -64, 64, 27, 27], though other solutions are possible. Note that you should output the cubes, not the numbers be... | stackexchange_codegolf |
The basis vectors for geometric algebra are
$$(e_0=1), e_1, e_2,\dots,e_n$$
They all square to 1 (we do not consider vectors which square to -1 or zero)
$$e_i \cdot e_i = 1$$
They are associative and anticommutative (except \$e_0=1\$ which is associative and commutative)
$$e_i \cdot e_j =-e_j \cdot e_i \: \; (i\neq j);... | stackexchange_codegolf |
Context
After "Computing a specific coefficient in a product of polynomials", asking you to compute a specific coefficient of polynomial multiplication, I wish to create a "mirror" challenge, asking you to compute a specific coefficient from polynomial division.
Polynomial division
Let us establish an analogy with inte... | stackexchange_codegolf |
Let \$Z\$ be either the integers, the positive integers, or the non-zero integers; pick whatever's convenient. Give two functions \$f\$ and \$g\$, each \$Z \to Z\$, such that:
\$f(g(a)) = g(f(a))\$, for infinitely many integers \$a\$, and
\$f(g(b)) \ne g(f(b))\$, for infinitely many integers \$b\$.
Rules
Many of the ... | stackexchange_codegolf |
Input:
A list of integers (which will never contain a zero)
Output:
A list of the same size with counts based on the following:
If the current item is negative: Look at all items before this item, and count how many times the digits occurred in those other numbers
If the current item is positive instead: Look at all i... | stackexchange_codegolf |
Let us define the "multiplicative deltas" of values \$[\; a_0, \cdots a_N, \;]\$ as:
$$
[\; a_1 / a_0, \cdots, a_{i+1} / a_i, \cdots, a_N / a_{N-1} \;]
$$
The reverse operation - namely "multiplicative undelta" - returns values such that the above operation results in the given values.
Example
Given values \$[\; 1, 5, ... | stackexchange_codegolf |
There have of course been challenges to render ASCII art fonts here and there. This challenge doesn't add anything to those. In contrary, it subtracts from them for a good reason. If you allow all characters,
it's a lot of boring work
the task is mainly about clever compression of the font and short extraction
This o... | stackexchange_codegolf |
In most programming languages, the string Hello, World! can be represented as "Hello, World!". But if you want to represent "Hello, World!" you need to escape the double quotes with backslashes for "\"Hello, World!\"", and to represent that you also need to escape the backslashes resulting in "\"\\\"Hello, World!\\\"\"... | stackexchange_codegolf |
A metaquine is a program which is not a quine, but whose output, when run as a program in the same language, is a quine.
The goal of this challenge is to write a metaquine. This is code-golf, so shortest code wins, with earliest answer used as a tiebreaker. Note that only full programs are acceptable, due to the defini... | stackexchange_codegolf |
Your task – if you choose to accept it – is to have your program print, literally, either one of the following:
E=mc² (if your language supports Unicode (so no HTML trickery, for instance))
E=mc^2 (if your language doesn't support Unicode)
Here are the conditions:
Your program must consist of exactly two expressions... | stackexchange_codegolf |
Challenge :
Given a word, check whether or not it is an isogram.
What :
An isogram is a word consisting only of letters with no duplicates (case insensitive). The empty string is an isogram.
Examples :
"Dermatoglyphics" ---> true
"ab" ---> true
"aba" ---> false
"moOse" ... | stackexchange_codegolf |
Forth is one of the few non-esoteric stack-based languages. For this challenge, we will use a small subset of Forth, which simply executes a sequence of words in a linear fashion — without any definitions or loops.
In good Forth code, each word definition includes a stack effect comment, which explains the layout of th... | stackexchange_codegolf |
Write a program that has at least one byte that, when run, does absolutely nothing.
I thought this would be done by now, but I can't find any other challenges like this.
How to tell if it does nothing:
No variables are declared
Nothing is returned
Input does nothing
You could run a program after it and it would run no... | stackexchange_codegolf |
The Caesar cipher is a simple and famous cipher, where the letters of the alphabet are rotated by some secret amount. For example, if our secret rotation is 3, we would replace a with d, b with e, w with z, x with a and so on.
Here is an example (rotation amount: 10):
Robo sc kx ohkwzvo
This cipher is very weak, becau... | stackexchange_codegolf |
Given a string as input, output a number of whitespace characters (0x0A and 0x20) equal to the length of the string.
For example, given the string Hello, World! your code would need to output exactly 13 whitespace characters and nothing else. These can be any mix of spaces and newlines.
Your code should not output any ... | stackexchange_codegolf |
Introduction
Almost everyone is familiar with the Travelling Salesman Problem (TSP). The task is to, given a list of N cities, find the minimum Hamiltonian cycle which is to say the shortest path that visits each city and comes full-circle back to the start. That is not what this challenge is about. This challenge is t... | stackexchange_codegolf |
Let's say I've got some ASCII art:
___
,"---".
: ;
`-.-'
| |
| |
| |
_.-\_/-._
_ / | | \ _
/ / `---' \ \
/ `-----------' \
/,-""-. ,-""-.\
( i-..-i i-..-i )
|`| |-------| |'|
\ `-..-' ,=. `-..-'/
`------... | stackexchange_codegolf |
Can you recover a sequence of letters from a sequence of dots and dashes? In Morse code, x is represented by -..-, but without the help of spaces, -..---.-... could represent xmas, or dole, or teettteteee, etc.
I took the lyrics from "Rudolph, the Red-Nosed Reindeer" to make the following sequence of letters:
youknowda... | 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 |
There's a cool magic trick that works using the power of binary. The effect of the trick is as follows:
An audience member chooses some natural number in the range of 1 to x where x is chosen by the magician.
The magician hands the audience member some special cards. Each card contains some numbers from 1 to x.
The ... | stackexchange_codegolf |
To dynamically include a JavaScript file in a web page, you'd normally insert a <script> tag pointing to your script. For example:
var js_file= document.createElement("script");
js_file.src='http://example.com/js.js';
document.body.appendChild(js_file);
Write JavaScript code will load an external JavaScript file in th... | stackexchange_codegolf |
The goal of this challenge is to implement a digital low-pass filter.
You are free to implement any type of digital filter you want, however whatever results produced must pass the validation script below.
Here's a general description of what the validation script expects:
When an FFT is taken of the filtered signal, ... | stackexchange_codegolf |
Challenge
To quote Wikipedia:
An octave-repeating scale can be represented as a circular arrangement
of pitch classes, ordered by increasing (or decreasing) pitch class. For instance, the increasing C major scale is C–D–E–F–G–A–B–[C], with the bracket indicating that the last note is an octave higher than the first no... | stackexchange_codegolf |
Challenge
The goal of this challenge is to make a function that takes an input string, a start keyword and a end keyword. The output extracted result is from (but excluded) the given start keyword to (but excluded) end keyword. The output sub-string follows the rules as below.
In all cases, the leading/trailing spaces... | stackexchange_codegolf |
Let's begin with a thought experiment. You have a clock and a timer, in which you start the timer when the clock shows exactly hh:mm.00.
Clock: The clock employs 24-hour time. So the range of hh is 0<=h<23. (Because 23 inputs are unsolvable, you aren't required to handle that)
Timer: It starts exactly on 00.00. The nu... | stackexchange_codegolf |
You are given a square matrix of width \$\ge2\$, containing square numbers \$\ge1\$.
Your task is to make all square numbers 'explode' until all of them have disappeared. You must print or return the final matrix.
More specifically:
Look for the highest square \$x^2\$ in the matrix.
Look for its smallest adjacent neig... | stackexchange_codegolf |
An alternating permutation is a permutation of the first \$ n \$ integers \$ \{ 1 ... n \} \$, such that adjacent pairs of values in the permutation alternate between increasing and decreasing (or vice versa).
Equivalently, it is a permutation where there are no "runs" of continuously increasing or decreasing values wi... | 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 |
In this challenge, your input is a string of lower-case letters like this:
insertspacesbetweenwords
and a dictionary like the that from my other challenge. You may assume that the dictionary file contains only lower-case letters and line-feed characters. Furthermore, the last character in the dictionary file is a line... | stackexchange_codegolf |
The Task
This is quite a simple coding task, all your program has to do is place a point on a canvas (or your alternative in another coding language) and connect it to all the dots already placed. Your program must take in one input, the number of dots that should be placed, and output some sort of display with the do... | stackexchange_codegolf |
Create a progress bar indicating year progress
Your code has to output the percentage of the year already passed form 1st of January of the current year.
You have to display a progress bar and the figure.
Input
You may use builtins to get the current date, if your language doesen't have it you can get date as input but... | stackexchange_codegolf |
Write the shortest program which, when run with no arguments, stdin, or user input, triggers a core dump.
Your code must behave this way when run on some common out-of-the-box Linux distribution. Other than installing support for your target language, you may not reconfigure the system to make it more fragile than it i... | stackexchange_codegolf |
The coefficients of a perfect square polynomial can be calculated by the formula \$(ax)^2 + 2abx + b^2\$, where both a and b are integers. The objective of this challenge is to create a program that not only can find if an input trinomial is a perfect square, but also find its square root binomial. The input trinomial ... | stackexchange_codegolf |
The usual rules: no external resources, or the like. Input will be a positive integer in valid Roman numeral format less than 10 thousand, say.
Use all the Roman numeral characters:
I = 1
V = 5
X = 10
L = 50
C = 100
D = 500
M = 1,000
Respect subtractive notation (copied from the Wikipedia page):
the numeral ... | stackexchange_codegolf |
Taken straight from the ACM Winter Programming Contest 2013. You are a person who likes to take things literally. Therefore, for you, the end of The World is ed; the last letters of "The" and "World" concatenated.
Make a program which takes a sentence, and output the last letter of each word in that sentence in as litt... | stackexchange_codegolf |
Write a program that keeps track of the number of consecutive days it has been run.
The day resets at midnight (the local time of the computer on which the program is run).
If there is a day that the program is not run, the counter is reset to zero.
Every time the program is run, the counter should go up by one day ... | stackexchange_codegolf |
An undulant number is a number where its digits alternate between up and down like the following number: 461902 or 708143, or even 1010101, but not 123, because
2 < 3.
Write a program or function which returns a truthy value if a number is undulant, and a falsy value otherwise. The shortest code wins.
Note: Single di... | stackexchange_codegolf |
Given a positive integer, n, along with n non-negative integers, write a program or function that prints or returns the smallest non-negative integer that can be obtained by additions and subtractions between those numbers. You must use all of the input numbers.
The winner is the algorithm with the smallest big O time ... | stackexchange_codegolf |
Write a program that prints an associative array (key-value) to a table.
Requirements
Standard loopholes are forbidden
Please include a link to an online interpreter and the byte count in the answer
Use box drawing characters to draw the table.
You can write both a full program or a function.
Key or value can't cont... | stackexchange_codegolf |
Given a positive integer \$n\$ output an ASCII hexagon with diagonal side length \$n\$, as pictured (note there are \$2n\$ _ characters on the top edge)
Examples:
\$n = 1\$
__
/ \
\__/
\$n = 2\$
____
/ \
/ \
\ /
\____/
\$n = 5\$
__________
/ \
/ \
/ \
... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.