instruction
stringlengths
34
53.1k
To simulate a zombie invasion, start with a grid of # and representing the map: ## ## ### # ## ## # ### # #### # represents land. represents water. The zombies start at a point on the map... ## ## ### # ## %# # ### # #### ...and spread. % denotes land infected by zombies. However, zombies cannot...
Typically, polyglots are constructed in such a manner that each language can ignore parts of the code that are present for other languages, by wrapping them in string literals, using comment syntax, or other similar tricks. Your goal is to write a polyglot where the output for each language is the code from the polyglo...
Generate me a QFP chip! From the sandbox! QFP is a type of form factor for an electrical component where pins come out the sides of a chip. Here are is a picture of a typical QFP component: you can see that the general formula is to have 4 sides of equal numbers of pins. Your challenge is to create a program that tak...
Write a program to draw a 2-D diagram of a knot based on the knot's structure. A knot is exactly what it sounds like: a loop of rope that's tied up. In mathematics, a knot diagram shows where a piece of rope crosses over or under itself to form the knot. Some example knot diagrams are shown below: There's a break in t...
What is the smallest possible runnable Mach-O executable on x86_64? The program can do nothing (not even returning a return code), but must be a valid executable (must run without errors). My try: GNU Assembler (null.s): .text .globl _main _main: retq Compilation & Linking: as -o null.o null.s ld -e _main -macosx...
Introduction: A Dutch BSN (BurgerServiceNummer) is valid when it complies to the following rules: It only contains digits. The length should be either 8 or 9 in length. When the digits are indexed as A through I, the result of the following sum: 9xA + 8xB + 7xC + 6xD + 5xE + 4xF + 3xG + 2xH + -1xI (NOTE the -1 instead...
Inspiration.* I cannot believe we have not had this challenge before: Task Given one or more printable ASCII strings, interleave them by taking one character from each string, cyclically until out of characters. If a string runs out of characters before the others, just skip that one from then on. Examples SIMPLE gives...
The problem is taken from this comic: http://www.smbc-comics.com/?id=2874 Your program must convert a number to the smallest base system in which it has the most fours in its digit sequence. Shortest code wins! Function entries are allowed provided that the function prints the base in which the number is fouriest as w...
As code-golfers, we're not used to releasing (surely). We're gonna need a few tools to help us do that. Of course, to help marketing a new release, we need a nice and shiny Release Version. Who doesn't get excited when they hear about version 3.0.0? Task Your task will be to write a program/routine/... to increment a v...
Make a fake loader just like this : Parameters : Display loading (space) one of these cyclically-\|/ (space) (percentage counter from 0-100) then a %. The percentage counter is supposed to increment by 1 every time the display changes. The time taken by counter to jump to next iteration is random. Any kind of ra...
You're given a non-empty list of positive integers, e.g. [6 2 9 7 2 6 5 3 3 4] You should rank these numbers by their value, but as is usual in leaderboards, if there is a tie then all the tied numbers get the same rank, and an appropriate number of ranks is skipped. The expected output for the above list would theref...
A ragged array is an array where each element is an array of unknown number of positive integers. For example, the following are ragged arrays: [[1,2,3],[4],[9,10]] Shape: 3,1,2 [[1],[2],[3]] Shape: 1,1,1 [[1,2,3,4,5,6,8]] Shape: 7 The following are not ragged arr...
The Task Write a program or function that, when passed a numerical input x, prints or returns the primes beneath the square root of x1 that are not factors of x. Examples Let f(x) be the function called: >>> f(4) [] >>> f(5) [2] >>> f(20) [3] >>> f(60) [7] >>> f(100) [3, 7] >>> f(10000) [3, 7, 11, 13, 17, 19, 23, ...
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 You may choose to use the up arrow...
Partition an n X n square into multiple non-congruent integer-sided rectangles. a(n) is the least possible difference between the largest and smallest area. ___________ | |S|_______| | | | L | | |_|_______| | | | | | |_____|___| |_|_________| (fig. I) The largest rectangle (L) has an area of 2 * 4 = 8, and ...
Introduction Let's define a new arithmetical operation, which I call zipper multiplication. To zipper multiply two nonnegative integers, you add leading zeros to make the lengths match, multiply the corresponding base-10 digits of the numbers, add leading zeros to the results to get 2-digit numbers, concatenate them, a...
Choose any five characters your language supports. There are 5! = 5×4×3×2×1 = 120 ways these can be arranged into a 5-character string that contains each character once; 120 permutations. Choose your characters such that, when each of the 120 strings is run in your language, the 120 outputs produced will be as many uni...
It's holiday season. A mall is empty except of air, money, and a very clever thief that is you. The mall consists of n floors. Each floor can be represented as a rectangular 2D grid. All floors have the same 2D dimensions. You are somewhere inside the building. Your job, as a hard-working thief, is to collect c coins a...
Given an integer n > 9, for each possible insertion between digits in that integer, insert an addition + and evaluate. Then, take the original number modulo those results. Output the sum total of these operations. An example with n = 47852: 47852 % (4785+2) = 4769 47852 % (478+52) = 152 47852 % (47+852) = 205 47852 %...
Background Summer is well over in the Northern Hemisphere, and a lot of us miss the sun, the beaches, the waves of the ocean... This challenge aims at cheering them up by reminding them of the sea. The challenge Here is the sea : ** ** ** ** ** ...
Introduction and credit Assume you're a bartender. You have many happy people in your bar at most times, but many only ever drink the very same drink and too few for your taste and you want to change that. So you introduce a system where the price of a drink is variable, depending on how many have already been sold, bu...
Kuznetsov's Sequence (I made the name up, don't bother with Wikipedia or Google) Given any number n > 0, let r represent the reverse of the number n. Iterate until the final result is zero, passing the result of each iteration back into the function using recursion or a methodology of your choice by performing the bel...
The 16-color CGA palette (also known as the HTML colors) is a set of 16 colors used by early graphics adapters. The goal of this challenge is to output all 16 of them, in hex format (RRGGBB), in ascending order by hex value, separated by newlines. Thus, the output should be exactly this: 000000 000080 0000FF 008000 008...
You are given a bunch of ASCII test-tubes, your task is to reduce number of test-tubes used. Each test tube looks like this: | | | | | | |~~| | | | | | | | | |__| Obviously, ~~ is the water level. Test-tube can be also empty, in which case there are no ~~ characters inside. Single tube can contain up to 8 water...
Your goal is to write some code that will output the shortest unique decimal sequence for the input fraction. No two fractions with the same denominator may have the same output, although it's possible for fractions with different denominators to have the same representation. Take 2 integers as input, the first is the ...
People on this site really love to embellish their post titles... Stewie's sequence: + * - / + * - / However, when this title needs to be included in the page URL, it is simplified: stewies-sequence The Challenge Your task is to create a program or function which, given a string representing a post title, outputs/re...
Make a code that takes a list and a number as input, and generates all possible combinations with the length of the number. For example, with the list {0,1} and the number 2: 00 01 10 11 Your program doesn't have to expect characters twice or more often in the list, such as {0,0,0,0,0,1,1,5,5} Make sure you print the ...
Given is any integer x > 0 and any base y > 3. Sum all digits of x (if written in the set base). Multiply this by the highest possible digit (is always base -1). Repeat until this value is (y - 1) ^ 2 Searched is the count of iterations and the steps. Example 1: x= 739 y= 7 searched: (7 - 1) ^ 2 = 36 based: (b7)2104...
Given two nonnegative integers n,k such that 0 <= k <= n, return the binomial coefficient c(n,k) := (n!) / (k! * (n-k)!) Test cases Most languages will probably have a built in function. c(n,0) = c(n,n) = 1 for all n c(n,1) = c(n,n-1) = n for all n c(5,3) = 10 c(13,5) = 1287 Related challenges Catalan Numbers Compu...
Based on THIS question. Given a string, replace each bracket ()[]{}<> with a bracket of the appropriate type so that the brackets match, and the nested brackets cycle as follows: Outermost ones are () Directly inside of () should be [] Directly inside of [] should be {} Directly inside of {} should be <> Directly in...
A secondary number is a positive integer whose prime factors (without multiplicity) are all less than or equal to its square root. 4 is a secondary number, because its only prime factor is 2, which equals its square root. However, 15 is not a secondary number, because it has 5 as a prime factor, which is larger than it...
In the decimal representation of every rational number p/q, you have a periodic tail, a non-periodic head, and a section before the decimal point in the following format: (before decimal point).(non-periodic)(periodic) Some examples include: 1/70 = 0.0142857... = (0).(0)(142857) 10/7 = 1.428571... = (1).()(428571) ...
Your task is to write a program that makes your screen appear to have a bad pixel. You should choose exactly one pixel on the screen, and exactly one channel between red, green and blue, and make its value either always 0 or always maximum (usually 255). The values of other channels should be the same as if your progra...
Concept Write a program that outputs code in its programming language. That code, when executed, must output the original program. Rules Since this is a cheating quine, you can read the original source code. First output program must be in the same language as the original program. You may not output a regular quine. ...
Using ASCII print a section of a hexagon ring tiling. Here's a small section: /\__/\ /_/ \_\ /\__/\ \__/ /\__/\ /_/ \_\/__\/_/ \_\ \ \__/ /\__/\ \__/ / \/__\/_/ \_\/__\/ /\__/\ \__/ /\__/\ /_/ \_\/__\/_/ \_\ \ \__/ /\__/\ \__/ / \/__\/_/ \_\/__\/ \ \__/ / \/__\/ Here's a larger...
Fermat's last theorem says that there there are no positive, integral solutions to the equation a^n + b^n = c^n for any n>2. This was proven to be true by Andrew Wiles in 1994. However, there are many "near misses" that almost satisfy the diophantine equation but miss it by one. Precisely, they are all the greater than...
Introduction In this challenge, you are given as input the ASCII representation of the net (unfolded surface) of a rectangular cuboid (3D box). The format is this: ....+--+....... ....|##|....... ....|##|....... ....|##|....... +---+--+---+--+ |###|##|###|##| +---+--+---+--+ ....|##|....... ....|##|....... ....|##|.......
Challenge Given a tic-tac-toe board in any format, determine if it is valid or not. If a board can be the result of a tic-tac-toe game, then it is valid. For example, this board is valid:X O X O X O X O XOn the contrary, this board is invalid: X X X X X O O O O Input A full (9/9) tic tac toe board (the outcome, not th...
Introduction Bob likes to have different passwords for each website he uses. He wants passwords in a special format so that he can remember. Help him by building a password generator which is as short as possible in code length, because he likes keeping stuff short just like his name. Challenge Build Bob a password gen...
The Cornu Spiral can be calculated using Feynman's method for path integrals of light propagation. We will approximate this integral using the following discretisation. Consider a mirror as in this image, where S is the light source and P the point where we collect light. We assume the light bounces in a straight ray f...
Create a script that, when run from a console, will display the text already in the console, prior to running. Challenge How will the winner of the challenge will be determined? The golf with the shortest length (in bytes) will win. Example Input and Output Input: (Shown is Windows) Microsoft Windows [Version 10....
This question was profoundly inspired by Joe Z's question. But, with a twist... So, now that it's almost 2017, it's time for a code question involving the number 2017. Your task is to make a program that counts up from 0, printing each number until it reaches 2017. without using any of the characters 012345678 or 9 in...
... Not that you would, would you? The task is simple, output the following text: ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ________ ||` |||1 |||2 |||3 |||4 |||5 |||6 |||7 |||8 |||9 |||0 |||- |||= |||BS || ||__|||__|||__|||__|||__|||__|||__|||__|||__|||__|||__|||__|||__|||______|| |/__\|/__\...
Roll cakes are delicious sweets made with a layer of sponge cake, a layer of cream (or icecream), rolled as a spiral, see Wikipedia. Your task is to get a non-empty phrase string from standard input, strip the spaces out, and roll it as a roll cake starting from the center in right to left in a counterclockwise directi...
Your program has to take a multi-lined string, like this: ############# # # # p # # # ############# p is the player and # is a block. Now under that in the terminal should be an input line saying: How do you want to move? If the player types l he has to walk left when there isn't a block...
Today, we'll be generating a map for a roguelike RPG! Example Map: ########## #### F# #### ## ## C#C# # ## # # C #E # #### # # # # #P # ########## # are walls, P is the player's starting location, F is the finish that must be reached, C are coins that can be collected, and E are enemies t...
Scenario One of your friends is struggling on a homework assignment. He needs a simple program which prints the first 404 natural numbers: 1 2 3 4 5 6 7 8 9 10 11 ... 401 402 403 404 Your challenge is simple: write this program for him. However, your connection is terrible, so 1 random character is lost every time you...
A straight-chain alk*ne is defined as a sequence of carbon atoms connected by single (alkane), double (alkene), or triple bonds (alkyne), (implicit hydrogens are used.) Carbon atoms can only form 4 bonds, so no carbon atom may be forced to have more than four bonds. A straight-chain alk*ne can be represented as a list ...
Scenario I often cook lasagne, but I also have a few mistakes. Since I repeat these faults so often, I thought I maybe could do a program that checks if I did everything right. Valid lasagne A valid lasagne is At least 5 columns wide At least 4 layers high Excluding extra cheese The top layer is cheese (represented...
I'm a time traveler, and I'm obsessed with the passage of time. I particularly love the moments when the clock hands pass 12, or when I get to flip to the next page of my calendar, or when everyone yells "Happy New Year!" Please write for me a program to show me how far I am from the last such moment to the next, in th...
The year 2013 had an interesting property: the digits are consecutive when sorted (0123). Let's call this type of number a sortable number: a non-negative integer whose base-10 digits are consecutive after sorting. Unfortunately, this won't happen again until 2031, and after that, not until 2103. Your challenge is to w...
For the purpose of this challenge, we'll define whitespace as only linefeeds (0x0A) and spaces (0x20). Note that most languages and regex flavours consider many other characters as whitespace as well, both inside and outside the ASCII range so you might not be able to make use of the corresponding built-ins. The Cops' ...
This is part of a Cops and Robbers challenge. Go here for the cops' part. For the purpose of this challenge, we'll define whitespace as only linefeeds (0x0A) and spaces (0x20). Note that most languages and regex flavours consider many other characters as whitespace as well, both inside and outside the ASCII range so yo...
Create a program that can create a randomly arranged maze (The path of the maze changes each time) with exactly 1 exit and one enterance and a minimum size of 8x4 and max size of 32x32, with the exact dimensions x and y as input Submissions can be original code, but to score higher add onto a submission with another la...
Note: As per consensus on Meta, challenge-writing questions are on topic here. In light of this "thing to avoid when writing challenges", I started to think about challenges involving random generation of certain kinds of objects. It sometimes happens that I want to post a code-golf challenge that involves randomly g...
(with apologies to Jim West for the title, and randomly inspired by Cisco's textual representation of their logo: .:|:.:|:. for the concept) Given an input integer 1 <= n <= 255, output an ASCII art representation of a suspension bridge of distance n following the below construction rules: The start and end of the bri...
A program is "conveniently palindromic" if it is equal to the string derived when its reverse has all its parentheses (()), brackets ([]), and braces ({}) flipped. No other characters are special and require flipping. (<> are sometimes paired but often not so they are left out.) copied from this challenge. Write a co...
McCarthy's 1959 LISP In early 1959, John McCarthy wrote a groundbreaking paper defining just nine primitive functions that when put together still form the basis for all LISP-like languages today. The paper is available digitized here: http://www-formal.stanford.edu/jmc/recursive.pdf Your job is to fully implement a p...
Introduction Let's observe the following string: AABBCCDDEFFGG You can see that every letter has been duplicated, except for the letter E. That means that the letter E has been de-duplicated. So, the only thing we need to do here is to reverse that process, which gives us the following un-de-duplicated string: AABBCCD...
Your task is to write a full program that will continue to count down from 10 every time it is run. The first time you run the program, it should print 10. The next time, it should output 9. The next time, it should output 8, and so on. Instead of printing 0, the program should crash. You do not have to handle the pro...
Introduction Consider two non-empty integer arrays, say A = [0 3 2 2 8 4] and B = [7 8 7 2]. To perform alignment addition on them, we do the following: Repeat each array enough times to have total length \$\text{lcm(length(A), length(B))}\$. Here \$\text{lcm}\$ stands for lowest common multiple. A -> [0 3 2 2 8 4][...
Because of this, families from all over the world are building Christmas trees. But this normal tree can get boring after a while, so let's make an ASCII tree! Leafs are represented by # and must be arranged as shown in the example output. We have 5 balls (O) and 5 candy canes (J), which we place randomly around the tr...
Help PPCG Claus Deliver his Presents Overview PPCG Claus is running hella late delivering his gifts because nowadays we have so many odd little kiddos out there. This makes it much harder for PPCG Claus to get all the presents to the correct place. Your challenge is to help him delvier his presents correctly. The Compl...
Challenge: Read input (within visible ASCII range) and output with a few modifications: In each set of 10 characters of the input randomly (50/50): replace one character* (with a random** one within visible ASCII range) (ex. lumberjack becomes lumbeZjack) or remove one character (ex. lumberjack becomes lmberjack) ...
Challenge: Given a string s on the characters a-z, A-Z, 0-9, append the length of s to itself, counting the additional character(s) in the length as part of the total length of s. Input: Just a string of arbitrary length (can be empty). Output: The same string, but with its length appended to the end. The characters t...
Inspired by the upcoming winter bash event Objective Add a hat ^,´ or ` to a single vowel in each word of the input. Rules The hat and the vowel must be chosen at random. Each hat has to appear with the same probability (33%) and the vowels must have the same probability within the valid vowels in the word (if the wo...
Your task is to print the hexidecimal times table: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 00 02 04 06 08 0a 0c 0e 10 12 14 16 18 1a 1c 1e 00 03 06 09 0c 0f 12 15 18 1b 1e 21 24 27 2a 2d 00 04 08 0c 10 14 18 1c 20 24 28 2c 30 34 38 3c 00 05 0a 0f 14 19 1e 23 ...
Read this if you're confused. Challenge: The goal of this code-golf is based around the number 8675309... Your goal is to print out every prime number from 2 to 8675309, starting with the number 2 and then skipping 8 prime numbers, then skipping 6, then skipping 7, etc. In essence, skip a number of primes determined by...
Challenge Create a program that will build a recursive list of all linked webpages (given a starting point), to a depth determined by user input. Any valid link in the HTML should be crawled, whether or not it is a script, image, etc. Example Input <program name> <url to crawl> <depth> webcrawler http://crawlthissite.c...
Given a string as argument, output the length of the longest(s) non-overlapping repeated substring(s) or zero if there is no such string. You can assume the input string is not empty. Examples abcdefabc : the substring abc is repeated at positions 1 and 7, so the program should output 3 abcabcabcabcab : abcabc or bcabc...
Prelude: I wanted to train making test cases, so I'm gonna try them on something easy. Challenge: Take any given (string) input (within visible ASCII range) and deduce if it's a number and output something that could be used to evaluate. Rules: A number will only contain the characters -0123456789,. Answers are only r...
Prelude: This challenge is different from "another cat program". There's literal tons of different twists, why can't I have my own, people? Unique things: It isn't reading direct input to output. It is manipulating the string in a way that for sure isn't a straight-up cat. Challenge: Given 3 inputs (or one input, s...
Keeping with a festive theme, print a carol singing angel with the shortest possible code. The angel is raising money for the homeless, so must be able to sing all three of the below songs available at request. To illustrate she can sing them, the title of the song must be placed within the speech bubble. This song tit...
Given a nonempty list of nonempty rows of numbers, compute the column wise sum, which is another list that has the length of the longest input row. The first entry of the output list is the sum of all the first entires of the input rows, the second one is the sum of all the second elements (if available) etc. I think f...
ISO Paper Sizes Defined: The A series paper sizes are defined by the following requirements: The length divided by the width is the square root of 2. The A0 size has an area of 1 unit. Each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides. Task: given an input f[n] output A0 divided...
Inspired by A014486. Challenge Given an integer input in base 10, construct a representation for the binary forest corresponding to the input. Representations include, but are not limited to, nested arrays and strings. How? Convert the input to binary. 1s represent branches, and 0s represent leaves. To make this easier...
Challenge description A "derangement" of a sequence is a permutation where no element appears in its original position. For example ECABD is a derangement of ABCDE, but CBEDA is not: ABCDE | | <- B and D are in their orignal positions CBEDA Given a sequence, generate a random derangement of it. Notes You may take ...
Alternating Arrays An alternating array is a list of any length in which two (not necessarily different) values are alternating. That is to say, all even-indexed items are equal, and all odd-indexed items are equal. Your task is to write a program or function which, when given a list of positive integers, outputs/retur...
Similar to this question, but this is a crossword variation! Instead of only one letter per grid square, you can have one or two. Input: A 2d array, or whatever works in your language. You can assume valid inputs Any array size must work Output: An array of all the words Across and down All words must be joined to...
The problem Given a binary number from 0 to 111111 convert it to trinary. (Base 3). Then print the result. Rules No using a list of conversions. Don't cheat You must use a string as the number No compressing the input string As I will be testing the code with several different numbers I can't use compressed strings Not...
This is much like my earlier challenge, except, this time, order doesn't matter. A straight-chain alk*ne is defined as a sequence of carbon atoms connected by single (alkane), double (alkene), or triple bonds (alkyne), (implicit hydrogens are used.) Carbon atoms can only form 4 bonds, so no carbon atom may be forced to...
I suddenly really want to play tennis, but alas I do not have a court! Surprise! This is where you come in. You have to print a tennis court for me, but you have to do it in the fewest bytes possible because of confidential reasons. Tennis court --------- | | --------- | | | xxxxxxxxx | | | --------- | ...
Almost equivalent to Project Euler's first question: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. Challenge: Given a positive integer N and a set of at least one positive inte...
Main task Your task is to print out integers in descending order, starting from 1, and increasing as you keep hitting 1 again, up until the given input is reached, then, print out the rest until you hit 1 again. Example with input 6: 1 21 321 4321 54321 654321 Without newlines (valid output): 121321432154321654321 Sid...
Introduction I found a really interesting puzzle it was called Busy Brain Beaver. But it has been 3 years since the latest activity and there are some things I didn't like about it. So I decided to make a new one. The Rules I want this one to be more brainfuck focused: Your goal is to make a brainfuck program that out...
A prime knot is: a non-trivial knot which cannot be written as the knot sum of two non-trivial knots. Explanation of a knot-sum: put the two knots adjacent, ... then draw two lines between them, to the same strand on each side, and remove the part between the lines you just drew. This composition of two knots will f...
Input: A non-empty sequence of integers greater than zero, the length of which is greater than 1. Output: The largest product of all elements of the longest subsequence between the minimum and maximum elements of sequence including themselves. Note: Because the minimum and maximum elements can be repeated, then to a de...
Ultrafactorials The ultrafactorials are a sequence of numbers which can be generated using the following function: $$a(n) = n! ^ {n!}$$ The resulting values rise extremely quickly. Side note: This is entry A046882 in the OEIS. Also related are the hyperfactorials, a still quite huge, but a bit smaller sequence: A002109...
Some of your employees have broken capslock keys and you're too cheap to replace them. Help them out by creating the shortest program possible to correct their work! Simply convert each character in a given string from uppercase to lowercase and vice-versa... but there's a twist! You're also very excited for Christmas!...
Many formulas in math involve nested radicals (square root signs inside other square roots signs). Your task here is to draw these using ascii art. Specs You will be given two integers, the number inside the radical, and the number of radicals. I think the best way to explain what you have to do is with an example. Her...
​Your task is to write a program or function that outputs the first character of its source code, then the second, then the third... each time it is run. For example, if your program was foo in language bar in file baz.bar, then you should get output similar to this: λ bar baz.bar f λ bar baz.bar o λ bar baz.bar o You...
Find the nearest Date to a TargetDate for a given Day of Week. For example, given a date of 20161219 and a day of week of Friday (6), the answer is 20161216. Another example, given a date of 20161219 and a day of week of Wednesday (4), the answer is 20161221. A final example, given a date of 20161219 and a day of week ...
Given a number N, output the sign of N: If N is positive, output 1 If N is negative, output -1 If N is 0, output 0 N will be an integer within the representable range of integers in your chosen language. The Catalogue The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list o...
A stack state diagram shows how the values on one stack are changed into the other. For example, this is a stack state diagram: 3 0 2 1 0 This means that there is a stack initially containing 3 values (the 3 part). These values are indexed from 0 to 2, with 0 at the top: 2 1 0. The next part 0 2 1 0 describes the fina...
Your goal is to write a full program or function that takes 5 positive integers and a string with an image filename as input [X1,Y1], [X2,Y2], N, image.jpg in any reasonable format, where: First couple [X1,Y1] are the top left X,Y coordinates (<=20) of the blue rectangle area in the example picture (16,11). Second c...
Your task is to generate the "Primitive and Basic" numbers, which are made like so: Start with 110. Take the digits of its base-1 representation (110 = 11) and interpret them as base-2 digits. This gives 12 = 110. Now, add the second prime number – 310 – to the result. This will give you 410, which is our first "Primit...
Im talking about this question, take a look at it if you are a bit confused. Main Task Your task is to output concatenated integers, in decreasing order, but increasing the maximum integer everytime you hit 1 (for this question, 1 will be considered a prime number). While this doesn't sound any different from the first...
Introduction In this challenge, we will be dealing with a certain ordering of the positive integers. The ordering goes like this: 3, 5, 7, 9, 11, ... 2*3, 2*5, 2*7, 2*9, 2*11, ... 4*3, 4*5, 4*7, 4*9, 4*11, ... 8*3, 8*5, 8*7, 8*9, 8*11, ... 16*3, 16*5, 16*7, 16*9, 16*11, ... ... ... 64, 32...
Task Given a wrapper element and a non-jagged 3D array, wrap the array top, bottom, and all-around. You must handle both character and numeric data, but the wrapper and the present will have the same data type. Character example For character data, you may chose to handle either 3D arrays of single characters or 2D ar...
Note: This is #2 in a series of array challenges. For the previous challenge, click here. Separating Nested Lists To separate values in a nested list, flatten it, and then wrap each value so it is at the same nested depth as before. That is to say, this list: [1, [2, 3], [4, 4, [5, 2], 1]] Would become: [1, [2], [3]...