instruction
stringlengths
34
53.1k
In this challenge, you will write a program to output how many decimal places are in the input string and trim the input if needed. Examples -12.32 2 32 0 3231.432 3 -34.0 0 -34 023 0 23 00324.230 2 324.23 10 0 00.3 1 0.3 0 0 -04.8330 3 -4.833 Rules Input will be a string which can be taken through, STDIN, f...
Palindromic prime problems are pretty common, but that's not what this question is about. In this challenge, the number doesn't have to be a palindrome, its prime factors do. Task Your code has to take a single positive integer as input. Then check if any of the permutations of the prime factors of that integer are pal...
A polynomial with coefficients in some field F is called irreducible over F if it cannot be decomposed into the product of lower degree polynomials with coefficients in F. Consider polynomials over the Galois field GF(5). This field contains 5 elements, namely the numbers 0, 1, 2, 3, and 4. Task Given a positive intege...
The residents of Flapus use a base-8 number system. The numbers are: 0 - Kuzla 1 - Ponara 2 - Boqkel 3 - Colopee 4 - Vruenat 5 - Foham 6 - Stikty 7 - Kricola For numbers over 7, the full name of the last digit comes first, followed by apostrophe and the first characters of the other digit(s), up to and including the fi...
A two-dimensional array of size n×n is filled with n*n numbers, starting from number 1. Those numbers are to be sorted per row in ascending order; the first number of a row must be greater than the last number of the previous row (the smallest number of all (1) will be in [0,0]). This is similar to the 15 puzzle. This ...
Introduction Skat is a traditional German card game for 3 players. The deck consists of 32 cards: Ace, King, Queen, Jack, 10, 9, 8, 7 in all 4 suits (Clubs, Spades, Hearts, Diamonds). In every round there one player plays solo while the other two play against him. At the start of a round each player is dealt 10 cards, ...
A simple register calculator This challenge involve a simple register calculator that works in the following way: It has some registers named A,B,C,...,Z, each of them can contain an integer, they are all initialized to 0. It executes instructions of 3 characters: The first character of any instruction is one of +,-,*...
Inspired by this question from our rivals friends over at Code Review. Definitions A super array is an array where each new element in the array is larger than the sum of all the previous elements. {2, 3, 6, 13} is a super array because 3 > 2 6 > 3 + 2 (5) 13 > 6 + 3 + 2 (11) {2, 3, 5, 11} is not a super array, becaus...
Back-story After typing up your essay on your new Macbook, you look up at the screen and realize that you typed in ten pages of gibberish! Or is it? On further inspection, you come to find that your Option key was stuck this whole time and these special Option-key characters correspond to the ASCII keys on your keyboar...
Your goal is to output all the "sides" (corners, edges, faces, etc.) of an N-dimensional unit hypercube, where N is non-negative. A "side" is defined as any (N-M)-dimension surface embedded in N-dimensional space, where 1 <= M <= N. The hypercube spans the space [0, 1] in each dimension. For example, for N=2 the square...
We all already crossed the look and say sequence, and where asked to guess the next element. As its name tells it very well, you just have to say what you see : 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1 3 1 2 2 1 1 ... But, what if we had to use a different base to describe it? You could count it in base 3 as this OEIS squence do...
Introduction tl;dr In this challenge you have to calculate the moon's phase for a given date. This challenge is inspired by the game psycho social audiovisual experiment "Superbrothers: Sword & Sworcery EP". In S:S&S EP the moon's phases are important to the outcome of the adventure as some events occur only at a spec...
The PGP Word List is a set of 512 English words for verbally communicating strings of bytes, such as authentication codes or hashes. It is used in secure VoIP software as well as in some other important applications, such as the DNSSEC Root KSK Ceremonies held four times a year. It consists of 256 two-syllable words a...
Generate the sequence number of bases in which n is a palindrome (OEIS A126071). Specifically, the sequence is defined as follows: given a number n, express it in base a for a = 1,2, ..., n, and count how many of those expressions are palindromic. "Palindromic" is understood in terms of reversing the base-a digits of t...
.i xu .e'o lo zunsnagri cu drani loka jboge'a Given an input of a string consisting of two characters, output whether it is a valid consonant cluster in Lojban. Here is a quote from CLL 3.6 detailing the rules for a valid consonant cluster pair (or rather, an invalid one): 1) It is forbidden for both consonants to be ...
Given a side-view of a mini-golf course and the power of the swing, determine if the ball will make it into the hole. A course will be in this format: ____ ____ _ __/ \ / U \ __/ \ / \_ \_/ The ball starts directly before the first piece of ground o...
Introduction The childhood song Eeny, meeny, miny, moe was often used to select who was "it" when playing tag. Everyone would stand in a circle and point at one person selected at random. They would sing: Eeny, meeny, miny, moe, Catch a tiger by the toe. If he hollers, let him go, Eeny, meeny, miny, moe. As t...
Quick musical refresher: The piano keyboard consists of 88 notes. On each octave, there are 12 notes, C, C♯/D♭, D, D♯/E♭, E, F, F♯/G♭, G, G♯/A♭, A, A♯/B♭ and B. Each time you hit a 'C', the pattern repeats an octave higher. A note is uniquely identified by 1) the letter, including any sharps or flats, and 2) the octav...
From a challenge in a programming book long ago, PNZ is a game where the user must guess three unique digits in the correct order. Rules: A random 3 digit number with no repeating digits is generated. (This is what the user is trying to guess) The user inputs a guess of 3 digits, which is to be evaluated by the progra...
Introduction While studying, I tried to come up with several ways to cheat a multiple choice test. It basically is a compressed version of the multiple choice answers. The method goes as following: The answers to the test: BCAABABA These can be converted to 3 different arrays, which indicates true or false if the curr...
Every day, every minute, ... every microsecond, many decisions are made by your computer. In high-level languages, these typically take the form of statements like if, while and for, but at the most basic level there exist machine language instructions called branch/jump instructions. Modern processors queue instructio...
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 sequence and S", where ...
Introduction There is an Apple tree trunk positioned between -2 to 2 on the x-axis, where some apples fall down around it: | | | | <-------|---|-------> -2 2 Everyday, n apples fall down. Each apple maintains its x coordinate as falls straight to the ground. But if it lands on top of anoth...
Everybody loves geometry. So why don't we try and code golf it? This challenge involves taking in letters and numbers and making shapes depending on it. The Input The input will be in the form of (shapeIdentifier)(size)(inverter). But what are shapeIdentifier, size, and inverter? The shape identifier is the identifie...
URLs are getting too long. So, you must implement an algorithm to shorten a URL. i. The Structure of a URL A URL has 2 main parts: a domain and a path. A domain is the part of the URL before the first slash. You may assume that the URL does not include a protocol. The path is everything else. ii. The Domain The domain ...
If you've read the book Contact by Carl Sagan, this challenge may seem familiar to you. Given an input of a set of mathematical equations consisting of a number, an unknown operator, another number, and a result, deduce which operators represent addition, subtraction, multiplication, or division. Each input equation w...
This is Markov. Markov's golf ball rolls around randomly. Markov's ball will hole however he strikes it. Markov is smart. Be like Markov. And this: is an anthill in Langton's backyard. The anthill is big enough to hold Markov's golfball, MarGolf. However, the anthill moves and changes direction depending on the surro...
Introduction Arrays can also be seen as a field for a bouncing ball. This of course sounds very vague, so here is an example of an input: [1, 2, 3, 4, 5, 6, 7, 8, 9] [9, 8, 7, 6, 5, 4, 3, 2, 1] [1, 2, 3, 4, 5, 6, 7, 8, 9] The challenge is to output the bounced arrays. These are made from diagonal patterns which bounce...
(FB, or Functional-Basic, as found here Interpret Functional-Basic) Task Implement a linting program for FB, similar to JSLint for JavaScript. Error types Invalid identifier Identifiers can only have upper and lower case ASCII letters. Locations: The identifier right after a let expression The identifier in a for loo...
A connected graph is a graph that contains a path between any two vertices. Challenge Build a [2-input NAND-gate] circuit that determines whether a 4-vertex graph is connected. (A gate's 2 inputs can be the same input bit or other gate.) Output True if the graph is connected, and False otherwise. Input The six possib...
Recently, the PPCG design leaderboard has been having some trouble parsing answer html headers. In this challenge you'll be taking your own shot at parsing answer headers. Example Test Cases These example inputs (NOT actual test cases), just so you can get the idea of how inputs might be like Input: <h1>Python 3, 32...
The goal of this challenge is to compute the set of equivalence classes over the transitive closure of a symmetric, reflexive relation. For those who don't know what that means, here is a brief introduction into the relevant terms: A relation ◊ is symmetric if a ◊ b ↔ b ◊ a. It is reflexive if each object is related to...
Introduction Some days ago I needed a metronome for something. I had none available so I downloaded an app from the App Store. The app had a size of 71 MB!!! 71 MB for making tic-toc...?! So code-golf came into my mind and I was wondering if some of you guys could improve this. Challenge Golf some code that outputs s...
A helicopter starting at the top left corner is descending (in a 2D space, for the purpose of this question) towards the ground. It has an autopilot mode and a manual mode. The autopilot mode behaves as follows: If the space directly below is free, descend to it. Otherwise move a step left or right, totally at random....
Note: a 1000 point bounty is still available for this challenge, which I will create and award if anyone takes the top score without using built-in compression. Below is a 386x320 png representation of van Gogh's Starry Night. Your goal is to reproduce this image as closely as possible, in no more than 1024 bytes of c...
Introduction Doppelkopf is a traditional German card game for 4 players. The deck consists of 48 cards (9, 10, Jack, Queen, King, Ace of each suit while every card is in the game twice), so each player gets 12 at the start of a round. There are always 2 teams which are determined by the distribution of the Queens of Cl...
Challenge You will be making a program/function that takes a string input of length n, and: Puts the kth char at the center of the space, where k = (n+1)/2. This will be the location of your ground zero. Puts the rest of the non-whitespace chars randomly arranged around ground zero. The Pythagorean distance from the c...
You live in a rectangular neighborhood which is completely partitioned into N rectangular plots, i.e. there are no gaps or overlaps. Plots do not necessarily have the same width/height as other plots. All widths/heights are positive integers. Your goal is to output all shared edges between plots. Inputs The input may c...
The Möbius function is an important number theoretic function. Your submission should accept a positive integer \$n\$ and return the value of the Möbius function evaluated at \$n\$. Definition The Möbius function \$μ(n)\$ is defined as follows: $$\mu(n) = \begin{cases} \hphantom{-}1, &n\text{ is squarefree and has an e...
Introduction Prime numbers are simple, right? Well, now you get your chance to find out! Challenge You must write a program or function that takes an input n and outputs the first n prime numbers. Example Input and Output Input: 10 Output: 2,3,5,7,11,13,17,19,23,29 Rules You must not include any of the following built...
Given an input of a series of characters representing movements on a hexagonal grid, output the final coordinates of the "pointer." Our hexagons will be numbered like so (imagine a rectangular grid with every odd-numbered column shifted downwards slightly): _____ _____ _____ _____ / \ ...
Introduction Everyone's first program outputs Hello World!. This program should be very simple, that's all you have to do. Challenge Output the string Hello World! to the STDERR. Rules If your language doesn't support STDERR or STDERR doesn't exist for it, you can output it to it's corresponding error system. You can'...
Given a list of the populations of each state, output, from greatest to least, the number of votes that state gets in the electoral college. Input: The first number represents the total number of votes to distribute; it is followed by a list of and populations. In this example, abbreviations for states are used, but an...
The task In this challenge, your input is a non-empty list of positive integers, given in the native format of your language. Your output is that same list, in the same format, with some elements removed. You shall remove every occurrence of 1, every second occurrence of 2, every third occurrence 3, and so on. In gener...
In this challenge, you are passed two words: Your job is to determine if they are adjacent. Two letters are adjacent if: They are the same letter, or They are lexicographically adjacent. For example, J is adjacent to I,J, and K only. Z is not adjacent to A Two words are adjacent if: They are the same length, and Ea...
Introduction tl;dr Continuously output the current distance from the Earth to the Sun. Simplified, the orbit of the Earth around the Sun is an ellipse. So the actual distance between both is constantly changing. This distance can be calculated for any given day using this formula: The equation can be split into the f...
Clock is an interesting card game, as it requires no skill. It is a single player game, and the same card configuration always leads to a win or a loss. In this challenge, you need to figure out whether a given card configuration wins or loses. You can play the game here. The game is played as follows: Thirteen pil...
Final results are here ! Introduction In 2042, the world has become overpopulated. Globalization, overcrowding, new lifestyles and a global lack of hygiene has caused a new pandemic to spread. During those hard times, state leaders have to manage the situation. You can't let your population be decimated, but maybe you ...
In this challenge, you will remove duplicate words from each sentence. Examples Hello Hello, World! Hello, World! Code Code! Golf Code Code! Golf Code Hello hello World Hello World Programming Golf Programming! Programming Golf! Specification Input will be a string of ASCII characters. A sentence is defined a...
In my previous challenge, I drew the first diagram mostly by hand (with the help of vim's visual block mode). But surely there must be a better way... Given an input of two dimensions, a width and a height, output a hexagonal grid with those dimensions in ASCII art. Here's the diagram referenced in the intro (with min...
I have a specific number in mind, but it's part of a challenge I'm doing, and I don't want people to do (all) the work for me. Here is a number which has the same digits, but shuffled: 5713167915926167134578399473447223554460066674314639815391281352328315313091488448321843 8892917486601064146636679920143691047671721184...
In that Coding Golf, you should convert one coding convention with TitleCase to lower_case_with_underscores. And... vice versa! Specification Change the casing in a following way: If underscore character is a delimiter, change the casing to Title Case without any of delimiter. If there are multiple words with no delim...
There is a network of up to 26 nodes (named A to Z or a to z as per your wish). Every pair of nodes may be connected or disconnected. A node may be connected to at most 4 other nodes. Your task is to draw the network in a 2D diagram. Input will be given such that this task is possible (see more constraints in output se...
I have a crank-operated music box that can play a series of four notes. When I turn the crank, it plucks one of four strings, depending on the position of the crank and the direction of the turn. When the crank is turned due north, the box (with its strings numbered 1 through 4) looks like this: 1 | 2 | O 4...
Australians love public holidays, and drinking. Yesterday, the 26th January, was Australia day, which is a public holiday. I was glad to not be at work yesterday, and eager to know the next time I get a public holiday! Unfortunately, I had a bit too much to drink, and I'm not able to work it out for myself. Write a pro...
Introduction In chemistry there is a type of extension, .xyz extension,(https://en.wikipedia.org/wiki/XYZ_file_format), that prints in each line a chemical element, and the coordinates in the plane of the element. This is very useful for chemists to understand chemical compounds and to visualize the compounds in 3D. I ...
Given an input of a list of blocks to drop at certain points, output the height of the resulting "tower." The best way to explain this challenge is by example. The input will be a list of 2n integers representing n blocks. The first integer is the block's x position, 0-indexed, and the second is how wide the block is. ...
Introduction Everyone should know IPv6 by now. IPv6 has very long, cumbersome addresses. In 1996 some very intelligent people created a scheme to encode them much better in RFC 1924. For reasons I cannot understand, this hasn't been widely adopted. To help adoption, it is your task to implement a converter in the langu...
I am standing at point (0,0) in a H x W map where the altitude is represented by digits, for example: 1132 2221 1230 # H = 3, W = 4 I'd like to experience the views from every peak, which in this case are the areas with altitude 3. However, climbing up hills is not an easy task, and I am also running out of time. ...
You want to open a new zoo. It'll be amazing. But being the cheapskate that you are, you only want to afford three-letter animals (everyone knows that an animal's cost is proportional to the length of its name). There goes your dream of making people pay to see an elephant. But suddenly you have a brilliant idea. If yo...
0h n0 is a very simple and enjoyable game, a bit like Sudoku or minesweeper. Game rules (I recommend using the tutorial in the game if you can, it is very simple and useful) The puzzle starts with an n * n board containing some fixed pieces and some empty cells, and the solver must find a way to fill the empty cells wi...
Someone's given us a string, but all bracket-like characters have been changed into normal ones, and we don't know which, or even how many there were. All we know is that if L1,L2,L3,...,LN were different kinds of left brackets and R1,R2,R3,...,RN were different corresponding kinds of right brackets, all being distinct...
A Stack Exchange script determines which five comments on questions or answers are initially seen on the main page of sites through the number of upvotes on them; the five comments with the highest number of votes are displayed. Your task is to recreate this behavior. Write a full program or function taking input throu...
Background It's well known in mathematics that integers can be put into a one-to-one correspondence with pairs of integers. There are many possible ways of doing this, and in this challenge, you'll implement one of them and its inverse operation. The task Your input is a positive integer n > 0. It is known that there e...
Introduction There is a plantation defined by one big square-board like this one: The numbers inside each small square represents its area's value/cash/... The farmer needs help to find the N squares that connected (it means all N squares should have at least one shared border) give him the greatest value. For example...
Easy As ABC, also known as "End View", is a puzzle where you are given an empty grid with letters around it; you must partially fill in the grid so that exactly one of each letter is in every row and column; in addition, letters at the end of a row (or column) must be the first letter visible in that row (or column) fr...
In this challenge you will be creating an image preview compression algorithm. It's goal is to reduce an arbitrary image file to a 4 KiB preview image, that can be used to quickly identify images with very little bandwidth. You must write two programs (or one combined program): a compressor and a decompressor. Both mus...
If you think this could be fun, but too much work, consider participating in this much smaller challenge. A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". Enjoy! The Objective Find Dyalog APL (download) expressions (other languages are allowed, see Eligibility below) involving exactl...
/* I hope such question is suitable for here*/ As the batch scripts are pretty limited, hybrid files that embed a code from another language into a batch file are used a lot lately. Though usually there are some requirements for a good hybrid script: The embedded code should be usable as-it-is - without any ugly batc...
The challenge is very simple. Given an integer input n, output the n x n identity matrix. The identity matrix is one that has 1s spanning from the top left down to the bottom right. You will write a program or a function that will return or output the identity matrix you constructed. Your output may be a 2D array, or n...
Task Your task is to write a program that will output ASCII boxes at the locations specified by the input. Input You will be given a list of numbers. The format here is a bit flexible, in that you can use any deliminator you want (e.g. 1,2,3,4, 1 2 3 4, [1,2,3,4]). The list is in groups of 4 and specifies the xywh of e...
IPv4 addresses are 32 bits wide, and thus the size of the address space is 232, or 4,294,967,296. However, this is only a theoretical upper-bound. It is not an accurate representation of all the addresses that may actually be used on the public internet. For the purposes of this challenge, it is assumed that all addr...
Seems like we do not have this one yet, so here we go: The Challenge Write a program or function that takes a date as input and outputs the day number of the year. You may not use any builtins for that! Rules As usual you may write a full program or a function. The format of the input is up to you, but it has to conta...
Given an input of two strings with sequences of underscores representing corresponding words, output the sentences with the "blanks" filled in. The best way to describe this challenge is by example. Here is an example input: programming _____________ and code golf programming puzzles ______ code ____ And here is the c...
Your task is to write a function or program that takes two non-negative integers i and k (i ≤ k), and figure out how many zeroes you'd write if you wrote all whole numbers from i to k (inclusive) in your base of choice on a piece of paper. Output this integer, the number of zeroes, to stdout or similar. -30% if you al...
This isn't very widely known, but what we call the Fibonacci sequence, AKA 1, 1, 2, 3, 5, 8, 13, 21, 34... is actually called the Duonacci sequence. This is because to get the next number, you sum the previous 2 numbers. There is also the Tribonacci sequence, 1, 1, 1, 3, 5, 9, 17, 31, 57, 105, 193, 355, 653, 1201... ...
Write a program or function that takes in two integers that represent the X and Y coordinates of a point on a Cartesian plane. The input may come in any reasonable format as long as the X value comes before the Y. For example, 1 -2, (1,-2), [1, -2], or 1\n-2 would all be fine for X = 1, Y = -2. Print or return a single...
In a popular image editing software there is a feature, that patches (The term used in image processing is inpainting as @mınxomaτ pointed out.) a selected area of an image, based on the information outside of that patch. And it does a quite good job, considering it is just a program. As a human, you can sometimes see ...
The cross product of two three-dimensional vectors \$\vec a\$ and \$\vec b\$ is the unique vector \$\vec c\$ such that: \$\vec c\$ is orthogonal to both \$\vec a\$ and \$\vec b\$ The magnitude of \$\vec c\$ is equal to the area of the parallelogram formed by \$\vec a\$ and \$\vec b\$ The directions of \$\vec a\$, \...
Here is another simple one: The Challenge Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance. The coordinates will be rational numbers; the only limits are the restrictions of your language. Lowest dimension is 1, highest is whatever your language can handl...
Introduction Pareidolia: From Ancient Greek; παρα ‎(para, “concurrent, alongside”) + εἴδωλον ‎(eídōlon, “image”). The tendency to interpret a vague stimulus as something known to the observer, such as interpreting marks on Mars as canals, seeing shapes in clouds, or hearing hidden messages in music. Source: Wiktionary....
Write a function or program that outputs the number of each type of element (vertex, edge, face, etc.) of an N-dimensional hypercube. As an example, the 3 dimensional cube has 1 cell (i.e. 1 3-dimensional cube), 6 faces (i.e. 6 2-dimensional cubes), 12 edges (i.e. 12 2-dimensional cubes) and 8 vertices (i.e. 8 0-dimens...
Introduction A known fact is that Jon Skeet can code Perl and make it look like Java. In this challenge you will try to do something similar. Challenge Write a piece of code of any length that can be executed without any errors/exceptions in two different languages. Your program can take inputs, give outputs, whatever ...
Quinary is like binary, except that 1 is represented by the text of the program, and 0 is represented as the backwards text of the program. The Fibonacci Sequence is the well known sequence F(0) = 0, F(1) = 1, F(n) = F(n - 1) + F(n - 2) Write a program that takes some input n and outputs the nth fibonacci number in qui...
The winding number is the integer number of net counterclockwise revolutions an observer must have made to follow a given closed path. Note that any clockwise revolutions count negative towards the winding number. The path is allowed to self intersect. Some examples (shamelessly taken from Wikipedia) are given below: ...
The Scenario I am building a fancy oscilloscope but I need your help. The oscilloscope can display any number of individual waveforms at the same time (e.g. sine waves) but I don't know how to synchronise the display so it doesn't jump around too much. The Challenge Your program or function will take a series of floati...
Your task is to generate the nth term of the RATS sequence, where n is the input. The RATS sequence is also known as the Reverse Add Then Sort sequence. This sequence can also be found here: http://oeis.org/A004000. test cases: 0 > 1 1 > 2 2 > 4 3 > 8 4 > 16 5 > 77 6 > 145 7 > 668 For example, the output for 5 is 77 b...
Lets say we have this existing data: Total - 10 Won - 7 Lost - 3 Longest Winning Streak - 5 Longest Losing Streak - 2 Now you need to write a function which generates an array of random boolean values (true representing a win and false representing a loss) which fulfills the above criteria. So, in this case the o...
Task Your task is simple. Write a program or function which takes three positive integer arguments \$n\$, \$k\$, and \$b\$ in any order, such that \$2 ≤ b ≤ 36\$, and returns or outputs the nth (1-indexed) base-\$b\$ digit after the decimal point of the rational number (\$b^k-1)^{-2}\$. The output must be correct for \...
I have an ASCII-art box and I need a program to open it. Examples Input: ------- | | |_____| Output: / / / / / / / | | |_____| Specification The first line will only consist of -, at least 3 of them The middle rows will start with | have spaces, and end with | All the middle rows will b...
Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in...
EDIT: I will be accepting an answer Monday, 2/15/2016. May the bytes be ever in your favor! In his "Print the N-Bonacci Sequence" challenge, @DJMcGoathem describes the N-bonacci sequences, wherein the previous N numbers are summed, instead of the traditional 2 of the Fibonacci sequence (said to be the "duonacci sequenc...
Given an input of any valid Glypho program, output its "human-readable" counterpart. Glypho is an interesting esolang idea: The instruction reference is given here. For each instruction, the characters abcd represent the symbols composing each instruction. a refers to the first unique symbol, b refers to the secon...
The inspiration for this challenge should be ridiculously obvious at the time of posting. The Task You must create a Shut the Box style program (not function, program). The basics of shut the box are: Players attempt to shut the box by turning a set of levers labelled 1-9. They must do so by flipping levers. The sequen...
Given input of a positive integer n, write a program that completes the following process. Find the smallest positive integer greater than n that is a perfect square and is the concatenation of n and some other number. The order of the digits of n may not be changed. The number concatenated onto n to produce a perfect...
How strings are twisted The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps to the top. It works like this: aaaa bbbb cccc Becomes: a ba cba ---- cba cb c With everything under the line wrapping to the top. Real example...
The goal of this challenge is to make a program that outputs the nth letter of its source code where n is given as input to the program. Like most quine challenges, you are not allowed to read your source code as a file or use any builtin quine functions. Input An integer 0 <= n < len(program). Output The nth character...
Given an input of an ASCII art "road," output the road with all dead ends labelled. This is a road: ########.....######..#..### #......#######....#..#..#.# #.##......#...#####..#..### #..#####..#....#..#######.# #......#...#####.....##...# #..###.#...#...###...#..### ##########.#..#..##..#.##.# ..#......#.######.#..#.#...
In case there's any doubt: Nan = Non-numeric datatype for the purposes of this challenge. Write a program or function that takes a matrix / array as input, as well as a list of column indices. The challenge is to remove the rows where all elements in the specified columns are Nan. It doesn't matter if other elements ...
You love watching the snow falling outside, but you know it won't be snowing much longer. You could take a video, but decide to make a snow animation because ... um ... you need to practice your animation skills! Snow Snow is simply the * symbol here. Half of the snow moves at 1 char per frame, while the other half mov...