instruction
stringlengths
34
53.1k
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: [0..9] -> [[0,1,2],[3...
The Challenge Given an arbitrary amount of rectangles, output the total count of intersections of those when drawn in a 2D plane. An intersection here is defined as a point P which is crossed by two lines which are orthogonal to each other and are both not ending in P. Example Each rectangle here is denoted by a 2-tupl...
Everyone realizes that Tic Tac Toe 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, Numberphile has a nice video about this concept....
Write a program or function that listens for incoming TCP traffic on port N. It offers a simple service: it calculates sum of IP address fields of incoming connection and returns. Program or function reads integer N from arguments or stdin. It listens to incoming TCP connections on port N. When someone connects to that...
Some of you may have heard of the Wargame series of computer based real time strategy game. These games pit teams of players with primarily cold war era units to see how a hot cold war would have played out. The goal of this challenge is to simulate a tank battle in these games. Input Two "tanks" (one red and one bl...
Background Consider a round-robin tournament, in which each contestant plays one game against every other contestant. There are no draws, so every game has a winner and a loser. A contestant A is a king of the tournament, if for every other contestant B, either A beat B, or A beat another contestant C who in turn beat ...
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 year, especially for...
Create program or function that takes file name as an argument or reads it from standard input, and completes the following task: Read image from a png file (name given as argument). Reverse colors in that image, so that for example dark green (0, 75, 30) would become (255, 180, 225) (because 255-0=255, 255-75=180 and...
I recently saw this question on stackoverflow. It's a great question, but there's one fatal problem with the question. They are asking for the best way to do it. E.g, easiest to read, most idiomatic, neatest etc. Don't they know that isn't what matters? You're supposed to ask about how to do it with the fewest bytes of...
Alice and Bob are playing a little game. First, they draw a tree from a root node (indicated by a thick dot), with no internal nodes, with numbers at the leaves. Any node may have any number of children. We start at the root, and first to play is Alice (A). She must select one of the current node's children. Then it's...
Background You awake to find yourself lost in a one dimensional labyrinth! A mystical genie (or something) appears and explains that the exit lies in front of you, but that between you and the exit is a series of challenges. As you wander forward you realize that all of the so-called challenges are merely locked doors....
This is a little codegolf challenge from codingame.com. I was wondering how much Python3 code is necessary (but of course answers are not limited to Python3). Input The first line contains one positive integer n. The second line contains n positive integers. Each consecutive integers on the second line are separated by...
Your challenge is to passwordify the string! What is passwordifying, you ask? Take a string as input. This string will only contain uppercase letters, lowercase letters, digits, and spaces. You must replace all spaces with underscores and move all numbers to the end of the string in the order that they appear from lef...
If you don't know already, a quaternion is basically a 4-part number. For the purposes of this challenge, it has a real component and three imaginary components. The imaginary components are represented by the suffix i, j, k. For example, 1-2i+3j-4k is a quaternion with 1 being the real component and -2, 3, and -4 bein...
Explanation Befunge is a two-dimensional program that uses stacks. 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 items in the stack and add them up, and push the result into stack (to those of you who do not know stacks, "push" just means add ...
You are in a one-floor dungeon. There is a treasure which is protected by locked doors. Doors can be opened by finding the corresponding keys. Your goal is to find the shortest path to the treasure. Input Input will be a two-dimensional grid representing the initial layout of the dungeon. ########### #$ # g# # #...
Your job is to open a browser window of the default browser to http://codegolf.stackexchange.com. Your code must open the browser itself, and cannot rely on an open one. This is code-golf, so the shortest answer in bytes wins. Moderator note: A large number of answers to this challenge use the URLs http://ppcg.lol or...
You are an explorer, mapping an unknown world. Your ship is carried on the wind. Where it goes, who knows? Each day, in your spyglass, you see features to the north, south, east and west. You always see four such features, corresponding to the cardinal directions. Your spyglass reports ASCII symbols like this: ~~.*, ~...
As per Luke's request and Peter Taylor's addition to this challenge. Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row loses. An interesting fact is that the maximum amou...
The Challenge Everybody loves genetics, right? In this challenge, you will be given the genotypes of two parents. You must find each possible genotype of a child produced by the parents. You must account for dominant and recessive alleles as well as incomplete dominance and codominance. An example input for the parents...
Since I am INSANELY hyped for the Final Fantasy XV Uncovered event, I want you to write me a program to tell me when it is!!! The input Your take input in the form of HH:MM XDT, where HH is a number in the range 1-12, MM is a number between 0-60, and XDT is a time zone, with X being one of E (eastern, UTC-4), C (centra...
An arborally satisfied point set is a 2D set of points such that, for any axis-aligned rectangle that can be formed using two points in the set as opposite corners, that rectangle contains or touches at least one other point. Here is an equivalent definition from Wikipedia: A point set is said to be arborally satisfi...
Your Task: Print "Hello, World!" using a palindrome. Simple, right? Nope. You have one restriction: you may not use comments. "Comments" include Normal // or # comments Adding extraneous characters to a string literal Triple-quoted string comments Creating a string literal to hide characters You may not use a pre-de...
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", Unsigned decimal: 0.0, 1.23, 1234.1234 "SD...
This post would make more sense if it were Friday the 13th today... But oh well. Write a full program that, given any year as the input from at least -10,000 to 10,000, prints all dates of that year that are Friday and also on the 13th of the month. Output can be expressed as MM/dd, dd/MM, dd.MM, or any other readable ...
Write a program that accepts input (through stdin) as a string of unary numbers delimited by spaces, and prints the equivalent string of numbers in binary, decimal, and hexadecimal. These unary symbols are allowed: stroke, '/' or '\' Decimal 1 ASCII 'I' ASCII '-' Your program does not have to support all symbols, but...
"Hey Bob, I need a new acronym. Something better than 'Automated Support System'. I need you to fabricate me an acronym!" "Sure thing Joe! I'd love to fabricate an elaborate way to renovate, and not replicate something that you can tolerate." "Alright Bob, make sure it can separate itself from the old acronym we need t...
I'm new to this stackexchange, but I must say I am very impressed by the knowledge of some here, and the original codegolf answers for some questions. I'm not even sure if the following is possible, since my programming language knowledge is very limited, but it sounds like a pretty interesting challenge: Goal: Output ...
In this code-challenge you will write a hash function in 140 bytes1 or less of source code. The hash function must take an ASCII string as input, and return a 24-bit unsigned integer ([0, 224-1]) as output. Your hash function will be evaluated for every word in this large British English dictionary2. Your score is the ...
(Just open 50 tabs in Google Chrome :D (just kidding, no you can't)) Shortest code for infinite disk I/O any language, C# example: using System.IO; namespace FileApp { static class Program { public static void Main() { do { File.WriteAllText("a", "a"); File.Delet...
Inspired by this Numberphile entry Background The cube distance numbers of an integer n are defined here as the set of integers that are x³ distance away for a given x. For a simple example, with n=100 and x=2, the cube distance numbers are {92,108}. This can be extended into a larger set simply by varying x. With x ∈ ...
Write a program or function that takes an input greater than or equal to 2. It should output a truthy or falsy value corresponding to whether the input is a Lucas number or not. You may take input from STDIN, or whichever source is most suitable to you. This question is different to this one because this question is sp...
I have a new programming language called Brussels-Sprout. Brussels-Sprout functions in an array of 256 boolean values, all initialized to zero, has one instruction pointer, and one "bit index". After each (non-branching) instruction is executed, the instruction pointer is incremented by one. If the instruction pointer...
Introduction A code page maps integer values to a specific character. We can visualize a code page like this: +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+...
Given a string of letters and a set of words, output an ordering of the words so that they can be found in the string by dropping letters that are not needed. Words may occur more than once in the word set. The input string and all words will consist of 1 to 1000 lower case letters each. The letters to be dropped may o...
I have a counter. It's a small device that looks like this: The display goes from 0000 to 9999. It has a little push-button at the top that increases the count by 1, and a little knob at the right whose purpose is to reset the counter back to 0. Now, the thing about the little knob is that if you turn it backwards, y...
The code on this site is rapidly being depleted. We need to invest in renewable strings. So you must write a program that takes a string and converts it into a windmill. The Challenge Let's take a simple wind-mill string as an example. Take the string abc. The pivot is the center character, in this case b. Since the st...
Your job is to write a program that finds the optimal number of moves it takes to get from the lower-left corner of a rectangle to the upper-right corner directly opposite. Your program will accept input as an ordered pair (width, height). These will be the dimensions of the rectangle you will work with. Your program w...
The above image is called a hexa-glyph. Hexa-glyphs are some cool patterns I made up while doodling during my DiffEq class. Here's how you make one: Consider the following set of points, shaped like a regular hexagram. The inner hexagon is what will contain the final glyph, while the outer 6 points form a star and...
Wikipedia has several restrictions on an article's title. I summarize them here: It may not be empty. It may not begin with a lowercase letter. A character is considered lowercase if it has an Ll after its name in UnicodeData.txt. It may not contain any of the characters: # < > [ ] | { } _ It may not be . or .. It may...
The derivative of a function is a cornerstone of mathematics, engineering, physics, biology, chemistry, and a large number of other sciences as well. Today we're going to be calculating something only tangentially related: the arithmetic derivative. Definition The arithmetic derivative a(n) or n' is defined here (A0034...
Let's write the shortest code to perform a simplified variant of the DoD 5220.22-M Wipe Method with only two writing passes. Any programming language accepted, but the use of disk-wiping-oriented libraries is prohibited. Here's how we are to implement it in pseudocode: Set x to 0 [Start] 'Write Pass For each sector in...
This is essentially the same thing as this question, except harder. You are again to write a program that gets from the lower-left corner of a rectangle to the upper-right corner. However, this time diagonal moves are allowed. The program will accept an ordered pair (width, height), and use these as the dimensions for ...
Okay, I propose a shortest-key-logger challenge. As explained by the gentleman at "Are key-logger questions allowed?", strict rules have to be imposed in order to make this challenge valid for PPCG. The key-logger has to run on Windows, Linux or Mac OSX (any programming language is welcome). Upon execution, it has to ...
Inspired by this question 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 (any format, newline separated, 2d list etc.) Blank squares will be represented with a (space characte...
Introduction Let a field be a rectangle filled with only the characters - and [0-9]. An example of a field is: 11-011123 111-010-- 0010---01 111-01234 You see that this field has been separated into three smaller areas: To calculate the score of a smaller area, we just add all numbers up. For example: 11 111 0010 111...
This challenge is in honor of the Rookie of the Year category winners of Best of PPCG 2015: muddyfish (for I'm not the language you're looking for!) and quartata (for Implement a Truth-Machine). Congratulations! Background In the deepest trenches of the ocean, there lives a rare and elusive square-shaped fish called th...
The plus-minus sequence The plus-minus sequence is one that starts with two seeds, a(0) and b(0). Each iteration of this sequence is the addition and subtraction of the previous two members of the sequence. That is, a(N) = a(N-1) + b(N-1) and b(N) = a(N-1) - b(N-1). Objective Produce the plus-minus sequence, in infinit...
Write a program that will output its own source code when run, and nothing else. Seems easy, right? The catch is that when the source code is reversed, your program must output "Hello, World!" exactly, without the quotes. This is code-golf, so lowest byte count wins. Edit: Your quine must be a proper quine.
Moderator note: https://strawpoll.me has officially shut down, and the linked API no longer appears to work or provide data. Therefore, new answers cannot actually do the task and so the challenge has been closed to prevent any new answers. Strawpolls are great, and we use them in chat all the time for getting opinio...
I have a pile of clean socks that I want to sort into pairs. Unfortunately, I can only take socks from either end of the pile, not the middle. Further, I can only remove socks from the pile a matching pair at a time. My strategy is to first split the pile into one or more smaller piles. I think some examples will make ...
The input is a word of lowercase letters not separated by whitespace. A newline at the end is optional. The same word must be output in a modified version: For each character, double it the second time it appears in the original word, triple it the third time etc. Example input: bonobo Example output: bonoobbooo Stan...
This challenge is to write fast code that can perform a computationally difficult infinite sum. Input An n by n matrix P with integer entries that are smaller than 100 in absolute value. When testing I am happy to provide input to your code in any sensible format your code wants. The default will be one line per row of...
Introduction For the ones who don't know, a palindrome is when a string is equal to the string backwards (with exception to interpunction, spaces, etc.). An example of a palindrome is: abcdcba If you reverse this, you will end up with: abcdcba Which is the same. Therefore, we call this a palindrome. To palindromize t...
A nearly massless cat is dropped in space (don't worry, with a space suit and everything) at the point (x, y, z) with velocity (vx, vy, vz). There is an fixed, infinitely dense planet (with volume of 0) at the point (0, 0, 0) and it attracts objects at distance r with acceleration 1/r^2. According to Newtonian gravity,...
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.
A narcissist program is simple. It is related to a quine. If the input is equal to it's source code, it prints a truthy value, if not it prints a falsy one. That is it. Rules: It can't read it's own file. This is code-golf, so the shortest answer wins. Hash functions are not allowed. This trivializes it into just s...
What general tips do you have for golfing in Racket / Scheme? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Racket / Scheme (e.g. "remove comments" is not an answer). I'm aware Scheme and Racket (formerly PLT Scheme) are technically different language...
Write a program or function that takes in a multiline string of 0's and 1's. No other characters will be in the string and the string will always be rectangular (all lines will have same number of characters), with dimensions as small as 1×1, but otherwise the 0's and 1's may be arranged arbitrarily. You may assume the...
You must write a program or function that takes a string of brackets and outputs whether or not that string is fully matched. Your program should print a truthy or falsy value, and IO can be in any reasonable format. Rules and definitions: For the purpose of this challenge, a "bracket" is any of these characters: ()[]...
Intro Cookie Clicker is a popular browser game in which the player has to click a cookie to gain... Cookies! The player can buy upgrades which will automatically farm cookies for you. Sometimes a golden cookie will enter the screen, which will provide a bonus upon clicking it. Challenge This challenge will not be about...
A snakified string looks like this: T AnE eOf ifi ing h s x l A k e r isI amp Sna dSt Your Task Take a string s and a size n, then output the snakified string. The inputs ThisIsAnExampleOfaSnakifiedString and 3 would produce the example above. Specifications s will only contain ASCII characters between code points 33...
Your program must take an input (n for the purpose of description) and output all permutations of a number that is n digits long with no repeating digits, where each of the digits preceding and including its index are divisible by the place in the number that it falls. You can read about magic numbers here. Rules: 1 <...
Given a matrix, output a representation of the matrix where the top left element is on top, the anti-diagonal is the central row and the bottom right element is at the bottom. For example, consider the following matrix: 1 2 3 4 5 6 7 8 9 The diamond version of this matrix is: 1 4 2 7 5 3 8 6 9 Inputs and output...
Let's do an exercise together, shall we? Simply follow the movements of the stickman. What stickman you ask? The one we are about to create! Make a program that allows for a string-input only containing integers, and outputs the following nine stick-figures with an interval in between: @ \@/ |@_ _@| @/ \@ |@| \@\ /...
In this game two players compete to eat the most points worth of tokens, but there's a twist! Eating multiple tokens in a row of the same color gives an ever-growing bonus, but watch out, or your opponent will thwart your plans by eating the tokens you want before you can! Rules: 1 versus 1 n by n board (random size b...
Introduction A pointer array is an array L of nonzero integers where 0 ≤ L[i]+i < len(L) holds for all indices i (assuming 0-based indexing). We say that the index i points to the index L[i]+i. A pointer array is a loop if the indices form a single cycle of length len(L). Here are some examples: [1,2,-1,3] is not a po...
In this challenge you are supposed to fill a grid 10x10 with numbers from 1 to 100 (each number once) following this rules: Number 1 must be on the bottom row Number 100 must be on the upper row Two consecutive numbers must be one next to the other (diagonals doesn't count) The grid must be random It's not necessary ...
What you need to do is create a Boolean parser. Boolean expressions, in case you haven't heard of them yet, have two inputs and one output. There are four 'gates' in boolean arithmetic, namely OR (represented by |), AND (represented by &), NOT (which are used a bit like brackets : / and \ note, I could have used !, bu...
Given a string, find the first word starting with each letter (case insensitive). Sample Using Ferulas flourish in gorgeous gardens. as input: "Ferulas flourish in gorgeous gardens." ^^^^^^^ ^^ ^^^^^^^^ | | | | | --> is the first word starting with `g` | --> i...
Your task is to compute the greatest common divisor (GCD) of two given integers in as few bytes of code as possible. You may write a program or function, taking input and returning output via any of our accepted standard methods (including STDIN/STDOUT, function parameters/return values, command-line arguments, etc.). ...
In ValiDate ISO 8601 by RX, the challenge was to use only standard regular expressions to validate standard date formats and values (the former is a common job for RX, the latter was unusual). The winning answer used 778 bytes. This challenge is to beat that using any language of your choosing, but without special date...
A regular string looks like this: Hello,IAmAStringSnake! And a string snake looks something like this: Hel l rin o,IAmASt g S !ekan Your Task String snakes are dangerous, so you must make a program that takes a string snake as input and outputs it as a regular string. Specification...
Is the path correct ? Given a string, your program must determine whether or not Alice can reach Bob, following the signs on the map. You must return a truthy or falsy value. The input string will contain the following characters : (space) and \n. Only used for padding. >, <, ^, v, are the "signs". They show the dire...
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? Turns out monkeys...
The Challenge In this challenge you have to do two different (but related) tasks depending of the order of the input. Your program will recieve a string s and an integer n as input and will split s into pieces of length n if s comes first. The last element will be shorter if necessary. split s into n pieces of equal l...
One of my favorite algorithms was posted on Stack Overflow as an answer to What is the fastest way to generate prime number recursively?. In pseudocode: Nathan's algorithm bool isPrime(int n): if (n < 2) return false for p in 2..n-1: if (isPrime(p) && n%p == 0) return false return true This program...
Here is an image: %%%%%%%%%%%%% % Hello, % % world! % %%%%%%%%%%%%% But it is too confusing for our undersized brains to compute. So we average it like this: Split it into 2 x 2 sections. If the picture ends before a section is complete, imagine that there are spaces there. Average the values of the ASCII chara...
You must write a program or function that creates a "stair-ified" string. Here is how you "stair-ify" a string: For each character in the string: If the character is an upper or lowercase vowel, not including 'y', output it then move the rest of the string up a column. If the character is a space or a tab, output it ...
This is the cops' thread. The robbers' thread goes here. The last cops-and-robbers thread was already 4 months ago. The cop's task The cop's task is to write a program/function that takes a positive (or non-negative) integer and outputs/returns another integer. The cop must state it if the program is intolerant toward...
This is the robbers' thread. The cops' thread goes here. In the cops thread, the task was to write a program/function that takes a positive (or non-negative) integer and outputs/returns another number (not necessarily integer). The robbers task is to unscramble the code the cops used to produce this output. The cracked...
Challenge You are given an ASCII-art representation of characters on a plane as input by any reasonable method. This will only contain: [a-z] representing moveable characters. Every letter will appear on the board at most once. # representing immovable walls . representing empty space For example: abcdef.gh#.. .........
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 b c ABCDHIJ E####GK F# M #L # ...
This geometric spiral looks complicated, but it's fairly simple to draw; take the following box: Draw a straight line between the corner of the box and some set distance above the next corner counter-clockwise. Continue this pattern inward, always staying that set distance away from the corner of the next line. Here...
On modern game consoles and other devices without traditional keyboards, trying to input text is a nightmare. Having to type with a few buttons and a joystick on a virtual keyboard is annoying, and I like to make as few movements/button presses as possible. The keyboard you will be using looks like this: +---+---+---+-...
I want to write a function golf(C, A) that takes the height (C = 2*c) and the width (A = 2*a) of an oblate (left image) or prolate (right image) spheroid or a sphere as parameters and returns the volume V and the surface area S of the shape as tuple. The output must be rounded to two decimal places. All input and outp...
This question will be deleted soon, do not read/answer it Introduction Given one matrix A x A and a number of movements N. You will need to walk like a spiral starting in (1; 1): right while possible, then down while possible, then left while possible, then up while possible, repeat until got N. Challenge You can on...
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 constructed as follows. Let P be the pattern obta...
Challenge: You are given a base 10 number. For each base from 10 counting down to base 2: Take the original input number as a base 10 string, and remove any digits of the number which are invalid for the base. Interpret the resulting number string in the that base. If this gives 1 or 0, terminate the whole process. O...
Very interesting background Comcoins are a currency like any other. The residents of Multibaseania (an economically robust system of city-states with very few residents in a galaxy far, far away) use Comcoins to conduct transactions between themselves. Comcoins are represented by unique codes on special not-paper slips...
Given a list of digits 1 through 9, output whether each digit is grouped together as a single contiguous block. In other words, no two of the same digit are separated by different digits. It's OK if a digit doesn't appear at all. Fewest bytes wins. Input: A non-empty list of digits 1 through 9. This can be as a decimal...
The Challenge Convert a phrase of two words to reverse style: candy bar -> bar le candy. Specifications There will be one word (only a-zA-Z0-9 + -), a space (), and then another word. For equal length, score is used to determine winner. Test cases: candy bar -> bar le candy code golf -> golf le code programming puz...
Challenge: You are given a string containing only digits. Your task is to output the minimum number of primes which must be concatenated to form the string. If this is impossible, output 0. Test Cases: Input -> Output: 252 -> 3 235 -> 2 92 -> 0 31149 -> 2
This is a pretty simple challenge, but (I hope) a fun one. Task If right now either the month is 4 and the day is 20, the hour (on a 12 hour clock) is 4 and the minute is 20, or the minute is 4 and the second is 20, print this ascii art: . .:. :|: ...
What general tips do you have for golfing in dc? dc is a calculator utility for UNIX/Linux that predates the C language. I am interested in how to make my dc programs (calculations?) shorter. I'm looking for ideas that can be applied to general code-golf that are at least a little bit specific to dc (eg. removing comm...
Exposition Your mathematics teacher is a big fan of Vieta's formulas, and he believes that you should use them to solve quadratic equations. Given the equation ax^2 + bx + c = 0 the product of its roots is c/a, and their sum is -b/a. When all of a, b and c are nonzero integers, assuming the roots are rational numbers,...
Most languages come with a built-in to search a string for all occurrences of a given substring and replace those with another. I don't know of any language that generalises this concept to (not necessarily contiguous) subsequences. So that's your task in this challenge. The input will consist of three strings A, B and...
Challenge: Given a matrix (or 2d array) of 0s and 1s, output the number of steps it takes for Conway's game of life to reach a stable state, or -1 if it never reaches one. A stable state is a state in which no cells are turned on or off each step. The game must run in the given matrix, with the top and bottom connec...
Given 5 distinct points on a two-dimensional plane, determine the type of conic section formed by the points. The output shall be one of circle, hyperbola, ellipse, or parabola. Rules The points will be in general linear position, meaning that no three points are collinear, and thus the conic passing through them will...
The challenge is simple: Create a pie-chart based on a number of input values. The input will be a list of positive numbers, decimal or integers, and the output will be a pie-chart where each of the input values are represented by separate colors, and a percentage value outside each of the areas. Rules: The colors mus...