instruction
stringlengths
34
53.1k
On December 4, 2017, the Google Doodle was a graphical programming game featuring a bunny. The later levels were nicely non-trivial and they seemed like a great candidate for an atomic-golf challenge. Details Game There are four available moves: hop forward, turn left, turn right, and loop. Each of these moves is one ...
If a string T of length K appears K or more times in a string S, then it is potentially communistic. For example, 10 in 10/10 is potentially communistic, for it appears 2 times and is of length 2. Note that these substrings cannot overlap. A communistic transformation is one that takes this string T and moves each cha...
Many digital clocks display the time using simplified digits comprised of only seven different lights that are either on or off: When mirrored horizontally, the digits 018 don't change because they are symmetrical. Also, the digits 2 and 5 get swapped, 2 becoming 5 and vice versa. All the other digits become invalid w...
Your task is to determine whether two numbers are easy to multiply. This means that their base-10 long multiplication doesn't have any carrying (regrouping) between place values, looking at both the multiplication steps and the addition step. This happens when each pair of digits being multiplied gives 9 or less and th...
Given an integer n, return the number of ways that n can be written as a list of prime numbers. For example, 2323 can be written as (2,3,23), (23,23) or (2,3,2,3) or (23,2,3), so you would output 4. If it can not be written in this way, you should output 0. A prime number such as 019 or 00000037 is a valid prime for th...
Inspiration. Posted with permission. Print one of the possible XKCD calendar "facts": You can get the raw text and structure from my APL reference implementation or from Explain XKCD's transcript (including the title text just under the illustration). Rules At every decision node, there must be an equal (pseudo-)rando...
A superabundant number is an integer n that sets a new upper bound for its ratio with the divisor sum function σ. In other words, n is superabundant if and only if, for all positive integers x that are less than n: $$\frac{\sigma(n)}n>\frac{\sigma(x)}x$$ For a few of the values: n σ(n) σ(n)/n superabundant 1 1 ...
Note to mods, if the title doesn't do justice, change it to whatever, I thought it was funny. You're tasked with hanging up the lights for this Christmas season, and your family has decided that for it to be a merry Christmas, you need to hang at least 2 Christmas lights on your house. So, your challenge is, given a n...
Background Minifiers are used, commonly, when serving JavaScript to your Web Browser. It is commonly used to reduce the number of bytes that have to be sent. Saving bandwidth is useful for obvious reasons. Some people use obfuscaters (that intentionally make code harder to read), I am not talking about those. We wil...
Do you remember my mat properly grouped by colors? Yesterday I was looking at it and realized that some letters fit inside others. Example: a letter P fits in the place where the letter R goes. So here's a simple challenge: given two letters, return a truthy value if any one of the letters fits inside the other (direc...
Your challenge is to take an array of strings and output the longest string in the array. So for ["tiny", "small", "bigger", "biggest"] the output would be biggest. If two elements of the array have the same length, you should choose the one that appears first in the array. That means if the array looks like this: ["o...
To check whether a list of non-negative integers is balanced, one can imagine putting respective weights on a board and then try to balance the board on a pivot such that the summarized relative weights left and right of the pivot are the same. The relative weight is given by multiplying the weight with its distance to...
Mafia (also known as Werewolf) is a party game that plays roughly like this: The game begins on day 0. After every day n comes a night n. After every night n comes a day n+1. i.e. D0, N0, D1, N1, D2, N2... At the dawn of day 0, a host secretly chooses players to fill certain roles:   Some number of players become th...
Covalent bonding uses so-called "hybrid" orbitals to form tetrahedral, octahedral, etc. formations out of the s, p, and sometimes d orbitals. Their naming conventions are pretty much the concatenation of the component orbitals; for example, the hybridization of the s orbital and one p orbital would be the two sp orbita...
Definition An arrowhead matrix is a matrix that has all entries equal to 0, except the ones on the main diagonal, top row and leftmost column. In other words, the matrix should look like this: * * * * * * * * 0 0 0 0 * 0 * 0 0 0 * 0 0 * 0 0 * 0 0 0 * 0 * 0 0 0 0 * Where each * is any non-zero entry. Task Given a squa...
The question: Given an a number n ≥ 2, how many distinct pairs of points on an n-dimensional n x n x n x n x n x n ... x n lattice, where the coordinates range from 0 to n - 1, are a distance at least n apart? The pairs {(2,1,3,1), (3,2,1,3)} and {(3,2,1,3), (2,1,3,1)} are not considered distinct from each other, as th...
We often see music videos on Youtube. Many Youtube channels that host music videos are "powered by VEVO". Those can be easily identified by both embedding VEVO at their video thumbnails and appending VEVO to their channel name. Now write some code to test whether a string given by user is a VEVO user account or not. Re...
Explanation In this task you'll be given a set of N points (x1,y1),…,(xN,yN) with distinct xi values and your task is to interpolate a polynomial through these points. If you know what Lagrange interpolation is you can skip this section. The goal of a polynomial interpolation is to construct the (unique) polynomial p(x...
Given a drawing of the letter shoot system, where an existing piece of pipe is marked with a *, and an empty spot is marked with a ., your task is to compile a lexicographically sorted list of index tuples [entry row, entry column, exit row, exit column], where each index is 0-based. Entry and exit points are always on...
The 52 week challenge is a way to save money. For example, Week 1, you save $1.00. Week 2 you save $2.00, and it continues through the year, adding one more dollar to each week’s savings goal. By Week 52, you’ll set aside $52.00, which will bring the year’s total savings to $1,378! Of course, you can decide how much mo...
A venerated pass time of pedants is to point out that pictures of "Rubik's Cubes" (on t-shirts, posters etc.) are not actually solvable. The first thing that should be checked is that the cube is made up of the right pieces. To be solvable a cube needs six colors each with nine squares. The cube also needs each edge ...
Your task is to program a mathematical function \$s\$, that takes a nonempty finite set \$A\$ of points in the 2D plane, and outputs an uncircularity score \$s(A)\$ that satisfies following properties: Positive Definiteness: If there is a circle or a straight line that contains all points of \$A\$, then \$s(A) = 0\$. ...
A mountain is defined to be a set of line segments whose first point has coordinates (0,a) where a > 0, and whose last point has coordinates (b,0), where b > 0. All intermediate points have a y-coordinate (ordinate) strictly greater than 0. You are given the points on the mountain sorted in ascending order of x-coordin...
(This might be quite classic but this is my first post here, so I'm not ready for the fancy stuff yet) The Goodstein sequence is defined for an input number as follows: Pick a starting number n, let b=2 and repeat: write n in heriditary base b notation substitute all the (b)s to (b+1)s in n and substract 1 output the ...
Challenge Given a whole number divisible by 9 and one missing digit, find the missing digit. The missing digit may be represented by any character other than the digits 0-9 as long as it is consistent. If the missing digit could be 0 or 9, output something to signify so. Assume the user is intelligent enough to put onl...
Introduction This challenge requires you to set the trailing zeros of an integers binary representation to 010101…, this is best explained with an example: Given the integer 400, the first step is to convert it to binary: 110010000 As we can see the fifth bit is the least significant 1 bit, so starting from there we r...
inspired by this chat conversation A satisfying number is a number whose decimal representation is of the form abx, with the following properties: x is the longest trailing repeating suffix, or the last digit if there is no repetition at the end (123333 -> 3333, 545656 -> 5656, 123 -> 3) b is the single digit prior to...
I posted this challenge a while ago, which concerns how many elves Santa needs to deliver presents. Due to population increase, Santa is a little more pressed for time this year. Although in the past we operated very asynchronously, we are beginning to experiment with being more and more synchronized. So, Santa needs t...
Challenge Given two digits 0-9 as input, output a domino (from the double-nine domino set) with these number of pips (dots) on the two faces. The ten possible faces look like this (separated by pipes): | | o| o|o o|o o|o o o|o o o|o o o|o o o | o | | o | | o | | o |o o|o o ...
Introduction This is a follow-up of this challenge where you're taking the role of that person's evil twin. Being evil you don't want to maximize your share, but rather be as unfair as possible and you're not going to make it too obvious, that's why you came up with the following scheme: You're going to tell the others...
In this challenge we learned a way to encode every positive integer using factor trees. Here is how it works: The empty string has value of 1. (S) where S is any expression with a value of S evaluates to the Sth prime. AB where A and B are arbirary expressions with values of A and B respectively has value A*B. For ex...
This has no practical purpose but it could be fun to golf. Challenge Given a number n, Count the amount of each digit in n and add 1 to each count Take the prime factorization of n Count the amount of each digit in the prime factorization of n, without including duplicate primes Create a new list by multiplying togeth...
Input: An integer N which represents the polygon's vertices and a list of their x and y coordinates. Expected output: The smallest difference possible between the area of the(not necessarily convex) polygon and the triangle containing it. The triangle also has to share at least 2 vertices with the polygon. If there is ...
Christmas is coming up, and this year you have been charged with organizing your family's christmas get-together. You have a list of foods you want be there, but before you assign foods to people, you need to know who's coming. So... Challenge Given an input of relative's names separated by commas or whatever (note tha...
You have been given N piles of coins. You have decided to divide each of those B1, B2, ..., BN piles among separate groups of people. The amount of people receiving coins has to be a prime number and the amount of money given to each person must be different in each pile. Input: N, B1, B2, ..., BN (The amount of coins ...
Given an input of a note, output an ASCII drawing of the corresponding major key on the treble clef. Here are all the major keys (that don't include double-sharps or double-flats) and their corresponding key signatures: Circle of fifths deluxe 4 by Wikipedia user Just plain Bill, copyright CC BY-SA 3.0 If the input is...
Introduction You have a friend that keeps asking you for loans and you are getting tired of it. Today, he came for a loan again. Instead of turning down his offer, you get a great idea: troll your friend by giving him as many coins/bills as possible. Challenge You will take as input: the amount of money your friend wa...
Background A typist comes home wfter some riugh drinkinh and realizes thag an importsnt letter still needs to be wtitten. To make sure he vets the text correct, he writes the text character bh vjaracter t0 be sure of 6he resuly. However, he dtill manages t0 miss some ofbthe keys. Yout task is to write cose that simulat...
Challenge We all know about normal Christmas trees - but how about an upside-down Christmas tree! This is a fairly easy, Christmas themed challenge. The objective of this challenge is to make me an ASCII upside-down Christmas tree. Here are the rules for this challenge: Accept an odd, positive integer. You can assume ...
In this challenge you will be asked to implement any function (or full program) that fulfills two properties. Those properties are: Your function must be an injective (reversible) function from the polynomials with non-negative integer coeffecients to the non-negative integers. This means no two unequal inputs can m...
Challenge Your task is to write a program which, once a second (including immediately when your program is started), prints the elapsed time from the time your program was started. Rules Time must be printed in hh:mm:ss format. (leading zeros for single-digit values) The time stamps must be separated by CR, LF, or CRL...
In this challenge I will ask you to find a QR decomposition of a square matrix. The QR decomposition of matrix A is two Matrices Q and R such that A = QR. In particular we are looking for Q to be an orthogonal matrix (that is QTQ=QQT=I where I is the multiplicative identity and T is the transpose) and R to be a upper...
Starting with a positive integer N, find the smallest integer N' which can be computed by repeatedly dividing N by one of its digits (in base-10). Each selected digit must be a divisor of N greater than 1. Example #1 The expected output for N = 230 is N' = 23: Example #2 The expected output for N = 129528 is N' = 257:...
In chat, we are often fast-typers and don't really look at the order of letters before posting a message. Since we are lazy, we need a program that automatically swaps the last two letters in our words, but since we don't want to respond too late, the code must be short. Your task, if you wish to accept it, is to write...
Your program must print out this exact sequence: 1 2 4 10 24 54 116 242 496 1006 2028 4074 8168 16358 32740 65506 131040 262110 NOPE! As usual, shortest program wins. Standard code golf rules apply.
A set of dominoes consists of tiles with two numbers on them such that every combination of integers from 0 to N are represented. Examples below refer to N=6 out of convenience, but N=9 and N=12 are also common. The orientation of the tiles does not matter (they are usually printed with dots rather than digits), so [1-...
Given a key, and an array of strings, shuffle the array so that it is sorted when each element is XOR'd with the key. XOR'ing two strings To XOR a string by a key, XOR each of the character values of the string by its pair in the key, assuming that the key repeats forever. For example, abcde^123 looks like: a ...
Write a program or function that takes N, and S and outputs the number of palindromes of length S you can build using an alphabet of size N such that any prefix of size between 2 and S-1 is not a palindrome. For example if N were 2 and S were 5 The valid palindromes would be 01110 10001 And thus the answer would be 2 ...
Background The nuclear industry has term, SCRAM, used to describe a quick shutdown of the reactor. There's a fun myth that it stands for "Safety Control Rod Ax Man," the role which served to shut down the Chicago Pile if it got too hot by literally cutting a rope with an ax (although this was debunked). The US Nuclear...
Your task is to print the text Good morning, Green orb!, with every character repeated in place as many times as the most frequent byte in your source (the mode). A trailing newline is permitted and need not be repeated. For example if your source was print p Since p appears twice and every other byte appears once yo...
(There exists some challenges that require to use the best strategy, but here we don't. Even if you are able to win, you are allowed to make a tie) Challenge Write a program which plays the game tic-tac-toe. It must not lose (therefore, it should end the game either with a tie or by winning). Allowed I/O methods Input...
Left and right Riemann sums are approximations to definite integrals. Of course, in mathematics we need to be very accurate, so we aim to calculate them with a number of subdivisions that approaches infinity, but that's not needed for the purposes of this challenge. You should instead try to write the shortest program,...
Imagine enumerating the elements of rhombi which grow [1],[1,3,1],[1,3,5,3,1],… (only odd numbers such that they align nicely). This would look like as follows, note that you always begin enumerating with 1: 01 1 02 03 04 1 2 3 4 05 06 07 08 09 … 5 10 11 12 ...
A doubly linked list is a data structure in which each node has a value as well as "links" to both the previous and next nodes in the list. For example, consider the following nodes with values 12, 99, and 37: Here, the nodes with values 12 and 99 point to their respective next nodes, with values 99 and 37. The node w...
What is the shortest way we can express the function f(a,b)(c,d)=(a+c,b+d) in point-free notation? pointfree.io gives us uncurry (flip flip snd . (ap .) . flip flip fst . ((.) .) . (. (+)) . flip . (((.) . (,)) .) . (+)) which with a little bit of work can be shortened to uncurry$(`flip`snd).((<*>).).(`flip`fst).((....
The idea of this is mainly from BIO 2017 q1. I got the idea for posting this challenge from my Binary Sequences challenge, since lots of people seemed to like it. Also, this is the first challenge I've posted without posting on the sandbox. I'll delete it if no one likes it. Rules Take in a sequence of digits in ternar...
Rules Given a list of integer coordinates, l, with a length of at least 4, and an integer n such that n is smaller than the length of l (but at least 3), return the largest area of an n-sided polygon satisfies: is simple (not self-intersecting). has all the coordinates of its n vertices in the list l. has no three con...
Today while playing with my kids I noticed that an apparently simple toy in the park hid a challenge. The wheel has a triangle that points to a number, but also has three circles that point to the numbers every 90 degrees from the first one. So: Challenge (really simple) Given an integer between 1 and 12 (the one poi...
It is the year MDLXVII in a world in which the Roman Empire never fell, and the collapse into the dark ages never occurred. Due to the extended period of Pax Romana, the empire's economic stability enabled technology to progress at a rapid rate. The Romans have begun to dabble with circuitry, and have invented an inge...
Challenge Given a non-negative integer, output whether it is possible for two dates (of the Gregorian calendar) differing by exactly that many years to share a day of the week. A year is assumed to be a leap year either if it is divisible by 4 but not by 100, or if it is divisible by 400. Output may be: falsey/truthy ...
So you want to create a haiku, but you're not sure if it follows the syllable rules for a haiku. I couldn't be bothered to write a proper blurb like I usually do, so you'll have to make do with this. Let's get stuck right in. Finding a haiku out in the wild For the purposes of this challenge, we will be checking if the...
Robbers post A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string: Split the string into equal sections. Reverse the strings, and starting from the start of each string. Pu...
Cops post A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string: Split the string into equal sections. Reverse the string, and starting from the start of each string. Put ru...
It is well known that odd primes will appear in Pascal's triangle exactly twice. However, not all numbers that appear exactly twice in Pascal's triangle are prime. We'll call these numbers Pascal primes. Pascal primes are composite numbers that appear exactly twice in Pascal's triangle. The first few Pascal primes are...
I really like times that follow certain patterns. In particular, I like times where all the digits are the same, or all of the digits increase arithmetically by one from left to right. Further, I viscerally hate when people put letters in my times, so all of that AM/PM nonsense is dead to me. Thus, my favorite times ar...
A riffle shuffle is a type of shuffle where the deck is split into two partitions and the partitions are then spliced back together to create a new shuffled deck. The cards are spliced together in such a way that cards maintain their relative order within the partition they are a member of. For example, if card A is b...
Inspired by Taken from a question at Stack Overflow. The challenge Given an integer n>1, output all arrays that can be obtained by swapping exactly two entries in the array [1, 2, ..., n]. The arrays can be produced in any order. You can consistently use [0, 1, ..., n-1] (0-based) instead of [1, 2, ..., n] (1-based). A...
Challenge Given a grid like this, 1 2 3 4 5 6 7 8 1 . . . . . . . . 2 . # . . . # . . 3 . . . . . . . . 4 . . . . . . . . 5 . . . . . . . . 6 . . # . . . . . 7 . . . . . . . . 8 . . . . . . . . write a piece of code that can determine the size of the largest square that does not include a '#'. (The answer to this in...
Balanced ternary logic Ternary is normally another name for base 3, that is to say, each digit is 0, 1, or 2, and each place is worth 3 times as much as the next place. Balanced ternary is a modification of ternary which uses digits of -1, 0 and 1. This has the advantage of not needing a sign. Each place is still worth...
Challenge Given any positive integer supported by your language: Take the input and divide it into two halves. For all divisions in this program, if the input is odd, round one half up and one half down (ex: 7 -> 3,4, not 7 -> 3.5,3.5). Divide either number in half, then take the larger of these two new halves and add...
Yesterday I asked this question about riffle shuffles. It seems that yesterdays question was a bit too hard so this question is a related but much easier task. Today you are asked to determine if a permutation is in fact a riffle shuffle. Our definition of riffle shuffle is adapted from our last question: The first ...
A loop is a pretty simple algebraic structure. It is a tuple (G,+) where G is a set and + is a binary operator G × G → G. That is + takes two elements from G and returns a new element. The operator is also required to fulfill two properties Cancellation: For every a and b in G there exists unique x and y in G such ...
The optimal matrix (for the rather narrow scope of this challenge) is obtained by "zipping" the elements from the corresponding rows and columns of a square matrix and getting the maximum of each pair. For instance, given the following matrix: 4 5 6 1 7 2 7 3 0 You can combine it with its transpose to get: [[[4,5,6],[...
If a positive integer \$N > 2\$ has (strictly) less prime factors (without counting multiplicities) than its successor and its predecessor, we will call it a factor-poor number. In other words, \$\omega(N) < \omega(N - 1)\$ and \$\omega(N) < \omega(N + 1)\$, where \$\omega(N)\$ is the number of unique prime factors of...
This is a overhaul of this now deleted question by ar kang. If the OP of that question would like to reclaim this question or has a problem with me posting this I'd be happy to accommodate Given a list of integers as input find the maximum possible sum of a continuous sublist that starts and ends with the same value....
Write a mathematical statement, using the symbols: 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) varia...
Redivosite is a portmanteau word invented for the sole purpose of this challenge. It's a mix of Reduction, Division and Composite. Definition Given an integer N > 6: If N is prime, N is not a Redivosite Number. If N is composite: repeatedly compute N' = N / d + d + 1 until N' is prime, where d is the smallest diviso...
This post is loosely inspired by this mathoverflow post. A Vanisher is any pattern in Conway's Game of life that completely disappears after one step. For example the following pattern is a size 9 Vanisher. An interesting property of Vanishers is that any pattern can be made into a vanishing one by simply adding mo...
The Task Given an input positive integer n (from 1 to your language's limit, inclusively), return or output the maximum number of distinct positive integers that sum to n. Test Cases Let f define a valid function according to the task: The sequence for f, starting at 1: 1, 1, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5...
I know it's 1.5 weeks after Christmas but trying to print an isosceles triangle in a monospaced font makes it look weird. Challenge Print the alphabet from A to Z so that it forms a filled triangle in the output. For each line in the output, starting from "A", add the next letter. No inputs, only outputs. Pad the leadi...
Introduction: At home we have a clock that strikes the stated amount at each hour, but also strikes once at every half-hour. So from 0:01 to and including 12:00 it strikes in this order: 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 1, 11, 1, 12 Challenge: Given an integer n, output a list of time-frame...
Inspired by We had a unit test once which only failed on Sundays, write a program or function that does nothing but throw an error when it is Sunday, and exit gracefully on any other day. Rules: No using input or showing output through the usual IO methods, except to print to STDERR or your language's equivalent. You ...
A zigzag scan is a method of encoding 2D information in one dimension: Write a function or program that, given a one-dimensional string of printable ASCII characters, will reverse the zigzag scan to arrange its characters into a square. For example, given the input string ABeIfCDgJmnKhLop, your program should return: ...
Thanks to this question for some inspiration In this challenge we will represent a line of dominoes as a string of |, / and \. You will be given a string of dominoes as input and you must determine what they look like when they have settled. Here are the rules for how dominoes fall over A standing domino, |, left ...
Rules Given an ISO3166-1-Alpha-2 country code your task is to decide on the traffic direction for that country: Input will be a valid country code (valid as in it's an element of the two lists provided) Input may be a list of two characters instead of a string if it helps You may choose to take input in lowercase You ...
My brothers and I like to play Cribbage. Now, the scoring rules for Cribbage are somewhat complicated, and I often worry that I'm not counting my score correctly. Therefore, your job is to write a program that will correctly score my hand. Scoring There are two ways to score points in Cribbage: during pegging, and wh...
Challenge Given a n-dimensional array of integers and a permutation of the first n natural numbers, permute the array dimensions accordingly. Details This challenge is inspired by MATLABs permute. demonstration The permutation is given as a list of integers, e.g. [1,3,2] means 1 gets mapped to 1, 2 gets mapped to 3 and...
Husk is a quite new golfing language, created by PPCG users Leo and Zgarb. It has begun being more and more competitive, often staying close or even beating languages known to be very terse, such as Jelly and 05AB1E. Let's list some of the golfing techniques that are somewhat specific to Husk. As always, please post on...
pannenkoek2012 aims to complete Super Mario 64 with as few presses as possible of the A button, which makes Mario jump. Each "A press" consists of three parts: Pressing the button Holding it for any length of time Releasing it See this video (1:15 - 3:23) for a great explanation that includes the above image. (Howe...
The Problem: Two enemy secret agents have devised a wonderful (for you) method of communication! Here’s how the encryption process works: 1) Take the ascii equivalents of each letter. (No spaces, numbers, or punctuation are sent) 2) For each letter in the message, the ascii equivalent of it and the letter after it (If ...
The Collatz conjecture postulates that if you take any positive integer, then repeat the following algorithm enough times: if number is odd, then multiply by three and add one if number is even, then divide by two you'll eventually end up at 1. It seems to always work, but it's never been proven that it always does. Y...
The Simplest N-Dimensional shape one can create for any dimension is a Simplex, and this is a set of N+1 points that are all equal distance away from eachother. For 2 dimensions, this is an equilateral triangle, for 3 dimensions, this is an regular tetrahedron, at 4 dimensions is the 5-Cell and so on. The Challenge Giv...
In Vim, you can repeat a command by preceding it with a number, like 3dd is equivalent to dd dd dd. Well, this repeating pattern is not restricted to Vim commands. String can be replicated in this way, too. Specification: Given a string, consisting of only digits, alphabetical characters (both upper-case and lower-case...
Bertrand's postulate states that there is always at least 1 prime number between n and 2n for all n greater than 1. Challenge Your task is to take a positive integer n greater than 1 and find all of the primes between n and 2n (exclusive). Any default I/O method can be used. Whoever writes the shortest code (in bytes)...
Ethereum is a blockchain platform. It has its own native cryptocurrency, ether, but in this challenge, we'll be focusing on its ability to run smart contracts. The ERC-20 standard describes an implementation of fungible tokens within a smart contract. Some examples of this implementation are EOS, OmiseGo, and the Golem...
Task: convert a HTML page into a mountain! When HTML pages are indented, they can look like: <div> <div> <div> </div> <div> <div> </div> </div> </div> </div> But to be honest, a mountain is more representative of this structure. So we can rewrite it as: ...
Given the sequence OEIS A033581, which is the infinite sequence, the n'th term (0-indexing) is given by the closed form formula 6 × n2 . Your task is to write code, which outputs all the subsets of the set of N first numbers in the sequence, such that the sum of the subset is a perfect square. Rules The integer N is g...
Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this file one character at a time, and at each step must guess the next character. This is code-challenge. Your score will be 2...
Let's play some code-golf! The challenge is to find the winner of a game of Tic-Tac-Toe. This has been done many times by giving a board that has one clear winner but here is the twist: The cells are numbered like this: 1|2|3 -+-+- 4|5|6 -+-+- 7|8|9 You get an array of exactly 9 moves like that: {3, 5, 6, 7, 9, 8, 1, ...
I have a problem at work. I need to compare two numbers that come as strings from two different databases. The numbers may come with leading zeroes and/or leading/trailing spaces. So I may have "0001 " from one database and " 1 " from the other one. I solved the problem in C# with the following code: Func<string, st...