instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Problem You're a staircase engineer on a house and realize you only have n rectangles to create a staircase. So you are tasked with finding the number of ways to use n rectangles to tile a stairstep shape for the architects. Your task is to write a program that takes a non-negative integer n as input and calculates the...
stackexchange_codegolf
Challenge Given an integer n ≥ 4, output a permutation of the integers [0, n-1] with the property that no two consecutive integers (integers with absolute difference 1) are next to each other. Examples 4 → [1, 3, 0, 2] 5 → [0, 2, 4, 1, 3] 6 → [0, 2, 4, 1, 3, 5] 7 → [0, 2, 4, 1, 5, 3, 6] You may use 1-indexing instead...
stackexchange_codegolf
33 is a simple esolang I created. You may have seen me use it in a few questions. You're not going to be writing a full interpreter. The interpreter you will be writing is for a simplified version of 33. This simplified 33 has two numeric registers: the accumulator and the counter. The accumulator holds all the post-ar...
stackexchange_codegolf
Consider the number 99999999. That number is obviously a palindrome. The largest prime factor of 99999999 is 137. If you divide 99999999 by 137, you get 729927. This number is also a palindrome. The largest prime factor of 729927 is 101. 729927/101=7227 which again is a palindrome. The largest prime factor of 7227 is...
stackexchange_codegolf
Introduction A "lobster number", by my own designation, is a number that contains within itself all of its prime factors. The "lobster" description was inspired by the recent question "Speed of Lobsters". The basic idea is that each prime factor can be made by lobsters munching away digits of the number until you are...
stackexchange_codegolf
I'm letting this one out of the sandbox. Hopefully it is well-written and make sense, feel free to improve. So in order to make 1+ more popular (and ease the creation of golfed 1+ text-printing programs) here comes the metagolf challenge: The 1+ Language 1+ is a fun deque-based esolang where 1 is the only literal, and ...
stackexchange_codegolf
Introduction This is a web scraping Code Golf challenge that attempts to take stock Name and price columns from the 'Most Active' list on this New York Times URL. Why is this challenge interesting? Challenge: Scrape these figures from this NYT page and turn it into a data frame using the smallest number of bytes possib...
stackexchange_codegolf
My user id is 106959 How to check if the number is Fmbalbuena number? First Step: Check if the number of digits is a multiple of 3: 6 = 3 * 2 Second step: Split the digits into even thirds: 106959 -> 10 69 59 Third step: Subtract the first set of digits from the second modulo 10: 6 - 1 = 5, 9 - 0 = 9 Last step: Check t...
stackexchange_codegolf
The input is a word of lowercase letters not separated by whitespace. A newline at the end is optional. The same word must be output in a modified version: For each character, double it the second time it appears in the original word, triple it the third time etc. Example input: bonobo Example output: bonoobbooo Stan...
stackexchange_codegolf
This challenge is created in celebration of my first esoteric language, Backhand! Backhand is a one dimensional language with a non-linear pointer flow. The pointer moves three steps at a time, only executing every third instruction. The program 1..1..+..O..@ will add 1+1 and output 2 before terminating. The intermedia...
stackexchange_codegolf
You are an employee of Microteque, a leading Silicon Valley startup creating smart microwave ovens for all kinds of strange places. Your customers can get their microwaves printed with patterns to match their kitchens, campers, man caves; even the kitchens of large nation-state facilities have shiny new branded microwa...
stackexchange_codegolf
...Ordinal numbers (or ordinal numerals) are words representing position or rank in a sequential order. From Wikipedia. Your task is, using 2 separate programs (of which can be made from 2 different languages), to output the ordinal sequence from first to nth. You will be outputting the full word second as opposed t...
stackexchange_codegolf
Undefined Behavior Killed My Cat It's well known that undefined behavior can kill your cat [citation needed]. But can it? Your Task Write a program that invokes undefined behavior. Describe a scenario that starts with the above program being run, resulting in a Felis catus ending its life while in your ownership, as a...
stackexchange_codegolf
Background A super-prime is a prime number whose index in the list of all primes is also prime. The sequence looks like this: 3, 5, 11, 17, 31, 41, 59, 67, 83, 109, 127, 157, 179, 191, ... This is sequence A006450 in the OEIS. Challenge Given a positive integer, determine whether it is a super-prime. Test Cases 2: f...
stackexchange_codegolf
What general tips do you have for golfing in Chef? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Chef (e.g. "remove unnecessary whitespace" is not an answer). Please post one tip per answer.
stackexchange_codegolf
The Corpus are a fictional faction from the popular video game Warframe who have a somewhat interesting language. Whilst other factions in the game such as the Grineer have some logic behind their language, the Corpus is simply a lossy substitution of the English language. All Corpus words are the same as their English...
stackexchange_codegolf
Given a positive integer \$n\$ output an ASCII hexagon with diagonal side length \$n\$, as pictured (note there are \$2n\$ _ characters on the top edge) Examples: \$n = 1\$ __ / \ \__/ \$n = 2\$ ____ / \ / \ \ / \____/ \$n = 5\$ __________ / \ / \ / \ ...
stackexchange_codegolf
See the cop thread for more information. Each answer to this question should crack an answer there. That is to say, it should be code to find the third-largest integer in the input when run in the interpreter given in that answer. If you post a crack that turns out to be invalid, you should delete it and are ineligible...
stackexchange_codegolf
Find the outcome of a game of War When I was in elementary school, there was a "Rock-Paper-Scissors"-ish game we'd play during assemblies, when waiting for our teacher, at recess etc. We called it "War". After some searching however, it turns out this is a much simpler variant of the "Shotgun Game" (according to WikiHo...
stackexchange_codegolf
This is a little codegolf challenge from codingame.com. I was wondering how much Python3 code is necessary (but of course answers are not limited to Python3). Input The first line contains one positive integer n. The second line contains n positive integers. Each consecutive integers on the second line are separated by...
stackexchange_codegolf
Inspired by a polyglot on the Stack Overflow 404 page: Goal Your goal is simple, to create a polyglot that outputs the number 404, and then terminate, in as many languages as possible. Restrictions Here's the twist, there's a restriction to make it harder: You have to write N programs and pick N languages in a particu...
stackexchange_codegolf
As you probably know, there have been multiple lovely Jimmy challenges recently popping up. In these challenges, you were challenged with our beloved friend's acrobatics skills. Now we've got a different challenge for you. Today you will be identifying different types of Jimmys! Explanation There are three varieties o...
stackexchange_codegolf
Disclaimer: This isn't my challenge but ThisGuy said I was OK to post. Occasionally I want to make a word into it's opposite, like happiness goes to unhappiness. Unfortunately when this happens, my brain will sometimes go blank. Then one day, after yet another this happening, I thought to my self "This is what program...
stackexchange_codegolf
Related as it requires you to measure the time between the first and last input. But here you're required to count how many inputs in a period of time. I was assigned a task to stand by a gate and count how many students enter it. The problem is that my memory is not as good as it was when I first started this job. I...
stackexchange_codegolf
(This is part 1 in a two-part challenge.) Your task is to solve a Hexasweep puzzle. A Hexasweep puzzle is set out on a grid of diamonds arranged in hexagonal shapes, of which the board looks like a hexagon, like so: _____ /\ \ _____/ X\____\_____ /\ \ / XX /\ \ /X \____\/____/X \____\ \ X/...
stackexchange_codegolf
Your task is to calculate the amount you have to pay for prescribed medication at a pharmacy in Germany. The amount is simply based on the full price of the item, which will be your input. It is a decimal number with exactly two fractional digits (ex. 5.43). You can assume it's strictly positive. Your task is to calcul...
stackexchange_codegolf
Yesterday, I left my sandwich on the table. When I got up today, there was a bite in it... Was it mine? I can't remember... Problem: Take a representation of the sandwich and my bite pattern and tell me if it was my bite or not. Examples: Example 1: My bite pattern: .. . Sandwich: ##### .#### ..### Output: truthy Ex...
stackexchange_codegolf
This is an ascii-art challenge where you will draw ascii-art showing a person "jumping" off the top of a building. The building Input given will be a group of rectangular buildings. You may assume buildings are not "stacked on top of each other", hence only one row of buildings. This is the standard format of a buildi...
stackexchange_codegolf
Challenge: Given a string only containing upper- and/or lowercase letters (whichever you prefer), put tape horizontally to fix it. We do this by checking the difference of two adjacent letters in the alphabet (ignoring wrap-around and only going forward), and filling the space with as much TAPE/tape as we would need. ...
stackexchange_codegolf
Background In the sport of Table Tennis (aka Ping-Pong or Whiff Whaff), two opponents play a sequence of rounds, where each round consists of players hitting a ball back and forth until one player (may or may not be the server) gains a point. Table Tennis has some official rules that make for a good game, but we will u...
stackexchange_codegolf
This is the first in a series, the second is Two roads diverged in a yellow wood (part 2) This challenge is inspired by Robert Frost's famous poem, "The Road Not Taken": Two roads diverged in a yellow wood, And sorry I could not travel both And be one traveler, long I stood And looked down one as far as I could ...
stackexchange_codegolf
Background Countless generations of children have wondered where they would end up if they dug a hole directly downwards. It turns out that this would, unsurprisingly, be rather dangerous, but anyway... Antipodes are points that are directly opposite each other on the Earth's surface. This means that if a line was draw...
stackexchange_codegolf
Given a positive integer N, output this doubling pattern of slash squares/rectangles. For N=1, the base is: /\ \/ The next square is added in the bottom right direction for N=2: /\ \/\ \/ After that, a 2x1 rectangle is added in the bottom left direction for N=3: /\ /\/\ \ \/ \/ Then a 2x2 square is added in the t...
stackexchange_codegolf
A Fermi-Dirac Prime is a prime power of the form \$p^{2^k}\$, where \$p\$ is prime and \$k \geq 0\$, or in other words, a prime to the power of an integer power of two. They are listed as integer sequence A050376. While a normal prime factorization generally does not contain a set of distinct primes (for example \$24=2...
stackexchange_codegolf
Given an input of a Pig, SickPig, DeadPig, QuinePig, or DeafPig program, choose one of those "languages" randomly and interpret the input as that "language." First, randomly choose between one of the five members of the "Pig series": Pig If the choice was Pig, mimic the reference interpreter by doing the following: F...
stackexchange_codegolf
The Xerox Alto, originally released in 1973, was the first computer to feature the now-familiar angled mouse pointer. The Alto's bitmapped pointer looked like this (redrawn from Fig. 2 here): Your task in this code-golf challenge is to write a program/function that generates an ASCII art representation of the mouse po...
stackexchange_codegolf
"Baby Shark" is a children's song about a family of sharks. Having long been popular as a campfire song, it has been popularized since the mid-2000s by social media, online video and radio. - Wikipedia Write program that takes no input, and writes the following text to the standard output or an arbitrary file: Baby S...
stackexchange_codegolf
When translating DNA into proteins, the ribosomes read the sequence of DNA nucleotides 3 by 3. Each set of 3 nucleotides is called a codon, and each codon encodes for an amino acid, with some redundancies. Here's the conversion table used by most organisms (table is read left, top, right): Humans and most other organi...
stackexchange_codegolf
Using the the ten inferences of the Natural Deduction System prove DeMorgan's laws. The Rules of Natural Deduction Negation Introduction: {(P → Q), (P → ¬Q)} ⊢ ¬P Negation Elimination: {(¬P → Q), (¬P → ¬Q)} ⊢ P And Introduction: {P, Q} ⊢ P ʌ Q And Elimination: P ʌ Q ⊢ {P, Q} Or Introduction: P ⊢ ...
stackexchange_codegolf
Your challenge is to construct a proper quine using as few distinct characters as possible. Scoring Your score is equal to the number of distinct characters in your code, aiming to minimise this. Standard quine rules apply.
stackexchange_codegolf
This is a challenge to write bots to play the 1st and 2nd players in the following simple poker game. Rules of the poker game There are two players, A and B. Each antes $10 into the pot, and is dealt a card, which is a real number in the range [0, 1). Player A goes first, and may pass or bet. If A passes, then there is...
stackexchange_codegolf
Consider an \$n \times n\$ grid and a circle of radius \$r \leq \sqrt{2} n\$ with its center in the top left. In each square there is an integer from the range -3 to 3, inclusive. For a given radius, there is a set of squares in the grid which are not at least half covered by a circle of radius \$r\$ but are at least ...
stackexchange_codegolf
Huge omega thanks to @wasif for emailing me this challenge idea in its basic form Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just so many of them. Henceforth, today's...
stackexchange_codegolf
Background You know how in text editors and just text fields in general, there's always that blinking bar where you type? Yeah, simulate typing there. You'll be given 3 inputs: The current text field, the position of the cursor, and the input sequence. Here's an example: Hello, World! 5 [U];[U];[B];[B];[B];[B];[B];[U];...
stackexchange_codegolf
What general tips do you have for golfing in Keg? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Keg (e.g. "remove comments" is not an answer). Please post one tip per answer.
stackexchange_codegolf
Introduction A circle-tangent polynomial is a polynomial of degree \$N\ge3\$ or above that is tangent to the unit circle from inside at all of its N-1 intersection points. The two tails that exits the circle are considered tangent at their intersection points from inside as well. You may consider such polynomials are w...
stackexchange_codegolf
This is my pet emoji, Billy: -_- Emojis don't like to be in the rain, so Billy is sad... Let's draw him an umbrella to make him feel better! /\ / \ / \ -_- This is good, he is entirely covered by his umbrella! Here is an example where only part of him is covered: /\ / \ / \ -_- In this case, s...
stackexchange_codegolf
Question Given the atomic number of an element in the range [1-118] output the group and period, of that element as given by the following Periodic Table Of Elements. For elements in the Lanthanide and Actinide series, (ranges [57-71] and [89-103]), you should instead return L for the Lanthanides and A for the Actinide...
stackexchange_codegolf
While at work I spotted a nice and simple challenge. The job was to stock products in cargo units with a certain capability. Since an order can have various batches, coming in sequence from the production, we usually make a list of the pieces of those batches distributed in each cargo to make sure nothing is lost durin...
stackexchange_codegolf
Problem source: https://oj.vnoi.info/problem/backtrack_j We have these two shapes: #. ## and .# ## Let's call the first shape the L and the second shape the flipped L. On a 4x4 board, there are 16 cells. Each cell can be either free or occupied. In all the illustrations, # represents an occupied cell and . represents...
stackexchange_codegolf
I like the Hilbert Curve. Your task for this challenge is to take an image (strictly a square image where all the sides are a power of two pixels wide) and unravel it line by line in a zig-zagging fashion and ravel it back up in a pseudo-Hilbert curve. Unraveling To unravel you will start with the pixel in the upper l...
stackexchange_codegolf
Given an array of integers A, the task is to output another array B of the same length so that B[i] is the maximum over A for every index that is not i. That is \$B[i] = \max_{i' \ne i} A[i']\$. Examples: A = [1, 5, -3, 4, 2]. B = [5, 4, 5, 5, 5] A = [1, 2, 3]. B = [3, 3, 2] A = [-1, -2, -3, -1]. B = [-1, -1, -1, -1] ...
stackexchange_codegolf
Background Boolean Algebra concerns representing values with letters and simplifying expressions. The following is a chart for the standard notation used: Above is what actual boolean algebra looks like. For the purposes of this code golf, this is not the syntax that will be used. Your Task Given a string with three c...
stackexchange_codegolf
A bipartite graph is a graph whose vertices can be divided into two disjoint set, such that no edge connects two vertices in the same set. A graph is bipartite if and only if it is 2-colorable. Challenge Your task is to, given the adjacency matrix of an undirected simple graph, determine whether it is a bipartite grap...
stackexchange_codegolf
Your goal is to write a program that takes no input and outputs the following text: ca e na ŋa va o sa; þa ša ra la ła. ma a pa fa ga ta ča; în ja i da ða. ar ħo ên ôn ân uħo; carþ taŋ neŋ es nem. elo cenvos. But there's a catch: for each letter (any character whose general category in Unicode starts with L) in your s...
stackexchange_codegolf
Challenge: To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points. Example: (0,0), (3,3) -> (1.5,1.5) (-1,-1), (1,1) -> (0,0) (-7,3), (2,-2) -> (-2.5,0.5) (3, 1), (-5,9) -> (-1,5) Rules: The input an...
stackexchange_codegolf
Given 2 integer inputs representing the size of the field, x and y, output a path through the field. Example output for 5, 4: # # # ### ### # The whole field is 5 by 4, and there is a path made of hashmarks crossing the field. The path should always start in the top left corner, and go to the bottom right. T...
stackexchange_codegolf
There's a payment machine for laundry in my building which does a few frustrating things. The ones relevant to this challenge are: It doesn't make change. So if you pay over the amount then you are not getting that over-payment back. It doesn't accept coins smaller than 20c. Meaning the only coins it accepts are 20c...
stackexchange_codegolf
If we take the natural numbers and roll them up counter clock-wise into a spiral we end up with the following infinite spiral: ....--57--56 | 36--35--34--33--32--31--30 55 | | | 37 16--15--14--13--12 29 54 | | | | | 38 17 ...
stackexchange_codegolf
A connected graph is a graph that contains a path between any two vertices. Challenge Build a [2-input NAND-gate] circuit that determines whether a 4-vertex graph is connected. (A gate's 2 inputs can be the same input bit or other gate.) Output True if the graph is connected, and False otherwise. Input The six possib...
stackexchange_codegolf
The cow and chicken problem is a traditional problem for introducing young students to the concept of systems of equations. It goes as follows: A farmer raises cows and chickens on his farm. His animals have a total of 24 heads and 68 legs. How many cows and how many chickens does he have? The numbers of heads h and ...
stackexchange_codegolf
Given a string of text, output it as a 'tower'. Each slice of the string (of the form 0:n) is repeated 5*n times, so the first character is repeated 5 times, then the first and the second 10 times, etc. Examples: 'hello' -> ['h'] ['h'] ['h'] ['h'] ['h'] ['h', 'e'] ['h', 'e'] ['h', 'e'] ['h', 'e'] ['...
stackexchange_codegolf
Disclaimer: ModTen is a fictional card game which was created for the sole purpose of this challenge. The rules of ModTen ModTen is played with a standard 52-card deck. Because the full rules are yet to be invented, we're going to focus on the hand ranking exclusively. A winning hand in ModTen. Graphics from Wikipedia...
stackexchange_codegolf
A Pythagorean triple consists of three positive integers a, b, and c, such that a2 + b2 = c2. Such a triple is commonly written (a, b, c), and a well-known example is (3, 4, 5). If (a, b, c) is a Pythagorean triple, then so is (ka, kb, kc) for any positive integer k. A primitive Pythagorean triple is one in which a, b...
stackexchange_codegolf
In this challenge you will take two inputs One input will be a string of numbers of any length which you will put into an array/table/whatever you call it in your language Ex: 10 10 145 20 53 102 20 Would become arraynameofyourchoice = {10, 10, 145, 20, 53, 102, 20} You can assume the input will have spaces in betwee...
stackexchange_codegolf
I have a number like this: n = 548915381 The output should be the sum of every second digit of that number. In this case 26: 4+9+5+8 = 26 Rules: This is a code-golf, so the shortest code in bytes wins. The input consists only of numbers bigger than 10 (at least 2 digits) but smaller than a 32-bit integer. The input ...
stackexchange_codegolf
This is a very simple challenge. The joke language InterpretMe consists of one command; *, which causes the program to take input of an InterpretMe program and execute it. An InterpretMe program will interpret as many InterpretMe programs as there are * in input. Your goal is to create a program that interprets Inte...
stackexchange_codegolf
The main purpose of the RGB (Red Green Blue) color model is for the sensing, representation and display of images in electronic systems, such as televisions and computers HSL (Hue Saturation Lightness) is an alternative color model, designed in the 1970s by computer graphics researchers to more closely align with the ...
stackexchange_codegolf
Adapted from the UIL - Computer Science Programming free response question "Carla" for 2018 District. Introduction In UNIX-like operating systems, each file, directory, or link is "owned" by a "user", who is a member of a "group", and has certain "permissions" represented by a ten-character string such as "drwxrwxrwx"....
stackexchange_codegolf
The following puzzle was invented by Eric Angelini in September 2007. As mentioned in A131744 : the sequence is defined by the property that if one writes the English names for the entries, replaces each letter with its rank in the alphabet and calculates the absolute values of the differences, one recovers the sequen...
stackexchange_codegolf
Background Peter's Father, the Teacher of a dance-club, asks Peter a question: Given are two natural numbers (\$\mathbb{N}\$ \$x\$ and \$y\$). \$x\$ is the number of the garment types (e.g. shorts, shirts\$\dots\$) we have \$y\$ is number of colors (e.g. green, blue, \$\dots\$) of each garment we have. In the dance cla...
stackexchange_codegolf
The Rockstar programming language has "poetic number literals", allowing you to assign nonnegative, finite (at least one Rockstar interpreter supports infinity) numbers to variables without typing a single digit: just type words with length equal to each digit, modulo 10. For example, This is a challenge sets the vari...
stackexchange_codegolf
Clarification: Basically, you need to make this Euler's totient function has the name phi. Let's try to calculate phi(8) First, list all numbers 8 and under backwards, not including 0 or under 8 7 6 5 4 3 2 1 Now find which numbers don't share a factor with 8 (1 doesn't count), and place a # in their place. 8 # 6 # 4 ...
stackexchange_codegolf
In combinatorics, the rook polynomial \$R_{m,n}(x)\$ of a \$m \times n\$ chessboard is the generating function for the numbers of arrangements of non-attacking rooks. To be precise: $$R_{m,n}(x) = \sum_{k=0}^{\min(m,n)} r_k x^k,$$ where \$r_k\$ is the number of ways to place \$k\$ rooks on an \$m \times n\$ chessboard ...
stackexchange_codegolf
Inspired by this Stack Overflow question. The challenge Input An array of square matrices containing non-negative integers. Output A square matrix built from the input matrices as follows. Let \$N \times N\$ be the size of each input matrix, and \$P\$ the number of input matrices. For clarity, consider the following ex...
stackexchange_codegolf
Given two contiguous shapes of the same area, determine the optimal way to divide the first shape into a minimum number of contiguous segments such that they can be rearranged to form the second shape. In other words, find the minimum number of segments required that can form both of the shapes. "Contiguous" means that...
stackexchange_codegolf
The question: Given an a number n ≥ 2, how many distinct pairs of points on an n-dimensional n x n x n x n x n x n ... x n lattice, where the coordinates range from 0 to n - 1, are a distance at least n apart? The pairs {(2,1,3,1), (3,2,1,3)} and {(3,2,1,3), (2,1,3,1)} are not considered distinct from each other, as th...
stackexchange_codegolf
If you are not familiar with Braid-Theory I recommend that you read this first. This question assumes that you are at least familiar with the concepts at hand and assumes you are well familiar with group-theory Let us define \$\sigma_n\$ to be the braid in which the \$n\$th strand (One indexed) from the top crosses ...
stackexchange_codegolf
In chess, fork means to target two pieces with just one piece, and one of the best pieces for forking is the knight. In this challenge, you will be given three coordinates in a to h and 1 to 8 (like a8 or e7) format. The first and second coordinates are for two other random pieces, and the third is the knight's coordin...
stackexchange_codegolf
An "Egyptian fraction" is a list of distinct fractions with a numerator of \$1\$. For example: \$ \frac 1 1+ \frac 1 2 + \frac 1 3 + \frac 1 6 \$ The "size" of an Egyptian fraction is just the number of terms involved. Your task is to take a positive integer \$n\$ and output the smallest Egyptian fraction that sums t...
stackexchange_codegolf
You are Odysseus, and are finally free from Calypso (who has kept you captive for many years) after you drugged her while she was sleeping1. You wish to return to your homeland of Ithaca, but the ship you've stolen is a bit damaged and cannot steer. However, you have also stolen a map which contains the location of Cal...
stackexchange_codegolf
Naismith's rule helps to work out the length of time needed for a walk or hike, given the distance and ascent. Given a non-empty list of the altitude at points evenly spaced along a path and the total distance of that path in metres, you should calculate the time needed according to Naismith's rule. Naismith's rule is ...
stackexchange_codegolf
To be able to challenge the Elite-4 of top programmers, you need to show your badges first, that qualify you as a potential programmer-master. However, there's a twist. Once you show a badge, it is collected, which means you can't re-show it. So better come prepared! There are n badge collectors, each has a known list ...
stackexchange_codegolf
Inspired by this OEIS entry. Background A saturated domino covering is a placement of dominoes over an area such that the dominoes are completely inside the area, the dominoes entirely cover the given area, the dominoes may overlap, and removal of any domino reveals an uncovered cell (thus failing to satisfy condition...
stackexchange_codegolf
Introduction Write a program or function that, given the coordinates of where a dart lands on a dartboard, return the score of that dart. Dart coordinates are given as two integers, x,y measured from the center of the dartboard, with millimeter precision. How to score a dart Darts is a game played by throwing a dart at...
stackexchange_codegolf
Write a regex that only matches valid country code top level domains (ccTLDs). Your regex must match both the domains with the dot and without the dot (it must match tv and .tv). Any domain that is not a ccTLD or does not exist (e.g. .info or .jobs or .xz) must not be matched. Use Perl, POSIX, PCRE or Python. For refer...
stackexchange_codegolf
This challenge is straightforward, but hopefully, there are plenty of avenues you can approach it: You need to print/return a valid JSON object of at least 15 characters, not counting unessential whitespace. Your program should work without any input. In the interest of clarity, a JSON object starts and ends with curl...
stackexchange_codegolf
Introduction In the field of mathematics known as topology, there are things called separation axioms. Intuitively, you have a set X and a collection of subsets of X, which we can think of as properties. The system is well separated, if one can distinguish between all items of X based on their properties. The separatio...
stackexchange_codegolf
Your input is a list/sequence/vector/array of 5-255 positive integers, not necessarily unique. You may assume whatever input format is most suitable, and that each integer (as well as the quantity of integers) is chosen uniformly at random from the range 5-255. The goal is to output the same list, in the same (or equi...
stackexchange_codegolf
Challenge Write a program that, given a string x which is 10 characters long and a character y, outputs the number of times character y occurs in string x. The shortest program in bytes to do so wins. Example Input: tttggloyoi, t Output: 3 Input: onomatopoe, o Output: 4
stackexchange_codegolf
Description The Caesar cipher is a cipher, where every letter in the alphabet will be rotated by a secret number. If the rotation is \$7\$, then a -> h, g -> n, v -> c and z -> g. Today, we're playing Caesar's Cipher with ASCII chars, (0-127 inclusive). So, with rotation \$7\$, b -> i, Z -> a, x -> DEL (127), But, even...
stackexchange_codegolf
Premise: For those in networking, you've most likely sent a ping to or from some device to make sure everything's properly connected. Cisco, a popular company in networking[citation needed], has a command for it in their IOS that looks like this: (Image source) Your challenge is to graphically recreate a portion of t...
stackexchange_codegolf
The simple part: Given an input string containing only printable ASCII-characters (space - tilde), count the number of occurrences of each character and return the result on any convenient format. The result for a string a%hda7a should be something like: a:3, %:1, h:1, 7:1, d:1. Sorting is unnecessary, the delimiters a...
stackexchange_codegolf
To dynamically include a JavaScript file in a web page, you'd normally insert a <script> tag pointing to your script. For example: var js_file= document.createElement("script"); js_file.src='http://example.com/js.js'; document.body.appendChild(js_file); Write JavaScript code will load an external JavaScript file in th...
stackexchange_codegolf
Part of Advent of Code Golf 2021 event. See the linked meta post for details. Related to AoC2020 Day 11, Part 2. You enter the waiting area for a ferry, and you see a bunch of people sitting at a bunch of seats. The seats form a grid like this (. is a floor, L is an empty seat and # is an occupied seat): LL.#L #.L.L L...
stackexchange_codegolf
Given two non-negative integers e.g. 27, 96 their multiplication expression would be 27 x 96 = 2592. If now each digits is replaced with a symbol, such that two digits are replaced with the same symbol if and only if they are equal we could get something like AB x CD = AECA or 0Q x 17 = 0Z10 or !> x @^ = !x@!. (follo...
stackexchange_codegolf
Subleq is a programming language with only one instruction. Each instruction contains 3 parameters. Code and data space is the same. How it works: A B C A, B and C are signed ints. Instructions are executed in the next way: *B = *B - *A if(*B <= 0) goto C; One post is one tip. Write your tips for Subleq here! Online ...
stackexchange_codegolf
Consider a triangle where the Nth row (1-indexed) is the array of the first N positive integer powers of N. Here are the first few rows: N | Triangle 1 | 1 2 | 2 4 3 | 3 9 27 4 | 4 16 64 256 5 | 5 25 125 625 3125 ... Now if we concatenate those powers into a single sequence, we get OEIS A075363: 1, 2, 4, 3, 9, 27, 4...
stackexchange_codegolf
You will need to evaluate the definite integral (bounded by \$a\$ and \$b\$) of a certain polynomial function that takes the form of: $$\int_a^b \left( k_n x^n + k_{n-1} x^{n-1} + \cdots + k_2x^2 + k_1x + k_0 \: \right) dx$$ Normally, this can be done using the fundamental theorem of calculus and power rules. For examp...
stackexchange_codegolf
Story: The π was recently computed with accuracy to 100 trillions digits, but it is useless to us. We can't do accurate enough math, because rational numbers are too boring and so we don't know that much digits of them! Challenge: Your task will be to write program or function which takes string of digits including dec...
stackexchange_codegolf