text
stringlengths
180
608k
[Question] [ Given the functions ``` L: (x, y) => (2x - y, y) R: (x, y) => (x, 2y - x) ``` and a number `N` generate a minimal sequence of function applications which take the initial pair `(0, 1)` to a pair which contains `N` (i.e. either `(x, N)` or `(N, y)`). Example: `N = 21`. The minimal sequence is of lengt...
[Question] [ I'm making a page selector for my super cool terminal-based blog program. In order for it to fit correctly into the design, it has to have some constraints. The page selector can only display a certain number of numbers at a time due to the constraints of the UI system. If there are more characters t...
[Question] [ In this challenge you will remove one of my least favorite features, operator precedence from traditional math notation, to acheive the syntax of one of my favorite languages, APL. The APL subset we will be working with includes only a few functions and single digit numbers. (No arrays!) ## Here is t...
[Question] [ [Gomoku](https://en.wikipedia.org/wiki/Gomoku) or *Five in a row* is a board game played by two players on a \$15 \times 15\$ grid with black and white stones. Whoever is able to place \$5\$ stones in a row (horizontal, vertical or diagonal) wins the game. ## Rules In this KoTH we'll play the Swap2 r...
[Question] [ Given two line segments, determine if the line segments intersect and if so, where. In the case that the two given line segments are co-linear and overlap, determine the midpoint of the overlapping segment. Lines will be specified in pairs of (x, y) coordinates. # Examples * [(-1, -1), (1, 1)], [(-1,...
[Question] [ # Introduction I have some ASCII cars that have velocity and direction. Their velocity is represented by their number. If a car is `<>` then it has stopped. For example: ``` <> 1> 2> 3> ``` After one second, I get ``` <> 1> 2> 3> ``` After two, I get ``` <> 1> 2> 3> ``` If two cars ...
[Question] [ This challenge is inspired by [this app](https://play.google.com/store/apps/details?id=com.andreasabbatini.logicgamestk). --- This is a much easier version of [this challenge](https://codegolf.stackexchange.com/q/128017/31516). This challenge is [code-golf](/questions/tagged/code-golf "show questions...
[Question] [ # PPCG hasn't had enough of quines already... ### Challenge: Your task is to create a program "A0". When this program is run with no input, it outputs nothing. When this program is run with input, it outputs "A1". When "A1" is run with no input, it outputs "A0". When "A1" is run with input, it output...
[Question] [ Your task will be to take a [balanced-string](/questions/tagged/balanced-string "show questions tagged 'balanced-string'") and a integer representing a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) (the number of characters that have to be inserted, deleted or changed to ...
[Question] [ A *pangram* is a string that contains every letter `a`-`z` of the English alphabet, case-insensitive. (It's OK if the pangram contains more than one copy of a letter, or if it contains non-letter characters in addition to the letters.) Write a program or function whose input is a list of strings, and...
[Question] [ Long time lurker first time poster here. Write a program which takes 3 inputs: X, Y and Z. * X = across (columns) * Y = down (rows) * Z = Location Marker The program should then print a visual grid X across and Y down. This grid will can be made of any character except "+". Each 'location' is given a...
[Question] [ ## Introduciton Some of you might have realised that I am a sloppy typer when using my phone. That's why I want you to write a program which corrects my typos. ## Chalkrnge Given a misspelled word, output all of the possible words which I meant to write. ## Typso The main cause of my typos is down to...
[Question] [ Your task is to write a RegEx that matches everything inside strings. A string is defined as everything surrounded by (but not including) two unescaped `"`. A `"` can be escaped by `\`, which can also be escaped again. # Testcases ``` string: ab\c"defg\\\"hi"jkl"mn\\\\"opqrst"" matches: ^^^^^^^...
[Question] [ # Interpret DOGO [DOGO](http://esolangs.org/wiki/DOGO) is a lesser known programming language. While the original DOGO (a joke language from a Usenet post) has never been implemented, a language resembling it has been created. The commands for the language are: ``` +===========+======================...
[Question] [ Everyone realizes that [Tic Tac Toe](http://playtictactoe.org/) is a solved game. However, the Misère version of only-Xs provides an interesting alternative. In this version of the game, both players play Xs onto the board and try to avoid making three in a row. If you'd like to see more about this, ...
[Question] [ In this challenge, you need to partition a list, where partitions have a max size, a min size, and a preferred size. I'll be using the notation `(min,pref,max)` to indicate the sizes in this challenge. For those unfamiliar with partitioning, the following list has been partitioned into parts of 3: ...
[Question] [ # Introduction **tl;dr** In this challenge you have to calculate the moon's phase for a given date. --- This challenge is inspired by the ~~game~~ *psycho social audiovisual experiment* "[Superbrothers: Sword & Sworcery EP](https://vimeo.com/20379529)". In *S:S&S EP* the moon's phases are important t...
[Question] [ [Newton's theory of gravitation](https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation#Modern_form) says that the gravitational force between two point masses is # F=(Gm1m2)/ r2 Where * *G* is the gravitational constant: 6.674×10−11 N · (m/kg)2 * *m1* is the mass of the first object...
[Question] [ ## Introduction When solving a rubiks cube, one often write down the times like this ``` 11.91, (11.28), (12.32) ``` This is called a average of 3, while a average of 5 looks like this ``` 13.36, (11.89), 12.31, (16.44), 12.26 ``` Note how the *worst* and *best* times have parenthesis around them. Wh...
[Question] [ The idea of this challenge is simple: create a bot to play the card game Euchre. For those of you who don't already know them, I've written out the rules to Euchre [here](https://drive.google.com/file/d/0B0S-KjeVoiwPeUdOV280QmZvWHc/view?usp=sharing) as they pertain to this challenge. I recommend usin...
[Question] [ Christmas is fast approaching and along with it, arranging the annual family Secret Santa. I'd like to try and get a head start on this, but making sure couples don't buy for each other keeps causing problems and despite doing this for years there's still the problem that `Bob` is pretty rubbish at b...
[Question] [ # Background [Slime molds](http://en.wikipedia.org/wiki/Slime_mold) are awesome. If you place them on a surface with food sources, they will spread their tendrils to find the food, after which they form a network of connections between the sources. In this challenge, you shall simulate a slime mold l...
[Question] [ I like Tetris a lot, but I'm not very good at it. Just once I'd like to see that spaceship take off in front of my own eyes! And since computers are oh-so great at everything, the only possible solution is to make a program to play it for me... except you're going to do that bit for me! Given a tetro...
[Question] [ This is not a Sudoku solver, nor a Sudoku checker. Your challenge is to write a function or script that, given as input the "block" size of a 2D Sudoku puzzle (which is 3 for the [classic 9x9 board](http://www.domo-sudoku.com/), 4 for a [16x16 board](http://www.domo-sudoku.com/evil-sudoku-16.php), et...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 6 years ag...
[Question] [ The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! # The Challenge Your challenge is to implement a program that will map some genes using cross-over frequencies, *in as many programming languages as possible*. You ...
[Question] [ Consider a NxN pixel grid with up to M objects drawn on it, either squares or diamonds: [![3x3 grid of black squares ("squares")](https://i.stack.imgur.com/stm2o.png)](https://i.stack.imgur.com/stm2o.png)square    [![3x3 grid with black squares forming a plus symbol ("diamonds")](https://i.stack.imgu...
[Question] [ Commentscript is a variant on Javascript that I made up for the purpose of this question. Only commented-out code is evaluated. Javascript has two types of comments: ``` // this is a single line comment, which starts with `//` and ends on a newline. /* This is a multiline comment. It starts with /* a...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 5 years ago. [Improve this que...
[Question] [ [<< Prev](https://codegolf.stackexchange.com/questions/149660/advent-challenge-1-help-santa-unlock-his-present-vault) [Next >>](https://codegolf.stackexchange.com/questions/149820/advent-challenge-3-time-to-remanufacture-the-presents) # Challenge Now that Santa has finally figured out how to get into...
[Question] [ A cruise control has 3 different options to move the handle to set the speed you want to drive with. * Towards you: Adds 1 speed. * Upwards: Increases speed to the next multiple of 10 (e.g. 20-->30, 32-->40) * Downwards: Decreases speed to the next multiple of 10 (e.g. 20-->10, 32-->30) **Input** * 2...
[Question] [ ## Background Back in the late 90's / first 00's when Flash Web Design was so much cool that noone could live without having a full Flash website, or at least an animated widget, I was hired to develop a "horse races viewer" in Flash/Actionscript, in the shape of an 80's videogame style animation, so...
[Question] [ # Intro In J. R. R. Tolkien's Lord of the Rings, this phrase is on the cover of each book. ``` Three Rings for the Elven-kings under the sky, Seven for the Dwarf-lords in their halls of stone, Nine for Mortal Men doomed to die, One for the Dark Lord on his dark throne In the Land of Mordor where the...
[Question] [ As if this challenge could be any more [Pythonesque](https://www.youtube.com/watch?v=uwAOc4g3K-g) in spirit... **No prior knowledge of Markov chains or encryption techniques is required.** You are a spy who needs to obtain some crucial information from the British security service M1S. The agents of ...
[Question] [ ## Background Your friend, a linguist, has recorded and analyzed some simple conversation snippets in various languages. Being quite absent-minded, they have forgotten which language each snippet was in. You must help them by creating a program that analyzes the sentence structures and rules out impo...
[Question] [ Write a program that takes one integer input *n* and one format letter and outputs *n* [autograms](http://en.wikipedia.org/wiki/Autogram) in the format `This sentence contains ? "A"s, ? "B"s ... and ? "Z"s.` * Each question mark `?` represents the number of times the the following letter appears in t...
[Question] [ Today, your task is to write a program (or a function) that accepts a string and outputs (or returns) four integers. **Input** The input string is a [CSS3 selector](http://dev.w3.org/csswg/selectors3/), and can contain basically any Unicode character. **Output** The output represents the CSS sp...
[Question] [ # The Setup Consider an oddly-shaped box containing 29 numbered cells as shown in Fig. 1 below. ![shubbles and smoles](https://i.stack.imgur.com/tCpUB.png) Inside this 2D box are two species of square-shaped animals: shubbles and smoles. Fig. 1 (a) shows some shubbles in blue, and some smoles in red....
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 7 years ag...
[Question] [ The goal of this challenge is to determine if a move is a legal [English Checkers](https://en.wikipedia.org/wiki/English_draughts#Rules) move. This challenge will use an 8x8 board. A moved piece should be treated as a man (not a king) that can only move diagonally forward. The board will have 0 or m...
[Question] [ ## Introduction [Braincopter](http://esolangs.org/wiki/Braincopter) is an esoteric Brainf\*\*\* derivative that encodes a Brainf\*\*\* program as an image. As a 2D language, it uses two additional commands; they rotate the instruction pointer (initially pointing right) clockwise and counterclockwise....
[Question] [ **This question already has answers here**: [Fairy chess "leaper" movement patterns](/questions/69014/fairy-chess-leaper-movement-patterns) (4 answers) Closed 7 years ago. Given an input of a pair of nonnegative integers describing a [leaper](https://en.wikipedia.org/wiki/Fairy_chess_piece#Lea...
[Question] [ A helicopter starting at the top left corner is descending (in a 2D space, for the purpose of this question) towards the ground. It has an autopilot mode and a manual mode. The autopilot mode behaves as follows: * If the space directly below is free, descend to it. * Otherwise move a step left or rig...
[Question] [ There are many [puzzles with matches](http://www.learning-tree.org.uk/stickpuzzles/stick_puzzles.htm) that involve adding, removing, or moving a certain number of matches to create new numbers or shapes. This is like that with a digital clock. Given a valid time on a 12-hour digital clock, output the...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 7 years ag...
[Question] [ Write a function or program that processes a block of text and returns the new text. Smallest valid program wins. Each line in the block of text will have the following format: ``` 12:34,56 ``` The first number is the line ID, the other two comma separated numbers are references to other lines. In th...
[Question] [ This challenge, if you accept it, is to write three functions or programs A, B, and C: * A is a quine that outputs all of A,B and C (which is also the whole content of the code in your submission). * B takes a parameter F and checks whether it is such a quine (outputting FBC), or doing something diff...
[Question] [ In [Bgil Midol's question](https://codegolf.stackexchange.com/q/242616/), the score of a sequence of slice is defined as > > sumof|startslices|∗2+sumof|endslices|∗2+sumof|stepslices|∗3 > > > Such scoring method makes multiple slices possibly take less score, e.g. * `[::25]` 75 * `[::5][::5]` 30 G...
[Question] [ This is based on a game one of my math teachers used to play in middle school. He would write 5 random one-digit numbers on the board, and then a random two-digit number. We would try to create an equation that used all 5 of the one-digit numbers to yield the two-digit number. Here are some examples ...
[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/210248/edit). Closed 3 years ago. [Improve this question](/posts/210248/edi...
[Question] [ 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...
[Question] [ A [radiation-hardened quine](https://en.wikipedia.org/wiki/Quine_(computing)#Radiation-hardened) can take a hit and stay standing, but nobody ever said that the quine can't be a *wuss* about it. For this challenge, you should write a quine that: * If no characters are removed, prints its source code ...
[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/175212/edit). Closed 5 years ago. [Improve this question]...
[Question] [ # Input: A maze containing the characters: * `--` (horizontal wall); * `|` (vertical wall); * `+` (connection); * (walking space); * `I` (entrance); * `U` (exit). I.e. an input could look like this: ``` +--+--+--+--+--+--+--+--+--+--+ I | | | + +--+--+--+ + + + +--+ ...
[Question] [ Simply put, your goal is to create a complete program that [modifies its own source code](https://en.wikipedia.org/wiki/Self-modifying_code) until every character of the source is different than what it started as. Please include the beginning source as well as the ending source in your post, as well...
[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/95742/edit). Closed 7 years ago. [Improve this question](/posts/95742/edit)...
[Question] [ Given N integers, output the sum of those integers. ## Input You may take the integers in any reasonable format, including: * `stdin` * arguments * an array or list ## Rules * Your code must not include the characters `+` or `-`. * [Standard loopholes](https://codegolf.meta.stackexchange.com/question...
[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/139736/edit). Closed 4 years ago. [Improve this question](/posts/139736/edi...
[Question] [ Create a program to display some approximation of a [bell curve](http://en.wikipedia.org/wiki/Gaussian_function). You are free to use whatever method you wish for generating the data, but the data must be displayed vertically, as in oriented like so: [![](https://i.stack.imgur.com/ENonU.png)](http://...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 7 years ago. [Improve this que...
[Question] [ A space cleaner is a special character which removes all spaces between it and the first non space character to its left and it is represented by a '!' character. If it reaches the beginning of the string it stops. Given a string output the string in any reasonable format after the cleaning process. ...
[Question] [ Write a program to find **a** number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number must also satisfy these divisibility requirements: 1. The number should be divisible by 9. 2. If the rightmost digit is removed, the remaining number should be divisible ...
[Question] [ The input is an array of (at least 3, maximum 20) different integers. Each integer is greater than -1000 and smaller than 1000. Your task is to shrink the numbers by "linearly mapping" them from `0.0` to `1.0`. This means the smallest number in the array will be mapped to 0.0, the largest to 1.0. You...
[Question] [ Write a program which takes a 3x3 matrix on stdin and prints its transpose along the anti-diagonal to stdout. You may assume that all elements of the matrix will be integers. Columns are space-separated and rows are newline-separated. ### Example Input: ``` 1 2 3 3 4 5 1 2 3 ``` Output: ``` 3 5 3 2 4...
[Question] [ *Alternatively: That one challenge I forgot I had in the sandbox and is about stuff from Discrete Mathematics I learned like 5-6 months ago and kinda don't remember* Given a path of vertices that form a cycle on a graph, output a simple version of the cycle. That is, if a vertex appears twice, snip o...
[Question] [ ## Problem John bought 5 apples. You are given the weights of every group of four apples, and must then find the weights of the apples themselves. For example, if all apples without the first one weigh 798 g, without the second - 794 g, without the third - 813 g, without the fourth - 806 g, and witho...
[Question] [ # Background: Here's a little simple challenge. You want to be able to find out whether the arrays inside an array have the same length. # Input: Your input should consist of exactly one array *(this is the value passed to the function, not a user input)*. Your function takes exactly 1 parameter. It ...
[Question] [ **Task:** Your task is to create two programs in different languages that can communicate one-way to each other. Your sending (tx) program will take input, for either stdin or a query, and send it along to the receiving (rx) program. Your rx program will then print out the data that it receives. **Ru...
[Question] [ [<< Prev](https://codegolf.stackexchange.com/questions/149861/advent-challenge-4-present-assembly-line) [Next >>](https://codegolf.stackexchange.com/questions/150028/advent-challenge-6-transport-dock-relabeling) Thanks to the PPCG community, Santa has managed to remanufacture all of his presents and ...
[Question] [ **This question already has answers here**: [Shortest power set implementation](/questions/9045/shortest-power-set-implementation) (47 answers) Closed 7 years ago. In almost every row nowadays, the people tends to order themselves as militaries would do. # Challenge Suppose `4` people where: *...
[Question] [ Write the shortest possible program or function that will join a list of columnar strings. For this challenge, columnar strings are defined as one-character-wide strings **spanning across multiple lines**. Each character, except for the last one, is **separated by a newline character**. Some examples...
[Question] [ Consider a `n x n` multiplication table and replace each item with its remainder of division by `n`. For example, here is a `6x6` table and its "modulo 6" structure: (The last column and row are ignored since both are null) ``` 1 2 3 4 5 6 | 1 2 3 4 5 2 4 6 8 10 12 | 2 4 0 2 4 3 ...
[Question] [ ## Task: Given sample index, x, calculate sample value f(x) of triangular wave, with period of 4 samples and amplitude 1. Offset can be negative and sample value could be either {0, 1, -1}. ## Test cases: ``` -5 -> -1 -4 -> 0 -3 -> 1 -2 -> 0 -1 -> -1 0 -> 0 1 -> 1 2 -> 0 ...
[Question] [ Your function must accept 2 [strings](https://codegolf.meta.stackexchange.com/questions/2214/whats-a-string/8964#8964) which are correct numbers. It needs to sum them up (without rounding and floating point errors) and return the result (which is also a correct number) without any leading zeros in th...
[Question] [ **SPECIFICATION** Given `m` variables, create every combination up to order `n`. For example, The output of mapping two variables (`a` and `b`) to order `1` would be: * a * b * a b The output of mapping two variables (`a` and `b`) to order `2` would be: * a * a2 * b * b2 * a b * a2 b * a b2 * a2 b2 ...
[Question] [ **This question already has answers here**: [Count the number of ones in an unsigned 16-bit integer](/questions/47870/count-the-number-of-ones-in-an-unsigned-16-bit-integer) (77 answers) Closed 7 years ago. **The Challenge** Given a non-empty string containing only lowercase or uppercase lette...
[Question] [ *This is the robbers' thread. The cops' thread is [here](https://codegolf.stackexchange.com/q/154741/61563).* Your challenge is to take an uncracked submission from the cops' thread and try to find the original unredacted program. Please comment on the cop's submission when you've cracked their code....
[Question] [ Literally! [April 6th is National Teflon Day](http://www.nationaldaycalendar.com/days-2/national-teflon-day-april-6/), which is celebrated with Teflon-coated pans (what we will be making). So, given a positive integer `n`, create a Teflon pan. The "pan" section of the pan is an octagon with each of i...
[Question] [ I'd like to see you create code (in any programming language) that output working BF (Brain\*\*\*k) code. Your program have a single character input on stdin. The input should be one digit ("0", "1", "2", "3", "4", "5", "6", "7", "8" or "9"). Your code should output BF-code that when interpreted with...
[Question] [ The [Len(language,encoding)](https://esolangs.org/wiki/Len(language,encoding)) family of languages is a variety of [Lenguage](https://esolangs.org/wiki/Lenguage) derivatives. To encode a program into a Len language, you replace every character with its representation in a certain encoding, then turn ...
[Question] [ **This question already has answers here**: [Find the prime factors](/questions/1979/find-the-prime-factors) (26 answers) Closed 10 years ago. A whole program to find the prime factors of a given number. The number will be given on standard input. [Answer] ## Bash Shell **6 Chars** `fac...
[Question] [ A port of my other question: [Double Prime Words](https://codegolf.stackexchange.com/questions/210733/double-prime-words) Consider a word/string of `n` alphanumeric characters with sum of the characters, `s`, using their numeric position in the alphabet (`a=1, B=2, c=3,` etc.) or numeric value (0,1, ...
[Question] [ [![This is the nepal flag.](https://i.stack.imgur.com/yT2lY.png)](https://i.stack.imgur.com/yT2lY.png) Above is the picture of the flag of the country Nepal. Pretty cool. What's cooler, is the aspect ratio, which is defined under the constitution as: [![Aspect ratio.](https://i.stack.imgur.com/eDvds....
[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/233405/edit). Closed 2 years ago. [Improve this question](/posts/233405/edi...
[Question] [ This question is similar to [Biggest Square in a grid](https://codegolf.stackexchange.com/questions/152305/biggest-square-in-a-grid). **Challenge** Given a matrix of `1` and `0` in a string format `"xxxx,xxxxx,xxxx,xx.."` or array format `["xxxx","xxxx","xxxx",...]`, You will create a function that d...
[Question] [ Given a list of scores (non-negative integers) pre-sorted from greatest to least: ``` [ 10, 10, 6, 6, 4, 0] ``` Assign each score an integer rank, beginning with 1 and ascending, such that equal scores have the same rank (i.e. they are tied): ``` [ 1, 1, 3, 3, 5, 6 ] ``` In the case of ties, ranks...
[Question] [ **Inputs** A list (array) of numbers, or numerical strings if that makes it easier. You can assume there will always be at least two elements in the list and every element will be a natural number (integer larger than zero). ### Outputs A single number, or again, a numerical string. ### Problem The i...
[Question] [ In March 25, 1821, Greece fought its great [war of independence](https://en.wikipedia.org/wiki/Greek_War_of_Independence). In order to honor this, your task is to print the Greek national anthem: ``` Σε γνωρίζω από την κόψη του σπαθιού την τρομερή. Σε γνωρίζω από την όψη που με βιά μετράει τη γη. Απ'...
[Question] [ Given 3 bytes or RGB as input, calculate the nearest CMYK values, and output them. * create either a function with parameters and return value or a program that operates on stdin/stdout * use the color profile of your choice, but provide a reference * input may be either separate numeric values in ra...
[Question] [ ## Background Imagine that I'm creating a really long necklace, consisting of only two characters, `A` and `B`. You must count the number of occurrences of the substring `AB` in the string. However, since it's a necklace, you must also consider if the last character and the first character join to ma...
[Question] [ > > Design a random number generator where the i th number has i% chance > of occurring for all 0 < i < 14. 0 should have exactly 9% chance of > occurring. The seed for the generator should be the system time. > You cannot use a pre-defined function for random number generation. > > > Basicall...
[Question] [ **This question already has answers here**: [Choosing Languages for Golfing [closed]](/questions/2070/choosing-languages-for-golfing) (6 answers) Closed 8 years ago. Which language usually produces shorter golfed code: Pyth, CJam or Golfscript? In asking this, I do not mean which has a prettie...
[Question] [ You are given a polynomial function, in the following format: \$x = (c\_0 \* y^0) + (c\_1 \* y^1) + (c\_2 \* y^2) + ... + (c\_n \* y^n)\$ where \$c\_n\$ stands for the coefficient of the \$n^{th}\$ power of \$y\$ You have to plot the equation on a \$10 \* 10\$ ASCII matrix. The value must be **floore...
[Question] [ 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...
[Question] [ The challenge is to write the shortest function/program to find a polynomial given the roots. The function or program should take valid input; that is, a list of integers representing the roots of the polynomial, and return valid output. Output should return a sequence of numbers representing the pol...
[Question] [ Given two points \$(x\_1, y\_1)\$ and \$(x\_2, y\_2)\$ with integer coordinates, calculate the number of integer points (excluding the given points) that lie on the straight line segment joining these two points. Use any [maths formula](https://math.stackexchange.com/questions/301890/how-many-points-...
[Question] [ As the [June 2021 Language of the Month](https://codegolf.meta.stackexchange.com/questions/22414/language-of-the-month-for-june-2021-red) is [Red](https://www.red-lang.org/), what are some general tips for golfing in Red language? Please suggest tips that are at least somewhat specific to Red (e.g. "...
[Question] [ ## Task A Rotate-Left-Double number in base \$n\$ is a number \$m\$, when its base-\$n\$ digits are rotated left once, equals \$2m\$. The base-\$n\$ representation of \$m\$ cannot have leading zeros. One example in base 7 is the number 480, or \$1254\_7\$. When rotated left once, the value becomes \$...
[Question] [ # The Rundown Given any input **x** and **y**, perform a complex operation, and print a corresponding result. # How your program should work 1. Given an input **x** and **y** in the form **z = x+yi**, find **zi-z** 2. If the absolute real value of **zi-z** is larger than the absolute imaginary part, ...
[Question] [ Coordinates in the flat-Earth world consist of latitude (x) and longitude (y), which are integers in the range 0...9999. Much like [Gaussian integers](https://en.wikipedia.org/wiki/Gaussian_integer), but they are always written using this notation: ``` 411S 370E ``` That is, with `S` or `N` appended ...