instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Stack Exchange doesn't know how to transpose tables. Let's help. Given a markdown table, transpose it. Input assumptions: There will be at least two rows (including header) and two columns Either all cells have no leading space or all cells have exactly one leading space (you must handle both) If the cells have a lead...
stackexchange_codegolf
I was answering one challenge here and this task was part of the challenge. I've got a 73 bytes solution in javascript. But I think it is too much for a simple thing. Challenge Given as input two integers: N the length of the expected array R the interval's range starting in one: 1..R, not 0..R-1 Output in each run o...
stackexchange_codegolf
Today your goal is to find integers a and b given non-negative integer n such that: You should write a program or a function that takes parameter n and outputs a and b in a format of your choice. Standard loopholes apply. Additionally, it's intended that you implement the above problem using basic arithmetic yourself....
stackexchange_codegolf
Elixir is a programming language with a feature called the pipe operator, |>, similar to the pipe in Bash and other languages. It passes the result of an expression on the left as the first parameter of a given function on the right. To clarify, here are some examples. 2 |> myFunction() is equivalent to myFunction(2) ...
stackexchange_codegolf
Task Given an integer \$n\in[0,10^{12})\$ in any convenient format, return the number of strokes needed to write that character in simplified Chinese. Background Chinese numerals are expressed in base 10 with a system of digits and places, with an important distinction that digits are in groups of four, rather than thr...
stackexchange_codegolf
What tips do people have for golfing in TeX/LaTeX? Please post one tip per answer, each at least somewhat specific to TeX/LaTeX. Context: I noticed this answer and that there is no tips question for TeX/LaTeX, so I'm creating this one. There's some overlap with the narrower question tips for golfing in TikZ (as TikZ i...
stackexchange_codegolf
The results are in, the contest is over. The winner is arshajii's EvilBot with 14 wins ahead of Neo-Bot with 13 wins and CentreBot and LastStand with 11 wins each. Scores from the final run Results: java Rifter: 9 match wins (45 total bout wins) java EvadeBot: 10 match wins (44 total bo...
stackexchange_codegolf
Matrix challenges are popular. There's an issue of how to provide test cases. A common method is the row-wise array-of-arrays representation, such as: [[1,2],[3,4],[5,6]] -> a 3 by 2 matrix This is good with vertical space, but there's always the task of converting the test cases into something your language can use, ...
stackexchange_codegolf
Task Write a function or program that takes n as a parameter and prints the first n self-divisors. Definition of Self-divisor A positive integer is called a “self-divisor” if every decimal digit of the number is a divisor of the number, that is, the number is evenly divisible by each and every one of its digits. Exampl...
stackexchange_codegolf
Intoroduction If you've ever been to Epcot at Disney World, you've probably been to the world showcase: a lake surrounded by various country-themed locations. One thing that's always bothered me about it is that the countries don't appear in the order you would run into them around the world. There are officially eleve...
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
Introduction Suppose for a moment that the vipers and cliff are only two steps away, instead of three. o --- Hsss! | ';;' ___ /_\ ___ _ | You are, unfortunately, a captive of a sadistic torturer. You must take a step either to the left or to the right every turn. ...
stackexchange_codegolf
Challenge Given a time and a timezone as input, output the time in that timezone. Time The time will be given in 24 hour format like so: hh:mm Where hh is the two digit hour and mm is the two digit minute. Note that the hour and the minute will always be padded with zeroes like so: 06:09 All the times given are at UT...
stackexchange_codegolf
I use "suffix" loosely here to mean "any sub-string that follows the prefix". "Prefix" here means the START of a word, where a word's start is defined as either after a space or from the first character of the input text (for the first word). A "prefix" in the middle of a word is ignored. E.g. if your input prefix is "...
stackexchange_codegolf
A laser shoots a straight beam in one of the four orthogonal directions, indicated by <>^v. Determine whether it will hit the target O on a rectangular grid. Each of these will hit (True): ..... ...O. ..... ...^. ..... >O. ... v.... O.... ........... ........... O.........< ........... These will miss (False): ......
stackexchange_codegolf
My mom really wants me to eat broccoli, but I hate it and never want to eat it. Mom wants to trick me so she cuts it into small pieces, puts it in a salad and mixes it. Help me find out if the salad contains broccoli! Input: Array of mixed letters of all the ingredients. For a single broccoli ingredient it could be: [c...
stackexchange_codegolf
Key links: Troll question Chat room Game Controller Interface Dwarf league table <script src="https://ajfaraday.github.io/Thud/dist/data/tables.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><table> <thead> <tr> <th>Client</th> <th>Wins</th><th>Loses</th> <th>S...
stackexchange_codegolf
You need to print A-Z like this: 1. A 2. B 3. C 4. D 5. E 6. F 7. G 8. H 9. I 10. J 11. K 12. L 13. M 14. N 15. O 16. P 17. Q 18. R 19. S 20. T 21. U 22. V 23. W 24. X 25. Y 26. Z But your source code cannot use 1,2,4,6. Trailing newlines in output allowed,, but leading ones not allowed. Standard loopholes apply, shor...
stackexchange_codegolf
There are currently nine feature length films in the core Fast & Furious/The Fast and the Furious media franchise, a series of films about bald men scowling and driving cars very fast. The names of the films, as can be seen, follow a completely logical and sensible convention: The Fast and the Furious 2 Fast 2 Furious...
stackexchange_codegolf
The Prisoner's Dilemma, but with 3 choices, and the payoffs are random! Each round, your bot recieves a 3x3 grid and chooses a row to play. The grid might be this: 4 5 7 3 1 9 9 9 0 Each number in the grid is between 0 and 10 (inclusive). Your score for the round is grid[your_play][their_play], and your oppone...
stackexchange_codegolf
The task Given a multiline string with ascii art operators and numbers, parse the expression! Possible symbols Numbers: (3x4) / /| | --- ___ _| | --- ___ _| | --- | | |_| | | ___ |_ | --- ___ |_ | | --- ___ / / | ___ |_| | | --- ___ |_| | --- ___ | | | | --- Operators: (3x3) | -+- | ---...
stackexchange_codegolf
Intro So I've been wasting my time again researching suffix sorting algorithms, evaluating new ideas by hand and in code. But I always struggle to remember the type of my suffixes! Can you tell me which type my suffixes are? Left-most what? A lot of suffix sorting algorithms (SAIS, KA, my own daware) group suffixes int...
stackexchange_codegolf
your challenge is to draw this ASCII art: | | |- - - - | | - - - | | | | | | | |- - -| |- - - | | | | | | | | | | | | | |- - - - |- - - |- - - - - - remember this is code golf meaning you have to answer in the leas...
stackexchange_codegolf
Cops challenge The Robbers' Challenge Find a vulnerable answer. That is, an answer which hasn't been cracked yet and which isn't safe yet either. Crack it by figuring out its language. That is, find any language in which the given program is a valid program (subject to the rules outlined in the Cops' Challenge above)...
stackexchange_codegolf
In this challenge, you will be given a list of points. These points lie on the perimeter of an imaginary square. Your goal is to: If possible, print out the rotation of the square, which will be a value from [0, 90) where 0 represents a square with lines vertical and horizontal. The rotation is to be given in degre...
stackexchange_codegolf
Introduction In the video the best way to count, binary is proposed as the best system of counting numbers. Along with this argument is a proposal on how to say numbers in this system. First, we give names to each "double power of two", \$2^{2^n}\$ for each \$n\$. number = symbol = spoken ============================ 2...
stackexchange_codegolf
Your task is to automatically complete URLs like the address bar in most browsers is doing. We will use the following (simplified) rules: If the input string starts with http://, ftp:// or https://, return the string unchanged. Otherwise, if the input string contains a dot ., e.g. in.put then the HTTP is assumed and ...
stackexchange_codegolf
I want to avoid responding to illegal or spoofed addresses. One type that's easy to detect is an address that should not exist on a packet received by my router: a special-use address. Challenge Given an IPv4 32-bit address, identify whether it is valid general-use address. Challenge rules Special-use addresses, as de...
stackexchange_codegolf
Your code-golf challenge is to find all occurences of a word in the 3d matrix. There is no restriction on I/O format. In the samples below, the word is presented, then a blank line, then the 2-dimensional layers from top to bottom, and the output, for each line, consists of a coordinate and a direction (x, then y, then...
stackexchange_codegolf
There have been many "Do __ without __" challenges before, but I hope that this is one of the most challenging. The Challenge You are to write a program that takes two natural numbers (whole numbers > 0) from STDIN, and prints the sum of the two numbers to STDOUT. The challenge is that you must use as few + and - signs...
stackexchange_codegolf
Create a piece of code and a genuinely-looking test for it. However, the test must be flaky: when run multiple times, it must sometimes fail, sometimes succeed. Be creative and try to hide the flakiness as much as possible. The most popular answer in (at least) 10 days wins.
stackexchange_codegolf
The Meeker numbers are a 7 digit number in form of \$abcdefg\$, where \$a×b=10c+d\$ and \$d×e=10f+g\$. As an example \$6742612\$ is a meeker number, here \$6×7=10×4+2\$ and \$2×6=10×1+2\$, so it is a meeker number. Additionally, a Meeker number does not have any leading zeros (so \$a \ne 0\$) The Challenge Your program...
stackexchange_codegolf
Lets Play Kick The Can! Although Moogie is the current winner, if anyone can take his crown they are encouraged to do so Kick the can is a children's game. Involving one defender, and multiple attackers. Today it is no longer such a game! Your job is to write a bot that plays it, to win, king-of-the-hill style! https:/...
stackexchange_codegolf
This is a code-golf, so keep your code small! The objective is to create a function that receives 3 arguments: Rows(int): The max number of an item in each array; Cols(int): The max number of dimensions (sub-arrays); Val(*): The starting value in each item; This function should return a multidimensional array with...
stackexchange_codegolf
Introduction Windows 95 used a very simple algorithm for verifying license keys. The scheme of an OEM license key always looked like this: xxxyy-OEM-NNNNNNN-zzzzz The day can be anything within 001-366, and the year cannot be lower than 95 or above 03. xxx represents the day of the year the key was printed on (for exa...
stackexchange_codegolf
The challenge: Assuming you have \$ X \$ collections, each collection \$ C_i \$ has a name \$ N_i \$ and a capacity \$ N_i \$ of elements - Determine which collection will be overflowed first while counting the occurrences of the names in a cyclic list. Also print how many cycles of the list occurred. Example: 4 Collec...
stackexchange_codegolf
So the golf question was like this: You are given a number T and then a total of T number of 17-character strings. For each of the strings, output yes if it contains four consecutive identical characters or contains the substring DX, else output no. The following constraints are promised for each of the 17-character ...
stackexchange_codegolf
Challenge For any string that is composed of alphabetical characters of any case, make a function that returns a list of all of it's variations, order and case-wise empty strings returns empty list. Test Cases "" -> [] "a" -> ['a', 'A'] "ab" -> ['ab', 'Ab', 'aB', 'AB', 'ba', 'Ba', 'bA', 'BA'] "abc" -> ['abc', 'Abc', '...
stackexchange_codegolf
As it turns out, Python allows for 1j for to be compressed to 1jfor. However, jfor sounds like xnor. Since all similar-phonic phrases have something in common, there must be some property shared between jfor and xnor. If we look at the ASCII representation of the first two characters of jfor in binary, we see: j: 110...
stackexchange_codegolf
Do you know Icy Tower ? Here is a gameplay example of what i'm talking about The game concept is simple : you play as Harold the Homeboy, and your goal is to jump from floors to floors to go as high as possible without falling and getting off-screen ( the camera goes higher following you or at a speed that gets faster ...
stackexchange_codegolf
Yet another Jimmy challenge by his original father. See these other lovely challenges. As you all know, recently we've been seeing challenges related to Jimmy on platforms. Now, Jimmy is an acrobat as I mentioned before, and he's got other tricks up his sleeve. One of these tricks is hanging by ropes. Here's an exampl...
stackexchange_codegolf
Most of us LOST fans out there remember the computer that Desmond had to type the characters "4 8 15 16 23 42" in every 108 minutes or the world would end (or would it?). The challenge here is to create a program that would do the same thing by requiring that every 108 seconds the input 4 8 15 16 23 42 is entered or it...
stackexchange_codegolf
Goal You have to print the ASCII printable characters' code page (0x20-0x7E). The output should look like this: !"#$%&'()*+,-./ 0123456789:;<=>? @ABCDEFGHIJKLMNO PQRSTUVWXYZ[\]^_ `abcdefghijklmno pqrstuvwxyz{|}~ Rules The output should be exactly like shown above, but trailing whitespace is OK. No builtins that triv...
stackexchange_codegolf
Chess960, a.k.a. Fisher random chess, is a variation of the game of chess. In classic chess the starting positions are always the same. In chess960 they vary. Before each game of chess960 one random number from 0 to 959 is drawn. Both players then arrange their pieces in the same way according to this number from a loo...
stackexchange_codegolf
Input A binary string \$s\$ of length \$n\$ and a positive integer \$k \leq n\$. Output The number of binary strings with Levenshtein distance exactly \$k\$ from the string \$s\$. Example outputs Each example gives the largest possible output for the given \$(n, k)\$ pair. k=1, s=1010, output=14 k=2, s=1010, outupt=55...
stackexchange_codegolf
Your task is simple: tell me who wins the battle of the letters. The troops There are three different "troops" in this battle, summarized by this table. name | health | damage A 25 25 B 100 5 C 10 50 You may use any three unique characters to represent the the troops, but m...
stackexchange_codegolf
Intro: I remember, when I was a kid, I would get a calculator and keep on pressing the + button, and see how high I could count. Now, I like to program, and I'm developing for iOS. Counting is a fundamental skill for both humans and computers alike to do. Without it, the rest of math can't be done. It's done simply by ...
stackexchange_codegolf
We have a strictly increasing sequence of non-negative integers, like: 12 11 10 Wait! This sequence isn't strictly increasing, is it? Well, the numbers are written in different bases. The least possible base is 2, the biggest is 10. The task is to guess bases each number is written, so that: the sequence is strictly ...
stackexchange_codegolf
In the card game Magic: the Gathering there are five different colours, which represent loose affiliations of cards, White (W), Blue (U), Black (B), Red (R) and Green (G). These are often arranged in a pentagon as follows: W G U R B Both in the lore of MtG as well as in many card mechanics, adjacent colours in th...
stackexchange_codegolf
The challenge: Write a script to print the alphabet, but you can't use any ASCII strings in your program. Unicode escape characters are allowed (if thats what you call them). External libraries are allowed, as long as a link to the documentation is provided, and an online example if possible. As this is code-golf, the ...
stackexchange_codegolf
Write an irreducible proper quine, i.e. a program that prints its own source code, which can't be reduced by removing characters to a shorter program with the same constraints. Eg. the python quine: var='var=%r;print(var%%var)';print(var%var) can be reduced to the quine v='v=%r;print(v%%v)';print(v%v) thus it is no...
stackexchange_codegolf
Pythagoras had his leg blown up in the war. It had to be amputated, and though he nearly died, he pulled through and made a full recovery. Now, after a year of walking with crutches, he gets the privilege of getting a prosthetic leg! Thing is, though, there are several that fit, but which ones? The Task Given a positiv...
stackexchange_codegolf
Given an input of a list of words, output the words with their letters arranged diagonally: p r o p g u r z a a z m n l m d e i c s n o g d g e o l f (The above should be the output for the input programming puzzles and code golf.) To be precise, each word starts on the first co...
stackexchange_codegolf
Inspired by this challenge, as well as a problem I've been working on Problem: Given a non-empty set of points in 3D space, find the diameter of the smallest sphere that encloses them all. The problem is trivial if the number of points is three or fewer so, for the sake of this challenge, the number of points shall be ...
stackexchange_codegolf
You are fighting an extensive network of enemy spies. You know that each spy has at least one (sometimes multiple) fake identities they like to use. You'd really like to know how many spies you're actually dealing with. Luckily, your counter-intelligence agents are doing their job and can sometimes figure out when two ...
stackexchange_codegolf
Blackbeard was an English pirate of the early 18th century. Although he was known for looting and taking ships, he commanded his vessels with the permission of their crews. There are no accounts of him ever harming or murdering his captives. This challenge is in honor of the infamous Blackbeard and inspired by Internat...
stackexchange_codegolf
Given a set of intervals \$\mathcal{I} = \{I_1, \ldots, I_m\}\$, where each interval \$I_j\$ is represented by its bounds \$(a_j, b_j)\$, find a partition \$\mathcal{T}\$ of \$\mathcal{I}\$ of minimal cardinality such that for each set \$T_i \in \mathcal{T}\$ it holds \$\bigcap T_i \ne \emptyset\$. In other words, find...
stackexchange_codegolf
Given an input integer, output the volume corresponding to the value. The value will always be in the range \$[0,100]\$. Examples If the input \$=0\$: _/| | |\/ |_ |/\ \| If the input \$>0\$ and \$<33\$: _/| | |\ |_ |/ \| If the input \$\ge33\$ and \$<66\$: _/| \ | |\ \ |_ |/ / \| / If the input \$\ge66...
stackexchange_codegolf
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. An Elf is hopping on a chessboard which extends infinitely in all four directions. They move like a generalized chess Knight: on each step, they move X units horizontally and Y units vertically, or Y units horizontally and X units vert...
stackexchange_codegolf
In this challenge, you must parse a list of lists, into a simpler list format. This challenge is based on my sadflak parser. In my sadflak parser, it has all the () removed, replaced with the sum of the ()s at the start of the list, to make the program run faster. To parse into a Sad-List, you have to do this (python i...
stackexchange_codegolf
Make a program which prints just another #{LANG} hacker where #{LANG} is the name of the language with which the program is being run. For example, if I run your program with Bash, I'd expect just another Bash hacker as the output, but when running the same program through C++, I'd expect the output to be just another ...
stackexchange_codegolf
Your task: given a nonzero positive number i, calculate pi using the Nilakantha series unto i terms. The Nilakantha series is as follows: $$\text 3 + \frac{4}{2 \times 3 \times 4} - \frac{4}{4 \times 5\times 6}+\frac{4}{6 \times 7 \times 8} - ...$$ 3 is the first term, 4/2*3*4 is the second, -4/4*5*6 is the third, and...
stackexchange_codegolf
We all know true and false, but what do speakers around the globe say? +----------------------+------------+------------+ | Language | True | False | +----------------------+------------+------------+ | Arabic | sahih | zaif | | Armenian | irakan | kelc ...
stackexchange_codegolf
The challenge is to implement a function or program that takes two numbers, \$x\$ and \$y\$ and return the result of \$x^y\$. The program cannot use any other mathematical operation other than \$+\$ or \$-\$, so no multiplication or division. Functions built into languages are also not allowed. The code in the least a...
stackexchange_codegolf
This challenge will be based on an R language trivia: every release is named and it's a reference to Peanuts comic strips (see here and here). Task Given a release name, output its number. For reference, use the below list: Great Pumpkin 2.14.0 December Snowflakes 2.14.1 Gift-Getting Season 2.14....
stackexchange_codegolf
Given an input string of length 2 or longer consisting solely of alphabetical characters [A-Z] or [a-z] (your choice if they're all uppercase or all lowercase), output a continuous string of characters forming a double diamond pattern. The input string starts on the center line and extends down-and-right at a diagonal ...
stackexchange_codegolf
(The \$\mathbb{Q}\$ in the title means rational numbers.) Background Conway base 13 function is an example of a strongly Darboux function, a function that takes every real number on any open interval \$(a,b)\$. In other words, for any given real numbers \$a, b, y\$, you can find a value \$x\$ between \$a\$ and \$b\$ su...
stackexchange_codegolf
Congratulations! You've just been hired by NASA to work on the new Horizons 2 project. Sadly, there have been huge budget cuts recently, so the top management has decided to fake the whole planned Pluto flyby (as they did for the moon landings in the 70s). Your task is to write a program that will accept as input a dat...
stackexchange_codegolf
The task is to calculate the average "funniness" of a given number given the following scoring system: 1 point for each "420" in it 2 points for each "69" in it 3 points if its a palindrome (doesn't count if it's just a single digit) 4 points if it has (not for each) "800813" 5 points for ending in "420" 6 points for ...
stackexchange_codegolf
Given a positive integer, write it as the sum of numbers, where each of them is in \$\{kt|k\in{1,9,81},t\in{1,2,3,...,64}\}\$. How many numbers at least are used? Shortest code win. Samples: Input Output Method 1 1 1 2 1 2 64 1 64 65 2 64+1 72 1 72 343 2 342+1 576...
stackexchange_codegolf
Given the 2-dimensional positions and velocities of a pair of billiard balls right before impact, calculate their velocities after a perfectly elastic collision. The balls are assumed to be ideal spheres (or equivalently: circles) with the same radius, same mass, uniform density, and no friction. Input consists of 8 nu...
stackexchange_codegolf
Out of all the years I've been making this challenge, 2017 is the first year that's been a prime number. So the question will be about prime numbers and their properties. Your task is to produce a program or function that will take an arbitrarily large positive integer as input, and output or return whether or not the ...
stackexchange_codegolf
Take the decimal number \$0.70710678\$. As a fraction, it'd be \$\frac{70710678}{100000000}\$, which simplifies to \$\frac{35355339}{50000000}\$. If you were to make the denominator \$1\$, the closest fraction is \$\frac{1}{1}\$. With \$2\$, it'd be \$\frac{1}{2}\$, and with \$3\$ it's \$\frac{2}{3}\$. Because \$0.\bar...
stackexchange_codegolf
The task is to to compete for the shortest regex (in bytes) in your preferred programming language which can distinguish between English and Spanish with minimum 60% 90% accuracy. Silvio Mayolo's submission (pinned as Best Answer) has secured his spot as the winner of original contest against any chance of being contes...
stackexchange_codegolf
The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! The Challenge Your challenge is to implement a program that will map some genes using cross-over frequencies, in as many programming languages as possible. You are allowed to use any ...
stackexchange_codegolf
Definition Wolstenholme's theorem states that: where a and b are positive integers and p is prime, and the big parentheses thingy is Binomial coefficient. Task To verify that, you will be given three inputs: a, b, p, where a and b are positive integers and p is prime. Compute: where a and b are positive integers an...
stackexchange_codegolf
User inputs an integer. Print out proper fractions using all positive integers up to the user's input, in ascending order. Rule 1: Eliminate equal fractions. Rule 2: Fractions should be in their simplest form. Rule 3: Use "/" as a fraction symbol and next line (\n or \r as convenient) as a separator between fractions. ...
stackexchange_codegolf
Provided that the input is a monotone sequence of three or more integers: Output -2 if the sequence strictly decreases. Example: [7,4,3,2] Output -1 if the sequence monotone decreases but is neither strict nor constant. Example: [6,5,5] Output 0 if the sequence is constant. Example: [0,0,0] Output +1 if the sequenc...
stackexchange_codegolf
Your task is to analyse the input and output the formula for the n-th term if it is an arithmetic sequence, otherwise it should print "NAAP". Input Input (from STDIN) will consist of few numbers, between 4 to 10 numbers where each number will be in the range between -1000 and 1000 inclusive, separated by a delimiter (...
stackexchange_codegolf
In crossword terminology, the grid is the region into which the crossword answers are inserted, consisting of white and black squares. The crossword answers, called entries, are inserted into contiguous sequences of white squares in a row or column, separated by black squares. For straight (American) crosswords, the g...
stackexchange_codegolf
This challenge was posted as part of the April 2018 LotM challenge Brain-Flak is a turing-tarpit language which has gained quite a lot of fame here on PPCG. The memory of the language is composed by two stacks, but a "hidden" third stack was discovered by Wheat Wizard, leading to some interesting new ways of thinking ...
stackexchange_codegolf
Note: reference to Nothing up my sleeve number. Your task is to take no input and generate this exact output: d76aa478 e8c7b756 242070db c1bdceee f57c0faf 4787c62a a8304613 fd469501 698098d8 8b44f7af ffff5bb1 895cd7be 6b901122 fd987193 a679438e 49b40821 f61e2562 c040b340 265e5a51 e9b6c7aa d62f105d 02441453 d8a1e681 e7...
stackexchange_codegolf
Setup: A block is any rectangular array of squares, specified by its dimensions \$(w,h)\$. A grid is any finite ordered list of blocks. For example, \$\lambda = ((3,2),(3,1),(1,2))\$ defines a grid. Let \$\lambda\$ and \$\mu\$ be two grids with equal area. A tiling of \$\lambda\$ by \$\mu\$ is any rearrangement of the ...
stackexchange_codegolf
(This challenge exists to extend sequence A276272 in the On-Line Encyclopedia of Integer Sequences, and perhaps create a new OEIS sequence1.) This is a code-challenge, which will have you write code to compute as many terms of this sequence as possible. Background A polytet is a kind of polyform which is construct...
stackexchange_codegolf
Introduction (may be ignored) Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the fifth challenge in this series (links to the first, second, third and fourth challenge). I...
stackexchange_codegolf
This challenge is from a game called Keep Talking And Nobody Explodes. Memory is a fragile thing but so is everything else when a bomb goes off, so pay attention! – from the manual The Objective A number from 1–4 is given as the "display", along with scrambled numbers 1–4 as the "buttons." The output must be the label ...
stackexchange_codegolf
Many programming languages are written using solely printable ASCII, tabs and newlines. These 97 characters are then stored in 8-bit bytes (which are actually capable of holding 256 different characters!), which is just terribly inefficient - especially in code-golfing, where every byte counts! In this challenge, you w...
stackexchange_codegolf
Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the Python language. 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 within the python documentation. So today I would like to ask y...
stackexchange_codegolf
Introduction: Inspired by a discussion that is already going on for many years regarding the expression \$6÷2(1+2)\$. With the expression \$6÷2(1+2)\$, mathematicians will quickly see that the correct answer is \$1\$, whereas people with a simple math background from school will quickly see that the correct answer ...
stackexchange_codegolf
Challenge Create a program that outputs a square grid showing visible and non-visible points \$(x, y)\$ from the origin based on their greatest common divisor (GCD). A point \$(x, y)\$ is considered visible from the origin \$(0, 0)\$ if the \$\gcd(x, y) = 1\$. Otherwise, it's non-visible. Input An integer \$n\$, repre...
stackexchange_codegolf
You are given a string of unknown length that contains a varied amount of (, {, [ and their respective closing parentheses (in this context all referred to as brackets). With one exception, all the brackets are all balanced, meaning an opening one has a corresponding closing one somewhere afterwards in the string. The ...
stackexchange_codegolf
Sandbox What is Hexagonification™? Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then rotated by 0, 120 and 240 degrees respectively, as shown in the following image. A triangle hole may appear in the middle, but that isn't a ...
stackexchange_codegolf
FizzBuzz is so simple, bet you can do it backwards. In this challenge, you will be given the length of the FizzBuzz string and must give the positive integer that produced that string. Description To break this down, a FizzBuzz string for n is generated by the following algorithm. Start with an empty string and, for e...
stackexchange_codegolf
Challenge The main objective of the challenge is pretty simple, this is an answer chaining contest, where you have to serially print numbers from 1. That means User 1's answer will print 1, then User 2's answer will print 2 and so on. But there are some rules to make the contest tougher. Rules You can't use the charac...
stackexchange_codegolf
Our boolean operators are AND, OR, XOR, NAND, NOR, XNOR and, in conjunction with one of those operators, NOT. Our numbers are \$1\$ and \$0\$. The challenge is to write a program or function that calculates the results of the input. Input A string, array or other input format of your choice; containing alternating numb...
stackexchange_codegolf
Given a 2-dimensional jagged array and a fill value, pad the array in both dimensions with the fill value to ensure that it is square and not jagged (i.e., all rows are the same length, and that length is the same as the number of rows). The fill values should always be added to the "edges", which may be the start or t...
stackexchange_codegolf
Background Tatamibari is a logic puzzle designed by Nikoli. A Tatamibari puzzle is played on a rectangular grid with three different kinds of symbols in it: +, -. and |. The solver must partition the grid into rectangular or square regions according to the following rules: Every partition must contain exactly one symb...
stackexchange_codegolf
The city defines a dog as any living entity with four legs and a tail. So raccoons, bears, mountain lions, mice, these are all just different sizes of dog. Given an ASCII-art image of an animal, determine if that animal is a dog. Rules An animal is a dog if it has four legs and a tail. The foot of a leg starts with one...
stackexchange_codegolf
You've seen the amazing alphabet triangle, the revenge of the alphabet triangle and now it's time for the revenge of the revenge of the alphabet triangle! Introducing... THE ALPHABET DIAMOND! Your task is to output this exact text, lowercase/uppercase does not matter, though newlines do: bcdefghijklmnopqrstuvwxyzazyxw...
stackexchange_codegolf
This is the cops' thread. See the robbers' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the robbers will try to come up with their algorithm. The catch is, the 'algorithm' must be a single closed-form mathematical e...
stackexchange_codegolf