text
stringlengths
180
608k
[Question] [ [Boustrophedon](https://en.wikipedia.org/wiki/Boustrophedon) is a type of bi-directional text where successive lines alternate between reading left-to-right and right-to-left. Character direction was also mirrored with respect to reading direction. In reverse boustrophedon writing systems, characters w...
[Question] [ Related puzzle: Pathfinder (available on [Puzzle Picnic](http://puzzlepicnic.com)) ## Background A robot is standing on a cell of a rectangular grid, where each cell has one or more gems except for the one with the robot. The robot can move to a horizontally or vertically adjacent cell in one step, and...
[Question] [ Suppose we start with the infinite list of prime numbers: ``` [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ... ``` Then, we take the absolute differences between each pair of numbers, repeatedly: ``` [1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, ... [1, 0, 2,...
[Question] [ Year of 2010, an Icelandic Vulcano, concisely named [Eyjafjallajökull](https://en.wikipedia.org/wiki/File:Is-Eyjafjallaj%C3%B6kull_(3).oga) erupted, resulting in my long-planned flight being canceled. In case this ever happens again, I would really like to know in advance, so please help me build a sim...
[Question] [ I need to light some candles. In fact, I need to light an *arbitrary* amount of candles. But only the good ones. **OBJECTIVE** Given a block of text (containing lit, valid, and invalid candles) and a number `N` as input, write a program or function that lights an amount exactly equal to `N`, minus the...
[Question] [ You are a glob of slime. Naturally, being slime, you want to ooze over as much area as possible. But there are 3 other slimes who want to do the exact same thing. Who will be the superior slime? ## Description All slimes will be gathered into one arena. The judges (i.e. the control program) will go thr...
[Question] [ Matthew likes solving puzzles. Whenever he manages to solve one he skips around happily. Recently he really *needs* to do this as a meteor shower has opened craters and holes in the ground in which he wouldn't like to fall. You are given a part of landscape that Matthew wants to cross, hopefully ar...
[Question] [ ### Introduction From [Wikipedia](https://en.m.wikipedia.org/wiki/Tessellation): > > A **tessellation** of a flat surface is the tiling of a plane using one or more geometric shapes, called tiles, with no overlaps and no gaps. > > > A fairly well known tessellation is shown below: [![enter image d...
[Question] [ The [Laver tables](https://en.wikipedia.org/wiki/Laver_table) provide examples of programs which have not been shown to terminate in the standard axiomatic system of mathematics [ZFC](https://en.wikipedia.org/wiki/Zermelo%E2%80%93Fraenkel_set_theory) but which do terminate when one assumes very large c...
[Question] [ ### The Background Imagine the English alphabet written out in a row in capital letters -- `ABCDEFGHIJKLMNOPQRSTUVWXYZ`. Suppose we have a special variable-width lens such that, when placed over the row, it shows a certain "window" of the alphabet, with letters outside the lens hidden from view. Additi...
[Question] [ Write a program that a will play a game of Misère tic-tac-toe. That is, the goal is to force your opponent to take three in a row. Accept on standard input either an 'X' or an 'O'(the letter, not zero), to determine which side the program will be playing as. Then output a single digit for your move on ...
[Question] [ Getting hit in the knee with arrows seems to be the [injury of choice](http://www.youtube.com/watch?v=vncIBREXCwU) right now. As such, I propose the following golf challenge. You have an adventurer that looks like this: ``` O /|\ / | \ | | / \ / \ ``` Given a text file that contains one bow (...
[Question] [ Your task: generate a Koch snowflake to the nth depth. You do not need to make a complete Koch snowflake, just one side of the starting triangle. Wikipedia on Koch flakes: <https://en.wikipedia.org/wiki/Koch_snowflake>. **Rules:** * The program must generate one side of the Koch snowflake to the nth de...
[Question] [ This challenge is to write a **minimax function** in a language of your choice, to output the next best move in an **NxN** game of **tic-tac-toe** given the **current board state**. The board input can be accepted as a **Matrix, 2D Collection** or **anything else that makes sense to you, but adheres to...
[Question] [ I've always wanted to surround some text with `#`s, but I have trouble figuring out what I surrounded so in this challenge you'll be writing a program to do just that ## Examples Input / Outputs are separated by a newline. ``` ### #a# ### a ``` ``` # #a# # a ``` ``` ### # a # # b c # ####### a...
[Question] [ ## Introduction Suppose you and your friend are playing a game. Your friend thinks of some particular sequence of `n` bits, and your task is to deduce the sequence by asking them questions. However, the only type of question you're allowed to ask is "How long is the longest common subsequence of your s...
[Question] [ > > For any integer \$r\$, there exists a > power of 2 each of whose last \$r\$ digits > are either 1 or 2. > > > Given \$r\$, find the smallest \$x\$ such that \$2^x\bmod{10^r}\$ consists of only 1 or 2. For \$r=2\$, \$x=9\$, since \$2^9=5\color{blue}{\textrm{12}}\$ For \$r=3\$, \$x=89\$, since ...
[Question] [ We can write mathematical expressions using the standard math operators `(`,`)`,`+`,`*`,`/`,`-` available pretty much universally. We allow the symbols `a`, `b`, `c`, `d` and integers (e.g. `1`, `45`, etc.) but will restrict to just these four symbols. (Bonus points if you can handle more.) The goal is...
[Question] [ Assuming StackExchange doesn't decide to restore my account after deleting it due to age restrictions (even though I'm 14 already and almost 15 ಠ\_ಠ), a lot of people on this site just lost reputation from my upvotes being deleted. This happened at around 5:30 PM on June 20th, 2017, UTC. So, your chall...
[Question] [ In the ~~location-based AR mobile game~~ way of life [Ingress](https://www.ingress.com/) the player can hack things called portals in order to get items. (If you are interested in Ingress, you can ping me in chat for more info. Trust me, it's better than Pokémon. If you end up downloading it, remember ...
[Question] [ These are ASCII dandelions: ``` \|/ \ / | /|\ | \|/ | | | | _\|/_ | | | /|\ ``` ASCII dandelions have three parameters: Length of the stem (positive number between 1 and 256, number of seeds (positive number between 0 and 7)...
[Question] [ **Challenge** Ever seen those movie trailer titles (namely Martian, Interstellar, etc) where they have huge gaps in between letters slowly spreading out? The challenge is to recreate this effect given a string, gap multiplier and direction, by inserting appropriate amount of spaces in between the lett...
[Question] [ Y'know, we've had a lot of "alphabet" challenges recently. ([one](https://codegolf.stackexchange.com/questions/86986/print-a-tabula-recta) [two](https://codegolf.stackexchange.com/questions/87064/print-output-the-l-phabet) [three](https://codegolf.stackexchange.com/questions/87496/alphabet-triangle) [f...
[Question] [ **Important note**: Because this challenge only applies to square matrices, any time I use the term "matrix", it is assumed that I am referring to a square matrix. I am leaving off the "square" description for brevity's sake. ## Background Many matrix-related operations, such as computing the determina...
[Question] [ You will be given two pieces of input: a string in run-length encoded format defining the running track, and a capital letter representing the lane to start from. For example, the string "3a4A6b5B" expands to "aaaAAAAbbbbbbBBBBB". You then use the expanded string to create a track, as such: ``` A) aaa...
[Question] [ ## About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series [in the first post](https:/...
[Question] [ # Finding the Deadlock When programming a multithreading application one must take good care to avoid deadlocking the various threads when accessing shared resources. A [deadlock](http://en.wikipedia.org/wiki/Deadlock) occurs when a thread attempts to access a resource that's locked in another thread a...
[Question] [ On puzzling SE there are what are called ["matchstick problems"](https://puzzling.stackexchange.com/questions/tagged/matches) in which math is written in match sticks and you are allowed to move a certain number of them to get a certain property. In this question we will be considering only integers re...
[Question] [ You've been given a bag of Skittles. Everybody knows that in order to appreciate the different flavors the most, you need to rotate between the flavors. ## Basics: 1. You can only eat 1 skittle at a time 2. The order that you eat your skittles *must* be periodic. 3. Each period cannot contain a particu...
[Question] [ In a twist on finding a needle in a haystack, you need to find the largest contiguous haystack containing **exactly** **one** **needle**. Note that you cannot connect cells on diagonals, only left/right/up/down. ## Input An array (or a number of user input lines, your pick) of `'N'` (needles) and `'#'`...
[Question] [ This challenge is about writing code to solve the following problem. Given two strings A and B, your code should output the start and end indices of a substring of A with the following properties. * The substring of A should also match some substring of B with up to one substitution of a single charact...
[Question] [ # Let's have a tank war! Partially inspired by [Destroy Them With Lazers](https://codegolf.stackexchange.com/questions/28345/destroy-them-with-lazers) ## Objective Your task is to control a tank. Move around and shoot other tanks and obstacles in the 2D battlefield. The last tank standing will be the w...
[Question] [ From [Quine central](http://blog.sigfpe.com/2011/01/quine-central.html): Write a quine that takes as input the name of a language and outputs the same thing implemented in the input language. The source article has something you can work from, but as the author says this is much harder. Obviously you o...
[Question] [ The Rubik's Snake (or Rubik's Twist) is a toy consisting of several triangular prisms strung together in a line in such a way that the pieces can be rotated about one another in 90 degree turns. [![unfolded](https://i.stack.imgur.com/KQmL8s.png)](https://i.stack.imgur.com/KQmL8.png) [![triplepeaks](htt...
[Question] [ Your task is to implement a Tetris strategy balanced in terms of score vs code size. In this version of the game tetrominoes are rotated and dropped from above into a grid of 20 rows and 10 columns. While falling, they cannot be rotated or moved horizontally. As usual, a dropped piece stops when it rea...
[Question] [ (This might be quite classic but this is my first post here, so I'm not ready for the fancy stuff yet) The [Goodstein sequence](http://mathworld.wolfram.com/GoodsteinSequence.html) is defined for an input number as follows: *Pick a starting number **n**, let **b**=2 and repeat:* * *write **n** in herid...
[Question] [ I'm at position **(0, 0)** of an infinite two-dimensional city, which is perfectly divided into blocks centered at each lattice point, some of which contain buildings. A building at a certain point **(x, y)** takes up the entire square with opposite corners at **(x-.5, y-.5)** and **(x+.5, y+.5)**, inc...
[Question] [ # Challenge You will be making a program/function that takes a string input of length `n`, and: 1. Puts the `kth` char at the center of the space, where `k = (n+1)/2`. This will be the location of your ground zero. 2. Puts the rest of the non-whitespace chars randomly arranged around ground zero. The P...
[Question] [ Shocking news: Dr. Mad J Scientist has released a proof of P = NP to the world. But the proof is nonconstructive, and she's keeping the algorithm to herself. Worry not. Without even looking at her proof, we can still (almost) write a computer program that solves NP-complete problems in polynomial time....
[Question] [ In Dungeons & Dragons 5th edition (as well as most other editions), there exists a magic item called the [*Deck of Many Things*](http://www.5esrd.com/gamemastering/magic-items/wondrous-items/#Deck_of_Many_Things). It is an incredibly powerful item, as the cards all have very strong positive or negative...
[Question] [ Dropbox recently released [Lepton](https://blogs.dropbox.com/tech/2016/07/lepton-image-compression-saving-22-losslessly-from-images-at-15mbs/) ([GitHub](https://github.com/dropbox/lepton)), a method that **losslessly** compresses JPEG images round-trip, saving an average of 22%. ![](https://i.stack.img...
[Question] [ Polygons are named after the number of sides that they have. A pentagon has 5 sides, an octagon has 8 sides. But how are they named? What's the name for a 248-sided polygon? All polygons are suffixed with `-gon`. There are specific prefixes for each polygon depending on the number of sides. Here are th...
[Question] [ My teacher was more than unhappy with my [Martian Homework](https://codegolf.stackexchange.com/questions/101727/please-do-my-martian-homework). I followed all the rules, but she says that what I output was gibberish... when she first looked at it, she was highly suspicious. "All languages should follow...
[Question] [ Write a program or function that prints an input string around the discrete circle that has the minimum possible radius. For example, for input `This is an example`, your program should output: ``` a si n s i e h x T a m p le ``` ### Circle ...
[Question] [ I define four box styles: ``` +-----+ ooooooo ^^^^^ ******* | 1 | o 2 o < 3 > * 4 * | | o o < > * * +-----+ ooooooo vvvvv ******* ``` Write a program or function that given an integer and a string will find one of the above boxes inside the string and cha...
[Question] [ There's a type of *n*×*n* matrix *W* called the basic [Weyr canonical form](https://en.wikipedia.org/wiki/Weyr_canonical_form). Such a matrix is described by its [blocks](https://en.wikipedia.org/wiki/Block_matrix) and has the following properties, using the following reference diagram: [![enter image ...
[Question] [ A riffle shuffle is a type of shuffle where the deck is split into two partitions and the partitions are then spliced back together to create a new shuffled deck. The cards are spliced together in such a way that cards maintain their relative order *within the partition they are a member of*. For examp...
[Question] [ Today is Purim on which one custom is to give out triangle-shaped cookies with filling called *hamantaschen* (singular: *hamantasch*). Another custom is to drink heavily. I'm not the most perfect baker.... I have so many irregularly-sized hamantaschen to give out and so many friends to give them to! If...
[Question] [ This is a mini golf hole: ![](https://i.stack.imgur.com/EwORE.png) The outer boundary is a circle with radius 10 and center (0,0). The inner boundary is a circle with radius 3 and center (0,5). The tee is at (0,-8). Assume the ball is just a point with radius 0. The dynamics of the ball are governed by...
[Question] [ Your friend invited you to a high-stakes poker game at the last minute and, as a computer scientist, you've decided to use your skills to gain an edge on the game. Your task will be, given `2 cards` (your hand) and `0, 3, 4 or 5 cards` (the dealt cards), you must decide what the best possible hand you ...
[Question] [ **The challenge below requires you to be familiar with formal parser theory.** If you don't know what the question is asking because you don't know what the terms mean, context-free grammars and first/follow sets are covered in a lot of university courses. I can recommend [this Stanford course](http://...
[Question] [ Censors are a common tool used on the interwebs. But they often censor too much of the word, and thus make the cursing ambiguous to the reader. And sometimes they don't censor enough, so the words still remain offending. Your task is to fix that. ## Your task Write a program/function/whatever that take...
[Question] [ # Paper Folding for the win --- "How many times can you fold a paper?" - This well known question led to many arguments, competition, myths and theories. Well, the answer to that question depends on many properties of the paper (length, strength, thickness, etc...). In this challenge we will try to fol...
[Question] [ > > *This question is the first of several Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday! You can find more information about Brain-Flak's Birthday [here](https://hackmd.io/KwRgnARiAcCGAsBaaEBMAGR8DG8Cmis0AZsVhPLOtsWAOzQAmIQA?view)* > > > Last summer we had the [B...
[Question] [ # The Challenge You are the owner of an amazing service called *Coyote Beta*, which magically answers math questions its users send to it over the internet. But it turns out, bandwidth is expensive. You have two choices, either create a "*Coyote Beta* Pro" or find some way to solve this. Just recently,...
[Question] [ Key links: * [Troll question](https://codegolf.stackexchange.com/questions/230966/play-thud-troll-edition) * [Chat room](https://chat.stackexchange.com/rooms/127179/thud-challenge) * [Game](https://ajfaraday.github.io/Thud/dist/index.html) * [Controller Interface](https://github.com/AJFaraday/Thud/blob...
[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/22009/edit). Closed 7 years ago. [Improve this question](/posts/22009/edit) ...
[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/150870/edit). Closed 6 years ago. [Improve this question](/posts/150870/edit)...
[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/139824/edit). Closed 3 years ago. [Improve this question](/posts/139824/edit)...
[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/141213/edit). Closed 6 years ago. [Improve this question](/posts/141213/edit)...
[Question] [ # Introduction My gnome friends are writing a programming language and have asked for my help. Due to their size, the gnomes can only handle small superscript numbers instead of big numbers. However, the language they're writing the interpreter in only accepts big numbers! # Your Challenge Given an inp...
[Question] [ Based on this: [Make me a square!](https://codegolf.stackexchange.com/questions/120052/try-to-make-a-square) You need to output this: ``` #### # # # ### # # # # #### ``` Where "#" is replaced with the input. If you input "A", you should get ``` AAAA A A A AAA A A A A AAAA ``` If you input "&", ...
[Question] [ Your task is to input a sequence of integers and chunk sort it. You may assume the input list can always be chunked into groups of 1, 2, and 3. # Definition *Chunk sorting* (a term I made up for the purpose of this challenge) is the action of first chunking a sequence into groups of 1, 2, and 3 in a cy...
[Question] [ Ah, yet another of [my selfish uses of this Stack](https://codegolf.stackexchange.com/questions/115863/create-a-codeblock-tool). Being a Chromebook owner, I'm a frequent user of the Ace IDE, the editor used by Cloud9. It has lots of tools for dealing with excess whitespace, but it notably lacks one: cl...
[Question] [ [Related](https://codegolf.stackexchange.com/questions/126172/create-a-binary-ruler), [related](https://codegolf.stackexchange.com/questions/71833/how-even-is-a-number) # Introduction The [ruler sequence](https://oeis.org/A001511) is the sequence of the largest possible numbers \$a\_n\$ such that \$2^{...
[Question] [ ### Task Given two lists of characters, output their Cartesian product, i.e. the list of pairings of each letter from the first list with each letter from the second list. ### Example `"123456"` and `"abcd"` give: ``` [["1","a"],["1","b"],["1","c"],["1","d"],["2","a"],["2","b"],["2","c"],["2","d"],["3"...
[Question] [ Given a string containing decimal numbers: `teststring134this 123test string54 100` increment every number in this string by one to give the new string `teststring135this 124test string55 101`. The string can be provided as: * a command line argument * STDIN * a hard-coded variable or function argument...
[Question] [ **Challenge** Given an integer **n ≥ 4**, output a permutation of the integers **[0, n-1]** with the property that no two consecutive integers (integers with absolute difference 1) are next to each other. **Examples** * **4** → **[1, 3, 0, 2]** * **5** → **[0, 2, 4, 1, 3]** * **6** → **[0, 2, 4, 1, 3, ...
[Question] [ Output ``` # # # # # ##### ## # ## #### ####### # # ## #### ## ## # ### ####### # # # # ##### ### # # # # ### ##### ...
[Question] [ Write a program that, given any 'n' number of strings of 'm' length, returns 'm' number of 'n'-length strings, with this condition: **Every new string should contains the letters at the same index of the others strings** For example, the first output string must contain the first letter of all the inpu...
[Question] [ The [Jaccard index / similarity coefficient](https://en.wikipedia.org/wiki/Jaccard_index), also known as the Tanimoto index / coefficient, is a statistic used for gauging the similarity and diversity of finite sample sets. It was developed by Grove Karl Gilbert in 1884 for the field of weather forecast...
[Question] [ Given a string `s` and a non-negative number `n` less than the length of `s`, output the character at the `n`-th position of `s`. 0-indexing and 1-indexing are allowed. For 1-indexing, `n` will be positive and less than or equal to the length of `s`. `s` will consist of printable characters only. Any r...
[Question] [ # Intro: --- You accidentally corrupted the flow of time with a device you made for fun, that turned out to be a time machine. As a result, you got pushed to the far future. You realized that computing, processing power, and computers in general have been evolved by a huge amount, *an infinite amount t...
[Question] [ I'm surprised that this challenge isn't already here, as it's so obvious. (Or I'm surprised I couldn't find it and anybody will mark it as a duplicate.) ## Task Given a non-negative integer \$n\$, calculate the sum of the first \$n\$ primes and output it. ## Example #1 For \$n = 5\$, the first five pri...
[Question] [ Actually *not* inspired neither by [Atbash Self Palindromes](https://codegolf.stackexchange.com/questions/68757/atbash-self-palindromes) nor by [Generalized Gematria Calculator](https://codegolf.stackexchange.com/questions/41760/generalized-gematria-calculator). Given a string *s* of length *n*, output...
[Question] [ # Intro Two numbers are a *reversed multiple pair* if they satisfy the following property: $$ a\cdot b = \operatorname{reversed}( (a-1)\cdot b ) $$ Here, \$\operatorname{reversed}()\$ means to reverse the digits of a number (e. g `123` becomes `321`.) # Example $$ a=6,\quad b=9,\quad 6\cdot 9=54,\quad ...
[Question] [ In a now deleted stackoverflow question, someone posted the following: Write a program or function to print alternating patterns in `*` and `#` based on a given integer `n`. Some examples: Input: `n=1` Output: ``` * ``` Input `n=5` Output: ``` *#### ###** ***## ###** *#### ``` Input: `n=8` Output...
[Question] [ A positive integer \$x\$ is an \$n\$-perfect number if \$\sigma(x) = nx\$, where [\$\sigma(x)\$](https://en.wikipedia.org/wiki/Divisor_function) is the divisor sum function. For example, \$120\$ is a \$3\$-perfect number because its divisors sum to \$360\$: $$360 = 3\times120 = 1+2+3+4+5+6+8+10+12+15+2...
[Question] [ Provided that the input is a **monotone** sequence of three or more integers: * Output -2 if the sequence strictly decreases. Example: `[7,4,3,2]` * Output -1 if the sequence monotone decreases but is neither strict nor constant. Example: `[6,5,5]` * Output 0 if the sequence is constant. Example: `[0,0...
[Question] [ This is not the same as [m-ss-ng-lette-s](https://codegolf.stackexchange.com/questions/164809/m-ss-ng-lette-s) **Challenge:** Given a string with masked characters, generate all possible words, inclusive of non-meaningfull words. **Rules:** * The sequence of the characters in the string does not change...
[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 ago....
[Question] [ [This blog post](http://www.paulirish.com/2009/random-hex-color-code-snippets/) about generating random CSS color codes in JavaScript have multiple solutions for generating a random color in JavaScript. The shortest I can find is this: ``` '#'+(Math.random()*0xffffff).toString(16).slice(-6) ``` If you ...
[Question] [ A mad scientist has just created a new species of bacterium! He has decided to name it *Noblus Gentlemanus*, after observing its behaviour. However, his bacteria have ran out of food, and have declared war, as they are able to harvest other bacterium's corpses for enough food to create copies of themse...
[Question] [ Obviously, code golfing is all about making the most of the least code. Who really cares what the actual output is? While [we have had](https://codegolf.stackexchange.com/questions/13074/shortest-code-for-longest-output) a challenge for highest input-to-output *ratio*, this is a call for **most finite ...
[Question] [ Given two strings of digits, determine which string, if any, has the earliest digit which is lower than the other string's digit at the same index. Do note that this differs from alphabetization, as shown in the following examples: ### Examples Given inputs `12345000` and `1233999999`, the second strin...
[Question] [ Tonight is card game night! You are the dealer and your task is to write a program to deal the cards to the players. Given an array of cards and the number of players, you need to split the array of cards into a hand for each player. [![example for 4 players with a deck of 10 cards](https://i.stack.img...
[Question] [ Given `n=m^2`, return a list of integers that do not border the `m x m` grid of integers from `1 to n`. ## Examples ### n=1 (m=1) Grid: ``` [1] ``` Return: ``` [] ``` ### n=4 (m=2) Grid: ``` [1,2] [3,4] ``` Return: ``` [] ``` ### n=9 (m=3) Grid: ``` [1,2,3] [4,5,6] [7,8,9] ``` Return: ``` [5] ``` ### n...
[Question] [ Another easy challenge for you. ## Your task Write a program or function that takes the input, which contains 3 pairs of x- and y-coordinates and calculates the area of the triangle formed inside them. For those who can't remember how to calculate it, you can find it [here](https://en.wikipedia.org/wik...
[Question] [ You host the Olympic Games, and need to build a fantastic pool for the sake of the occasion, but the supervisors often change their mind regarding the dimensions, and need a quick way to rebuild it with the requested size! --- Given two integers, `L` and `x`, your task is to build a swimming pool of le...
[Question] [ [Pascal's triangle](https://en.wikipedia.org/wiki/Pascal%27s_triangle) is a triangular diagram where the values of two numbers added together produce the one below them. This is the start of it: ``` 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 ``` You can see that the outside is all 1s, and each number is t...
[Question] [ **Definition**: a *prime power* is a natural number that can be expressed in the form pn where p is a prime and n is a natural number. **Task**: Given a prime power pn > 1, return the prime p. **Testcases**: ``` input output 9 3 16 2 343 7 2687 2687 59049 3 ``` **Scoring**: This is [code-golf...
[Question] [ *Note: This is #3 in a series of [array-manipulation](/questions/tagged/array-manipulation "show questions tagged 'array-manipulation'") challenges. For the previous challenge, [click here](https://codegolf.stackexchange.com/questions/103973/an-array-of-challenges-2-separate-a-nested-array).* # Moving ...
[Question] [ Write a program or function that takes input and outputs/returns a full program (in the same language) that outputs said input. Note that the input may contain any printable ASCII character or newline (AKA 0x20-0x7f and 0x0a). However, the input will not have trailing whitespace nor preceding whitespac...
[Question] [ # Background I am currently in an AP Comp Sci A: Java class, and I want to start some of my friends on code golfing. I have a challenge from the course, and I would like to see how many bytes the community can do this challenge in. # Challenge details: Given two input strings, the main string and the ...
[Question] [ # The Problem You must write a program that, when the Konami Code is typed in during runtime, prints the string "`+30 lives`" and sounds a noise of your choice from the computer's speaker. ### Definition The "Konami Code" is defined as `UUDDLRLRBA` followed by pressing the enter key. ### The Rules * Yo...
[Question] [ # The Symbols vs. The Letters The [ASCII characters](http://www.asciitable.com/) have been divided once [again](https://codegolf.stackexchange.com/questions/35310/write-the-whole-of-the-holed-using-the-unholed)! Your sets are **The Letters** and **The Symbols**. ## The Letters ``` ABCDEFGHIJKLMNOPQRSTU...
[Question] [ The [Polygamma](https://en.wikipedia.org/wiki/Polygamma_function) function of order \$m\$, \$\psi^{(m)}(z)\$, is the \$(m + 1)\$th derivative of the logarithm of the [gamma](https://en.wikipedia.org/wiki/Gamma_function) function, which is also the \$m\$th derivative of the [digamma](https://en.wikipedi...
[Question] [ Fairly obviously, you have to print the Greek alphabet. But I thought I'd make it slightly more interesting, so there's a twist: when your program is ran with an argument (anything), it should output the Greek alphabet in lowercase. **Information** 1. Greek alphabet (Capitals): `ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨ...
[Question] [ Given a list of positive integers such as `[69, 420]`, your challenge is to generate the sequence of numbers that can be formed by concatenating numbers from the above set, in ascending numerical order. For example, with `[69, 420]` the sequence begins: ``` 69 420 6969 42069 69420 420420 ``` Note that ...
[Question] [ Three positive integers A, B, C are ABC-triple if they are coprime, with A < B and satisfying the relation : A + B = C Examples : * `1, 8, 9` is an ABC-triple since they are coprime, 1 < 8 and 1 + 8 = 9 * `6, 8, 14` is not because they are not coprime * `7, 5, 12` is not because 7 > 5 You can see this ...