text
stringlengths
180
608k
[Question] [ Your task is to create a program where if any one character is deleted, it will detect which character was deleted and then re-insert the deleted character in its own source file. For instance, if your program is `RadiationHardened` and it is modified to `RadiaionHardened`, then your program must outpu...
[Question] [ ## Introduction: At home we have a clock that strikes the stated amount at each hour, but also strikes once at every half-hour. So from 0:01 to and including 12:00 it strikes in this order: ``` 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12 ``` ## Challenge: Given an integer ...
[Question] [ My kids have an alphabet mat to play with, something like this: [![Alphabet mat](https://i.stack.imgur.com/KQVw4.jpg)](https://i.stack.imgur.com/KQVw4.jpg) After months with the tiles of the mat randomly placed, I got tired and placed all the tiles of the mat grouped by sections according to their back...
[Question] [ Given a list of lists find the shortest list that is a contiguous sublist of exactly one list. For example if we had ``` [[1,2,3], [1,2,3,4], [2,4,5,6], [1,2,4,5,6]] ``` the shortest contiguous sublist would be `[3,4]` since it only appears in the second list. If there is no unique contiguous sublis...
[Question] [ Kids who are learning how to count often know runs of numbers, but can't seem to put those runs together properly. For example, they might say: ``` 1,2,3,4,7,8,9,10 ``` Sometimes kids will realize that they skipped some numbers, and go back: ``` 1,2,3,4,7,8,5,6,7,8,9,10 ``` This is clearly the superior...
[Question] [ # Power Grid Resource Costs **Introduction** In the board game [Power Grid](https://boardgamegeek.com/boardgame/2651/power-grid), an integral part of the game is the act of buying resources to fuel your power stations. There are four types of resource used in the game (five, if you include renewable en...
[Question] [ Inspired by [this question](https://codegolf.stackexchange.com/questions/74970/stuffing-primes-in-a-box) about packing into this format. Occasionally I see a completed crossword and being as I am, I can't be bothered to find out what the solutions to the clues actually were. ## Input: * A 2D string (an...
[Question] [ # The story "2016? Al..right," grumbled toy seller Hilbert. He opened his eyes, wiped salad dressing trickling out of his ear and ate a morning kick-start cremeschnitte. Exemplar holidays. He needs to go to work now though, and finish the year's accounting. Christmas is a very yielding period of the y...
[Question] [ You probably do know that the different reputation levels on Stack Exchange are formatted differently when seen from the questions page / a post. There're all the rep-formatting rules: * if a user has 1 to 999 (one to three digits) rep, it's left as-is. * if a user has 1000 to 9999 rep (four digits), i...
[Question] [ # Background This is the first part of a 3-hole golf course on text processing. The over-arching idea is that if you take an input text and pipe it through the solutions to all three challenges (with a small amount of glue code), it will spit out a beautifully formatted paragraph. In this first challen...
[Question] [ # Introduction This challenge is inspired by [Grime](https://codegolf.stackexchange.com/a/47905/32014), my 2D pattern matching language. Basically, you are given a "grammar" that describes two-dimensional grids of characters, and your job is to generate a grid according to the grammar. In addition, the...
[Question] [ ## Challenge On each of the 12 days of Christmas, output the appropriate verse of "12 days of Christmas", according to the date, otherwise output the chorus of "I Wish It Could Be Christmas Everyday". Leading and/or trailing newlines (`\n`) and trailing spaces are permitted. You may not read from any e...
[Question] [ On some old Nokia phones, there was a variation of the [fifteen puzzle](https://codegolf.stackexchange.com/questions/6884/solve-the-15-puzzle-the-tile-sliding-puzzle) called Rotation. In this variation, instead of sliding one tile at a time, you rotated four tiles at a time in one direction. In this ga...
[Question] [ Suppose we define an infinite matrix `M`, on `N^2 -> {0, 1}` (where `N` starts from `1` instead of `0`) in this manner: * `M(1, 1)` = `0`. * For every `x > 1`, `M(x, 1)` = `1` if `x` is prime, and `0` otherwise. * For every `y > 1`, `M(1, y)` = the `y`th term in the `Thue-Morse sequence`. * For every `...
[Question] [ [Chomp](https://en.wikipedia.org/wiki/Chomp) is a two-player game with a setup of a rectangle of pieces. Each player takes a turn removing any piece, along with all pieces above it and to its right. Whoever takes the bottom-left piece loses. It can be proven fairly easily that the first player always h...
[Question] [ A weird number is a number that the sum of proper divisors is greater than the number itself and no subset of proper divisors sum to that number. Examples: > > 70 is a weird number because its proper divisors (1, 2, 5, 7, 10, 14, and 35) sum to 74, which is greater than 70, and no combination of these...
[Question] [ Code golf always involves some answers that bend the rules more or less by breaking constraints that the challengers took for granted or just haven't thought about and didn't list in the rules. One of these interesting loopholes is the possibility to output *more* than the challenge asks for to get a b...
[Question] [ For any ragged list its *dimensions* will be a list of non-negative integers defined as follows: * Elements that are not a list will have dimensions \$\textbf{[}\,\,\textbf{]}\$. * An empty list has dimensions \$[0]\$. * An \$n\$ dimensional list \$L\$ of length \$x\$ has dimensions \$x : k\$ where \$k...
[Question] [ The task is to find the smallest paper size on which it is possible to print a picture of the dimensions given in milimetres. The image will be printed without margins. # Input: Two integers (bigger than zero) and a letter a, b, or c, for example: ``` 290 200 A ``` # Output: Paper size, for example: > ...
[Question] [ I've been recently playing through '[The Weaver](http://pyrosphere.net/weaver/)' and I think it presents an interesting challenge for [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"). # Premise: The Weaver is a game wherein you are given a number of ribbons coming from 2 dir...
[Question] [ The [trumpet](https://en.wikipedia.org/wiki/Trumpet) is a valved aerophone instrument, usually pitched in `B♭`. The sound is made when the player vibrates their lips to displace air inside the instrument. That vibration is acquired by setting one's mouth in a specific way, called the embouchure. Differ...
[Question] [ Philosophers have long pondered the [Trolley problem](https://en.wikipedia.org/wiki/Trolley_problem). Unfortunately, no human has solved this problem yet. Luckily, as programmers we can use computers to solve the problem for us! [![](https://i.stack.imgur.com/coK7c.png "☹")](https://i.stack.imgur.com/c...
[Question] [ ## Introduction As some of you may know, URLs actually have a list of characters that do special things. For example, the `/` character separates parts of the URL, and the `?`, `&`, and `=` characters are used to pass query parameters to the server. In fact, there is a bunch of characters with special ...
[Question] [ What general tips do you have for creating a bot to participate in a King of the Hill challenge? What strategies do you use to go from considering the challenge to creating your bot? What data structures do you find most useful? Please post one tip per answer. [Answer] ## Finding [Nash Equilibria]...
[Question] [ # Golf a Purple Interpreter [Purple](http://esolangs.org/wiki/Purple) is an esolang which is designed with two main purposes: * To be a minimization of [Aubergine](http://esolangs.org/wiki/Aubergine), since there just aren't enough self-modifying one-instruction languages around. * To admit the possibi...
[Question] [ ## Background An interesting way to solve a Sudoku puzzle is to represent it as a [Boolean satisfiability problem](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem), and then feed it to a SAT solver. A Boolean Satisfiability Problem (abbreviated as **SAT problem**) is a problem in which you...
[Question] [ Given a string that represents a bunch of tables stacked on top of each other and/or arranged side-by-side, disassemble all the tables. ## Tables A table looks like this: ``` ------- | | | | ``` More formally, a table has a tabletop, composed of `n` dashes, and two visible legs. (Obviously, the...
[Question] [ ## [Introduction](https://i.stack.imgur.com/GYwVP.jpg): Ever used Dropbox with some other people and you both modified the same file? Ever had a multi-user application with a relational database, and two people were modifying (or worse, one was deleting and the other modifying) the same object? Well, l...
[Question] [ Honestly, I can't believe this hasn't already been asked, but here it is # Background Given a simple undirected *planar* (the graph can be drawn in the plane without intersections) graph, it is a proven theorem that the graph is 4-colorable, a term we will explore in a bit. However, it's far easier to ...
[Question] [ Given a list of hole yardages, green sizes, a slice angle and a max distance, compute a [golf](https://en.wikipedia.org/wiki/Golf) score. ## Assumptions * Earth is flat * All greens are circular * Slice angle will be between -45 and 45 degrees and will be given in degrees * All distances in the same me...
[Question] [ Consider three sets `A`, `B` and `C` each containing `n` integers. From this we can make the set ``` S_n = {a * b + c | a in A, b in B, c in C}. ``` Given an `n`, there are one or more minimal sized `S_n` which depend on which sets `A,B and C` have been chosen. The sets can contain any `n` distinct i...
[Question] [ In [Twitch Plays Pokémon](https://en.wikipedia.org/wiki/Twitch_Plays_Pok%C3%A9mon), one of the most annoying obstacles one can face is an ice puzzle, where you must travel from one place to another by sliding all the way in one direction until you either hit a wall or a boulder. Your task is to build a...
[Question] [ This is an "arrow maze": ``` v < > v > ^ > v ^ < * ``` The `*` marks the spot where you will finish. Your goal is to find where the maze **starts** (hence, reverse maze). In this case, it's the first `>` on the second line. ``` v------< S-+---v | | >--^ >...
[Question] [ The **continued fraction** of a number \$n\$ is a fraction of the following form: $$a\_0 + \cfrac 1 {a\_1 + \cfrac 1 {a\_2 + \cfrac 1 {a\_3 + \cfrac 1 {a\_4 + \ddots}}}}$$ which converges to \$n\$. The sequence \$a\$ in a continued fraction is typically written as: \$[a\_0; a\_1, a\_2, a\_3, ... a...
[Question] [ ### Kira needs your help! --- ## Input format: ``` Date [and/or Time] Name Gender Reason ``` ## Output format: ``` <Last Name, First Name> <will die/died> on the <DD><st/nd/rd/th> of <MMM, YYYY> [at <hh:mm:ss TT>]. <He/She> <will die/died> of <Reason>. ``` --- --- # Details, Details: --- Your program s...
[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/478/edit). Closed 1 year ago. [Improve this question](/posts/478/edit) So be...
[Question] [ This challenge is about computing the [chromatic number](https://en.wikipedia.org/wiki/Graph_coloring#Vertex_coloring) of special types of graphs. # Input The input will consist of two integers. * A positive integer \$n > 1\$. * A distance \$d < n\$. # Task The two inputs values will define a graph wit...
[Question] [ Motivated by [this challenge](https://codegolf.stackexchange.com/questions/260743/calculate-euclidean-distance-on-a-torus) ### Background Let we have a square sheet of flexible material. Roughly speaking, we may [close it on itself four ways](https://en.wikipedia.org/wiki/Fundamental_polygon#Examples_o...
[Question] [ ## 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](https://en.wikipedia.org/wiki/Flat_(geometry)) (affine) subspace that contains those points, that is 1 for a line, 2 for a plane, and so on. For ...
[Question] [ *You find yourself in a strange place. A frighteningly dark maze, lit only by dim candles resting in the occasional hallway. Numerous paths lie only in impassable darkness, foreboding and--* ...Hm? What? Pick up a candle and carry it with you? No, no, that would be *extremely* rude. ## The Task Given a...
[Question] [ (There exists some challenges that require to use the best strategy, but here we don't. Even if you are able to win, you are allowed to make a tie) # Challenge Write a program which plays the game tic-tac-toe. It must not lose (therefore, it should end the game either with a tie or by winning). # Allow...
[Question] [ [TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) is a Latex package used for drawing precise images in Latex documents. It has a massive specification and a boatload of features that may be useful for [graphical-output](/questions/tagged/graphical-output "show questions tagged 'graphical-output'") style ...
[Question] [ # Task Given the pre-order and post-order traversals of a full binary tree, return its in-order traversal. The traversals will be represented as two lists, both containing *n* distinct positive integers, each uniquely identifying a node. Your program may take these lists, and output the resulting in-or...
[Question] [ Write the shortest program that waits for every key of a [Standard 101 key US Keyboard](http://www.pcguide.com/ref/kb/layout/stdEnh101-c.html)\* to be pressed and then exits writing OK! Every time a key is pressed the program displays on a new line the remaining number of unpressed unique keys that nee...
[Question] [ This is code golf. The winner is the valid code with the smallest number of bytes. --- ## Challenge Given inputs ***M*** and ***N***, the width and height of a rectangular grid of squares, output a polygon that satisfies the following: * **The polygon edges are made up only of square edges:** there are...
[Question] [ This is a [tips](/questions/tagged/tips "show questions tagged 'tips'") question for golfing in [python](/questions/tagged/python "show questions tagged 'python'"). Suppose you have two lists of strings, and you want to concatenate the corresponding entries from each list. E.g. with `a=list("abcd")` an...
[Question] [ # Background Alice and Bob play a game called *construct a binary word*. To play the game, you fix a length `n >= 0`, a set `G` of length-`n` binary words called the *goal set*, and a length-`n` string `t` containing the letters `A` and `B`, called the *turn order*. The game lasts for `n` turns, and on...
[Question] [ ## Task Write a program that takes in a compound made solely of elements with an atomic number less than or equal to 92 (Uranium), and outputs the molar mass of the compound in `grams/mole`. ## Rules and Restrictions * You may not use a function that directly calculates molar masses for you. * Your pro...
[Question] [ My dog is barking at me, but I'm too lazy to take him for a walk. I have an idea! I'll get the people at Code Golf to do it for me! Your challenge is to simulate a dog's walk. Here are the rules for walking the dog: * The human (`H`) will start at `0,0` on a (Cartesian) coordinate plane, and will rando...
[Question] [ I heva this wierd text where vewols seem to be ratetod : > > I'm a badly written text. Some lunatic guy played with the order of vowels. Please fix me ! > > > So I'd need a pragrom which can rateto the vewols (and the 'y' letter as it seems) back so that the text is raadeble agian. Ouy can choeso t...
[Question] [ When I was a child I used to play a variation of [Snap](https://en.wikipedia.org/wiki/Snap_(card_game)) to stake soccer trading cards. "Game" is an overstatement because the only role of the players is to secretly prepare their starting piles. As the game starts there are no choices other than just p...
[Question] [ The game [shapez.io](https://shapez.io) has a *lot* of shapes. In [my previous challenge](https://codegolf.stackexchange.com/questions/233709/make-me-a-shape/233738#233738), the object was to generate a random code for a shape. Now, your challenge is to render a shape. # Specs ## Shapes Each shape has ...
[Question] [ [![A sample Facebook Meme](https://i.stack.imgur.com/FP8eh.jpg)](https://i.stack.imgur.com/FP8eh.jpg) ## Executive summary: Print NxN matrices \$A\$ and \$B\$ where \$ AB = 10A + B \$. Largest N wins! ## Details: Entrants in this challenge should choose an N. Submit a program that takes an input intege...
[Question] [ This challenge will have you count pseudo-[polyforms](https://en.wikipedia.org/wiki/Polyform) on the [snub square tiling](https://en.wikipedia.org/wiki/Snub_square_tiling). I think that this sequence does not yet exist on the [OEIS](https://oeis.org/), so this challenge exists to compute as many terms ...
[Question] [ 256-color Xterm-compatible terminals add 240 colors on top of the usual 16 system colors. Colors 16-231 use 6 levels (0, 95, 135, 175, 215, 255) of red, green, and blue, ordered lexicographically. Colors 232-255 are simply 24 levels of gray (8...238 by 10s). To get a better idea of what I'm talking abo...
[Question] [ The input will be two five letter words. They don't actually have to be dictionary words, just any five letters each, all lowercase or all uppercase, your choice. Only A-Z will appear in the input words and they will always be 5 characters in length. Your program is to score them both as though they we...
[Question] [ ## Introduction In this challenge, a 2×2 matrix is indexed like this: ``` 0 1 2 3 ``` We define a family of fractal-like patterns `F(L)`, where `L` is a length-`n` list of these indices and `F(L)` has size `2n-1 × 2n-1`. * If `L == []`, then `F(L)` is the 1×1 pattern `#`. * If `L != []`, then `F(L)` is...
[Question] [ The game of Sevens is played as follows: `n` players sit in a circle, and start counting up from 1, passing to the left (or from player `A` to player `B`). When a number `p` that has a `7` in it OR is divisible by `7` is reached, then the player who spoke the number `p-1`, after the next player says `p...
[Question] [ We are given a list of integers p1, ..., pk (not necessarily distinct) where each has a value between 1 and 9, inclusive. Using each of the p1, ..., pk exactly once, we can form concatenations of digits, to achieve a new list of numbers; we then output the product of this new list. The goal is to maxim...
[Question] [ Write a program that outputs the total number of characters and the frequency of each character in its source *and* its output. You must follow the format illustrated in the example. ## Example If your code was ``` abb1 ``` Its output would have to be ``` My source has 4 characters. 1 is "a" 2 are "b" ...
[Question] [ Post an answer to this question that evaluates any answer to this question and determines whether it wins. **Who wins:** * Winner is the answer that wins according to the most answers at 1700 UTC, Sunday, March 2nd. * You are welcome to and encouraged to change your own answer as the contest progresses...
[Question] [ ## The challenge Given a bagatelle board like the one below: ``` | | | /\ / | | \ /| | \ \ /\ \ | | \ / \ | |\ / / \ | | \ / \ | | \ | | \ / \ /\ \ | |\ / / \ /| | ...
[Question] [ An integer \$x\in[0,2^{32}-1]\$ divided by an integer \$d\in{[1,2^{31}]}\$ will produce an integral quotient \$q\$ and a remainder \$r\$, so that \$x=d\times q+r\$. Any \$q\$, in fact, can be calculated by the following formula. $$y=\left\lfloor\frac{mx}{2^{32}}\right\rfloor\\q=\left\lfloor\frac{y+f\lf...
[Question] [ Given a binary 3D array, for each layer, cyclically rotate up each of its columns as many steps as indicated by the binary encoding of the columns of the layer above it, and then cyclically rotate left each of its rows as many steps as indicated by the binary encoding of the rows of the layer below it....
[Question] [ Given a 7-segment display with some segments switched on and some off, find a sequence of digits (0-9), such that after toggling the corresponding segments for each digit, all segments are switched off. ## Example ``` _ _ [3] => | [1] => [OFF] _ | ``` Numbers and their c...
[Question] [ While similar to the other [water-carrying puzzle](https://codegolf.stackexchange.com/questions/100723/i-want-to-watch-you-die-of-thirst), the unique aspects of this challenge make it entirely different. [![Beth](https://i.stack.imgur.com/6jr2y.png)](https://i.stack.imgur.com/6jr2y.png) Beth is located...
[Question] [ You are a traveller crossing the desert between two towns. You cannot carry enough water to get across without stopping. [This is a variation of a classic puzzle.](http://dailybrainteaser.blogspot.co.uk/2012/10/cross-desert-logical-riddle.html) # The Rules A desert looks like this: a WxH grid of mostly...
[Question] [ The Halloween is upon us, and I haven't decorated my house yet, so I gonna need your help to do this task **Input** The input will be a list of 4 digits numbers, where each digit represent a portion of decoration: ``` EMBU |||| |||+-upper decoration ||+-bottom decoration |+-mouth/nose +-eyes ``` Eyes...
[Question] [ Welcome to your first day at PPCG Inc. As our newest junior assistant document sorter, you are responsible for making sure all documents we sent down to you are archived in alphabetical order. It's so easy a monkey can do it. Well, metaphorically speaking, as we did hire a monkey to do it. Guess what? ...
[Question] [ The challenge is simple: Determine the type of an input, and output an identifier telling what type it is. * "UI", Unsigned integer: `0`, `1`,`34`, `111111111111111111111111111111111111111111` * "SI", Signed integer: `+0`, `+1`, `+42`, `-1`, `-3`, `-111111111111111111111111111111111111111111` * "UD", ...
[Question] [ Given an input of a Spanish verb in its infinitive form, output the verb conjugated in all 6 forms of the indicative imperfect. To conjugate an infinitive in the imperfect, remove the infinitive ending (-ar, -er, -ir, and sometimes -ír) and add the imperfect endings listed below. There are three irregu...
[Question] [ # Background Due to some [unfortunate accident during coding](http://www.bestoldgames.net/img/ss/another-world/another-world-ss2.gif) you are now teleported and stranded on an alien planet. You really hope that the locals will be helpful and point to the general direction of how to get home, but before...
[Question] [ In *Dungeons & Dragons*, almost everything is decided by rolling a die. Typically, if the roll is greater than or equal to a specified value, your attempt at doing whatever you wanted to do succeeds, and fails otherwise. Most commonly, a 20-sided die (aka d20) is used to roll. Other times, the skill ch...
[Question] [ ## Introduction There comes a point in childhood when you think you've mastered adding and multiplying, then someone comes along and informs you that: a \* b + c = (a \* b) + c != a \* (b + c), and that it wasn't as simple or linear a process as you were earlier taught. You learn that there exists some...
[Question] [ ## Inspiration This question is inspired by the cards Throne Room and King's Court from the popular deck-building card game [Dominion](http://boardgamegeek.com/boardgame/36218/dominion). ![Throne Room](https://i.stack.imgur.com/F79Ao.jpg) ![King's Court](https://i.stack.imgur.com/EB47F.png) As part of...
[Question] [ The [Stern-Brocot tree](http://en.wikipedia.org/wiki/Stern%E2%80%93Brocot_tree) is a binary tree of fractions where each fraction is acquired by adding the numerators and denominators of the two fractions neighbouring it in the levels above. It is generated by starting with `0/1` and `1/0` as "endpoint...
[Question] [ Special thanks to [Bubbler](https://chat.stackexchange.com/transcript/message/53206244#53206244) and [AdmBorkBork](https://chat.stackexchange.com/transcript/message/53253206#53253206) for supplying feedback about this challenge **Keta** (**Ke**yboard **ta**cit — clever naming, I know!) is a golfing la...
[Question] [ I was browsing Stackoverflow and saw [this question](https://stackoverflow.com/questions/54947584/tile-a-mxn-rectangle-with-1x2-and-1x3-tiles-no-alignment) about tiling an MxN rectangle, and I thought it would be great for golfing. Here is the task. Given the dimension M and N, write a program that out...
[Question] [ Inspired by recent popularity of [nandgame](http://nandgame.com/) on TNB, and [my own previous challenge](https://codegolf.stackexchange.com/q/176371/78410). ## Background [Densely packed decimal (DPD)](https://en.wikipedia.org/wiki/Densely_packed_decimal) is a way to efficiently store decimal digits i...
[Question] [ This challenge is based on this [video](https://www.youtube.com/watch?v=LYKn0yUTIU4). I recommend that you watch it before trying this challenge. First we define a function. This function ([OEIS](http://oeis.org/A005589)) takes a integer n as input and outputs the number of letters in the English repre...
[Question] [ Text adventure games have a pretty set formula; there's a world composed of a series of rooms / spaces, the player can move around these rooms, and there are some items in the rooms. Items can be picked up by the player, put down, used to access other rooms (e.g. keys), and combined with other items to...
[Question] [ *Time for you to implement my new stack based language! It's called StackyMath. This will be a stack based language with 8 operations on the stack and ways to add numbers to the stack.* ### List of operations: * `/`: Division. Performed on the top 2 numbers of the stack. Pushes the result back on the s...
[Question] [ My first ever Programming Puzzles & Code Golf is the [Seven-Slash Display](https://codegolf.stackexchange.com/questions/51445/seven-slash-display/51447#51447). Here is my first Challenge, also based on 7-segment display. I often think about, besides numbers, what kind of letters I can display using a s...
[Question] [ Related: [Counting polystrips](https://codegolf.stackexchange.com/q/155983/78410) ## Background [Link-a-Pix](https://www.conceptispuzzles.com/index.aspx?uri=puzzle/link-a-pix) is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules: * Connect two ...
[Question] [ ## Background Information Inspired by [this answer](https://gaming.stackexchange.com/a/385114/189591) on Arqade SE Minecraft has rails which allow you to move minecarts around on them for transporting players, entities, and items. There are many types of rails, but today we're only interested in regula...
[Question] [ ## Challenge: **Input:** a string, consisting of only printable ASCII characters **Output:** a truthy/falsey value whether its characters are in alphabetical order (based on their UTF-8 unicode values), from any starting point inside the string including wrap-around by going left-to-right For example...
[Question] [ This challenge is based on [Project Euler problem 208](https://projecteuler.net/problem=208). Also related to my Math Stack Exchange question, [Non-self-intersecting "Robot Walks"](https://math.stackexchange.com/q/2767118/121988). You have a robot that moves in arcs which are \$1/n\$ of a circle, with ...
[Question] [ You will be given a sequence of memory requests and a cache size. You must return the least possible number of cache misses under any cache replacement strategy. An optimal strategy is [Belady's algorithm](https://en.wikipedia.org/wiki/Cache_replacement_policies#B%C3%A9l%C3%A1dy's_algorithm), which you...
[Question] [ [Stack Cats](https://github.com/m-ender/stackcats) is a reversible, stack-based language. Its reversible nature makes for somewhat weird loops. This challenge is about the conditional loop `(...)`. When these loops are nested in certain ways, it's possible to transform the code to reduce the nesting de...
[Question] [ ## Summary The goal of this challenge is to create an undone image-version of a [15-puzzle](https://en.wikipedia.org/wiki/15_puzzle) / [sliding puzzle](https://en.wikipedia.org/wiki/Sliding_puzzle) also called [taquin](http://www.wordreference.com/fren/taquin) in french. ## Details: Given an input comp...
[Question] [ Here are all the 2x2 binary matrices ``` #0 #1 #2 #3 #4 #5 #6 #7 #8 #9 #10 #11 #12 #13 #14 #15 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 00 00 00 00 01 01 01 01 10 10 10 10 11 11 11 11 00 01 10 11 00 01 10 11 00 01 10 11 00 01 10 11 ```...
[Question] [ ## Explanation [Befunge](https://esolangs.org/wiki/Befunge) is a two-dimensional program that uses [stacks](https://en.wikipedia.org/wiki/Stack_%28abstract_data_type%29). That means, to do 5 + 6, you write `56+`, meaning: ``` 56+ 5 push 5 into stack 6 push 6 into stack + pop the first two item...
[Question] [ # Background You have recently been hired by a small accounting firm. The world of accounting is somewhat foreign to you, so you're not sure whether you are following all the professional guidelines. In particular, you don't know when you should round all those numbers, and in which direction, so most ...
[Question] [ Write a program or function that takes in a positive integer N (via stdin/command line/function arg) and prints or returns a string representation of a two dimensional [random walk](http://en.wikipedia.org/wiki/Random_walk) that is N steps long, drawn out of slashes: `/` `\` (plus spaces and newlines f...
[Question] [ The game [Waving Hands](http://www.gamecabinet.com/rules/WavingHands.html) is somewhere between a pen-and-paper Magic: the Gathering and a very elaborate Rock Paper Scissors. Each turn you write down one of eight gestures for each hand: * wiggled `F`ingers * proffered `P`alm * `S`nap * `W`ave * `D`igit...
[Question] [ ## **Challenge:** Given two five-card hands, determine which one wins by the [standard ranking of poker hands](http://en.wikipedia.org/wiki/List_of_poker_hands). ## **Input:** Ten cards separated by spaces from stdin or as command line arguments, whichever you prefer. The first five cards are Player 1'...
[Question] [ Welcome to the piNapple bar, Melbourne. All of the finest code golfers are here, with their laptops, sampling cocktails and programming increasingly badly. I feel a special need to reemphasise the last point. Increasingly badly. Alcohol can do funny things to programming logic. So - a few of the Golfer...
[Question] [ Given the Cartesian coordinates of three points on a plane, find the equation of the circle through them all. The three points will not be on a straight line. Each line of input to your program will contain the `x` and `y` coordinates of three points, in the order `A(x),A(y),B(x),B(y),C(x),C(y)`. These...
[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/46/edit). Closed 10 months ago. [Improve this question](/posts/46/edit) From...
[Question] [ Do randomly generated drum loops sound good? A **drum loop** is a \$5\times 32\$ matrix \$A\$ of \$1\$s and \$0\$s such that 1. \$A\_{1,1}=A\_{1,17}=A\_{2,9}=A\_{2,25}=1\$, 2. for each \$i\$, the \$i\$th row has exactly \$f(i)\$ different \$1\$s, where \$ f(1)=3, f(2)=2, f(3)=6, f(4)=8, f(5)=5\$, 3. fo...