instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
This problem is inspired from shinh's problem. Given an input of positive integer \$n\$, output a smiley triangle (see below) with \$n\$ rows. Detailed rules Can be either a function or a full program. Standard I/O rules applied. RULE CLARIFICATION: Output as exactly a string, rather than an array of strings whose it...
stackexchange_codegolf
July 1st is Canada day (yay Canada)! Or is it? It seems that the Wikipedia page for this day has a lot of Canada related content, but is there another day which is more Canadian? Your task is to write a program or function which takes a date (month and day) as input and returns or outputs the number of mentions of "Ca...
stackexchange_codegolf
Write a program which takes two arrays of positive integers as input. One of them (your choice which) will have one item missing compared to the other. Your program must figure out what is missing. Rules You can choose which array has one missing: You can take ordinary then missing or vice versa. Arrays may contain dup...
stackexchange_codegolf
Note: This is based on Two roads diverged in a yellow wood (part 2), a previous challenge of mine. Because of the popularity of that question and Two roads diverged in a yellow wood (part 1), I wanted to make a third. But the first 2 were too easy (a 2-byte answer on the first, a 15-byte answer on the second.) So I ma...
stackexchange_codegolf
We can represent a Rubik's Cube as a net as follows (when solved): WWW WWW WWW GGGRRRBBBOOO GGGRRRBBBOOO GGGRRRBBBOOO YYY YYY YYY Each letter represents the corresponding colour (W is white, G green etc.) It has been shown that there are exactly \$43,252,003,274,489,856,000\$ (~\$43\$ quintillion) di...
stackexchange_codegolf
Modern regular expressions (regexes) have many features (\d, {n,m}, \1, etc.), but to define a regular language (modern regexes can define broader classes of languages, in their defense), all you need are three operators: concatenation (+), union (|), and the Kleene star (*). Here are some examples: a - Matches the str...
stackexchange_codegolf
note: the string art might look horrible here because of SE font weirdness :P :( Given a list of four-tuples representing the corners of rectangles, draw translucent rectangles over each other in that order. For this challenge, you are required to have the smallest coordinate in the top-left corner and the x-axis incre...
stackexchange_codegolf
Randomness is fun. Challenges with no point are fun. Write a function that, given integer input n, will output a set (unordered, unique) of exactly n random integers between 1 and n^2 (inclusive) such that the sum of all integers is equal to n^2. Randomness does not have to be uniform, provided each valid set has a non...
stackexchange_codegolf
Task Given two positive integers a, b and a Unicode mathematical inequality symbol c, determine if a c b is true. You many take the character or its Unicode codepoint for the input c. You may output your language's truthy/falsy values, or two distinct values for true and false respectively. Standard code-golf rules app...
stackexchange_codegolf
I recently watched The Wizard Of Oz and thought that when Dorothy taps her shoes together three times, it would be easier if she used a program to do it. So let's help her. Task Output slippers being tapped together 3 times. Output Slippers being tapped together. A pair of slippers not being tapped looks like this: _...
stackexchange_codegolf
One problem on a website like this is that you often don't know if you are talking to a male or female. However, you have come up with a simple NLP technique you can use to determine the gender of the writer of a piece of text. Theory About 38.1% of letters used in English are vowels [a,e,i,o,u] (see References below, ...
stackexchange_codegolf
I found this YouTube video with a table on it showing some card suits with ampersands. You might not understand what it is about, but I still want to make a challenge about it. The input is two suits, being one of the following: heart diamond spade club You can do anything for any other input. Then the output is their...
stackexchange_codegolf
You are given an array \$A\$, which may contain duplicate elements. In each swap, you may swap the value of any two indices \$i, j\$ (i.e. switch the values of \$A_i\$ and \$A_j\$). What is the least amount of swaps needed to sort the array, and what are the corresponding swapped indices? Scoring This is code-golf, so ...
stackexchange_codegolf
I was pondering today about how many characters it would take in each language to throw an exception, and noticed there wasn't any existing collection of answers, so: The task Throw an exception in the least amount of characters. If your language does not have exceptions, then a panic is valid. A panic constitutes as a...
stackexchange_codegolf
Boustrophedon is a type of bi-directional text where successive lines alternate between reading left-to-right and right-to-left. Character direction was also mirrored with respect to reading direction. In reverse boustrophedon writing systems, characters were rotated 180 instead of mirrored. Challenge Write a program/f...
stackexchange_codegolf
For this challenge, you will be required to write 3 programs: The first program should be a quine, i.e, it should print it's own source code. The second program should read the input and print all of it. The third program should simply print the string "Hello, Permutations!", with or without quotes. In addition to th...
stackexchange_codegolf
Wordle is a daily online word game that has received considerable attention recently. The Game The object is to guess a secret word in the fewest attempts. Consider the following instance of the game: The secret word is rebus, and the player's first guess was arise. The letters r, s, and e are displayed in yellow to i...
stackexchange_codegolf
This is not just another challenge asking you to color random maps... In this challenge, you are asked to write a program that is actually used in the formal proof of the Four Color Theorem. First I shall describe the challenge without any background or motivation, for the impatient. A chromogram is a list made of the ...
stackexchange_codegolf
The Challenge is to write the shortest implementation to find the Longest increasing subsequence . Example : Let S be the sequence 1 5 7 1 8 4 3 5 [length of S = 8 ] We have 1 sub-sequence of length 0 [will consider it increasing] 6 sub-sequences of length 1 {1,5,7,8,4,3}[all of them are considered increasing] (7*8)/2...
stackexchange_codegolf
Background A polyomino of size \$n\$ is a contiguous shape made from joining \$n\$ unit squares side by side. A domino is a size-2 polyomino. A polydomino of size \$2n\$ is defined as a polyomino of size \$2n\$ which can be tiled with \$n\$ dominoes. The following are some examples of polydominoes for \$n=3\$ (hexomino...
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
Long-time lurker, first-time poster. So here goes. In the Wikipedia page for quine, it says that "a quine is considered to be 'cheating' if it looks at its own source code." Your task is to make one of these "cheating quines" that reads its own source code. This is code-golf, so the shortest code in bytes - in each lan...
stackexchange_codegolf
Given a list of two or more spelled-out serial numbers of equal length greater than two, e.g. [[ "three" , "one" , "four" ], [ "one" , "five" , "nine" ], [ "two" , "six" , "five" ], [ "three" , "five" , "eight" ]] sort the list by the numbers that the words represent: [[ "one" , "five" , "nine" ], [ "t...
stackexchange_codegolf
Given a positive number \$n\$, find the number of alkanes with \$n\$ carbon atoms, ignoring stereoisomers; or equivalently, the number of unlabeled trees with \$n\$ nodes, such that every node has degree \$\le 4\$. This is OEIS sequence A000602. See also: Paraffins - Rosetta Code Example For \$n = 7\$, the answer is \...
stackexchange_codegolf
Inspired by a challenge from the OUCC 2022 Seniors competition. Background Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of time. The attacking players each have one soft ball they can throw at the defenders. Teams ge...
stackexchange_codegolf
Robbers thread Cops, Choose two strings of code, one public and one secret. We will call them P and S. You will be writing a program using only repetitions of these strings. For example: if you choose P=helloand S=world, valid programs would be hello, world, helloworld, worldhello, helloworldworldhello, hellohellohello...
stackexchange_codegolf
Introduction The Sierpinski Arrowhead Curve is a curve that's limit is Sierpinski's Triangle. It first starts like this: _ / \ Then, each line is replaced with a rotated version of the first one: _ / \ \ / _/ \_ Next: _ / \ \ / _/ \_ / \ \_ _/ _ \ / _ / \_/ \_/ \ Your task Given a ...
stackexchange_codegolf
A continuation of Inverse Deltas of an Array Your task is to take an array of signed 32 bit integers, recompile it with its deltas reversed. Example The List, 18 19 17 20 16 has the deltas: 1 -2 3 -4 which, when reversed, yields: -4 3 -2 1 then when recompiled, using yields: 18 14 17 15 16 whi...
stackexchange_codegolf
Awhile back I encountered a simple programming puzzle to determine whether a string was a pangram, or a perfect pangram. (Although it's worth noting that this particular challenge gave a different meaning than the standard definition of a "perfect pangram," to mean any sentence where every letter appears n times for so...
stackexchange_codegolf
This challenge takes place on the snub square tiling. Start by choosing any triangle, and color it \$c_1\$. Next, find all tiles which touch this triangle at any vertex, and color them \$c_2\$. Next, find all tiles which share a vertex with any \$c_2\$-colored tile, and color these \$c_3\$. Continue this process ad inf...
stackexchange_codegolf
Natural numbers ≡ \$\mathbb{N}≡\{0,1,2,...\}\$ The submission can be either a program or a function, both cases will henceforth be referred to as "function". The task is to golf the shortest function \$\mathbb{N}^n→\mathbb{N}\$, i.e. a function that maps \$n\$ natural numbers (with \$n>0\$ being a number of your choosi...
stackexchange_codegolf
Given a string \$ x \$, we say another string \$ y \$ is half of it, if both of the following properties are true: \$ y \$ is a (not necessarily continuous) subsequence of \$ x \$ - there exists a strictly increasing sequence \$ a_i \$ such that \$ y_i = x_{a_i} \$ Each character appears in \$ x \$ exactly twice as ma...
stackexchange_codegolf
Unlike most languages, Python evaluates a<b<c as it would be done in mathematics, actually comparing the three numbers, as opposed to comparing the boolean a<b to c. The correct way to write this in C (and many others) would be a<b && b<c. In this challenge, your task is to expand such comparison chains of arbitrary le...
stackexchange_codegolf
Unless you have a userscript that modifies the site's design (or even if so), you should have noticed that we have our site design! (It's November now) So, to celebrate, let's make a program that retroactively applies this design (oversimplified, of course)! So, the most important changes are: our new name is now Code...
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
Given a matrix consisting of positive integers, output the path with the lowest sum when traversing from the upper left element to the bottom right. You may move vertically, horizontally and diagonally. Note that it's possible to move both up/down, right/left and diagonally to all sides. Example: 1* 9 7 3 10...
stackexchange_codegolf
The JavaScript compressor RegPack uses a very simple string compression algorithm. Given a piece of code, it will make a list of characters that aren't used in that code and use them to delimit repeated strings that are inserted back into the string. To show how strings are compressed, it's necessary to show how the de...
stackexchange_codegolf
Summer Klerance turned in her term assignment for this challenge. Her professor was miffed (but also amused) when he overheard a disgruntled classmate of Summer's saying she got her answers by simulation rather than by the probabilistic methods covered in the course. Summer received a note to see the prof during his ne...
stackexchange_codegolf
One element of the list aa, ab, ba, bb, c has been removed, and the remainder shuffled and joined with no separator. Find the missing element. For example, if the input was aaabbac, this is made by concatenating aa ab ba c, so the output would be bb. Rules Standard I/O rules apply. You must take input as a string (or ...
stackexchange_codegolf
Can you decrypt me? Cops Cops, post obfuscated code that hides a number \$n\$ (n must not be greater than the program length) inside its code. If \$n\$ chars are changed (no additions or deletions), the program outputs exactly one \$n\$ (any amount of whitespace before or after is allowed.) Otherwise, it outputs someth...
stackexchange_codegolf
Without taking any input, output this exact text: A B A C B A D C B A E D C B A F E D C B A G F E D C B A H G F E D C B A I H G F E...
stackexchange_codegolf
Final Standings +----------------------------------+---------+---------+---------+----------------------------+ | Name | Score | WinRate | TieRate | Elimination Probability | +----------------------------------+---------+---------+---------+----------------------------+ | 1. SarcomaBo...
stackexchange_codegolf
Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. (2, ウシロ) → ウ/シ\ロ. To help you out with this, I'll explain a little about Japanese phonology. Background: on moras For the purpose of this challenge, we will write Japane...
stackexchange_codegolf
It's Christmas in July, so what better way to celebrate than a virtual white elephant gift exchange! For this King of the Hill challenge, you must create a bot that plays in a White Elephant exchange simulation, trying to get the highest-valued present it can. Game Rules The game will be played over many rounds, each ...
stackexchange_codegolf
Input: an array of length \$n\$ containing integers in the range \$0\$ to \$2n\$. For each integer \$x\$ in the array, compute the number of integers that occur before \$x\$ that are no larger than \$x\$. As an example, if the array is [3, 0, 1, 4, 3, 6] the output should be equivalent to: 3: 0 0: 0 1: 1 4: 3 3: 3 6: ...
stackexchange_codegolf
Given a word, get the indexes of each letter in the alphabet. For example: uncopyrightable becomes: [21, 14, 3, 15, 16, 25, 18, 9, 7, 8, 20, 1, 2, 12, 5] Convert these indexes to the given numeral system. For example, if the radix is 36, then the array above would become: ['l', 'e', '3', 'f', 'g', 'p', 'i', '9', '7',...
stackexchange_codegolf
Given infinite different integers, order them into a sequence \$a_1, a_2, a_3, ...\$ such that \$a_i>a_{i+1}\$ iff \$i\$ is even(or odd, as long as it's constant for all possible inputs and all \$i\$). In other word, make the sequence go alternately up and down (or down first, as long as it's constant). Examples: ℤ => ...
stackexchange_codegolf
Introduction In a standard* (e.g. not 2020) tax year, estimated payments are due quarterly according to the schedule outlined in Publication 505. Payment Period Due Date January 1 – March 31 April 15 April 1 – May 31 June 15 June 1 – August 31 September 15 September 1 – December 31 January 15 * Saturd...
stackexchange_codegolf
Robber's thread Your task as cops is to select three things: A programming language An OEIS sequence A byte set You are then to secretly write a program in that language that computes the nth term sequence using only the bytes in the set. You will reveal the three pieces of information so that robbers can try to f...
stackexchange_codegolf
We can arrange the positive integers like this: 1_| 2 | 5 | 10 4___3_| 6 | 11 9___8___7_| 12 16 15 14 13 That is, in L-shaped brackets expanding down and right infinitely. Then, we can read it off with the antidiagonals: 1 2 5 10 / / / 4 3 6 11 / / / 9 8 7 12 / / / 16 15 14 13 For the above, we rea...
stackexchange_codegolf
Objective Given an expression involving ternary values, evaluate it into a ternary value. Ternary Values The three truth values in question are the values of Haskell's Ordering, namely LT, EQ, and GT. They stand for "less-than", "equal-to", and "greater-than", respectively. Furthermore, they themselves have an order; L...
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
Gringotts isn't just a vault, but a reputable financial institution and wizards need loans too. Since you don't want to be screwed over by the Gringotts goblins, you decided it would be a good idea to write a program to calculate interest. Interest is compounded only yearly. Your task is to calculate total owed amount ...
stackexchange_codegolf
Some people insist on using spaces for tabulation and indentation. For tabulation, that's indisputably wrong. By definition, tabulators must be used for tabulation. Even for indentation, tabulators are objectively superior: There's clear consensus in the Stack Exchange community. Using a single space for indentation i...
stackexchange_codegolf
My brothers and I like to play Cribbage. Now, the scoring rules for Cribbage are somewhat complicated, and I often worry that I'm not counting my score correctly. Therefore, your job is to write a program that will correctly score my hand. Scoring There are two ways to score points in Cribbage: during pegging, and wh...
stackexchange_codegolf
The set of necklaces is the set of strings, where two strings are considered to be the same necklace if you can rotate one into the other. Your program will take nonnegative integers k and n, and generate a list of the k-ary (fixed) necklaces of length n. Necklaces will be represented by any representative string. So t...
stackexchange_codegolf
What is elementary cellular automata? Since I'm not sure I'll be able to explain this so that somebody who has never heard of this is able to understand, I'm giving an explanation from https://mathworld.wolfram.com/ElementaryCellularAutomaton.html Elementary cellular automata have two possible values for each cell (0 ...
stackexchange_codegolf
This challenge, I hope, is simple to understand. Given a date-string (given in any format you prefer, so long as it has 4 digits of year and 2 digits of day and month), calculate the weekday for the particular date-string. You must output 7 different values, corresponding to the weekday you have calculated. It's okay i...
stackexchange_codegolf
Print the biggest-size subset of strings in the input that are all permutations of each other. If there are ties, any one will do. If no strings are permutations of each other (for example, only one string was given or the strings contain distinct characters), this is just one of the strings. If no strings were passed ...
stackexchange_codegolf
Very simple, write a program that at first glance appears to be a quine, but is not. Upon running, the program actually prints the source to a real quine, obviously distinct from the original program in some way, preferably creative, but since this is a popularity contest, the answer with the most upvotes wins. Standa...
stackexchange_codegolf
Create a function which given a number of lines n, makes a bigA. The horizontal bar of bigA must be at the middle row, or the lower of the two if n is even Assume a monospace font for output Output should be a string (or similar, eg character array) with clear linebreaks to break up the lines, and with correct whites...
stackexchange_codegolf
emanresu A posted a challenge to reconstruct an ordered list of integers from its unordered set of unordered prefixes. Many users (beginning with xnor's answer) noticed that summing each unordered prefix led to a very short solution. Well, let's cruelly take that possibility away by using data that isn't integers! A fe...
stackexchange_codegolf
Your program must take an input (n for the purpose of description) and output all permutations of a number that is n digits long with no repeating digits, where each of the digits preceding and including its index are divisible by the place in the number that it falls. You can read about magic numbers here. Rules: 1 <...
stackexchange_codegolf
Consider compass-and-straightedge construction, where you can construct new points from existing ones by examining intersections of straight lines and circles constructed with one of the following two options: Draw the unique infinitely long straight line passing through points \$(x, y)\$ and \$(x', y')\$ Draw the uni...
stackexchange_codegolf
You work at a bakery and every day you make exactly 100 bagels. However your customers are not as reliable and every day a random number of bagels will be ordered. So sometimes you will run out of bagels and sometimes you will have leftovers. Now leftover bagels will still be good for 1 more day. After a day on the ...
stackexchange_codegolf
Write a regex that works in at least 2 regex flavors (or versions), and match a different string in each flavor (or version) it is running in. The strings to be matched in this challenge are the first words of the Ubuntu code names, which are listed below. Your regex has to match from the top of the list. That is, if y...
stackexchange_codegolf
Your task is to form an expression equaling \$ 11111111111 \text{ (11 ones)} \$ using only the following characters: 1+(). Keep in mind that the result is in base 10, and not some other base like binary. Of course, these expressions should follow the order of operations. Furthermore, the only operations which should be...
stackexchange_codegolf
Task Given two positive integers (dividend and divisor), calculate the quotient and the remainder. Normally it would be calculated as e = o*q+r where q*o<=e and 0<=r<o. For this challenge it still e = o*q+r but q*o>=e and -o<r<=0. For example e=20 and o=3, normally it would be 20/3 -> 20=3*6+2, since 18<=20 and 0<=2<3....
stackexchange_codegolf
The challenge here is to accurately depict the flower of life (which is a sacred geometrical figure according to some) in the language of your choice. The design consists an arrangement of circles and partial circles of radius 1 as shown whose centres arranged on a triangular grid of pitch 1, plus one larger circle of...
stackexchange_codegolf
Final Standings +----------------------------------+---------+---------+---------+----------------------------+ | Name | Score | WinRate | TieRate | Elimination Probability | +----------------------------------+---------+---------+---------+----------------------------+ | 1. SarcomaBo...
stackexchange_codegolf
It's been a while since I posted here, so here we go another day another challenge. Challenge : Given a number(n) split it into it's prime factors. Input : A positive non-zero integer greater than 2. Output : Decompose the number into it's prime factors and return the number of occurances of each prime in it. Ouput...
stackexchange_codegolf
Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer #RRGGBBAA. But Android developers may prefer #AARRGGBB. When handling AAS file format, #AABBGGRR is needed. That's too confusing. Maybe we need a program...
stackexchange_codegolf
Introduction I have decided that this Christmas, as a "present" to a friend, I wish to purchase the things described in the classic song "The 12 Days of Christmas". The only problem is, I don't know how to calculate the total price! Your Task Given a list of prices (in order from first to last), calculate the total pri...
stackexchange_codegolf
The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them? Input A word consisting of the 26 english letters. Output First, change every consonant in the word to the next consonant in the alphabet. So, b goe...
stackexchange_codegolf
This is the Cop post. The Robber post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written backwards: 1, 4, 9, 61, 52, 63, 94, 46, 18, 1, 121, 441, ... Note that leading zeros are trimmed away (100 becomes 1, not 00...
stackexchange_codegolf
Description : You are given a string of numbers (positive and negative but not decimals) along with the number of entries like so. Like so 8 '1 2 5 0 7 -9 12 -8' Task : Your job is to return the number closest to zero be it +ve or -ve. Your input will be separated by spaces only. You are free to return the answer in a...
stackexchange_codegolf
Consider a sequence of natural numbers for which N appears as a substring in N^2. A018834 Output the nth element of this sequence. Rules Program takes only n as input and outputs just one number - N. The sequence can be 0-indexed or 1-indexed. Sequence: 1 5 6 10 25 50 60 76 100 250 376 500 600 625 760 ... Squares: 1 2...
stackexchange_codegolf
Description The task of this challenge is to devise a program or function that tracks a given object in an \$n×n\$ space. I/O Your program will be given 3 inputs, which may be taken in any sensible way: n will be the size of the plane's side. (so, for \$n=5\$, your plane will be \$5×5\$). You may assume n will always b...
stackexchange_codegolf
Your challenge is to write 5 different full programs for the 5 following tasks: Print Hello, World!. Given an input on STDIN, output the factorial (you can assume that the input is an integer ≥ 0). Given an integer N, calculate the sum of the primes ≤ N. Given an input on STDIN, output the letters used in the input. F...
stackexchange_codegolf
Write a program to play the popular English nursery rhyme. (This file is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported license. Attribution: Helix84 at the English language Wikipedia; Blahedo at the English language Wikipedia.) Some Wikipedia articles that may be useful: Twinkle Twinkle Lit...
stackexchange_codegolf
The Challenge Given a list of words and a grid of letters, your job is to determine which of the given words can be found on the grid in all 8 directions (forward, backward, up, down, and the 4 diagonal directions), much like a word search. The grid is toroidal, so the grid wraps around on the edges. Letters can be reu...
stackexchange_codegolf
Did you know that Heronian Tetrahedra Are Lattice Tetrahedra? A Heronian tetrahedron is a tetrahedron where the length of each edge is an integer, the area of each face is an integer, and the volume of the tetrahedron is an integer. It's always possible to place such a tetrahedron in space such that all of the vertic...
stackexchange_codegolf
Sandbox For the purposes of the current task, a cube of unit length is rendered in oblique projection with ASCII symbols as follows: +-----+ / /| +-----+ | | | + | |/ +-----+ + for the vertices. - for the X edges. The unit length along X is represented by five - between two vertices. | for the Y edges....
stackexchange_codegolf
There are many puzzles with matches that involve adding, removing, or moving a certain number of matches to create new numbers or shapes. This is like that with a digital clock. Given a valid time on a 12-hour digital clock, output the digit that requires moving the fewest lines to make it so every visible digit on the...
stackexchange_codegolf
A Flow Snake, also known as a Gosper curve, is a fractal curve, growing exponentially in size with each order/iteration of a simple process. Below are the details about the construction and a few examples for various orders: Order 1 Flow Snake: ____ \__ \ __/ Order 2 Flow Snake: ____ ____ \__ \ \__ \__/ / __ ...
stackexchange_codegolf
Given year, month and optionally weekday of 1st, output the calendar of the month. The first week should remain nonempty. For empty cell, fill it with the date where it's supposed to be, in last or next month, and add # to indicate gray. If last few days can't fit in 5 lines, then they share last line with 5th week, us...
stackexchange_codegolf
Here's a very simple little problem that I don't believe has been asked before. Challenge Write a program or a function that takes in four positive integers that represents the lengths of movable but unbreakable and unbendable straight fences. Output the area of the largest rectangular yard that can be fully encompasse...
stackexchange_codegolf
Everyone's been freaking out about that stupid "Flappy Bird" game being removed. So, your task is to crate a Flappy Bird Clone game. Its really simple. Here are the guide lines: It can use either ascii art or real images You can make your "bird" flap with either a click or a key press It should try to be as short as p...
stackexchange_codegolf
The happy ending problem (actually a theorem) states that Any set of five points in the plane in general position has a subset of four points that form the vertices of a convex quadrilateral. The problem was so named by Paul Erdős when two mathematicians who first worked on the problem, Ester Klein and George Szekere...
stackexchange_codegolf
Ouput the following banner: _____ _ _____ _ __ / ____| | | / ____| | |/ _| | | ___ __| | ___ | | __ ___ | | |_ | | / _ \ / _` |/ _ \ | | |_ |/ _ \| | _| | |___| (_) | (_| | __/ | |__| | (_) | | | \_____\___/ \__,_|\___| \_____|\___/|_|_| The code ...
stackexchange_codegolf
Given two positive integer fractions \$x\$ and \$y\$ such that \$x < y\$, give the fraction \$z\$ with the smallest positive integer denominator such that it is between \$x\$ and \$y\$. For example \$x=2/5\$, \$y=4/5\$, the answer is \$1/2\$. Other fractions such as \$3/5\$ are also in between the two, but \$1/2\$ has...
stackexchange_codegolf
Although what is a Pascal's triangle is well-known and we already can generate it, the task is now different: Output \$n\$ first lines of the Pascal's triangle as colored bricks. Color number is computed as maximal power of \$d\$, that divides the needed-to-color element or \$7\$ if power is more than \$7\$. Numbered c...
stackexchange_codegolf
Uilta is a minority tungusic language spoken in the far east of Russia. A neat thing about Uilta is that it has pitch accent which can be predicted by a computer program. In this challenge we are going to take Uilta a word and determine where the accent peak is. Let me explain how this can be done. Phonemes The first ...
stackexchange_codegolf
As you probably know, there is a war going on in Ukraine. I noticed that it seems nobody has posted a Ukrainian flag challenge yet, so I thought I'd do it myself in support of Ukraine. The Challenge Here is the flag: The flag is divided horizontally across the middle into two equally sized stripes. Stripe colors: (0,...
stackexchange_codegolf
The Challenge Given an algebraic expression (eg 2ab, change it so it follows standard convention rules. The Rules Letters should be in alphabetical order. ie 2ab is allowed but not 2ba. Numbers should always go first. ie 2ab is allowed but ab2 is not. Exponentiation will be given as a^b to mean a to the power of b....
stackexchange_codegolf
Challenge Given a Youtube playlist, output the number of videos in it. I/O The playlist will be given as an URL; for example, https://www.youtube.com/playlist?list=PL_3jnZNPYn7qUatgDYBS5NShkfXoehSRC (this is a playlist a friend sent me to try to get me to listen to K-Pop because she's obsessed with it and I don't like ...
stackexchange_codegolf
Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any character more than once across your snippets. Rules You may use the same character multiple times in one (and only one) sni...
stackexchange_codegolf
Last time you made a square of text, but now, can you make a cube of text? The Challenge Given a string, output the string in the form of a cube. You can assume the string will always have 2 chars or more, and will only have printable ascii characters. How to Make a Text Cube Test Cases Input: Test Output: Test ...
stackexchange_codegolf
When you look at the last decimal digit of each power of a non-negative integer a repeating pattern forms. For example, 3: 3^1 = 3 3^2 = 9 3^3 = 27 3^4 = 81 3^5 = 243 3^6 = 729 3^7 = 2187 3^8 = 6561 3^9 = 19683 The last digits go 3971 which repeats indefinitely. In fact any number we choose that en...
stackexchange_codegolf
The abs() function in most languages does one thing: give the positive version of the input. Most of the times this is done using something similar to int abs (int i) { return i < 0 ? -i : i; } I was wondering if there is any way to do this with less bytes. Note that this doesn't have to be more efficient, just sm...
stackexchange_codegolf