instruction
stringlengths
34
53.1k
Four integer sequences In this challenge, you will test four different properties of a positive integer, given by the following sequences. A positive integer N is perfect (OEIS A000396), if the sum of proper divisors of N equals N. The sequence begins with 6, 28, 496, 8128, 33550336, 8589869056, 137438691328, 23058430...
Background I saw this very interesting Venn Diagram on wikipedia: https://simple.wikipedia.org/wiki/Alphabet#/media/File:Venn_diagram_gr_la_ru.svg It shows the letters (physical shapes) in different alphabets that are common between Russian, Greek and Latin alphabets. The Challenge Given an input string of characters f...
Write a short program which takes in a positive number of seconds representing an age, and outputs an estimate of that time in English. Your program must output the least precise amount of time which has passed, among the following metrics and their lengths in seconds: second = 1 minute = 60 hour = 60 * 60 day = 6...
We'll define the N-exponential potential of a positive integer M as the count of prefixes of MN that are perfect N-powers. The prefixes of an integer are all the contiguous subsequences of digits that start with the first one, interpreted as numbers in base 10. For example, the prefixes of 2744 are 2, 27, 274 and 2744....
The input is an array (or space-separated string, as you wish), zero-indexed, consisting of one strictly increasing array and one strictly decreasing array (in this order, not other vice versa), each having a length of 2 at least. Example is: -10 -2 4 18 38 46 28 19 10 The goal is to write the fastest algorithm to fin...
So, last week I posted a challenge to play Duck, Duck, Goose. This lead to a number of Minnesotans commenting about their regional 'Gray duck' variation. So here's the rules: Using this list of colours: Red Orange Yellow Green Blue Indigo Violet Gray Write a program to follow these rules: Select one of these colours,...
The rules are as follows: Take in a string of integers separated by spaces. Add the first and last numbers, the second and second-last numbers, and so on. The program must output the numbers separated by newlines. The program must handle negative numbers, but may not handle decimals. If an odd amount of integers are i...
In this challenge you are to write a program or function, that takes a string as input and outputs one of two possible values. We will call one of these values truthy and one falsy. They do not need to actually be truthy or falsy. For an answer to be valid it must meet four additional criteria When you pass your pro...
In order to defend someone’s baffling decision, people often say that that person is going over everyone’s heads and playing “3-dimensional chess”. Now it’s your chance to play 3-dimensional chess! Rules There are many variants of 3D Chess, but for this challenge I’ve made up my own. My version is just like regular che...
Inspired by I'm not the language you're looking for! Challenge Choose two different programming languages, and write a program that prints the following line to stdout (or equivalent): This program errors out in <the current language> :P and then generates different kind of error in each of the two languages. Rules So...
Challenge Consider the rainbow as seven colours, represented by strings as Red Orange Yellow Green Blue Indigo Violet. Your task is to create a program that receives one of these colours as input and outputs next in order rainbow colour. This includes overlapping Violet -> Red Input A string containing one of rainbow c...
If you have any tips regarding golfing in Sesos, a language made by Dennis, and nobody else has covered them yet, please post them here! Only one tip is allowed per answer. Your tip should be at least somewhat specific to Sesos itself, and not just brainfuck. If your tip is relevant to brainfuck in general, you should ...
Challenge Factory workers are usually very hard-working. However, their work is now being commonly replaced with machines. You have to write a program that takes a number as input. It will print out a factory of 10 workers 10 times. Every time, each worker has a 1/input chance of being 'fired' and replaced by a machine...
Different systems have different ways to describe colors, even if all of them are speaking in R-G-B-A space. A front-end developer who is familiar with CSS may prefer #RRGGBBAA. But Android developers may prefer #AARRGGBB. When handling AAS file format, #AABBGGRR is needed. That's too confusing. Maybe we need a program...
A self number (also called a Colombian or Devlali number) is a natural number, x, where the equation n + <digit sum of n> = x has no solutions for any natural number n. For example, 21 is not a self number, as n = 15 results in 15 + 1 + 5 = 21. On the other hand, 20 is a self number, as no n can be found which satisfie...
Alice (A) and Bob (B) decided to have a battle. Each combatant has 10 health. They take turns to roll a 6 sided die for damage. That damage is removed from their opponent's health. In the end either Alice or Bob, will vanquish their foe. Show me how the battle went. Outputting these codes for the actions which have ...
Self-limiting lists Consider a nonempty list L containing nonnegative integers. A run in L is a contiguous sublist of equal elements, which cannot be made longer. For example, the runs of [0,0,1,1,3,3,3,2,1,1] are [0,0], [1,1], [3,3,3], [2], [1,1]. The list L is self-limiting if for each integer N ≥ 1, the number of oc...
This challenge already describes dropsort. However, I'm kinda lazy and I really only need my array to be a bit more sorted than before, it doesn't need to be sorted all the way. In Drop Sort, we drop every element less than any element before it. In Lazy Drop Sort, we drop every element less than the one strictly prece...
Inspired by this. Agatha Stephendale, a sophomore who is really into raster graphics, has taken a course in linear algebra. Now she imagines matrices as rectangles, but in her artistic mind, she attaches diagonal lines to those rectangles and tries to compute traces along them. In fact, she wants to compute traces of a...
Create a function which given a number of lines n, makes a bigA. The horizontal bar of bigA must be at the middle row, or the lower of the two if n is even Assume a monospace font for output Output should be a string (or similar, eg character array) with clear linebreaks to break up the lines, and with correct whites...
Your task is to build a program that identifies the shape of the input. The shapes to be identified can be any of the following: Square To be identified as a square, the source must have lines of all equal length, and the same number of lines as characters per line (newline characters excluded). An optional trailing ne...
Quarterstaff repo here with additional quarterbf interpreter: rather bereft of documentation, however, but it does contain the two interpreters you can go to https://tio.run/#quarterstaff to run quarterstaff programs online. however, the TIO BF implementation seems to have limited cells, according to the documentation ...
Overview Given the integer representation of three elements in GF(2^64), give the product of the first two elements over GF(2^64) with the reducing polynomial defined as the polynomial m such that m(x) = x^64 + n(x), where n is the polynomial representation of the third element. You want me to what? A finite field GF(...
Most people here are familiar with seven segment displays, which are also used in matchstick puzzles. Below are the digits 0 through 9 and letters a through z, except k,m,t,v,w, written in this format. _ _ _ _ _ _ _ _ | | | _| _| |_| |_ |_ | |_| |_| |_| | |_ _| | _...
Your task is to write a non-empty program / function of byte count L, which, when repeated M times, checks whether a given positive integer N is equal to L × M. You should, in theory, support an arbitrary number of repetitions (an arbitrary positive integer value of M), but it's fine if, due to language limitations, it...
Grid: +---------------+---------------+---------------+---------------+---------------+ | id: 20 | id: 19 | id: 18 | id: 17 | id: 16 | | pos: (-2, -2) | pos: (-1, -2) | pos: (0, -2) | pos: (1, -2) | pos: (2, -2) | +---------------+---------------+---------------+---------------+---...
Challenge Your challenge is to make a simple program that takes the [input] and formats it as "Hello, [input]!" Input Either a function call variable or STDIN, this is the name. Can contain any character, UTF-8, and can be empty - would result in Hello,!. Also newlines in the input are fine - On a new line -> Hello, O...
Your task is to accept as input two gene sequences, and a sequence of "cross over points", and return the gene sequence that results from the indicated cross overs. What I mean by this is, say you have the sequences [A, A, A, A, A, A, A] and [Z, Z, Z, Z, Z, Z, Z], and cross over points of 2 and 5. The resulting sequenc...
Example Input -> 5 Output -> 55555 Input -> 12 Output -> 121212121212121212121212 Criteria Least number of bytes wins!
Introduction For a given rational number r, find a pair of integers p,q so that p/q=r and the number of less used bits in p and q are minimized (details below). Challenge A positive rational number r can be expressed as the ratio of two positive integers, r=p/q. The representation is not unique. For each of these repre...
Find a maximally profitable sequence of exchanges given an exchange rate table. As an example consider the currencies Ariary (your home currency), Baht, Cedi, and Denar where the rate from one to another (after any transaction rate has been levied) is given by the (row, column) entry in the exchange rate table below: ...
Drunkard's Journey Home In this challenge you are to write a program which simulates a drunkard stumbling his way home from the bar. Input: The input will be an adjacency matrix (representing a directed graph) which represents paths the drunkard can take. At each location, the drunkard will choose one path at random (E...
Background Stack Cats is a reversible esoteric language made by Martin Ender. Each command in Stack Cats is either the inverse of itself (represented as a symmetric character, such as -_:T|), or has its inverse command (represented as the mirror image, such as () {} [] <>). Stack Cats has a strong syntactic requirement...
Given positive integer n and e, knowing that e<n and that n is the product of two different odd primes(but the primes are not directly given to you), find such a positive integer d smaller than n that, for each integer m, (me)d ≡ m (mod n). Your program should handle n up to 24096 in 1TB space, but not necessary reaso...
World Bowling scoring Many people have gone to their local bowling center to play a few games of bowling, and many people continue to struggle to calculate their scores. World Bowling has introduced a simplified scoring system in order to attract more people to the sport. This scoring system is utilized in internation...
Let's say I'm ten steps away from my destination. I walk there following the old saying, "Two steps forward and one step back". I take two steps forward, one back, until I'm standing exactly on my destination. (This might involve stepping past my destination, and returning to it). How many steps did I walk? Of course, ...
The three-dimensional Levi-Civita symbol is a function f taking triples of numbers (i,j,k) each in {1,2,3}, to {-1,0,1}, defined as: f(i,j,k) = 0 when i,j,k are not distinct, i.e. i=j or j=k or k=i f(i,j,k) = 1 when (i,j,k) is a cyclic shift of (1,2,3), that is one of (1,2,3), (2,3,1), (3,1,2). f(i,j,k) = -1 when (i,j...
Given integers 0<x<10106 and 0<n<106, work out x(1/n) under 15 seconds(TIO or your computer), 1GB memory. You can assume the result is integer smaller than 50000. Shortest code in bytes in each language win. Sample: x n result 121 2 11 123 1 123 1024 10 2 A larger sample can be seen here
Description Let a permutation of the integers {1, 2, ..., n} be called minimally interpolable if no set of k+2 points (together with their indices) fall on a polynomial of degree k. That is, No two points fall on a horizontal line (0-degree polynomial) No three points fall on a line (1-degree polynomial) No four poi...
Challenge: Create a program or function that takes an integer input, which outputs a new program/function as specified below. Input: Integer n: Time in seconds before the Time Bomb explodes. Output: The original program which had the time in seconds n as input, will output a new program/function that does the following...
Input: A list of integers Output: Put each digit (and the minus sign) in its own lane, in the order -0123456789, ignoring any duplicated digits. Example: Input: [1,729,4728510,-3832,748129321,89842,-938744,0,11111] Output: -0123456789 <- Added as clarification only, it's not part of the output 1 2 7 ...
Your task is to find two missing characters in a Columbo episode title. Input One of the 69 Columbo episode titles (as listed below), with exactly two characters replaced with *. Example: "Ran*om for a *ead Man" Output You may either return the full episode title, or just the two missing characters in any reasonable f...
Anyone remember Boaty? You could totally make any old word, right? Write a function to turn a string into Somethingy McSomethingface. It should accept one string as input. Ignore the case of the input. If the word ends in 'y', your function should not add an additional 'y' to the first instance, but should remove it i...
In this simple challenge you are given an input array L of non-negative integers and a number of bins b greater than 0 but no more than the length of L. Your code must return a new array M whose length is b and which has binned the array L. This is easiest explained with examples. L = [1,0,5,1] and b = 2 returns M = [1...
Related: Determine the position of a non-negative number in the infinite spiral Wind me a number snake! Challenge: Given a grid, with an ID starting at the center and spiraling out, what is the ID given a position in the fewest number of bytes? Grid: +---------------+---------------+---------------+---------------+--...
Inspired by Digits in their lanes and 1, 2, Fizz, 4, Buzz Introduction Your task is to generate exactly the following output: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz ...
Given a positive integer n, do the following (and output every stage): start with a list containing n copies of n. do the following n times: at the ith step, gradually decrement the ith entry of the list until it reaches i So, for example, if the given n is 4, then you start with [4,4,4,4], and then at the first step...
Given an integer n ≥ 0 , output it in a non-positional base-3 notation, using digits 139ABCDE… and a 1-character separator. Every digit is a consecutive power of 3 and the digits on the left side of the separator are negated, e.g. A931|B → 81−(1+3+9+27) → 41. A digit may appear only once. Rigorously, let ...
API Easter egg hunt! There's an API at http://easter_egg_hunt.andrewfaraday.com which will provide a special Easter egg hunt, just for you... You can see the API docs at the above address, or try it from here. The API: All calls to this API are GET requests, which will return a JSON string. These examples are in a 5x5 ...
The objective is to print a graph from an array of numbers, of the design below. Printing the X and Y scale exactly as in the "design", with padding, is part of the challenge. The input array of numbers can be of virtually any range of integers in X and Y, but not 0 and not negative - though I would suggest keeping it ...
The goal of this challenge is to write a program or function that returns the least amount of strikes needed to complete a given course. Input The layout of the course can be passed in any suitable way and format you prefer. (read from the console, passed as an input parameter, read from a file or any other, multilin...
The Challenge Given an input string (or array) consisting of < and >, output a sequence (array or string) of integers such that: the operators are all correct when applied in order between consecutive numbers in the output all integers are positive (1 or greater) the sum of the integers is as small as is mathematicall...
Challenge: The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing bytes. BUT WAIT..... there is one restriction: Your source code can not include any of the digits from your byte count So if your score is 186 bytes, you...
A piggy bank is a container used to collect coins in. For this challenge use the four US coins: quarter, dime, nickel, and penny. Challenge Your challenge is to create an electronic piggy bank. Write a program (or function) that when run (or called), outputs (or returns) the count of each coin you have, as well as the ...
Inspired by The Great API Easter Egg Hunt! Summary Your task is to search for a predetermined integer in the "Collatz space" (to be explained later) using the fewest step possible. Introduction This challenge is based on the famous Collatz conjecture that hopefully everyone here at least heard of. Here is a recap taken...
Introduction For as long as programmers have been programming and as long as English teachers have been teaching, there's a controversy over the datasets called Arrays and Lists (or hashes). Arrays have almost always had their first index at 0. Which, for the programmer, is understandable because of math. But along the...
The task in this challenge is to put elements of an array into time bins. The input will be a non-decreasing array of positive integers representing the time of events, and an integer which represents the size of each bin. Let us start with an example. We call the input array A and the output array O. `A = [1,1,1,2,7,...
Challenge You need to generate a program or function that takes in a positive integer N, calculates the first N terms of the Fibonacci sequence in binary, concatenates it into a single binary number, converts that number back to decimal, and then outputs the decimal as an integer. For example 1 -> [0] -> 0 to decimal o...
A well known song by the Irish rock band U2 starts with the singer Bono saying "1, 2, 3, 14" in Spanish ("uno, dos, tres, catorce"). There are various theories as to the significance of those numbers. Apparently the official explanation is "we drank too much that night". But there's a more interesting hypothesis: Bono ...
Introduction I have some ASCII cars that have velocity and direction. Their velocity is represented by their number. If a car is <> then it has stopped. For example: <> 1> 2> 3> After one second, I get <> 1> 2> 3> After two, I get <> 1> 2> 3> If two cars are too close, they crash. 1> <1 1> <2 Afte...
Background IEEE 754 Double-precision floating-point format is a way to represent real numbers with 64 bits. It looks like the following: A real number n is converted to a double in the following manner: The sign bit s is 0 if the number is positive, 1 otherwise. The absolute value of n is represented in the form 2**y...
Introduction I have a lot of ASCII rocks. They are built with dashes, pipes, Vs, carets, angle brackets, slashes and spaces. Example: /--\ | | | | \--/ I want to erode them, like this: /\ / \ \ / \/ All of the corners have become rounder. A more complicated example: /----\ | \------\ | | | ...
Introduction Some months are completely symmetric, meaning they have central symmetry as well as reflection symmetry, like February of 2010: February 2010 ┌──┬──┬──┬──┬──┬──┬──┐ │ │ │ │ │ │ │ │ ├──┼──┼──┼──┼──┼──┼──┤ │ │ │ │ │ │ │ │ ├──┼──┼──┼──┼──┼──┼──┤ │ │ │ │ │ │ │ │ ├──┼──┼──┼──┼──┼...
Given the spiral of size S and the step N, output the "square" S*S spiral having N asterisks, built from the outer to inner radius clockwise. Test cases (examples) below. Input: 4 3 Output: *** Input: 4 6 Output: **** * * Input: 4 11 Output: **** * * * **** Input: 6 18 Output: ****** * * * * ...
Given a positive integer N ("virality"), your program should create an ASCII-art drawing of a tree with two branches of length N extending downwards and/or rightwards from the top-left corner. The direction taken by each branch after the first asterisk can be either rightwards or downwards, and this choice should be ma...
This challenge was posted as part of the April 2018 LotM challenge, as well as for Brain-flak's 2nd birthday I was thinking about what the most efficient way to encode brain-flak programs would be. The obvious thing to do, since there are only 8 valid characters, is to map each character to a 3-bit sequence. This is c...
Roguelike pathfinding Your task will be, given a two-dimensional array of the elements described below, which represents a dungeon, to output or return a single number representing the amount of gold pieces the rogue can collect without waking up any monsters. The elements of the array are as follows: Empty spaces are...
For the purposes of this challenge, we define a postfix regex dialect with alphabet {1, 0} and the following operations: 1 and 0 match themselves literally. _ matches the empty string. ! always fails (i.e. it does not match anything). ab; matches a, followed by b. ab| matches both a and b. a+ matches one or more insta...
Write a program or function that given n ≥ 1 returns the number of solutions to ±1 ± 2 ± 3 ± ... ± n = 0. For n = 6 there are no solutions, so the answer is 0. For n = 4 there are two solutions, so the answer is 2 (the two solutions are 1 - 2 - 3 + 4 = -1 + 2 + 3 - 4 = 0). This is OEIS sequence A063865. Some example in...
Challenge : \$\pi\$ is supposed to be infinite. That means every number is contained inside the decimal part of \$\pi\$. Your task will be to take a positive integer on input and return the position of this number in \$\pi\$ digits on output. For example, if the input is 59, we'll return 4 Here is why : we will look fo...
Inspired by Digits in their lanes Input: An ASCII-art of width ≤ 11, consisting of spaces and #. (You can choose any two distinct characters instead.) Example: # ### # # # # # # # # # ### # # ### # ########### # # # # # ### # # ...
Well I think it is about time we have another proof-golf question. This time we are going to prove the well known logical truth \$(A \rightarrow B) \rightarrow (\neg B \rightarrow \neg A)\$ To do this we will use Łukasiewicz's third Axiom Schema, an incredibly elegant set of three axioms that are complete over proposit...
I have recently thought of a wonderful relatively old mobile game, called Tower Bloxx. Alhough I'm not really old myself, but it reminded me of childhood and school :) So this my challenge is a kind of a reference to that good game! I have (hopefully) looked into any tower question on PPCG and this won't be a dupe. ...
Background: Pi (π) is a transcendental number, and therefore it has a non-terminating decimal representation. Similar, the representation doesn't terminate if written in any other integer base. But what if we wrote it in base π? Digits in decimal represent powers of 10, so: π = 3.14… = (3 * 10^0) + (1 * 10^-1) + (4 * 1...
As of ECMAScript 2015, JavaScript has 33 reserved keywords, such as break, const and new, as well as 10 future reserved keywords, such as let and await. Your task is to chain together the largest number of consecutive1 distinct reserved keywords2 while writing functional JavaScript code3. Consecutive reserved keywor...
Given an integer, output five perfect cubes whose sum is that integer. Note that cubes can be positive, negative, or zero. For example, -10 == -64 - 64 + 64 + 27 + 27 so for input -10 you could output [-64, -64, 64, 27, 27], though other solutions are possible. Note that you should output the cubes, not the numbers be...
Challenge: Input: Two integer parameters a and b (where a<b and the difference is at least 2) Output: Output or return this text, where a and b are filled in: (a,b) = ]a,b[ = {a<x<b} = {a<x&&x<b} = a+1..b-1 [a,b) = [a,b[ = {a<=x<b} = {a<=x&&x<b} = a..b-1 (a,b] = ]a,b] = {a<x<=b} = {a<x&&x<=b} = a+1..b [a,b] = [...
In some nations there are recommendations or laws on how to form emergency corridors on streets that have multiple lanes per direction. (In the following we only consider the lanes going in the direction we are travelling.) These are the rules that hold in Germany: If there is only one lane, everyone should drive to t...
So, here's a map of, let's say, a dungeon... ########## # ##### # ##### ########## ########## ########## ########## #### ## #### ## ########## Let's say that the hero is in Room A (at the top left) and their goal (a prince in distress?) is in Room B (to the bottom right). Our map does not allow the hero to...
Input A non-empty array of positive integers. Task Convert each integer to either binary, octal, decimal or hexadecimal in such a way that each digit (0 to F) is used at most once. Output The list of bases that were used to solve the puzzle. Detailed example The expected output for [ 16, 17 ] is [ octal, decimal ]. Her...
The following problem is a common interview question, thus dull answers are discouraged. Go short or creative, best if both: Create the following pattern ########### ## ## # # # # # # # # # # # # # # # # # # # # # # # # # # # ## ## ########### In case you cry "dupe", I see y...
For an integer n that satisfies n > 0, write its value as a right-descending path based on its binary representation. Rules The first (most significant) set bit is always in the top-left corner. When the next bit is set (a 1), draw a character ("filled") on the next line in the same column as the previous character dr...
Trigonometry has LOTS of identities. So many that you can expand most functions into sines and cosines of a few values. The task here is to do that in the fewest bytes possible. Identity list Well, the ones we're using here. sin(-x)=-sin(x) sin(π)=0 cos(-x)=cos(x) cos(π)=-1 sin(a+b)=sin(a)*cos(b)+sin(b)*cos(a) cos(a+b)...
A number theory expression contains: There exists at least one non-negative integer (written as E, existential quantifier) All non-negative integers (written as A, universal quantifier) + (addition) * (multiplication) = (equality) >, < (comparison operators) &(and), |(or), !(not) (, ) (for grouping) variable names(all ...
Input The board: A 2D container (matrix, list of lists, etc.) of letters like: ["B", "C", "C", "C", "C", "B", "B", "C", "A", "A"], ["B", "A", "C", "B", "B", "A", "B", "B", "A", "A"], ["B", "C", "B", "C", "A", "A", "A", "B", "C", "B"], ["B", "B", "B", "A", "C", "B", "A", "C", "B", "A"], ["A", "A", "A", "C", "A...
So your task is to take a 3x3 block where -'s mean blank spaces, and *'s mean filled spaces, for example: -** -*- *-* and rearrange the block so that the *'s form an X, like this: *-* -*- *-* Input: 3x3 squares like above, they can be 3 lines, an array, or however you want. Output: The shortest amount of moves to rea...
Given an integer N perform the following steps: (using 9 as an example). Receive input N. (9) Convert N from base10 to base2. (1001) Increase every bit by 1. (2112) Treat the result as base3 and convert it back to base10. (68) Return/Output the result. Input May be received in any reasonable number format. You only ...
What if we have a corridor comprised of two parallel mirrors? | | | | | | | | | | | | | | | | | | | | Now, we shine a laser down it... | \ | | \ | | \ | | \ | | \ | | \ | | \ | | ...
Recreational languages win at code golf too much. This challenge is simple, when using higher level functions. The task is as follows: Given any valid url, which is guaranteed to result in a valid HTML document (for example https://en.wikipedia.org/wiki/Ruby_on_Rails, which has 9 images), count the number of images di...
Given a list of two or more spelled-out serial numbers of equal length greater than two, e.g. [[ "three" , "one" , "four" ], [ "one" , "five" , "nine" ], [ "two" , "six" , "five" ], [ "three" , "five" , "eight" ]] sort the list by the numbers that the words represent: [[ "one" , "five" , "nine" ], [ "t...
In the context of quines, an intron (or payload) is a part of a quine that serves no purpose in producing output, but is still included in the data section. For example: function quine() { const data = "function quine() {\n const data=\"@\";\n // Arr! This be an intron!\n return data.replace(\"@\", JSON.s...
Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with. Specifics: Your language needs to support variadic argument functions: something callable that takes an arbitrary number of arguments and returns a value. Parameters must be...
A certain well-known cable company has a somewhat clumsy 'Search for Program' feature that works through the remote. It takes muchly much button pushing; so, being an admirer of economy of motion, I thought I'd seek out a programmer's help to minimize the number of finger movements I have to make. The Craptastic Search...
This is an answer-chaining challenge in which each answer builds on the previous answer. Taking no input, you are to output the most recent submission to this thread. I would HIGHLY suggest sorting by oldest and skipping to the last page to find the most recent answer. Scoring The winner will be chosen based on a point...
Input: A 2D array containing two distinct (optional) values. I'll use 0 and 1 when explaining the rules. The input format is of course flexible. Challenge: Zeros are water, and ones are islands. In order to ensure loneliness, your task is to surround all islands with water by inserting rows and columns of zeros. You d...
Premise So recently I was about half an hour early to an appointment, and decided to wait outside. I also determined that it would look strange if I just stood motionlessly in front of the house. Therefore, I decided to go on a quick walk, within a limited area. I also concluded that if I started walking in circles tha...
Given latitude/longitude of two points on the Moon (lat1, lon1) and (lat2, lon2), compute the distance between the two points in kilometers, by using any formula that gives the same result as the haversine formula. Input Four integer values lat1, lon1, lat2, lon2 in degree (angle) or four decimal values ϕ1, λ1, ϕ2, λ2...
I have a series of binary switches, which I can represent as a bit string. The last person who used my switches left them in some arbitrary state without cleaning up, and it bugs me. I always keep the switches in one of four possible "tidy" configurations: All 1: e.g., 111111111 All 0: e.g., 000000000 Alternating 1 an...
Not sure if this is the correct community to post this is. But as I see this problem as an interesting puzzle to solve, I'd thought to give it a shot... Problem Statement: Let`s say we have: N collections of parts: A, B,C,D,...etc Each collection consists of n parts: 1,2,3,4,5 ... All these parts are randomly present...
Input: A list of integers (which will never contain a zero) Output: A list of the same size with counts based on the following: If the current item is negative: Look at all items before this item, and count how many times the digits occurred in those other numbers If the current item is positive instead: Look at all i...