text
stringlengths
180
608k
[Question] [ ## Background [Fractran](http://en.wikipedia.org/wiki/FRACTRAN) is an esoteric Turing-complete programming language invented by John Conway. A Fractran program consists of an ordered list of fractions. The program starts by taking a single integer as input. Each iteration of the program, it searches th...
[Question] [ [Brainfuck](https://esolangs.org/wiki/brainfuck) is an esoteric programming language that is Turing Complete, meaning you can't tell whether a given program will halt without running it. It's cell-based and has an infinite tape of cells, values containing an unsigned integer from 0 to 255, but if you g...
[Question] [ Related: [Music: what's in this chord?](https://codegolf.stackexchange.com/q/24816), [Notes to Tablature](https://codegolf.stackexchange.com/q/39778), [Generating guitar tabs?](https://codegolf.stackexchange.com/q/2975), [Translate number pairs to guitar notes](https://codegolf.stackexchange.com/q/9462...
[Question] [ For your hard thing to do, you must make a thing for a computer to do that finds out if some words are explained in a simple way. Something is explained in a simple way if it only uses the ten hundred most used words. If not, it is explained in a hard way. This can be a full computer thing or part of a...
[Question] [ Your task is to compile regexes... by specifying a substitution for each character in a regex. ## Regexes The regexes support these ``` REGEX = (LITERAL REGEX / GROUP REGEX / STAR REGEX / ALTERNATIVE) LITERAL = 1 / 0 GROUP = '(' REGEX ')' STAR = (LITERAL / GROUP) '*' ALTERNATIVE ...
[Question] [ # Definition There is infinite row of concatenated natural numbers (positive integers, starting with 1): `1234567891011121314151617181920212223...` # Challenge * Write program in any language, that accepts position number as an input, and outputs digit from that position in the row defined above. * Pos...
[Question] [ A new code-golfer, Joe, just registered to the site. He has 1 reputation but determined to reach all his lucky numbers in reputation exactly. Joe believes in higher powers which will help him to achieve his goal with minimal amount of (his or others) actions. As a new user he also believes that negativ...
[Question] [ Note: *Minor* spoilers for *The Martian* are in this challenge. Read ahead with caution --- [The Martian](https://en.wikipedia.org/wiki/The_Martian_(Weir_novel)) is a Science Fiction novel about astronaut and botanist extraordinaire, *Mark Watney*, who has been accidentally stranded on Mars. At one poi...
[Question] [ Given the name of a Stack Exchange site which doesn't have their own design yet, decide how many ASCII characters (non-ASCII ones are counted separately) are there on their icons. Your code should distinguish these 4 cases: 1 character: ``` Astronomy Beer Freelancing Health History Law Music: Practice ...
[Question] [ Time for another Pyth practice. I present here 8 problem statements with a Pyth solution each. These solutions are written by a Pyth beginner. He is quite happy about these solutions, since they are a lot shorter than his Python answers. Your task however is to show him better. Create equivalent but sh...
[Question] [ ## Some background In math, a [**group**](https://en.wikipedia.org/wiki/Group_(mathematics)) is a tuple \$(G, \*)\$ where \$G\$ is a set and \$\*\$ is an operation on \$G\$ such that for any two elements \$x, y \in G, x \* y \in G\$. For some \$x,y,z\in G\$, basic group axioms are as follows: * \$G\$ i...
[Question] [ Well, the librarian caught you cheating at your job by using your [sorting algorithm](https://codegolf.stackexchange.com/q/58086/42963), so now you're being punished. You've been ordered to create some code so the librarian can impress the object of their unrequited affection, the math teacher. So *tha...
[Question] [ In this challenge you will receive a list of non-negative integers. Each one represents a mushroom with a cap of that radius centered at that location. So a `0` means that it occupies no space at all, a `1` means that its cap only occupies space above it, a `2` means it occupies space above it and one ...
[Question] [ You probably know what a Turing Machine is but do you know what is a Turning Machine (lathe)? Ok you already know.. and what about a Golf Turning Machine ?? Ok I tell you.. A Golf Turning Machine is a full program or function taking a list/array (or any convenient method) representing the Profile (P) o...
[Question] [ Inspired by the upcoming winter bash event ### Objective Add a hat `^`,`´` or ``` to a single vowel in each word of the input. ### Rules * The `hat` and the `vowel` must be chosen at random. Each hat has to appear with the same probability (33%) and the vowels must have the same probability within the ...
[Question] [ I recently ordered some new and colorful tiles to replace my boring old white tiling for my kitchen. However, when the tiles arrived, they were all in a weird shape! Therefore, I need a program to figure out how to arrange the tiles so that I need to use as few of my old boring white tiling as possible...
[Question] [ This challenge is based on actual collision detection I had to write for a simple game recently. Write a program or function which, given two objects, returns a [truthy or falsy value](http://meta.codegolf.stackexchange.com/a/2194/8478) depending on whether the two objects are in collision (i.e. inters...
[Question] [ A Young diagram is a rectangular binary mask whose every row and every column are sorted in descending order. It is easy to check that every rectangular binary mask can be formed by xor-ing together a finite number of Young diagrams. This decomposition is by no means unique, but there will be a minimum...
[Question] [ > > Weather forecasting: Wrong too often to rely on, right too often to ignore. > > > Given a high and low temperature and one of four weather conditions per day, output an ASCII-art graphical five day weather forecast. The structure of the four graphical indicators are shown below. ``` \ / -O- ...
[Question] [ You have probably seen these signs on the doors of various shops: > > ### OPENING HOURS > > > mon-fri 0900-1800 > > sat-sun 1100-1530 > > > The task here is to generate a sign like that, grouping consecutive days with the same opening hours, from a list of opening hours for the whole week. No...
[Question] [ ## Introduction Almost everyone is familiar with the [Travelling Salesman Problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem) (TSP). The task is to, given a list of `N` cities, find the minimum [Hamiltonian cycle](https://en.wikipedia.org/wiki/Hamiltonian_path) which is to say the short...
[Question] [ Write a program to play the game of [Connect 4](http://en.wikipedia.org/wiki/Connect_Four). You are given the state of the board as input and you must decide which column to place your piece in to either get 4 in a row (horizontally, vertically, or diagonally) or block your opponent from doing the same...
[Question] [ A `TicTacToe` game can be represented by a string denoting the sequence of positions as the players make their move. ``` 0 1 2 3 4 5 6 7 8 ``` Assume `X` always plays first. So a string of "012345678" denotes the game ``` X O X O X O X O X ``` Notice, the game is already won when Player `X` marks `6`, ...
[Question] [ ## Background A **snake** is a path over the cells of a square grid, such that it doesn't touch itself on a side of a unit square. Touching at a corner is allowed. An example snake: ``` ##.#. .#.## ##..# #.### ###.. ``` Some example non-snakes: ``` ###.# #.#.# ##### .#... .#### ### .#. ## ## ``` ## Cha...
[Question] [ For those who wish a lot more challenge then the [old Spanish alphabetical order](https://codegolf.stackexchange.com/questions/75259/old-spanish-alphabetical-order), let's take a look at how the Hungarian alphabet is ordered. > > a, á, b, c, cs, d, dz, dzs, e, é, f, g, gy, h, i, í, j, k, l, ly, m, n, ...
[Question] [ The task here is to read from a Golly `.rle` or plaintext file (your choice) whose filename is provided (on STDIN or as a command line argument) and identify and count the common patterns in the grid encoded therein. Alternatively, you may choose to have the contents of the file provided directly over ...
[Question] [ Bonjour, PPCG ! Quelle heure est-il ? This means what time is it in French, for that is exactly what this challenge is about. Telling time in French (at least formally) is a bit different from telling time in English. Telling the time starts out with *Il est* (It is). Then, you put the hour followed by...
[Question] [ Help! My math exam is coming up soon and I didn't study! 1 Part of the exam is to classify a quadrilateral given its vertex coordinates, which I, unfortunately, do not know how to do. 2 So, your challenge is to write a program to do this for me so I don't fail! # Challenge Given four vertices such that...
[Question] [ Write functions \$x(a)\$, \$y(a)\$ and \$z(a)\$ such that for any rational \$a\$ **all functions return rational numbers** and $$x(a) \times y(a) \times z(a) \times (x(a) + y(a) + z(a)) = a$$ You may assume \$a \ge 0\$ You do not need to use rational types or operations in your program, as long as your...
[Question] [ # Introduction [Nine Mens's Morris](https://en.wikipedia.org/wiki/Nine_Men%27s_Morris) (also called Mills) is a board game for two players which is played on the following board (image taken from the linked Wikipedia-page): [![Mill board](https://i.stack.imgur.com/0sS03.png)](https://i.stack.imgur.com/...
[Question] [ Consider a sequence based on recurrence relations, `f(n) = f(n-1)+f(n-2)`, starting with `f(1) = x1, f(2) = x2`. For `x1 = 2, x2 = 1`, the sequence begins like this: ``` 2 1 3 4 7 11 18 29 47 76 123 199 322 521 843 ``` Concatenating this into a string will give: ``` 213471118294776123199...
[Question] [ # Challenge Write a program/function that accepts an "image" and outputs a [picture maze](https://en.wikipedia.org/wiki/Picture_maze) formed from that image. # Input Your program should accept two arguments: * I, the image to form the maze from * S, a boolean specifying whether or not to display the so...
[Question] [ Let's plot a function *f(x) = sin(πx) + 0.5 sin(3πx)* over the domain *[-3,3]*. We can interpret this as a loose string lying on a board. Now let's drive *n* nails into the board at positions *(x1, y1)* to *(xn, yn)*, where the *xi ∈ (-3,3)* and *yi ∈ [-1,1]*. Imagine that there are two eyelets at the ...
[Question] [ **Goal:** Write a function that takes a number as input and returns a short-hand roman numeral for that number as output. **Roman Numeral Symbols:** ``` Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1,000 ``` For an example of what I mean when I say "short-h...
[Question] [ Given two positive integers X and Y, output any combination of the following three ASCII-art animals such that the output contains exactly X commas (`,`) and Y periods (`.`), if it is possible. 1. **Koala:** 1 comma, 2 periods ``` <.,.> ``` 2. **Crab:** 2 commas, 2 periods ``` ,<..>, ``` 3. **Commapill...
[Question] [ Recently, I have found a bijective mapping \$f\$ from positive integers to finite, nested sequences. The purpose of this challenge is to implement it in the language of your choice. ## The Mapping Consider a number \$n\$ with the factors \$2^{a\_1}3^{a\_2}5^{a\_3}\cdots p^{a\_i}\$ where \$a\_i > 0\$ $$...
[Question] [ # Bowl Pile Height The goal of this puzzle is to compute the height of a stack of bowls. [![A stack of bowls](https://i.stack.imgur.com/9dZsZm.jpg)](https://i.stack.imgur.com/9dZsZm.jpg) A bowl is defined to be a radially symmetric device without thickness. Its silhouette shape is an even polynomial. T...
[Question] [ # Cyclically self-describing lists A list \$L\$ of positive integers is *cyclically self-describing*, if the following conditions hold. 1. \$L\$ is nonempty. 2. The first and last elements of \$L\$ are different. 3. If you split \$L\$ into runs of equal elements, the element of each run equals the leng...
[Question] [ Recently at the newly released [Puzzling.SE](https://puzzling.stackexchange.com/), there was [a problem about spies throwing stones into a river](https://puzzling.stackexchange.com/questions/625/two-spies-throwing-stones-into-a-river) that was actually quite challenging: > > Two spies must pass each o...
[Question] [ # Introduction The arena is a flatland dotted with skyscrapers, which your enemies use for cover. You and your enemies shoot each other with lasers. All of you carry jet packs, allowing flight. Which enemies can you hit with your laser, and which are hiding? # Problem First, the size of an arena is giv...
[Question] [ Write a program to determine if the input polygon is [convex](http://en.wikipedia.org/wiki/Convex_and_concave_polygons). The polygon is specified with one line containing *N*, the number of vertices, then *N* lines containing the *x* and *y* coordinates of each vertex. The vertices will be listed clock...
[Question] [ Your task is, given `x`, output `2*x`. Easy right!? But there's a catch: `x` will be given as a (possibly infinite) [continued fraction](https://en.wikipedia.org/wiki/Continued_fraction "Continued Fraction Wikipedia Page"), and the output must be a continued fraction. The input is guaranteed to be a re...
[Question] [ You are in a one-floor dungeon. There is a treasure which is protected by locked doors. Doors can be opened by finding the corresponding keys. Your goal is to find the shortest path to the treasure. ## Input Input will be a two-dimensional grid representing the initial layout of the dungeon. ``` ######...
[Question] [ ## Introduction In the field of mathematics known as [topology](https://en.wikipedia.org/wiki/Topology), there are things called [separation axioms](https://en.wikipedia.org/wiki/Separation_axiom). Intuitively, you have a set `X` and a collection of subsets of `X`, which we can think of as properties. ...
[Question] [ Apply an indefinite integral to a given string. The only rules you will be using are defined as such: ``` ∫cx^(n)dx = (c/(n+1))x^(n+1) + C, n ≠ -1 c, C, and n are all constants. ``` # Specifications: * You must be able to integrate polynomials with any of the possible features: + A coefficient, possib...
[Question] [ There is a variant of the well-known N-queens problem which involves queens and knights and is said to be *"considerably more difficult"* **1**. The problem statement is as follows: > > You must place an equal number of knights ♞ and queens ♛ on a chessboard > such that no piece attacks any other pie...
[Question] [ 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 acce...
[Question] [ **Introduction** Arithmetic Gaol is a special facility that incarcerates positive integers. However, recently, the positive integers have been trying to escape. Therefore the wardens have decided to, um, *eliminate* some of the positive integers to send a message to the other integers. They have hired ...
[Question] [ ## Background Consider a (closed) chain of rods, each of which has integer length. How many distinct hole-free [polyominoes](http://en.wikipedia.org/wiki/Polyomino) can you form with a given chain? Or in other words, how many different non-self-intersecting polygons with axis-aligned sides can you form...
[Question] [ **Plot**: Jimmy is missing; we have to find him. We should split up. **Plot twist**: Jimmy is already dead. But, our cast doesn't know that, so they need to search the whole area anyway. There is an N columns x M rows (1<=M,N<=256) grid of cells, either marked as "S" for the starting point, "." for op...
[Question] [ Given an 8x8 grid of letters representing the current state of a game of chess, your program's task is to find a next move for white that results in checkmate (the answer will always be mate in one move). ## Input Input will be on STDIN - 8 lines of 8 characters each. The meanings of each character are...
[Question] [ In this challenge, you are given two overlapping rectangles, and you need to calculate the rectangles created by removing one from the other. For example, if you remove the red rectangle from the black one: [![rectangles](https://i.stack.imgur.com/cisSA.png)](https://i.stack.imgur.com/cisSA.png) You en...
[Question] [ In math, a [permutation](https://en.wikipedia.org/wiki/Permutation) ***σ*** of order ***n*** is a bijective function from the integers 1...***n*** to itself. This list: ``` 2 1 4 3 ``` represents the permutation ***σ*** such that ***σ***(1) = 2, ***σ***(2) = 1, ***σ***(3) = 4, and ***σ***(4) = 3. A squ...
[Question] [ Given a polynomial, determine whether it's prime. A polynomial is `ax^n + bx^(n-1) + ... + dx^3 + ex^2 + fx + g`, where each term is a constant number (the coefficient) multiplied by a nonnegative integer power of `x`. The highest power with a nonzero coefficient is called the degree. For this challeng...
[Question] [ A complete [deterministic finite automaton](https://en.wikipedia.org/wiki/Deterministic_finite_automaton) is a machine, with some states. Each state in the automaton has, for each character in the alphabet, a pointer to a state (not necessarily a different one). The automaton starts at some state, and ...
[Question] [ Recently I've been writing a new [language](https://github.com/vihanb/Blocks), to avoid needing to handle *order of operations*, I simply parenthesize each expression properly to avoid this entirely. Because parenthesis are at char-codes 40-41, your code will need to be as short as possible. --- ## Ex...
[Question] [ Any regular hexagon can be tiled with diamonds, for instance like so (stolen from [this question](https://codegolf.stackexchange.com/q/50562/25180)): ``` ______ /_/_/\_\ /_/\_\/\_\ /\_\/_/\/_/\ \/_/\_\/_/\/ \_\/_/\_\/ \_\_\/_/ ``` We'll consider the above a tiling of size 1 (since the diamonds...
[Question] [ ## Background One source of ennui in tabletop role-playing games is dealing with rolls involving many dice. Casting a Disintegration spell may be instantaneous, but rolling and adding together 40 dice certainly isn't! A number of suggestions for handling this [are discussed at rpg.stackexchange.com](ht...
[Question] [ # Task Given the x,y coordinates (coordinates are guaranteed to be integers) of the vertices of two [simple polygons](https://en.wikipedia.org/wiki/Simple_polygon) in clockwise or anti-clockwise order. Output a Truthy value if both the polygons are [similar](https://en.wikipedia.org/wiki/Similarity_(ge...
[Question] [ # Detect Duplicate Questions Once upon a time, there was a golfing site. It had a problem: people would post similar or identical questions again and again. You have been ~~chosen selected forced conscripted blackmailed~~ requested to automate the process of deciding whether a question is a duplicate o...
[Question] [ [Fillomino](http://en.wikipedia.org/wiki/Fillomino) is a puzzle where you fill a grid with [*polyominoes*](http://en.wikipedia.org/wiki/Polyomino). Each polyomino is an area of contiguous cells. The grid representation shows what size polyomino is covering each cell. For example, a pentomino(5) would b...
[Question] [ # Introduction Write a program or function that adds a drop capital to a paragraph. The program will input the text to format, the column width, and the number of lines to drop the capital. The drop capitals look like this: ``` Lines: 2 3 4 Drop capital: A| A.| A..| ...
[Question] [ Your task make a bot that plays [Atomas](http://sirnic.com/atomas), with the highest score. ## How the game works: The gameboard starts with a ring of 6 "atoms", with numbers ranging from `1` to `3`. You can "play" an atom between two atoms, or on another atom, depending on the atom itself. You can eit...
[Question] [ # Challenge Summary In summary, the challenge is to provide the glider synthesis for a Game of Life configuration, which is your input. # What does this mean? Well, firstly, let me explain a few terms. By Game of Life, I mean Conway's Game of Life. If you don't know what this is, you can read the Wiki...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** [Update the question](/posts/2303/edit) so it's [on-topic](/help/on-topic) for Code Golf Stack Exchange. Closed 10 years ago. [Improve this question](/post...
[Question] [ *Inspired by [this](https://codegolf.stackexchange.com/q/210638/95792) challenge, which got closed. This is meant to be an easier, but no less interesting version of that.* This is the robbers thread of a [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'") ...
[Question] [ A lottery company wants to generate a random lottery ticket number of length 10 characters. Write a code in any language to create such a number in which every digit comes only once for example `9354716208` in this number all integers from 0 to 9 comes only once. This number should be a random number. ...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/100663/edit). Closed 7 years ago. [Improve this question](/...
[Question] [ [Robbers Thread](https://codegolf.stackexchange.com/questions/231410/which-character-to-change-robbers) Cops, your task is to chose a program that prints a string (you can choose). Although, if you change 1 character in your code, it should print another string. But there's a twist: You should make y...
[Question] [ # Challenge Print or return the Stack Exchange favicon, as provided below: ``` ___________________ / \ --------------------- | | --------------------- | | --------------------- \__________ _____/ | / | / |/ ``` ...
[Question] [ Take an array which consists of positive integers or arrays, output if it only contains `2`s. Output should be a truthy or falsey value (Sorry if this destroys answers) ## Truthy Test Cases ``` [2] [2,2] [[2],[2,2],2] [] [[],[]] ``` ## Falsey Test Cases ``` [1] [22] [2,2,2,1] [[1,2],2] ``` [Standard Lo...
[Question] [ (Based on [this closed challenge](https://codegolf.stackexchange.com/questions/229794/drawing-a-grid-using-and-in-python-using-the-least-bytes-possible#229794), [related](https://codegolf.stackexchange.com/questions/58243/16-bit-binary-grid)) Given an integer n > 1, draw a grid composed of the characte...
[Question] [ 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...
[Question] [ "Talk" is a baroquified accumulator-based language that is created in response to Dennis's [quote](https://chat.stackexchange.com/transcript/message/31809962#31809962) on talk.tryitonline.net. ``` Waiting for someone to create an esolang called talk. ``` . The "Talk" language has 4 commands: * `00` If...
[Question] [ # Input This task takes no input. # Output Your code should compute and print (or return) \$\pi^y\$ for all \$y = \frac11, \frac12, \frac13, \frac14, \frac15, \frac16, \frac17, \frac18, \frac19, \frac1{10}, \frac1{11}, \frac1{12}\$. The first 20 digits of the output (truncated and without any roundin...
[Question] [ Take an input, and convert it from Two's Complement notation (binary where the first bit is negated, but the rest are taken as normal) into an integer (in a somewhat standard output form). Input can be as a string, a list of digits, a number, or pretty much any other format which is recognizably Two's ...
[Question] [ Your challenge today is to write a program or function which takes a list `l` and gives the positions in `l` at which each successive element of `l` sorted appears. In other words, output the index of the smallest value, followed by the index of the second smallest value, etc. You can assume that the i...
[Question] [ You must produce a function which nests a string `s` inside an array, `n` times ``` >>> N("stackoverflow",2) [['stackoverflow']] ``` # Parameters: 1. `s` - An ascii string 2. `n` - An integer `>= 0` ## Rules * Shortest code wins. * The output will be a nested `array`, `list` or `tuple` (or similar type...
[Question] [ Given a lower case string. Ex: ``` s = 'abcdefghijklmnopqrstuvwxyz' ``` The goal is to make every other [vowel](https://en.m.wikipedia.org/wiki/Vowel) uppercase. Desired output here: ``` abcdEfghijklmnOpqrstuvwxyz ``` As you can see, from `aeiou`, \$`e`\$ and \$`o`\$ get uppercased. For `aeiou`, the de...
[Question] [ Write shortest code to print the following Multiplication Table: ``` 1×1=1 1×2=2 2×2=4 1×3=3 2×3=6 3×3=9 1×4=4 2×4=8 3×4=12 4×4=16 1×5=5 2×5=10 3×5=15 4×5=20 5×5=25 1×6=6 2×6=12 3×6=18 4×6=24 5×6=30 6×6=36 1×7=7 2×7=14 3×7=21 4×7=28 5×7=35 6×7=42 7×7=49 1×8=8 2×8=16 3×8=24 4×8=32 5×8=40 6×8=48...
[Question] [ Write the shortest code, in number of bytes, to display, return, or evaluate to the golden ratio (that is, the positive root of the quadratic equation: \$x^2-x-1=0\$, approximately 1.618033988749895), to at least 15 significant figures. No input will be given to your program. Sample in Stutsk programmi...
[Question] [ We will think of a partition as a sequence of non-increasing integers. For a given partition into \$n\_1, n\_2, \dots, n\_k\$ with \$n\_1 \geq n\_2 \dots n\_{k-1} \geq n\_k = n\$ we write it out with \$n\_i\$ dots on row \$i\$. So for \$6, 1, 1\$ we would write six dots on the first row, one on the sec...
[Question] [ I just had a genius idea for making the work-life easier - a countdown to a specific date which only counts workdays. --- The basic task is to create a countdown to a specific date which only includes the workdays in the countdown. As workday counts *Monday*, *Tuesday*, *Wednesday*, *Thursday* and *Fri...
[Question] [ Given two integers as input in an array, draw a rectangle, using the first integer as width and second as height. Or, if your language supports it, the two integers can be given as separate inputs. Assume the width and height will never be less than 3, and they will always be given. Example Outputs: **...
[Question] [ Characters in strings are sometimes represented as their ASCII hexadecimal codes. Printable characters have two hex digits in their representation. Swapping those digits leads to another character, which will be our output. The table of relevant character codes can be found on [Wikipedia](https://en.wi...
[Question] [ Your work is to recreate this piece of art: ``` _____ | | | | _____| | | | | _____| ...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/64763/edit). Closed 1 year ago. [Improve this question](/posts/64763/edit) C...
[Question] [ Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a visually appealing explanation. ## How do I do that? The current **iteration index** starts at `0`. * If t...
[Question] [ # Task Given a string `s`, output a truthy value if the ASCII code of each letter is divisible by the length of `s`, and a falsey otherwise. ## Input/Output Input is a nonempty string containing only ASCII `[32-126]`. Output is a standard truthy/falsey value. Note that you can switch the values, for ex...
[Question] [ Given a list of Integers greater than zero, Sort each of the unique values in ascending order, then repeat the process on the remaining duplicate values and append. Example: ``` [1,5,2,2,8,3,5,2,9] ==> [1,2,3,5,8,9,2,5,2] [8,5] ==> [5,8] [2,2,2] ==> [2,2,2] ``` [Answer] # [Haskell](https://www.has...
[Question] [ The \$\text{argwhere}\$ function takes a list of values and a predicate/boolean function as arguments and returns a list of indices where the predicate function returns true in the input list. For example, ``` argwhere([1, 2, 3, -5, 5], x -> x > 2) ``` would produce an output of `[2, 4]` because those ...
[Question] [ Let's solve [this user's homework](https://stackoverflow.com/q/64768698/509868); I think it's an interesting exercise! ### Input Two 3-digit natural numbers. ### Outputs Two 2-digit numbers. In each of the output numbers, one digit is taken from one input number, and the other from the other number. Th...
[Question] [ We haven't had any nice, easy challenges in a while, so here we go. Given a list of integers each greater than \$0\$ and an index as input, output the percentage of the item at the given index of the total sum of the list. Output should be whatever the natural representation for floats/integers is in y...
[Question] [ # Task Build a calculator, that takes any string, from a file, stdin or whatever, and adds up all the values of the chars. Example ``` Input Hello World! Output 1085 ``` # Rules The calculator needs to accept just ASCII encoding. The shortest code wins. # Notes Regarding to the comment of m.buettner, I...
[Question] [ Let \$Z\$ be either the integers, the positive integers, or the non-zero integers; pick whatever's convenient. Give two functions \$f\$ and \$g\$, each \$Z \to Z\$, such that: * \$f(g(a)) = g(f(a))\$, for infinitely many integers \$a\$, and * \$f(g(b)) \ne g(f(b))\$, for infinitely many integers \$b\$....
[Question] [ I honestly cannot believe that this is not a question yet on Code Golf, but.... Print the local time (with a.m. or p.m.) as a string to the console, preceded by "It's ". Example: ``` Run code.... ``` **Output:** ``` It's 12:32p.m. ``` Shortest code wins. Code away! ### Leaderboard ``` var QUESTION_ID=5...
[Question] [ ## The Challenge Given a finite list of integers, split it into the fewest partitions possible such that no partition contains a number more than once. ## Rules Input can be in any format and any order. Output can be in any format, as long as it's clear that each group is separate. This is [code-golf](...
[Question] [ [Inspired by wezl.](https://chat.stackexchange.com/transcript/message/61328796#61328796) Your challenge is to take words (sequences of `[a-zA-Z]`) and truncate them to length 3. For example, `never gonna give you up` would become `nev gon giv you up`. Words will not necessarly be delimited by spaces - ...
[Question] [ Your challenge is to read a "password" from the keyboard / standard input. **Challenge**: * Read a string `s` invisibly. * For each of the characters in `s`, print a character `c`. * In realtime. **Rules:** * You must print `c` in realtime. As soon as the user enters a character you must display `c`. *...
[Question] [ This is tangentially related to my quest to [invent an esoteric programming language](https://cs.stackexchange.com/a/4912/2161). A table of the binary numbers 0 .. 15 can be used to implement a Universal Binary Function using indexing operations. Given two 1-bit inputs X and Y, *all* 16 possible functi...