instruction
stringlengths
34
53.1k
Your task In your language of choice: create a program that outputs 1 This 1 may either be a string or value equivalent to the number one. The shifting catch If you take the unicode codepoint (or whatever codepoint encoding your languages uses if not UTF) for each character in your program, and shift each of those valu...
For example, let's look at the following ASCII art: /\ - encloses a total of 2 cells - half a cell per slash \/ /\ - encloses 4 cells fully and half of 8 cells, for a total of 8 / \ \ / \/ Your challenge is to write a program that determines (and outputs) the total area enclosed by ASCII art composed only of...
Introduction I crochet a lot, and lately I've started writing crochet patterns. However, while I work very well from notes such as rnds 2-6 (round number = x, original number of stitches = y): *dc x-2 stitches, 2 dc in next stitch* around (xy stitches), most published patterns spell out each row in more detail. I don't...
Please note the special scoring for this challenge. Given a non-empty string made of a-z, output the string immediately before it in the shortlex order. Shortlex order We enumerate strings in shortlex order by first listing the strings of length 0, then those of length 1, then length 2, and so on, putting them in alph...
Given two integers, s and e, print the title of Black Mirror series #s episode #e. Expected output is as below, case sensitive. Output for blank cells and invalid inputs is unspecified. e↓s→ 1 2 3 4 5 ...
Goal: Get every integer from the string (not a number, but integer) Multiply them Output the result Input: 5 kilograms of food eaten, 10 liters of water drank, 20 plates dirty, 40 mugs dirty, and only 3 people acted! Output: 120000 How: Result was 5 * 10 * 20 * 40 * 3 What do we count as an integer: General: If int...
June 2020 is a month in which June 1st corresponds to Monday, June 2nd corresponds to Tuesday, ... June 7th corresponds to Sunday. For reference, here's the cal of June 2020. June 2020 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...
Imagine a simple SKI calculus expression - for example, (((S α) β) γ). As you can see, each node of the rooted tree has exactly two children. Sometimes though, the parentheses are omitted and the tree is unrooted (just to make the notation clear, I believe). The challenge is to put the parentheses back, so that the tre...
Task Given a matrix of numbers \$M\$ with \$r\$ rows and \$c\$ columns, and the magnification factor \$n\$, build the matrix with \$rn\$ rows and \$cn\$ columns where the original elements are spaced \$n\$ units apart and the gaps are filled by piecewise linear interpolation: $$ \begin{bmatrix} a_{11} & a_{12} ...
Lucky dice rolls In pen and paper roleplaying games dice are used for various chance calculations. The usual way to describe a roll is \$n\textbf{d}k\$ where \$n\$ is the number of dice and \$k\$ is the number of faces on a die. For example \$3d6\$ means that you need to roll the classical 6-sided die 3 times (or roll ...
The challenge today is very simple. The task is to determine the TI calculator for which the submitted datafile was made. The datafiles always start with a string **TI, the version (described below), and other data you can ignore. Now, the versions you need to recognize are: 95* => TI-95 92P => TI-92+ 92* => TI-92 89* ...
Intro Help! I'm stuck on a snow-covered mountain and I need to get down as fast as possible, preferably without dying. I have a map showing how high each part of the mountain is above the normal ground. I am a novice skier, which means I like to stick to slopes that aren't too steep. I'm willing to go down just two mod...
Related Challenge: Single Digit Representations of Natural Numbers Task Write a program/function that when given a non-negative integer \$n \le 100000\$ outputs an expression which uses all the digits from \$0\$ to \$9\$ exactly once and evaluates to \$n\$ The expression outputted by your program may only use the opera...
Input Name of a stackexchange site or any way to uniquely identify the site. Output The hour of the day that had the largest number of answers posted over the previous 24 hours. E.g. 14:00-15:00 GMT. You can take the input and give output in any easily human readable format. Your code can access the Internet but only t...
You are playing a famous game called \$1\text{D Array BattleGround}\$. In the game, the player can be stationed in any position from \$0\$ to \$10^5\$. You are a Paratrooper in the game and have the ability to do two types of operation \$-\$ Advance, which would multiply your position by \$2\$ Fall-back, which would d...
Inspired by certain puzzles on Flow Free: Warps. Background We all know that L-triominos can't tile the 3x3 board, and P-pentominos can't tile the 5x5 board. But the situation changes if we allow the board to wrap around in both dimensions: L-triominos can tile 3x3 toroidal grid The 3rd tile wraps around through all fo...
This challenge is a relatively simple concept that I'm surprised has not been done yet. You will be given only an integer as an input. Your task is to find the date that is this number of days from January 1st, 1984. This challenge is uniquely for the Gregorian calendar (which is standard almost everywhere). One restri...
For this challenge, you will be given a long string as an input. With this string, you must create a dictionary. Details: This dictionary will contain all the words from the string - a word being any sequence of letters surrounded by non-letter characters (ASCII). Letter case of the entries of the dictionary should alw...
The incenter of a triangle is the intersection of the triangle's angle bisectors. This is somewhat complicated, but the coordinate formula for incenter is pretty simple (reference). The specifics of the formula do not matter much for this challenge. The formula requires lengths of sides, so it can be very messy for mos...
Task Write a program/function that when given a positive integer \$n\$ splits the numbers from \$1\$ to \$n\$ into two sets, so that no integers \$a, b, c\$, satisfying \$a^2 + b^2 = c^2\$ are all in the same set. For example, if \$3\$ and \$4\$ are in the first set, then \$5\$ must be in the second set since \$3^2+4^2...
In the description of this challenge, the following board will be used as a reference for positions: ABC DEF GHI For instance, in a game of ordinary tic-tac-toe, B E A C G D F H I describes the following: -X- -X- XX- XXO XXO XXO XXO XXO XXO --- -O- -O- -O- -O- OO- OOX OOX OOX --- --- ...
Background Entombed is an Atari 2600 game released in 1982, with the goal of navigating through a continuous mirrored maze as it scrolls upwards. In recent times, the game has been subject to research — despite the strict hardware limitations of the Atari 2600, it somehow manages to create solvable mazes every time. By...
We've had Meta Regex Golf and Display OEIS Sequences. Now, it is time for Meta OEIS Golf. Challenge Given a sequence of integers, your program/function should output a program/function in the same language that then outputs the same sequence. A simple example in Python would be def f(sequence): # generate a dictionar...
Background Shakashaka is a puzzle on a grid, whose objective is to place some half-squares (right triangles) on the empty cells so that all the remaining contiguous regions form rectangles, either upright or 45 degrees rotated. Here is an example puzzle with a solution: Ignore the number clues for this challenge. Cha...
I'm posting my code for a LeetCode problem copied here. If you have time and would like to golf for a short solution, please do so. Requirement It has to only pass the LeetCode's Online Judge, if the language would be available. If the language is not available, simply we should possibly keep the class Solution as we...
If you haven't played the game Baba is You, I think you really should. Whether you’ve played it or not, have a go at implementing it as a code golf. The idea behind this challenge is to have a bit more complicated, non-standard task with a bit longer answers. Game rules Alas, the challenge is not to implement the entir...
Background This challenge is about Convolutional neural networks, and its two main building blocks, namely Convolutional layer and Pooling layer. For simplicity, we ignore the "depth" of the images and intermediate tensors, and just look at the width and height. Convolutional layer A convolutional layer works like a ke...
Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milk-white, one black, one dappled and one yellow. The number of bulls is greater than the number of cows, and the relations between them are as follows: White bulls \$=...
Background Mathematicians are interested in all kinds of algebraic structures, e.g. groups, rings, boolean algebras. Generally, we have several operations (addition, multiplication, meet, join, etc.), and some equational relationships on the operations (e.g. associativity of multiplication). This makes up an algebraic ...
Given a matrix of size at least 3×3 formed by positive integers, determine if it contains at least one "U" pattern, defined as + + + - - - + + + + - N - N - + + + - N - N - + + + - N N N - + + + + - - - + + where N is the same number, repeated in those seven positions - (optional) represents any number different than...
Input a scientific notation number (base 10), output scientific notation in base 16 (as defined below). Details In scientific notation, all non-zero numbers are written in the form $$ m \times 10^n $$ Where \$ n \$ is an integer, and \$ m \$ is a real number, \$ 1 \leq |m| < 10 \$. Consider scientific notation in base ...
Challenge Premise It's 2006, and Alice is trying to send Bob their her completed notes on their newly ended expeditions into the labyrinthine school library, which the two of them found suffers from a bad case of non-Euclidean geometry.1 For some reason, Alice originally created her notes, which consist of black text o...
The challenge is to golf a program that checks if a statement of propositional calculus/logic is a logical tautology (i.e. it is true for all possible values of the variables). Input Input formulas will use P, P', P'' ect. as variables. They can either be true or false. (P and P') means both P and P' are true. (P or P'...
This a simple question. The start day is a Saturday and let the input be a non-negative number x. The output should be the number of weekdays (Mon-Fri) in the next x days inclusive. For example, if x = 3 then the output should be 2. For x from 0 onwards the output should be: 0,0,1,2,3,4,5,5,5,6,7,8,9,10,10,10,11,... —...
Task Your task is to write a program that, taking no input, outputs a string that represents a formatted codegolf answer of itself. The pattern is the following: [Language name][1], n bytes = ``` source code ``` [1]: link-to-language With the language name being the language that you wrote your program (as stated in...
Write a program for a specific language that in different orientations performs different tasks. Your code should have at least two non-empty lines and at least two non-empty columns and should complete at least one challenge from each category of challenges below when oriented in different ways. Orientations Your code...
Help, I've been diagnosed with prosopagnosia! This means I'm no longer able to recognise faces.... :( Can you help me? The challenge You will be given an image as a matrix of regular ASCII characters separated by new line characters, and your task is to determine if it contains a face. Faces will look something like th...
Challenge Given a matrix of digits (0-9), find the smallest (in terms of area) rectangular matrix of digits where one or more copies of itself, possibly rotated, can tile the original matrix. Reflection is not allowed (think of a collection of tiles on a wall or floor). Input can be taken in any reasonable ways to repr...
The goal of this challenge is to print the following tongue twister: She sells seashells by the seashore, The shells she sells are seashells, I'm sure. So if she sells seashells on the seashore, Then I'm sure she sells seashore shells. This is more complicated than just calling your language's print equivalent. Since ...
Given the measures of two of the interior angles of a triangle (x and y; the other angle can be easily calculated with 180 - x - y), draw a line segment that cuts this triangle into two isosceles triangles. You need to output the angle measures of both of your triangles. However, because the base angles are the same, y...
You are given a non-empty list of positive integers. Your task is to figure out how many distinct numbers can be obtained by applying the following algorithm: Remove either the first or the last item from the list and initialize N to the corresponding value. Remove either the first or the last item from the list. Let'...
This is the logo for LAPACK, a widely used software library for numerical linear algebra. Your task is to print the logo (color and matrix brackets not required) as this exact string. Trailing newline is allowed. L A P A C K L -A P -A C -K L A P A -C -K L -A P -A -C K L A -P -A C K L -A -P A C -K
Task Write a program/function that when given 3 positive integers \$a, b\$ and \$m\$ as input outputs a positive integer \$x\$ such that \$a^x\equiv b\ (\text{mod}\ m)\$ or that no such \$x\$ exists. A reference implementation can be found here. Constraints You can expect \$a\$ and \$b\$ to be less than \$m\$. Scoring ...
Challenge In this challenge, the input will be an ordered set of numbers and the program should be able to tell if the set of numbers is an Arithmetic Sequence. Input The input will be a list separated by ,(comma) or , (comma+space). The minimum length of the list should be 3 elements. Output The Output can be a Boo...
Challenge: Get the JavaScript string value containing only the "-" character using code only containing the following three symbols: +[]. Note: I'm not sure if this is possible. Scoring criterion: The number of bytes of code used. Why? I've set myself a challenge to be able to write code using only the above three char...
Back in 1965, The Beatles released their hit song 'Eight Days a Week'. In this code-golf challenge we are going to reimagine dates of the 21st century as if there really were eight days a week. Input A Gregorian calendar date between 1 January 2001 and 31 December 2100 inclusive. You may take input in any convenient fo...
So, this is a task from one very popular educational site in Russia: https://acmp.ru/index.asp?main=task&id_task=786&ins=1 Mathematically, you need to find the power of two not exceeding the given number, read from the standard input stream, and output their difference in the standard output stream. My python3 solution...
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 ...
Tom the lumberjack is going to do his daily routine: chop trees. After all, it's his job to do so. His boss has ordered him to chop trees in a straight line marked with a special tape to identify them, so he knows which trees he is going to have to chop. However, Tom quickly realizes he has a problem. His axe will only...
Background Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically adjacent to each of the trees, so that no two tents touch each other in 8 directions (horizontally, vertically, and diagonally) and the number of tents on each row...
Background Adám and I were once discussing a way to properly extend some features in Dyalog APL. I came up with the following extension to Take, a function that takes some front or back elements (and an analogous extension to Drop). We agreed that it was a good idea, but it was incredibly hard to come up with a piece o...
Input: from STDIN number of vertices in Graph \$2 \leq N \leq 100\$. Rules: [Code size] = max ([code length without spaces, tabs and newlines], [total code length divided by 4]) Math formulation: In the graph of N vertices, between each pair of vertices can be 3 road states: there is no road there is a road from A to ...
Description Your task is to implement a simple UNIX command parser and file system. Your program will have to implement a file system that can be modified via commands. The starting directory of your file system is an empty root directory /, with no subdirectories or files. Your program must be capable of handling the ...
Task Write a program/function that when given three 2d points in cartesian coordinates as input outputs a truthy value if they are collinear otherwise a falsey value Three points are said to be collinear if there exists a straight line that passes through all the points You may assume that the coordinates of the three ...
Your task is to turn a square root like this: √12 into a form like this: 2√3 For our purpose, we only need to output the left number here: 2 Test cases 4 -> 2 9 -> 3 12 -> 2 13 -> 1 108-> 6 Specifications You may assume for the input that \$n>0\$. \$n\$ has to be as large as possible. If the number is already a ...
Task Given a positive integer return the geologic era and period it was that many million years ago. Input/output The input is a string or integer; the output is a string. Eras and periods are separated by slashes (/). Input will always be between 0 and 542 inclusive Data The possible outputs for eras and periods and t...
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...
Background We all know about distributivity, i.e. \$a(b+c) = ab + ac\$. This is a property on 2 different operations, namely addition and multiplication. But indeed, nothing can stop us from studying distributivity of 1 operation. In this challenge, you will be studying a kind of left-distributive operation. Task Given...
Because I forgot to celebrate Pi Day (14.3), let's celebrate with \$\pi\$, \$e\$ (Euler's number) and music! Challenge No, we don't have time to eat a pi-pizza, let's make a program. What you need is \$500\$ digits of \$\pi\$, and \$10\$ digits of \$e\$. The input is an integer \$n\$ between \$0\$ and \$499\$ inclusiv...
Given a \$2\times N\$ maze, determine if you can get from the start top left corner to end bottom right corner using only up, down, left, and right moves. Input A \$2\times N\$ block (\$1 \le N \le 100\$) of your choice of two distinct characters, one representing walls and the other representing empty tiles that can b...
I've been posting relatively hard challenges recently, so here goes an easy one. Task Given an array \$A\$ and a number \$n\$, calculate the sum of all numbers of \$A\$ multiplied by \$n\$, except the last one. All numbers (the elements of \$A\$ and the value of \$n\$) are positive integers, and \$A\$ is non-empty. Sho...
The problem You just got a new job, hurray! You expect to be given various interesting tasks, and be able to learn a lot in the next few months. Good news, your boss gave you your first work this morning. You are now in charge of... Writting adresses on envelopes. Yay. Fortunatelly, you are not required to write everyt...
The periodic table gets its shape from the arrangement of elements into blocks: An element is assigned its block based on what type of orbital holds its valence electron(s). For instance, the sole valence electron of neutral hydrogen occupies the 1s orbital in the 1s subshell, and so hydrogen belongs to the s-block. T...
Print this tree: 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 15 20 15 7 21 35 35 21 7 8 28 56 70 56 28 8 9 36 84 126 126 84 36 9 252 462 462 924 1716 171...
Laguerre polynomials are nontrivial solutions to Laguerre's equation, a second-order linear differential equation: \$xy''+(1-x)y'+ny=0\$. For a given value of \$n\$, the solution, \$y\$, is named \$L_n(x)\$. To avoid trivial solutions, the polynomials are non-constant except for \$n=0\$. The polynomials can be found wi...
This time I will give you an easy challenge: Print the Om sign with \$\pi\$!(Sorry for many challenges with \$\pi\$) Here is the om sign drawn using pi numbers: 59 0 64 230781 3.14159 26 502884 535 83279 1971 89 433 6939 79 44 937 ...
Challenge Given the Cartesian coordinates of two or more distinct points in Euclidean n-space (\$\mathbb{R}^n\$), output the minimum dimension of a flat (affine) subspace that contains those points, that is 1 for a line, 2 for a plane, and so on. For example, in 3-space (the 3-dimensional world we live in), there are a...
Background As you maybe know Ramanujan made this magic square by \$4x4\$ Matrix: This works like all magic squares. But the special thing in this square is that his birthdate is hidden in the first row, the 22\$^{nd}\$ Dec 1887. Challenge Can you make one for your birthdate? Input The User will give Input in this form...
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...
Sandbox Many of us have seen math problems where a shape made of unit cubes is dipped in paint, and the answer is the number of painted sides. We'll generalize that problem in this challenge. Input A 3-dimensional matrix of 0s and 1s. Output A non-negative integer Challenge Given a n by m by k matrix of 0s and 1s, we c...
Sequel to Verify Tents and Trees solution. Background Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically adjacent to each of the trees, so that no two tents touch each other in 8 directions (horizontally, vertically, and diag...
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...
When encountering a problem whose input is meant to be read sequentially, but you may also want to push back onto the input like a stack, which languages have the optimal boilerplates for doing so, and how? For example, from Create a Boolean Calculator, we have a string like: 1AND0OR1XOR1 We want to "pop" 5 chars 1AND...
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...
My phone number (which I will not be sharing here) has a neat property where there is a two digit number, which when iteratively removed from my phone number will eventually remove all the digits. For example if my phone number were abaababbab Then by repeatedly removing ab we would eventually get nothing (I encluse ...
Objective Given a matrix of connected box drawing characters, count its genus, the number of plane sections it encloses. Valid input The box drawing characters are ─│┌┐└┘├┤┬┴┼╴╵╶╷ (U+2500 U+2502 U+250C U+2510 U+2514 U+2518 U+251C U+2524 U+252C U+2534 U+253C U+2574 U+2575 U+2576 U+2577). The matrix shall contain these c...
Given two strings as input, return the result of XORing the code-points of one string against the code points of the other. For each character in the first input string, take the code-point (e.g. for A, this is 65) and XOR the value against the corresponding index in the second string and output the character at the co...
Let's begin with a thought experiment. You have a clock and a timer, in which you start the timer when the clock shows exactly hh:mm.00. Clock: The clock employs 24-hour time. So the range of hh is 0<=h<23. (Because 23 inputs are unsolvable, you aren't required to handle that) Timer: It starts exactly on 00.00. The nu...
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...
Ah, Tinder . . . the app that takes the code golf approach to online dating. With just a few well-chosen right swipes and a bit of luck (or a cute puppy pic), you too could have more matches than /(?!)/. This code-golf challenge involves Tinder dates of a very different kind. Given a Tinder version number as input, hoo...
Objective Given a vertex figure consisting of regular convex polygons, determine whether it represents a convex uniform polyhedron. What is a uniform polyhedron? A uniform polyhedron is a polyhedron whose faces are regular polygons, while having the same vertex figure for each vertices. Generally a uniform polyhedron c...
Inspired by this Task Your task is to output the average character of your code. What is an average character? Say we have a string golf(). We then take the ASCII value of each separate symbol, so our string is 103 111 108 102 40 41, and calculate the average of those values, rounded to an integer. In our case the aver...
Background In Minesweeper, you will often encounter a horizontal or vertical wall of one's and two's (not yet revealed cells are marked as ?): ... 1 1 1 1 2 2 2 1 2 1 1 ... ... ? ? ? ? ? ? ? ? ? ? ? ... ... A B C D E F G H ... It is equivalent to a problem of recovering zeros and ones in a boolean array when only wind...
Imagine a grid where the origin square \$(0,0)\$ is at the top left of the screen, and positive \$x\$ is rightwards whereas positive \$y\$ is downwards. Coloured squares are at various positions on the grid. In a magical void separate from the grid are multiple snake-like strips of squares, each of a fixed length and a...
Introduction This problem is a challenge that has to do with DOM manipulation at scale and overcoming some issues that may be inherent in dealing with the DOM. This challenge is interesting because limitations push us to think through things differently and lean on the strengths of languages different than what we usu...
Background A magic square is an n×n matrix consisting of one of each of the integers from \$1\$ to \$n^2\$ where every row, column, and diagonal sum to the same value. For example, a 3×3 magic square is as follows: 4 9 2 3 5 7 8 1 6 Here, each row, column, and diagonal sum to the magic sum of 15, which can be calculat...
Background Sometimes in calculus you're expected to calculate the sum of an infinite series. Sometimes these series are very friendly, like a geometric series, but add anything else onto it and it can quickly get complicated to solve by hand. Sometimes I like to be lazy - a lot of sums can be found simply by adding the...
The Cantor function is continuous everywhere and constant almost everywhere, but has an average slope of 1: The function can be found recursively: \$f_0(x)=x\$ \$f_{n+1}(x)=\left\{\begin{matrix}\frac{1}{2}f_n(3x)&x\in[0,\frac{1}{3})\\ \frac{1}{2}&x\in[\frac{1}{3},\frac{2}{3})\\ \frac{1}{2}+\frac{1}{2}f_n(3x-2)&x\in[\f...
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...
Introduction: Inspired by the Puzzling-stackexchange post with the same name, which I've answered four years ago: Can you create a perfectly valid English sentence, which makes perfect sense, but which contains the word "and" in it, five times consecutively in a row ? "Something-or-other and and and and and something-...
Background Milking the deck is the name given to the following card shuffling method: 'Pinch' the deck to remove the top and bottom cards simultaneously. (With lots of imagination, this action resembles milking a cow.) This pair of cards forms the base of a new pile. Repeat, adding each pair of cards to the top of the...
A superpermutation on n symbols is a string which contains every permutation of n symbols in its body. For instance, 123121321 is a superpermutation on three symbols because it contains 123, 132, 213, 231, 312 and 321 as substrings. The Challenge Given a string composed of n unique symbols (and, optionally, n), output ...
Since this is a answer-chaining challenge, you might want to sort answers by oldest. Your task is simple: Choose any printable ASCII character that's not chosen in the previous answers. And then, you need to print your chosen character in your program to standard output. (You can ONLY print your chosen character, with...
A ripoff of this challenge. Go upvote it! Objective Given a rational number amongst \$[0,1]\$, apply the Cantor function to it and output the rational number that's produced. The Cantor function The Cantor function is continuous everywhere and constant almost everywhere, but has an average slope of 1: The Cantor funct...
This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here A pretty common beginner style question is to print some string, but there's a catch! You need to do it without using any of the characters in the string itself! For this challenge, we will find out who is the best at printi...
This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do it without using any of the characters in the string itself! For this challenge we will find out who is the best at prin...
Related puzzle: Pathfinder (available on Puzzle Picnic) Background A robot is standing on a cell of a rectangular grid, where each cell has one or more gems except for the one with the robot. The robot can move to a horizontally or vertically adjacent cell in one step, and it picks up one gem from the cell it steps on....
In this question at Code Review they tried to find the fastest way to return the unique element in an array where all the elements are the same except one. But what is the shortest code that accomplish the same thing? Goal Find the unique element in an array and return it. Rules The input array will contain only integ...
Task Given a matrix, your program/function should output a row-equivalent matrix in checkerboard form ( \$A_{ij}=0\$ if and only if \$i+j\$ is odd). Two matrices are defined to be row-equivalent if and only if one can be obtained from the other by a sequence of elementary row operations (EROs), where each ERO consists ...
Background I feel that for a site named code-golf we have a shockingly little amount of golf being played. Let's fix that. Challenge Determine whether the hole of a minigolf course can be reached after exactly a certain number of movements and whether it can be reached at all. How to play Inputs are an integer "power l...