instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Write a program that outputs the number 0. That's a bit trivial, isn't it? Let the length of your program be \$S\$. Write a program that outputs the number 0. When your program is cyclically shifted \$i < S\$ bytes left, it should output \$i\$. To cyclically shift a string \$i\$ bytes left means to move the last \$i\$ ...
stackexchange_codegolf
{}is the empty set. You may use () or [] if you choose. We aren't going to rigorously define "set", but sets all satisfy the following properties: Sets follow the usual mathematical structure. Here are some important points: Sets are not ordered. No set contains itself. Elements are either in a set or not, this is bo...
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
Description We consider an integer with at least 3 digits triple-balanced if, when split into three parts, the digits in every part sum up to the same number. We split numbers as follows: abcdefghi - Standard case: the number of digits is divisable through 3: abc def ghi abcdefgh - Number % 3 == 2: The outer groups ar...
stackexchange_codegolf
A man lives in the north-west corner (0, 0) of a town with height h and width w . Everyday he walks from his home to the border (?, w) or (h, ?). In the following example, the man goes to (3, 3) today. (0, 0) +--+ + + . (0, 4) | + +--+--+ . | + + + + . ...
stackexchange_codegolf
Mahjong is a tabletop game played using tiles. It features three "number" suits (pins, sous, mans, represented as p, s and m) from 1 to 9, and one "honor" suit z of seven distinct tiles. Note that contrary to western card games, tiles are not unique. To complete a hand and win, the 13 tiles in your hand are combined w...
stackexchange_codegolf
Bowl Pile Height The goal of this puzzle is to compute the height of a stack of bowls. A bowl is defined to be a radially symmetric device without thickness. Its silhouette shape is an even polynomial. The stack is described by a list of radii, each associated with an even polynomial, given as input as a list of coeff...
stackexchange_codegolf
Adapted from Tips for restricted source in Python Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the Powershell language. Now, We already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep wit...
stackexchange_codegolf
Yes is a stack-based language that has a few space-separated instructions: yes: Push 1 to the stack no: Push 0 to the stack what: Push the input to the stack (input is taken at the start of program execution and is the same for the whole execution) sure: Increment the last item in the stack nah: Decrement the last item...
stackexchange_codegolf
Your task: Print or return a conversion table with every byte from 00 to ff's value as an unsigned integer, to its value as a signed one (using two's complement). For example: 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 1...
stackexchange_codegolf
Task: With the minimum amount of bytes, determine today's Zodiac sign using the programming language of your choice. Rules: This is code golf, the answer with the fewest characters wins. The initialization of getting the current date into a variable (e.g. var now = new Date();) does not add to the count. Leap years mu...
stackexchange_codegolf
Inspired by Flow Fit: Sudoku, a brand-new mobile puzzle game (as of Nov 2019). Background A Latin square is a square grid of side length \$ n \$ filled with \$ n \$ different symbols, where each row and column contains each symbol exactly once. Let's define a row (resp. a column) as a maximally consecutive group of cel...
stackexchange_codegolf
Introduction: Pete likes doing word search puzzles. Despite that, he has trouble searching for words vertically, (anti-)diagonally, or reversed. Because of that, he'll always search for the words left-to-right, and rotates the entire puzzle in increments of 45 degrees clockwise. In addition to that, he'll also always s...
stackexchange_codegolf
In a matrix of characters, a cursor is a movable position between two adjacent characters, before the first character or after the last character in a line, like that "I"-shaped indicator which moves while you type. In this challenge, a cursor position is considered valid if at least one of its two sides touches a spac...
stackexchange_codegolf
You're designing a new esoteric programming language and one feature you've decided to add is a dynamic memory allocator. Your language specifies a special dedicated virtual address space for the user's program space. This is separate from the address space used by the memory allocator for any internal state. To help r...
stackexchange_codegolf
Let \$\sigma(n)\$ represent the divisor sum of \$n\$ and \$\sigma^m(n)\$ represent the repeated application of the divisor function \$m\$ times. Perfect numbers are numbers whose divisor sum equals their double or \$\sigma(n) = 2n\$. For example, \$\sigma(6) = 12 = 2\times6\$ Superperfect numbers are numbers whose twic...
stackexchange_codegolf
Introduction: Beckett Grading Service (aka BGS), is a company which encapusulates and grades Trading Card Game (TCG) cards (i.e. sport cards, Magic The Gathering, Pokémon, Yu-Gi-Oh, etc. etc.). The TCG cards that come in for grading will be checked on four categories (which we will later refer to as subgrades): centeri...
stackexchange_codegolf
Problem Assume you have a single 7-segment display without a decimal point, so 7 "lines" that can be labelled A through G as seen here. This display will only show the numbers from 0 to 9 as usual, like so: Any time this display changes from one number to another, some of its lights will have to change their state fr...
stackexchange_codegolf
The challenge is simple: given two parameters, x and y, output y staircases with x steps. For example: f(3,1) - 1 staircase with 3 steps. _ _| _| f(5,2) - 2 staircases with 5 steps. _ _ _| _| _| _| _| _| _| _| Make sure you output the staircases just like,...
stackexchange_codegolf
Problem: Given a string representing a mathematical expression with constants (pi, e, psi, i), basic arithmetic operations (+, -, *, /), parentheses, fractions, and exponentiation, write a program or function to convert a string to its equivalent LaTeX code. The input string will only contain digits, arithmetic operato...
stackexchange_codegolf
The task here is simple: given a target location on an XY grid, and a rectangle on that grid, find the length of the shortest path from the origin to the target which does not intersect the rectangle. All parameter values are integers. You can assume that neither the target point nor the origin is inside or on the bord...
stackexchange_codegolf
Background MENACE (Machine Educable Noughts And Crosses Engine) is a rudimentary shallow machine learning algorithm for the game Noughts and Crosses, created by British computer scientist Donald Michie in the 1960s. It was originally implemented with 304 matchboxes, each labelled with a board position and containing co...
stackexchange_codegolf
Given an input string, determine the number of regions that a page will be split into. Consider the letter P. It has one enclosed region within the letter. Assume that each letter splits the page by one or more regions (i.e. a box is drawn around the character). Input A string of 0 or more characters. You may assume th...
stackexchange_codegolf
Introduction This is one is pretty straightforward. We will be drawing a snake in ascii. This was inspired by that old snake game where you have to collect the fruit and you continuously grow. Definition Given a positive integer N that represents the snake's length, draw a snake so that it has a body of n plus a head a...
stackexchange_codegolf
This is the third in a series of puzzles that I will be posting every Monday at Midnight PST, and the final variant of "Take It or Leave It". The first puzzle is located Here The second puzzle is located Here Context: A reclusive billionaire has created a game show to attract the world's best and brightest programmers...
stackexchange_codegolf
Inspired/mostly copied but I don't think it's a dupe. Also Inspired. In this challenge, you will create polyglots that include all languages from previous answers, and another language which you won't share and others must guess. The first language prints 1, the second prints 2, etcetera. For example, if the first answ...
stackexchange_codegolf
Challenge There are many numbers which can be expressed as the difference of two squares, or as the difference of two cubes, or maybe even higher powers. Talking about squares, there are various ways of writing a number, say 75, as the difference of 2 squares. You can write: 75 = (10)^2 - (5)^2 = (14)^2 - (11)^2 ...
stackexchange_codegolf
Note This is the decryption challenge. The encryption challenge can be found here. Challenge The challenge is to decrypt a given string, using the rules as specified below. The string will only contain lowercase alphabets, digits, and/or blank spaces. If you want to know how the input string has been encrypted, refer t...
stackexchange_codegolf
Your challenge is to print/output/return this text: _____ _____ | 1 | | 2 | | H | ...
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
Background: Take this input as an example: 1 1 2 1 1 2 1 3 1 3 If you look only at the first few digits, between 1 1 2 and 1 1 2 1 1 2 1, this input appears to consist of the pattern 1 1 2 repeating indefinitely. This would make its period 3, as there are 3 numbers in the pattern. Given only the first number, the peri...
stackexchange_codegolf
This is the robber's thread. The cop's thread is here. A snake matrix is a square matrix that follows this pattern: 3-by-3: 1 2 3 6 5 4 7 8 9 and 4-by-4: 1 2 3 4 8 7 6 5 9 10 11 12 16 15 14 13 Your task is to write a code that takes an input n and creates such a matrix, in the same language as a cop pos...
stackexchange_codegolf
Given an integer n >= 1 as input, output a sample from the discrete triangular distribution over the integers k, for 1 <= k <= n (1 <= k < n is also acceptable), defined by p(k) ∝ k. E.g. if n = 3, then p(1) = 1/6, p(2) = 2/6, and p(3) = 3/6. Your code should take constant expected time, but you are allowed to ignore o...
stackexchange_codegolf
Let's have a ragged list containing no values, only more lists. For example: [[[],[[]],[],[]],[],[[],[],[]],[]] And the list will be finite, meaning that eventually every path terminates in an empty list []. It's simple enough to determine if two of these are structurally equal. Check each element in order for equali...
stackexchange_codegolf
Imagine a W by H grid of squares that wraps toroidally. Items are placed onto the grid as follows. The first item can be placed on any square, but subsequent items must not be within a Manhattan distance R of any previous item (also known as a Von Neumann neighbourhood of range R). Carefully choosing the positions allo...
stackexchange_codegolf
This post is loosely inspired by this mathoverflow post. A Vanisher is any pattern in Conway's Game of life that completely disappears after one step. For example the following pattern is a size 9 Vanisher. An interesting property of Vanishers is that any pattern can be made into a vanishing one by simply adding mo...
stackexchange_codegolf
Write a program which, according to whether the script has access to the internet, produces an output which is "Truthy/Falsey". You may try and connect to any existing site, at your own discretion (don't use a shady site which only has 10% uptime - try to keep to above 80% annual uptime). If the site is down, your prog...
stackexchange_codegolf
Imagine you have a grid where some squares are walls, some are empty, and some are lights that shine for arbitrary distances in the four cardinal directions until they meet walls: ####.#### ##..L.... ####.##.# ####.##L. ##......L In the above grid, the lights cover all the tiles. But in some cases, they may not be: ##...
stackexchange_codegolf
The N-bonacci sequence, originally invented by @DJMcMayhem in this question, is a sequence generated by starting with the integers 0 and 1, and then adding the previous N numbers to generate the next number. The special N-bonacci sequence is an N-bonacci sequence beginning with a pair of numbers other than 0 and 1, wh...
stackexchange_codegolf
The Onion (warning: many articles are NSFW) is a satirical news organization that parodies traditional news media. In 2014, The Onion launched ClickHole (warning: also frequently NSFW), a satirical news website that parodies "clickbait" sites like BuzzFeed. Thanks to Poe's Law, it's fairly common for people to read the...
stackexchange_codegolf
This challenge is based on, and contains test cases from, a programming course I took at Aalto University. The material is used with permission. Two and a half years ago there was a challenge about spoonerisms in English. However, in Finnish spoonerisms are much more complicated. Spoonerisms in Finnish In Finnish, the ...
stackexchange_codegolf
Introduction Given a set of text-based "screenshots" consisting of printable ASCII chars merge them so that all of them form one long screenshot so that nobody has to do it themselves when reading it. Challenge Take input as a list of strings (referred to as "screenshots"). Each screenshot consists of several lines of ...
stackexchange_codegolf
The picture: Sick of the same old grid where the answer is simply a square pyramidal number? Accept the challenge and write a program that given a positive integer \$n\$ counts how many squares are in the \$n^{\text{th}}\$ iteration of the Harter-Heighway dragon! The sequence of squares of size 1 is A003230 Your cod...
stackexchange_codegolf
The setup: A social network reports the number of votes a post has in two ways: the number of net upvotes (total upvotes - total downvotes), and the % of votes that were upvotes, rounded to the nearest integer (.5 rounds up). The number of net upvotes is an integer (not necessarily positive), and the second is guarant...
stackexchange_codegolf
In Fewest (distinct) characters for Turing Completeness, the goal is to find the minimum number of characters which make a language Turing Complete...in other words, allow it to do any computation possible with any other language. In this challenge, we'll be doing somewhat of the opposite, and finding the minimum numbe...
stackexchange_codegolf
Oh, <PROGRAM NAME HERE>, tell me how many character '<CHARACTER HERE>'/s are there in your body. I do not think it a dupe to this. That question asks for printing a list directly but this one requires some input that will cause problem. Your work is to write a quine-like program/function that takes an input of one cha...
stackexchange_codegolf
Introduction A function that adds months to a date (without overflowing ends of months) is implemented in many languages/packages. In Teradata SQL it's ADD_MONTHS, here are some examples: ADD_MONTHS('2021-01-31', 1) => 2021-02-28 ADD_MONTHS('2021-01-30', 1) => 2021-02-28 ADD_MONTHS('2021-02-28', 1) => 2021-03-28 ...
stackexchange_codegolf
Program A outputs program B's code when run, and B outputs A's source. Requirements: Only one language across both programs Programs are different. One program that outputs itself does not qualify. Both programs are non-empty, or at least 1 byte in length. Trailing newlines in both source and output are ignored st...
stackexchange_codegolf
Given a positive integer N ("virality"), your program should create an ASCII-art drawing of a tree with two branches of length N extending downwards and/or rightwards from the top-left corner. The direction taken by each branch after the first asterisk can be either rightwards or downwards, and this choice should be ma...
stackexchange_codegolf
Given a text input such as: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG render the following output: /\ \ \ / \ / /\/ / / /\ / / / / ...
stackexchange_codegolf
Introduction Suppose you want to compute the tail maxima of a list of numbers, that is, the maximum of each nonempty suffix. One way to do it is to repeatedly choose one number and replace it by a higher number occurring after it, until this is not possible anymore. In this challenge, your task is to perform one step o...
stackexchange_codegolf
Background This is Post's lattice: Credit: EmilJ It denotes the lattice of all clones on a two-element set {0, 1}, ordered by inclusion (from Wikipedia). That can be a bit of a mouthful so lets look at a concrete example. MP (located near the top) is a set that contains all boolean circuits that can be made with and a...
stackexchange_codegolf
Given the input tilesX and tilesY create a method that would make a rectangular ring from the tiles. The function must order the tiles in a ring like this: tilesX and tilesY are always positive integer values, cannot be 0 tilesX and tilesY are not always equal, expect values like: 2x5, 6x3 etc. Checking for invalid i...
stackexchange_codegolf
I have a string like this: s = "helloworldandhellocodegolf" I want to make every consonant after a vowel uppercase. Desired output: heLloWoRldaNdheLloCoDeGoLf As you can see, l gets uppercased because it's right after the vowel e etc.. If there are repeated vowels, like: s = "aabeekad" Desired output: s = "aaBeeKaD"...
stackexchange_codegolf
Overview Consider the following task: Given a positive integer n > 0, output its integer square root. The integer square root of a number n is the largest value of x where x2 ≤ n, usually expressed with the formula floor(sqrt(n)). Examples: 25 -> 5, 24 -> 4, 40 -> 6, 1 -> 1. This task is easy enough on its own. Howev...
stackexchange_codegolf
Those of you who like Numberphile would be familiar with Dr. James Grime, who described a non-transitive dice game on his channel. The game consists of three 6-faced dice: Die 1: 3,3,3,3,3,6 Die 2: 2,2,2,5,5,5 Die 3: 1,4,4,4,4,4 Two players each select a die to use. They roll them and the higher die wins, best-of-wha...
stackexchange_codegolf
Inspired by this. Given a string as input consisting of only upper and lowercase alphabet characters, wicka-wub it. How do I wicka-wub a string? The example text used is "DJMcMayhem". Split the string before each capital letter, so you get ["D", "J", "Mc", "Mayhem"]. Next, take the two halves of the list as sublists. T...
stackexchange_codegolf
Background A rooted tree is an acyclic graph such that there is exactly one path from one node, called the root, to each other node. A node v is called the parent of another node u if and only if the path from the root to u goes through v and there is an edge connecting u and v. If node v is the parent of node u, node ...
stackexchange_codegolf
Given a list of integers, your task is to output the second largest value in the first k elements, for each k between 2 and the length of the input list. In other words, output the second largest value for each prefix of the input. You can output an arbitrary value for the first element (where k = 1), or simply omit th...
stackexchange_codegolf
In this challenge you've to print multiplication tables by input, Here are some examples: Input: 2 Output: 0 2 4 6 8 10 12 14 16 18 20 Input: 20 Output: 20 40 60 80 100 120 140 160 180 200 Rules The shortest code in bytes wins. This challenge is a code-golf, It follows code-golf general rules (code-golf) ...
stackexchange_codegolf
You may have heard of the "Hacker Logo", also called the "Hacker Emblem". It looks like this: This is a pattern from a mathematical simulation called the Game of Life. The glider is the simplest Life pattern that moves, and the most instantly recognizable of all Life patterns. The challenge The challenge is pretty sim...
stackexchange_codegolf
Well, last time I asked for an arithmetic sequence, now comes the geometric sequence Challenge In this challenge, the input will be an unordered set of numbers and the program should be able to tell if the set of numbers is a Geometric Sequence. Input The input will be a set separated by ,(comma). Output The Output ...
stackexchange_codegolf
Every positive integer can be expressed as the sum of at most three palindromic positive integers in any base b≥5.   Cilleruelo et al., 2017 A positive integer is palindromic in a given base if its representation in that base, without leading zeros, reads the same backwards. In the following, only base b=10 will be c...
stackexchange_codegolf
For some part of history people in France used a decimal clock. with the clock having 10 hour day, 100 minutes an hour and 100 seconds per minute. Though this clock simplified calculations a bit the idea wasn't appreciated by most of the world which used our current 24 hour, 60 minute hour, and 60 second minute. And he...
stackexchange_codegolf
I'm one of the authors of Gimli. We already have a 2-tweet (280 chars) version in C but I would like to see how small it can get. Gimli (paper,website) is a high speed with high security level cryptographic permutation design that will be presented at the Conference on Cryptographic Hardware and Embedded Systems (CHES)...
stackexchange_codegolf
Your task is to take an array of numbers and a real number and return the value at that point in the array. Arrays start at \$\pi\$ and are counted in \$\pi\$ intervals. Thing is, we're actually going to interpolate between elements given the "index". As an example: Index: 1π 2π 3π 4π 5π 6π Array: [ 1.1, 1...
stackexchange_codegolf
The sound of the theremin has been immortalized in The Beach Boys song Good Vibrations. Many also associate its sound with the theme for the original series of Star Trek, though apparently it was a soprano's emulation. This challenge requires you to implement a theremin. Input Take 2 dimensional input from a mouse or...
stackexchange_codegolf
Introduction One of the first things I learned in chemistry, was giving the formula for the combustion of alkanes. The most basic example was: 2CH4 + 4O2 -> 4H2O + 2CO2. Note that the equation could have been simplified by dividing every coefficient by 2, we would get CH4 + 2O2 -> 2H2O + CO2. To make things easier, we ...
stackexchange_codegolf
Left and right Riemann sums are approximations to definite integrals. Of course, in mathematics we need to be very accurate, so we aim to calculate them with a number of subdivisions that approaches infinity, but that's not needed for the purposes of this challenge. You should instead try to write the shortest program,...
stackexchange_codegolf
It's Nowruz and you want to set up a Haft-Sin table by words. This means finding seven words that start with letter s. The Challenge Write a program which its input is a list of words separated by space, and output at most first 7 words which starts by letter s. If the s is before letter h it doesn't count because it w...
stackexchange_codegolf
The naming conventions for games in the Super Mario series is very strange, and don't match up between regions. | Japanese Name | American Name | |---------------------|------------------------------------| | Super Mario Bros. | Super Mario Bros. | | Super Mario Bros. 2 | S...
stackexchange_codegolf
Intro/Background I was looking at "You Had One Job" pictures lately, and noticed an old favourite of mine: And I said to myself: "I need a program that can generate text like that". So I devised a set of rules for character swapping and wrote a CGCC challenge! The Challenge Given a single string as input, output a str...
stackexchange_codegolf
Imagine you are given two lists of numbers which are to be interpreted as points on a circle of circumference 1000. Let us say circleA = [10, 24, 44, 175, 321, 579, 618, 841, 871, 979] circleB = [270, 283, 389, 406, 435, 457, 612, 684, 692, 732] To measure the distance between these two circles we do the following. F...
stackexchange_codegolf
This challenge is very simple: Given an angle measure in degrees or radians (your choice), output the angle between 0 and 2π non-inclusive [0º, 360º) that is coterminal with it. Input A positive or negative angle measure. You can pick if you want to take it in degrees or in radians. Output The angle on [0, 2π) that ...
stackexchange_codegolf
Suppose denominations of banknotes follow the infinity Hyperinflation sequence: \$ $1, $2, $5, $10, $20, $50, $100, $200, $500, $1000, $2000, $5000, \cdots \$. How many banknotes are required, at minimum, to pay a \$$n\$ bill? Consider Alice needs to pay \$ $992 \$ to Bob. It is possible for Alice to use 7 banknotes \$...
stackexchange_codegolf
Validate a codice fiscale Every Italian resident/citizen is given a 16-character alphanumeric codice fiscale Challenge The final letter is a check code, which is calculated as follows : Characters of the code are split up into even and odd character according to their positions (check letter excluded) Both sets are re...
stackexchange_codegolf
Quell is a single-player grid-based puzzle game. Pearls are scattered across a 2D map and the aim is to collect them all by rolling a drop of water over them. For this challenge we will only consider basic maps containing the drop, pearls, walls, and empty spaces. (The full game includes a variety of additional objects...
stackexchange_codegolf
Cellular Automata are truly fascinating. The ones that are usually talked about are the binary ones, i.e., the ones representable by a number. However, those, in my opinion, have been done to death. Ternary CAs are more interesting, but we have all of ASCII to consider! What fun could that be! Instead of deciding a rul...
stackexchange_codegolf
Futoshiki is a logic puzzle where an \$n×n\$ Latin square must be completed based on given numbers and inequalities between adjacent cells. Each row and column must contain exactly one of each number from \$1\$ to \$n\$ while satisfying the inequalities. In a solved Futoshiki puzzle any row (or column) forms a linear ...
stackexchange_codegolf
I recently learned from a comment by MathOverflow user pregunton that it is possible to enumerate all rational numbers using iterated maps of the form \$f(x) = x+1\$ or \$\displaystyle g(x) = -\frac 1x\$, starting from \$0\$. For example, $$0 \overset{f}{\mapsto} 1 \overset{f}{\mapsto} 2 \overset{g}{\mapsto} -\frac12 \...
stackexchange_codegolf
Introduction Formula One is a complex sport and as with complex sports, strategy is very important.Some teams will manage better strategy than others and those teams will often win the races. After last weekends' amazing German GP, which saw last years Champion Lewis Hamilton pit 6 times (in comparison, some races just...
stackexchange_codegolf
A half cardinal cyclic quine is a cyclic quine with two states, one perpendicular to the other. Rules You can decide which rotation you want to implement, clockwise or counter-clockwise. Once rotated, any gaps in your code should be replaced with spaces to preserve the positioning. Your program must satisfy the communi...
stackexchange_codegolf
A good resolution for 2015 is to live more sustainably. We'll start by recycling. Recycling code, that is! Your task is to print the number 2015 to STDOUT, with or without trailing newline (and only that). However, you have to do so by recycling some old code from PPCG. Here is how that works: Pick any answer posted o...
stackexchange_codegolf
The sequence of Fibonacci numbers is defined as follows: \$ F_0 = 0 \\ F_1 = 1 \\ F_n = F_{n-1} + F_{n-2} \$ Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not need to handle the inputs \$ 0 \$ or \$ 1 \$, nor any non-Fibonacci numbers. Errors as a result of floating point inaccu...
stackexchange_codegolf
Task The input consists of a JSON object, where every value is an object (eventually empty), representing a directory structure. The output must be a list of the corresponding root-to-leaf paths. Inspired by this comment on StackOverflow. Input specifications You can assume that that the input always contains a JSON ...
stackexchange_codegolf
Your task is to take in one integer input and print a zigzag pattern using slashes and backslashes. The integer input determines the length of each zig and zag, as well as the number of zigs and zags The pattern always starts from right to left Test Cases 4-> / / / / \ \ \ \ / / / / \ \ \ \ 2-...
stackexchange_codegolf
Task Given two positive integers, output the number of carries needed to add them together in long addition in base 10. Examples ¹¹¹ <-- carries 999 + 1 ---- 1000 Three carries are needed. ¹ 348 + 91 ---- 439 One carry is needed. Testcases 999, 1 -> 3 398, 91 -> 1 348, 51 -> 0 348, 52 -> 2 5, 15 -> 1 9...
stackexchange_codegolf
Challenge Determine how many integer lattice points there are in an ellipse $$\frac{x^2}{a^2} + \frac{y^2}{b^2} \leq 1$$ centered at the origin with width \$2a\$ and height \$2b\$ where integers \$a, b > 0\$ . Input The Semi-major \$a\$ and Semi-minor \$b\$ axes. Output Number of interior and boundary points. Example E...
stackexchange_codegolf
Background A Hamiltonian path is a path on a graph that steps through its vertices exactly once. On a grid, this means stepping through every cell exactly once. On a square grid, a Chess King can move to a horizontally, vertically, or diagonally adjacent cell in one step. Challenge Count the number of Hamiltonian paths...
stackexchange_codegolf
Generative AI is here! It's great for certain things, but it has a few problems. Not only has it broken our Stack Exchange community, it also makes mistakes. For example, when you ask Bing AI if it is sentient, Bing says (credits to GPT Gone Wild) Your job is to print that text exactly. More specifically, Take no inp...
stackexchange_codegolf
In the game 15, two players take turns selecting numbers from 1 to 9 (without choosing any number that either player has already selected). A player wins if he or she has three numbers that add up to 15. If all the numbers have been selected and no combination of either player's adds up to 15, then the game is a tie. Y...
stackexchange_codegolf
(Note: This is a spin-off of my previous challenge Find the Swirling Words!) Definition of Infinity Word: If you connect with curves all the characters of an Infinity Word on the alphabet (A-Z) you obtain the infinity symbol ∞ like in the diagrams below. All the even connection must be down, all the odd connections mu...
stackexchange_codegolf
Inspired by this. No avocados were harmed in the making of this challenge. Hello I have challenge I need help juic an avocado so I need program to tell me how long to juic avocad for Observe this ASCII art avocado: ###### # # # #### # # # p# # ## #### # # # ###### This avocado consists...
stackexchange_codegolf
Given an image, either as input (possibly in RGB triplets) or with the filename as input (you may assume the image has a specific filename, possibly without an extension), output an image representing a single color channel of the image. You will also take another input, representing which channel to output. The input ...
stackexchange_codegolf
Let's assume we've got an imaginary assembler. The assembler supports numerical labels. An infinite loop example: :1 jmp 1 Your task is, to write a preprocessor for this assembler supporting named labels (instead of numerical ones; with up to 8 characters in length), so the label name is replaced to it's numerical...
stackexchange_codegolf
Take a string, s containing printable ASCII-characters as input, and output its "binary split sum". Need an explanation? How do you get the binary split sum? We'll use the string A4 as an example in the following explanation. Convert the characters to binary, treating each letters as a 7-bit ASCII character A -> ASCII...
stackexchange_codegolf
Polystrips are a subset of polyominoes conforming to the following rules: each piece consist of 1 or more cells no cell can have more than two neighbours the cells should not enclose a hole Free polyominoes are distinct when none is a rigid transformation (translation, rotation, reflection or glide reflection) of ano...
stackexchange_codegolf
CLOSED to competing entries New bots are welcome but are not part of the main competition and probably won't be officially tested. You stand on a dusty stretch of code, watching the other programs stare at you. Will they shoot? How much ammunition do they have left? All you know is that you want to be the last one stan...
stackexchange_codegolf
The partitions of an integer N are all the combinations of integers smaller than or equal to N and higher than 0 which sum up to N. A relatively prime partition is an integer partition, but whose elements are (overall) coprime; or in other words, there is no integer greater than 1 which divides all of the parts. Task G...
stackexchange_codegolf
In celebration of HyperNeutrino getting back his account and rep, following Mr. Xcoder. Apologies for rotating the picture for drawability. Print or output this ASCII art exactly. You may have trailing spaces and/or a trailing newline. _______________ / \ / / \ \ / / ...
stackexchange_codegolf