instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Challenge
Given a left- or right-stochastic matrix where the limit as x approaches infinity of the matrix to the power of x approaches a matrix with all finite values, return the matrix to which the matrix converges. Basically, you want to keep multiplying the matrix by itself until the result no longer changes.
Test C... | stackexchange_codegolf |
Problem
There is a circular track containing fuel pits at irregular intervals. The total amount of fuel available from all the pits together is just sufficient to travel round the track and finish where you started. Given the the circuit perimeter, list of each fuel pit location and the amount of fuel they contain, fin... | stackexchange_codegolf |
I'm (still) trying to make another submission to the Largest Number Printable question, and I've got the following bit of code:
f=->a{b,c,d=a;b ?a==b ?~-a:a==a-[c-c]?[[b,c,f[d]],~-c,b]:b:$n}
h=[],$n=?~.ord,[]
h=f[h]until h==p($n+=$n)-$n
Ungolfed:
f=->{b,c,d=a
if b
if a==b # a is not an array
return a-1
elsif a... | stackexchange_codegolf |
If you are given an array of numbers between 1 and 100 and an integer n, you must remove any instances of an item that appear greater than n times.
For example:
In : [92, 41, 81, 47, 28, 92, 84, 92, 81], n = 1
Out: [92, 41, 81, 47, 28, 84]
The most aesthetic/simple algorithm wins. And since this is a popularity-contes... | 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 |
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 |
Task
You are playing Hangman, and your opponent uses a simple but effective strategy: Each turn, from the remaining letters, they guess the letter that appears most frequently across all possible words. When multiple letters appear with the same maximum frequency, your opponent selects randomly among them.
That is, yo... | stackexchange_codegolf |
We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if n teens have m torches with them, but each group needs at least one torch?
Example: Three teens with torches (X) and two without ... | stackexchange_codegolf |
Sylvester's sequence, OEIS A000058, is an integer sequence defined as follows:
Each member is the product of all previous members plus one. The first member of the sequence is 2.
Task
Create a program to calculate the nth term of Sylvester's Sequence. Standard input, output and loopholes apply.
Standard sequence rule... | stackexchange_codegolf |
We define \$V(x)\$ as the list of distinct powers of \$2\$ that sum to \$x\$. For instance, \$V(35)=[32,2,1]\$.
By convention, powers are sorted here from highest to lowest. But it does not affect the logic of the challenge, nor the expected solutions.
Task
Given a semiprime \$N\$, replace each term in \$V(N)\$ with an... | stackexchange_codegolf |
Your task is to write a program or function that checks if a string is a valid phone number.
Given a string (or list of characters/codepoints) input, you will output a truthy value if the input is a valid phone number. If it is not, output a falsey value. An input string is considered a valid phone number for this chal... | stackexchange_codegolf |
Given a mapping from the integers from 1 to N to the integers from 1 to N, determine if the mapping is surjective, injective, bijective, or nothing.
You may choose any character/digit for the four outputs.
Specs
Input format: n, arrays of pairs (n is the highest number in the domain and range)
For example, if the first... | stackexchange_codegolf |
I've recently been indulging myself in some nostalgia
in the form of Bookworm Deluxe:
In case you haven't seen it before,
it's a word game where the goal is to connect adjacent tiles to form words.
In order to determine whether a string is a valid word,
it checks it against its internal dictionary,
which is stored in ... | stackexchange_codegolf |
So, last week I posted a challenge to play Duck, Duck, Goose. This lead to a number of Minnesotans commenting about their regional 'Gray duck' variation.
So here's the rules:
Using this list of colours:
Red
Orange
Yellow
Green
Blue
Indigo
Violet
Gray
Write a program to follow these rules:
Select one of these colours,... | stackexchange_codegolf |
The task is simple, given two IP adresses a and b, output all addresses within that range.
Examples
Example #1:
f(a = 192.168.0.1, b = 192.168.0.4)
192.168.0.1
192.168.0.2
192.168.0.3
192.168.0.4
Example #2 (TIO will truncate this, use a smaller range when testing):
f (a = 123.0.200.0, b = 124.0.0.0)... | stackexchange_codegolf |
Consider a grid of NxN unique elements. Each element has a letter (from A to the Nth letter, inclusive) and a number (from 1 to N, inclusive). Hence, each number/letter pair is in the grid exactly once.
Your job is to arrange a grid such that:
Each row, column, and diagonal (including wrapping) contains each letter a... | stackexchange_codegolf |
Introduction
In a general election, one would like to calculate a constant price per parliament seat. This means that for N >= 0 seats to be distributed and a list ns of votes per party, we would like to find a number d such that
sum(floor(n/d) for n in ns) == N
To make things interesting (and more like the real worl... | stackexchange_codegolf |
At time of writing, my reputation is \$16,256\$. As I noted in chat,
Oh cool my rep is the concatenation of two powers of 2: 16,256
Or even the concatenation of a power of 2 and its square, which is much more interesting
which then spawned a CMC about checking if a number has this property.
Given an integer \$n > 0\... | stackexchange_codegolf |
Just take an input in any way and then print it backward (trailing newlines allowed). For example:
Hello World -> dlroW olleH
Hi -> iH
Yes, it is case sensitive. Shortest code wins
| stackexchange_codegolf |
This is a relatively quick one, but I'm sure you'll like it.
Codegolf a program that will take input in the form of a sentence and then provide the output with the first letter capitalized in each word.
Rules:
Submissions may not be in the form of a function. So no:
function x(y){z=some_kind_of_magic(y);return z;} as ... | stackexchange_codegolf |
Several years back, Hot Wheels made a simple flash game called "Formula Fuelers Racers"*. To play the game, you select three ingredients from a fridge to put into your car, which is then raced against the computer's randomly-generated car. It turns out the mechanics of this game are pretty simple. First off, the act... | stackexchange_codegolf |
Wholly surprised this hasn't been posted already, given the large number of chess puzzles on the site. While I thought of this myself, credit to Anush for posting it to the sandbox back in March. But I figured it's been long enough that I could go ahead and do so myself.
A checkmate in chess is a position in which the ... | stackexchange_codegolf |
Your task is to, given a map as input, zoom it out or in, depending on the scale. Note that the scale given is the scale by which to zoom out, so a scale between 0 and 1 will actually zoom in.
For example, given the following (badly made) map:
..____....
../OOO\...
..\OO/\...
..........
And a scale factor of 2, you sh... | stackexchange_codegolf |
"A picture is worth a thousand words"—so the old saying goes. The average word is about four characters long, so a picture conveys 4kB of information. But how much entropy, rather than information, can a picture convey?
Your task is to generate an image, exactly 4,000 bytes in size, with the highest entropy possible. Y... | stackexchange_codegolf |
Given 2 positive integers in any format you'd like, return their sum using only logic gates and bit shifts (see example below). Don't worry about overflow.
EDIT: Using pre-written addition is obviously not allowed. So no a + b, Add(a, b), a - (-b) etc.
This is code golf, so standard loopholes apply. Shortest program in... | stackexchange_codegolf |
An arithmetico-geometric sequence is the elementwise product of an arithmetic sequence and a geometric sequence. For example, 1 -4 12 -32 is the product of the arithmetic sequence 1 2 3 4 and the geometric sequence 1 -2 4 -8. The nth term of an integer arithmetico-geometric sequence can be expressed as
$$a_n = r^n \cdo... | stackexchange_codegolf |
You want to draw a regular polygon but you have limited space! In this challenge, you should draw a polygon with n sides which is as big as possible for a given square container image.
I found surprisingly little information on the Internet about inscribing a polygon into a square. To save you the hassle, I verified th... | stackexchange_codegolf |
Challenge
Your challenge is simple, calculate the depth of each matching brackets in the given input e.g. (()()(()))->[[1,1,[1]]], and output it in the form of a list/array/string representation
Explanation:
For every bracket in the input, you have to count how many nested brackets there are for that part of the input ... | stackexchange_codegolf |
Doing my history reading and note-taking, I can't help but get tired of writing out all these long dates –– 1784 is six entire pencil lifts! jǝǝz!
As you can see, I –– like most challenge posters on this site –– am lazy when it comes to writing stuff. Thus, I ask you to please help me shorten some dates. Of course, you... | stackexchange_codegolf |
I'm searching (am I?) for a piece of code that quits immediately - in an absolutely unconventional way.
This does not mean: System.exit((int) 'A'); (Java).
It might mean:
#!/usr/bin/env python3
# NOTE: This kills ALL RUNNING Python processes. Be careful!
def exit():
import os
os.system("killall python3")
# ... | stackexchange_codegolf |
Inspiration.* I cannot believe we have not had this challenge before:
Task
Given one or more printable ASCII strings, interleave them by taking one character from each string, cyclically until out of characters. If a string runs out of characters before the others, just skip that one from then on.
Examples
SIMPLE gives... | stackexchange_codegolf |
Preamble
There was a unit test in our codebase which was shuffling a string of length \$52\$ formed from the set of letters \$[A-Z]+[A-Z]\$ and then using the first \$20\$ characters of that shuffled string.
It failed quite a while after being written due to no repeated character being present in those twenty and we wo... | stackexchange_codegolf |
When making a Dungeons & Dragons character, an alternative to rolling ability scores is to assign them within a power budget called point buy. Higher ability scores cost more points, especially towards the upper end: a score of 8 is free, and raising a score by 1 costs 1 point, except raising to 15 or 16 costs 2 points... | stackexchange_codegolf |
Let \$S \subset \mathbb N_{\geq0}\$ be a subset of the nonnegative integers, and let $$
S^{(k)} = \underbrace{S + S + \dots + S}_{k\ \textrm{times}} = \{ a_1 + a_2 + \dots + a_k : a_i \in S\}.
$$
For example, $$\begin{align}
\{1,2,3\}^{(2)}
&= \{1+1, 1+2, 1+3, 2+1, 2+2, 2+3, 3+1, 3+2, 3+3\}\\
&=\{2,3,4,5,6\}
\end{align... | stackexchange_codegolf |
Dropbox recently released Lepton (GitHub), a method that losslessly compresses JPEG images round-trip, saving an average of 22%.
Because of the pigeonhole principle, any general compression algorithm cannot be guaranteed to result in a smaller file (general because it doesn't apply to inputs constrained to a specific ... | stackexchange_codegolf |
Create a program that does the same thing forwards and backwards, in different languages. “Different languages” does not include different versions of the same language.
Challenge
This program can take any input and write anything to stdout and stderr.
However, the program must output exactly the same things for the sa... | stackexchange_codegolf |
About Hangul
As I'm Korean, I'm really proud of Korean character, Hangul(한글).
Hangul is a syllabary invented by King Sejong the great, 4th king of Joseon dynasty, in 1443.
Because today (October 9th) is Hangul day in Korea, I'll give you a challenge: Make some Hangul ascii-art
List of characters
So, To make ASCII art, ... | stackexchange_codegolf |
So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code...
Here's a (short) example output:
+
+
+
+
+
+
+
... | stackexchange_codegolf |
Input is in this format:
image fontwidth fontheight rowwidth xoffset yoffset xgap ygap non-existent charstart thetextitself
thetextitself: The text that should be rendered from the image.
image: The image filename. Implementation may vary; it could be either the filename from your computer, an image URL, or something ... | stackexchange_codegolf |
This challenge is inspired by Blink the CAPS LOCK by zeppelin.
Most webcams feature a small integrated LED light, indicating if the webcam is in use, as controlled by a hardware mechanism to prevent spying.
Your task is to blink it:
Turn it on.
Wait for 0.5 (±0.1) seconds.
Turn it off again.
Wait for 0.5 (±0.1) secon... | stackexchange_codegolf |
Intro
The Tetris Guidelines specify what RNG is needed for the piece selection to be called a Tetris game, called the Random Generator.
Yes, that's the actual name ("Random Generator").
In essence, it acts like a bag without replacement: You can draw pieces out of the bag, but you cannot draw the same piece from the ba... | stackexchange_codegolf |
In this challenge we learned a way to encode every positive integer using factor trees.
Here is how it works:
The empty string has value of 1.
(S) where S is any expression with a value of S evaluates to the Sth prime.
AB where A and B are arbirary expressions with values of A and B respectively has value A*B.
For ex... | stackexchange_codegolf |
In this task, we consider arrays of positive integers such as this:
3 18 321 17 4 4 51 1 293 17
The input comprises a pair of such arrays both of arbitrary, possibly distinct, positive length. Determine if a total ordering ≤X ⊂ N × N, where N is the set of positive integers, exists such that both input arrays are in o... | stackexchange_codegolf |
This is a more difficult version of It's a find-a-movie challenge .
Input
Your code should take a BBFC rating and a number from 1 to 5 as input. It can do this in any way you find convenient.
Output
Your code should return the name of any movie which has a) that film rating and b) that number of stars in a Guardian fi... | stackexchange_codegolf |
Intro
Two numbers are a reversed multiple pair if they satisfy the following property:
$$
a\cdot b = \operatorname{reversed}( (a-1)\cdot b )
$$
Here, \$\operatorname{reversed}()\$ means to reverse the digits of a number (e. g 123 becomes 321.)
Example
$$
a=6,\quad b=9,\quad
6\cdot 9=54,\quad
5\cdot 9=45
$$
As you can ... | stackexchange_codegolf |
Is it a good chord?
Definition of a chord:
We define a chord as three notes together.
Definition of a note:
We define a note as a number between 1 and 7, inclusive. As in music, we define 1 as do, 2 as re, 3 as fa, etc. However, the note names are not important. They will not be included in the question and likely not ... | stackexchange_codegolf |
Let me explain one by one the above terms...
We will call \$\text{Z-Factorial}(n)\$ of a positive integer \$n\$, \$n!\$ (i.e. \$n\$ factorial) without any trailing zeros.
So, \$\text{Z-Factorial}(30)\$ is \$26525285981219105863630848\$ because \$30!=265252859812191058636308480000000\$
We will call Modified Z-Factorial ... | stackexchange_codegolf |
CONGRATULATIONS to @kuroineko. Wins the bounty for excellent speed (672 moves) on the Gauntlet track.
LEADER:* Nimi scoring a lightweight 2129. Other entries are larger but showing some serious speed.
*Leader may change due to later entries.
Your task is to write a small program that can drive a racing car fast.
Rules
... | stackexchange_codegolf |
Specification
This challenge is simple to state: your input is a non-empty array of nonnegative integers, and your task is to partition it into as few substrings as possible, such that each substring is a permutation of a consecutive integer range.
More formally, if the input array is A, then the output is minimum numb... | stackexchange_codegolf |
My Alarm Clock
I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button moves it up one minute. Hitting both buttons at the same time resets it to midnight (12:00 am), and counts as two button... | stackexchange_codegolf |
A screen consists of some LED segments like such:
The screen can be split into several(maybe one) component. Each component is a segment like above, with varying lengths. These components can be used to display any amount, including 0, of digits, as long as the component is large enough.
Every digit except 1 needs two... | stackexchange_codegolf |
Write a program that outputs its input unchanged. However:
If all uppercase characters are removed from the program, it lowercases all uppercase letters.
If all lowercase characters are removed from the program, it uppercases all lowercase letters.
Transforming characters beyond the basic Latin [A-Za-z] range is opti... | stackexchange_codegolf |
This challenge but with a better spec.
Spec
Your program will take a linear equation containing a single variable x and output the value of x.
Input / Parsing
The input will only contain numbers, operators, parenthesis (()), x, and an = sign (this means no whitespace).
Parenthesis will always be balanced.
There will a... | stackexchange_codegolf |
There are 16 distinct boolean functions for two binary variables, A and B:
A B | F0 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | F15
-----------------------------------------------------------------------------------------
0 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 ... | stackexchange_codegolf |
Related: Music: what's in this chord?, Notes to Tablature, Generating guitar tabs?, Translate number pairs to guitar notes
Given a guitar fingering, output the chord it represents. You can use standard input and output, or write a function that returns a string.
The input fingerings will be classifiable as one of the f... | stackexchange_codegolf |
Challenge
The primitive circle problem is the problem of determining how many coprime integer lattice points \$x,y\$ there are in a circle centered at the origin and with radius \$r \in \mathbb{Z}^+
\$ such that \$x^2+y^2 \le r^2 \$. It's a generalization of Code-Golf: Lattice Points inside a Circle.
Input
Radius \$r... | stackexchange_codegolf |
Inspired by this accidental misspelling
If you could read the title, then you already know what the challenge is about. If not, then I'll tell you. Easy: simply take each word (single space delimited), and swap the positions of the first two letters. You may assume that the input will contain only lowercase ASCII let... | 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 |
Given a natural number \$n\$, return the \$n\$-th cuban prime.
Cuban Primes
A cuban prime is a prime number of the form
$$p = \frac{x^3-y^3}{x-y}$$
where \$y>0\$ and \$x = 1+y\$ or \$x = 2+y\$
Details
You may use 0 or 1 based indexing, whatever suits you best.
You can return the \$n\$-th prime given the index \$n\$ or... | stackexchange_codegolf |
The task is to to compete for the shortest regex (in bytes) in your preferred programming language which can distinguish between English and Spanish with minimum 60% 90% accuracy.
Silvio Mayolo's submission (pinned as Best Answer) has secured his spot as the winner of original contest against any chance of being contes... | stackexchange_codegolf |
A tower is made out of layers, each one being one unit shorter than the one below it. Every layer is completely on top of the previous layer. For example, here is a tower along with it's height map:
#
##
###
####
#####
14532
Because the lengths of the layers are the integers from 1 to n, and because the layers ar... | 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 |
Write a program or function (hereafter "function") that returns or prints the source code of four new functions: Increment, decrement, undo, and peek.
The initial function contains an internal integer value of 0. Each of the returned functions contains a value based on that value, and each behaves differently:
Increme... | stackexchange_codegolf |
Lets define the process of crushing an array of numbers. In a crush we read the array left to right. If at a point we encounter two of the same element in a row we remove the first one and double the second one. For example here is the process of crushing the following array
[5,2,2,3]
^
[5,2,2,3]
^
[5,2,2,3]
... | stackexchange_codegolf |
Specifically, Conway's PRIMEGAME.
This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers:
A B C D E F G H I J K L M N
17 78 19 23 29 77 95 77 1 11 13 15 15 55
-- -- -- -- -- -- -- -- -- -- -- -- -- --
91 85 51 38... | stackexchange_codegolf |
Given an infinite arithmetically-progressive¹ sequence, compute the minimum length of a prefix with a product divisible by 2^8.
Sample cases & reference implementation
Here is a reference implementation that I wrote in Io.
1, 1 -> 10
2, 4 -> 8
3, 5 -> 10
2, 6 -> 5
7, 5 -> 6
4, 1 -> 9
10, 9 -> 7
256, 9 -> 1... | stackexchange_codegolf |
This Stack Snippet draws an aliased white rectangle on a black background given parameters for its dimensions, position, angle, and the grid dimensions:
<style>html *{font-family:Consolas,monospace}input{width:24pt;text-align:right;padding:1px}canvas{border:1px solid gray}</style><p>grid w:<input id='gw' type='text' ... | stackexchange_codegolf |
Drunk Uncle (sorry M.E. and AUS for region lock) is a fictional character from Saturday Night Live. He often confuses words for others that sound like them. For this challenge you need to convert normal speech into drunkspeak.
Algorithm
Translating to drunkspeak requires swapping the order of words in the text. Swappin... | stackexchange_codegolf |
This is a Hello World challenge! Those plain ones! Yeah....
However, it's different this time.
Because here, you can't use C or C++ or Stuck or ArnoldC or whatever you want. You can only choose raw x86 opcodes from this list, or any other x86 opcode lists.
It is also assuming you have no Protected Mode or any other thi... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2015 Day 3, Part 2. This challenge was kindly contributed by Wheat Wizard (Grain Ghost).
Santa is delivering presents to an infinite two-dimensional grid of houses. The delivery begins delivering a present to the ... | stackexchange_codegolf |
Given an image, output the [width in pixels of a full vertical section]1 (if one exists). If no vertical section exists, output 0.
Input may be provided as a local file or a nested array. If you choose to take input as a nested array, white pixels should be represented by a truthy value while non-white pixels should be... | stackexchange_codegolf |
You are Ruby, a railway engineer. Your task is to lay track in any given valley such that it visits every station (M). The amount of track laid is not important, but it must be laid in one continuous path which starts and ends at the valley entrance/exit point (>) and does not, at any point cross itself. There are a fe... | stackexchange_codegolf |
Inspired by Create a binary wall
Given a list of positive integers, we can write them out all above each other like so, for [2, 6, 9, 4] as an example:
0010
0110
1001
0100
We can imagine this as a wall:
..#.
.##.
#..#
.#..
However, this is a very weak wall, and it has collapsed! Each 1 (#) falls down until it hits th... | stackexchange_codegolf |
Programmer's Garden
Being a professional software developer, you cannot risk exposing yourself to the harsh non-artificial light of the sun, but you also have a soft spot for flowers, and want to keep your garden in good shape all year round.
To this end, a gardener is hired each month to tidy up the flowerbed at the f... | stackexchange_codegolf |
Strangely never asked before, this question pertains to the generation of a list of prime numbers within a given range using the shortest possible code. Several algorithms, such as the Sieve of Eratosthenes and trial division, are known to be effective for this purpose, but require significant code length. Is there an ... | stackexchange_codegolf |
There are a few questions on this site about balancing brackets, and checking whether brackets are balanced. I propose it's now time to use those balanced brackets for something!
In mathematics and programming, brackets are like bubbles, isolating everything inside form everything outside so that whatever's inside can ... | stackexchange_codegolf |
Given a non-empty list/vector of positive integers, write a function to check the following conditions in as few bytes as possible.
Take the first integer (the key, or k1) and check that the next k1 values have no duplicate values, excluding instances of k1.
Take the last integer (the second key, or k2) and check tha... | stackexchange_codegolf |
I like pizza!
Task
Given the radius of a pizza and a list of ingredients, create the corresponding ascii pizza!
Example size 4 pizza with mozzarella cheese, olives and ham:
#####
#@@@@M#
#H@O@@@@#
#M@@@H@@#
#@OO@@@@#
#@@H@@@@#
#M@M@@@@#
#O@@@H#
#####
Input
A positive integer r for the size of the pizza and... | stackexchange_codegolf |
Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with.
Specifics:
Your language needs to support variadic argument functions: something callable that takes an arbitrary number of arguments and returns a value.
Parameters must be... | stackexchange_codegolf |
Given a string, first square it as follows:
First, write the string.
abcde
Next, write the string rotated one left.
abcde
bcdea
Keep doing this until you have written len(string) lines.
abcde
bcdea
cdeab
deabc
eabcd
Now, read from the string like this:
----+
+--+|
|+>||
|+-+|
+---+
Which gives:
abcdeabcdcbaedcbcdea... | stackexchange_codegolf |
Part of Advent of Code Golf 2021 event. See the linked meta post for details.
The story continues from AoC2018 Day 3.
But you're not Bubbler, you're Lyxal! yeah, I know.
After a long period of chaos, the Elves have finally agreed on how to cut the fabric. Unfortunately, the next day they have come up with how to utili... | stackexchange_codegolf |
Employers love to see their employees working hard, while the employees would love to work less, especially those with a monthly rather than hourly payment.
The laziest of employees are thinking about the world where every month starts with the same weekday and it makes them wonder if they would work more or less.
T... | stackexchange_codegolf |
Given a list of n strings, return a list of that strings in ascending order. However, be aware, that in this case we want integer comparison for all numbers appearing in the strings, meaning that "12" > "3".
Example cases:
{"abc123", "abc6", "abc47", "abd49"} -> {"abc6", "abc47", "abc123", "abd49"}
{"foo0", "bar12", "f... | stackexchange_codegolf |
Given an input of a string, output the partial fraction in string form.
The partial fraction decomposition of a rational fraction of the form \$\frac{f(x)}{g(x)}\$, where \$f\$ and \$g\$ are polynomials, is its expression as:
$$\frac{f(x)}{g(x)}=p(x)+\sum_j\frac{f_j(x)}{g_j(x)}$$
In this case \$p\$ is 0, because we ass... | stackexchange_codegolf |
Given a non-empty string, keep removing the first and last characters until you get to one or two characters.
For example, if the string was abcde, your program should print:
abcde
bcd
c
However, if it was abcdef, it should stop at two characters:
abcdef
bcde
cd
Trailing newlines and trailing spaces at the end ... | stackexchange_codegolf |
Your task: write a program/function that when given a string containing only ASCII characters, outputs/returns the string in reverse-ish.
Example:
1) Input
Hello, World!
2) Number unique characters in input. (Input string separated by pipes (|) for readability)
H|e|l|l|o|,| |W|o|r|l|d|!
1 2 3 4 5 6 7 8 9 10
3) ... | stackexchange_codegolf |
Introduction
Lately, I've been getting used to typing with Swype.
I've noticed certain words can be produced by drawing a straight line from your starting letter to your ending letter, or by skipping letters that repeat.
For example, I can type the word balloon by Swyping across the following letters:
b > a > l > o > n... | stackexchange_codegolf |
Write a program for a specific language that in different orientations performs different tasks.
Your code should have at least two non-empty lines and at least two non-empty columns and should complete at least one challenge from each category of challenges below when oriented in different ways.
Orientations
Your code... | stackexchange_codegolf |
A rotation "is made by splitting a string into two pieces and reversing their order". An object is symmetrical under an operation if the object is unchanged after applying said operation. So, a "rotational symmetry" is the fact that a string remains unchanged after "rotation".
Given a non-empty string s consisting of o... | stackexchange_codegolf |
You are the treasurer and you have received information that a counterfeit coin has entered the treasury. All you know is that the counterfeit coin is lighter than the original.
Knowing how many coins you have in total and using only a balance scale, you need to determine the minimum number of weighings to determine wh... | stackexchange_codegolf |
Santa's Shortest Path Problem
Trying to be as time-efficient as possible Santa needs to plan his trips carefully. Given a 5X5 grid representing a map of villages it is your task to be Santa's flight controller. Show santa the shortest and therefor fastest route to fly his sleigh and give him a list of coördinates (or d... | stackexchange_codegolf |
The goal of this challenge is to print the following tongue twister:
She sells seashells by the seashore,
The shells she sells are seashells, I'm sure.
So if she sells seashells on the seashore,
Then I'm sure she sells seashore shells.
This is more complicated than just calling your language's print equivalent. Since ... | stackexchange_codegolf |
Your job is to draw a Bézier curve given it's control points. The only criteria is that you actually have to show how to draw the curve from the initial control point to the last one.
Criterias
The result has to be animated, e.g. it has to show the drawing process somehow. The way you do the animation is irrelevant, i... | stackexchange_codegolf |
Challenge
Given a number, x where -1 ≤ x ≤ 1, and the integers a and b, where b > a, solve the equation sin(θ) = x for θ, giving all solutions in the range a° ≤ θ ≤ b°.
Rules
x will have a maximum of three decimal places of precision. The output, θ, must also be to three decimal places, no more, no less.
Your output ma... | stackexchange_codegolf |
With this challenge we pay homage to everyone around the whole world fighting against the coronavirus crisis; particularly represented are the people tied to medicine, as the Rod of Asclepius is a symbol associated with medicine and health care.
For that matter, we resort to some ASCII art found at asciiart.eu (wrongfu... | stackexchange_codegolf |
Yet another Jimmy challenge by his original father. See these other lovely challenges.
As you all know, recently we've been seeing challenges related to Jimmy on platforms. Now, Jimmy is an acrobat as I mentioned before, and he's got other tricks up his sleeve.
One of these tricks is hanging by ropes. Here's an exampl... | stackexchange_codegolf |
Implement this recurrence relation as a function or program that inputs and outputs a non-negative integer:
F(0) = 0
F(N) = the smallest integer greater than F(N-1) such that the sum and/or product of its base-10 digits is N
N is your program's input and F(N) its output.
To be clear, the sum of the digits in a number... | stackexchange_codegolf |
Overview
In this challenge, you will be given two numbers which are both a small offset larger than a multiple of a medium-size number. You must output a medium-sized number that is almost a divisor of both of the numbers, except for a small offset.
The size of the numbers involved will be parameterized by a difficulty... | stackexchange_codegolf |
A quotation is "the repetition of one expression as part of another one". In American English, a quotation is surrounded by double-quotation marks ("), as in the previous sentence. However, this rule differs when a quote appears inside another quote. In this case, the inner quote is surrounded by single-quotation marks... | stackexchange_codegolf |
Inspired by this Youtube Video from Tom Scott.
Write a program or function that prints the current amount of views this question has.
That's it.
Your program may only access the stack exchange api, any other websites are disallowed.
Output
An integer with the exact amount of views this question has at the moment. Outpu... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.