instruction stringlengths 34 53.1k |
|---|
Until decimalization in 1971, British money was based on dividing the pound into 240 pennies. A shilling was 12 pennies so 20 shillings made a pound. The smallest denomination was the farthing at one fourth of a penny. There were many other denominations and nicknames for coins, which can get quite confusing if you're ... |
The Setup
Suppose you're given n fuses, with 1 ≤ n ≤ 5, each of which is a meter long, and where each fuse has an associated burn rate of N meters per D hours.
A fuse can be lit at one or both ends, subsequently extinguished at one or both ends, relit, re-extinguished, etc., as many times as needed until the fuse is fu... |
When it comes to eating candy, I hold myself to higher standards than the typical layperson. There is a delicate balance between "mixing it up" and "saving the best for last."
In this challenge, you will be given a string of characters in which each character represents a piece of candy. Different characters (case-se... |
Note: This challenge is now closed to new cop submissions. This is to ensure that no one can post submissions that only remain uncracked because there aren't enough robbers interested in the challenge anymore.
In this game of cops-and-robbers, each cop will write a simple program to give a single output. They will t... |
This is the companion thread to the main Unscramble the Source Code challenge. If you think you have managed to unscramble one of the cop answers, you should post your solution as the answer to this thread.
As a reminder, you have one attempt at cracking each submission. Your cracking attempt will be an unscrambled ve... |
Generate a Koch Snowflake
A Koch snowflake is a triangle that for each n, another equilateral point is added in the middle of each side: http://en.wikipedia.org/wiki/Koch_snowflake#Properties
We already had a kolmogrov-complexity Koch Snowflake challenge for n=4. The new challenge is to draw a Koch snowflake with any ... |
This challenge is partly an algorithms challenge, partly an optimization challenge and partly simply a fastest code challenge.
A cyclic matrix is fully specified by its first row r. The remaining rows are each cyclic permutations of the row r with offset equal to the row index. We will allow cyclic matrices which are n... |
Background
In typography, rivers are visual gaps in a block of text, which occur due to coincidental alignment of spaces. These are particularly annoying since your brain seems to pick them up more easily in peripheral vision, which constantly distracts your eyes.
As an example, take the following block of text, lines ... |
WinAli is a model assembler for Windows. It emulates a real CPU and is meant to help students learning and understanding the Assembly language.
German Wikipedia article: http://de.wikipedia.org/wiki/WinAli (there is no english article at the moment)
In case you want to test your produced output: Link to Google Drive (t... |
Introduction
Pi is
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089...
Let's treat each digit as an instruction as to how to get to the next digit.
The first digit is 3.
Counting three digits after the first digit, we arrive at 1.
One digit after this 1 is a 5.
Five digits after that ... |
I have a simple task that should be relatively easy to implement by means of code. Your goal is to write a program that will output the time written in Spanish, given the time in HH:MM format. Many people likely don't know how to do this, so I will elaborate.
Time in Spanish is fairly logical. It usually follows the pa... |
Challenge
Write a function or program which takes a positive decimal number, call it A, and output two positive numbers, B and C, such that:
A == B bitxor C
B and C must not contain any of the digits 0, 3 or 7 in its decimal representation.
Examples
>>> decompose(3)
1, 2
>>> decompose(7)
1, 6
>>> decompose(718)
121, ... |
The board game
In the board game "Carcassonne" players place tiles by matching their edges and earn the highest scores through creating large contiguous areas of terrain. The following are (roughly) the types and quantities of tiles included in the game:
#01 x4
#02 x5
#03 x8
#04 x2
#05 x9
#06 x4
#07 x1
#08 x3
#... |
Your task is, given a square grid of digits (0-9), output one of the ways that the digits can be grouped such that:
Each digit is part of exactly one group
All groups have the same number of digits
All groups are bounded by one polygon-like shape (this means that every digit in the group is next to [left, right, up, d... |
The goal of this codegolf is evaluating the cumulative distribution function of the student-t probability distribution. This is not trivial since there is no closed form and the function is dependent of two variables v and x. The distribution function is
For getting the CDF you could integrate this function from -inf... |
Objective
Write a routine that accepts a string of printable ASCII characters, s, and returns a string containing the same characters as s, reordered so that no two-character substring appears more than once. The program must process all benchmark strings (see below) in under one minute each on a modern computer. I wi... |
In this form of the game Tic-Tac-Chec, the goal is to move chess pieces to get four-in-a-row. Your goal here is to figure out if a position has a winning move.
Rules
The rules are similar, but not identical, to those of Tic-Tac-Chec.
The board is 4 by 4 squares. Each player has a rook, bishop, knight, and queen. On you... |
Challenge: implement calculation of a Delacorte Number in any language. Shortest code wins.
For a given square matrix of distinct integers 1..n² (possible side length n at least between 3 and 27), its Delacorte Number is the sum of the products gcd(a, b) × distance²(a, b) for each distinct pair of integers {a, b}.
The... |
The Challenge
In this challenge, you specify a source language S and a target language T. Your task is to write the following program P in the language S. If a valid program Q in the language T is given as input to P, it will output a valid program R in the language T which takes no input and outputs Q(R), that is, the... |
Everyone knows that the content makes the question. But a good title helps too, and that's the first thing we see. It's time to turn that first impression into a program, and figure out what kinds of titles get more upvotes.
You are hereby challenged to write a program or function that takes the title of a PPCG questio... |
In this challenge, you are given a map of a two-dimensional terrain, viewed from the side. Unfortunately, some parts of the terrain are floating in the air, which means they'll come crashing down. Your job is to predict where they land.
The Input
Your input is one or more newline-separated strings of equal lengths, con... |
In 1984, Michael Crichton wrote a security program in BASIC that was published in Creative Computing magazine. The program would ask the user to type a phrase of their choice, record the intervals between the keystrokes, then ask them to retype the phrase. If the timings differed by too much, the program would identify... |
Task
The task is to tile polygons, given a vertex configuration.
Scoring
Your score is equal to the "complexity level" your submission reaches. Complexity levels are cumulative, meaning that to reach #3 you must also support #1 & #2.
Submissions at an equal complexity level are distinguished by byte count; lowest wins... |
Notice: Following popular demand I have slightly relaxed the rules:
The maximum regex size grows by 1 byte every 5 answers. Answer N may use up to 29 + ⌈N/5⌉ bytes.
The score of each answer will be (M/(30+N/5))N
In regex golf, you're given two sets of strings, and are asked to create the shortest regex which match... |
Introduction
You are stranded on a deserted island with some servants and are hunting for treasure. The longer one searches, the more treasure one finds. The fewer people searching, the more each person finds.
Due to limited supplies, the leader has decided that a few people, up to a quarter of the group, shall be left... |
This challenge's concept is pretty simple. All you have to do is write a program that will compile as both valid C and valid C++! Well, there are some catches. The program must behave differently when compiled in each language. The program must have different output for each language in order to be considered "behaving... |
Your job is to write a program (or two separate programs) in any language that:
Can take a completed Sudoku board as input (in any logical format) and compress it into a string of characters
Can take the compressed string as input and decompress it to get the exact same completed Sudoku board (output in any logical fo... |
Digesting a polygon is a process in which you take an input polygon, and create another polygon that can contain the entirety of the input polygon, while having one side less than it.
The goal of this challenge is to generate the optimal polygon digest- a polygon digest that has the minimum area possible.
Your challeng... |
This is supposed to be a code golf challenge on the simpler end of the spectrum. But I figured it could be nice to bring out some micro-optimisation here.
There are three basic types of DVI connectors: DVI-A (analog), DVI-D (digital) and DVI-I (integrated). Furthermore, there are single-link and dual-link versions of t... |
You are given integers N and M, 1 <= N,M <= 10^6 and indexes i and j. Your job is to find the integer at position [i][j]. The sequence looks like this (for N=M=5, i=1, j=3 the result is 23):
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
Shortest code wins. Good luck!
|
Sequences
You are given four number sequences, numbered 1 through 4.
OEIS The location of 0's when the natural numbers are listed in binary. Here's an example of how to calculate the sequence:
0,1,10,11,100,101,110,111
^ ^ ^^ ^ ^
0 3 78 10 14
The start of the sequence goes like this: 0, 3, 7, ... |
Let's say you have a list of words and you want to be able to use letter cards to spell each word. For example, to spell cat, you would use three cards labelled C, A, T.
Assuming each card is double-sided, submit a program to define a minimum number of cards that can be used to spell the entire list of words.
Input is ... |
This is a challenge of practicing golf optimization in Python -- reusable tricks and shortcuts to shave off a few characters. Many will be familiar to Python golfers and use common ideas from the Python Tips. Some of these use Python-specific features that you might not know exist unless you've seen them, so do take a ... |
The shortest C# code that generates an uncatchable ExecutionEngineException wins. You are not allowed to call FailFast directly or indirectly.
|
The aim of this challenge is to write a program that satisfies the following conditions:
The program is not palindromic, or essentially palindromic (meaning that it is possible to remove characters to make it a palindrome without changing the effects of the program).
The program is not an involution (meaning that it d... |
As we all should know, there's a HTTP status code 418: I'm a teapot.
Your mission, should you choose to accept it, is to use your creativitea and write the smallest possible server that responds with the above status code to any and every HTTP request made to it.
Standard loopholes apply, including
Fetching the desire... |
Today, your task is to write a program (or a function) that accepts a string and outputs (or returns) four integers.
Input
The input string is a CSS3 selector, and can contain basically any Unicode character.
Output
The output represents the CSS specificity of this selector.
The first number is always 0 (because it'... |
Consider the function Remove(n, startIndex, count) that removes count digits from the number n starting from the digit at position startIndex. Examples:
Remove(1234, 1, 1) = 234
Remove(123456, 2, 3) = 156
Remove(1507, 1, 2) = 07 = 7
Remove(1234, 1, 4) = 0
We will call the prime number X fragile if every possible Remov... |
The goal is to find a way better than the current best known way of encoding the index of a child HTML element, so that encoded indices have the following property.
if (index_i >= index_p) {
assert(encoding(index_i).indexOf(encoding(index_p)) == 0);
}
if (index_i < index_p) {
assert(encoding(index_i).indexOf(enco... |
Your task is to create a program which outputs a completed tournament bracket given a list of entrants, their seeds, and their scores in each game; in the fewest characters possible.
Input
Your entrants will have the following data. You can organize your data in whatever form you like, but you cannot pre-sort your arra... |
You just invited a liberal arts major to your house and you're telling him/her
"You know, I am a great programmer and I can do x and y and z..."
S/he quickly gets bored and asks you:
"If you really are a great programmer, can you make a programme to let me draw, I just need to draw lines on the screen by using the
... |
Choose your favorite famous computer scientist or computer science pioneer who was born in 1942 or earlier (as 1943 marks the start of the creation of the 'first' computer). They should have a Wikipedia page or other site that lists their birth year and tells how their accomplishments relate to computer science. You ma... |
The Challenge
In as few characters as possible, find the value of \$i^n\$, given \$n\$, a positive integer greater than 0. This should be outputted as a String.
For those that don't know, \$i\$ is defined such that \$i^2=-1\$. So:
\$i^1=i\$
\$i^2=-1\$
\$i^3=-i\$
\$i^4=1\$
This then repeats..
Rules
If your language s... |
I just discovered this website and was amazed. Somehow this challenge popped into my mind:
Provided a very long list of words; Write or describe an algorithm which finds a regex to match them all.
Ex.: A very long list of Dates, model-numbers, CD-Codes, ISBNs et cetera.
I hope it's not too big or does not belong here. ... |
Credits for the challenge idea go to @AndrewPiliser. His original proposal in the sandbox was abandoned and since he has not been active here for several months, I have taken over the challenge.
Balanced ternary is a non-standard numeral system. It is like ternary in that the digits increase in value by a factor of 3 a... |
Cyclic Equivalence
Let L be a list of pairs of letters, for example [(a,b), (a,c)]. We call L a list of commutators. Two words are cyclically equivalent over L, if one can be transformed into the other using the following operations:
Cyclic shift: pop a letter from the beginning, and push it to the end.
Commutator swa... |
Create a bidirectional Gematria calculator, for any given sequence of Unicode characters as the alphabet.
Gematri-What?
Gematria is a system of assigning numerical values to symbols, developed by ancient Greeks and adopted by ancient Jews. It is in a way like ASCII or Unicode, it's just non-linear... See the following ... |
A perfect square is a number that is the square of an integer.
However, let's define something called a Magical Square, which is a perfect square with the following restriction:
The perfect square must be the sum of the numbers 1...N for some natural number N. Write a program that calculates the first X magical squar... |
Leaderboard - JIT Compiled (Lower is better)
es1024 - 81.2 points (including a working compiler!)
Kieth Randall - 116 points
Ell - 121 points
Leaderboard - Interpreted (Lower is better)
Martin Büttner - 706654 points (somewhere around 2 hours).
criptych - 30379 points (97 seconds)
Your mission, should you choos... |
Objective:
The objective is to calculate e^N for some real or imaginary N (e.g. 2, -3i, 0.7, 2.5i, but not 3+2i). This is code golf, so, shortest code (in bytes) wins.
So, for example:
N = 3, e^N = 20.0855392
N = -2i, e^N = -0.416146837 - 0.9092974268i
The letter i shouldn't be capitalized (since in math it is lower... |
The best solution I've found so far for a golf code puzzle I'm working on includes two rather fat-looking invocations of range. I'm very new at code golf, especially in Python, so I could use a few tips.
The relevant fragment is this
[x for x in range(n+1,7**6)if`x`==`x`[::-1]*all(x%i for i in range(2,x))]
The upper ... |
Background
Imagine, you have a big array A, which is mostly zeroes, but contains a short subarray B which has only strictly positive entries. For instance:
| A |
[0 0 0 0 1 2 3 0]
| B |
Now say, we split the array A into consecutive subarrays of length d ... |
ESL gaming, where you can challenge players to play games. I've provided some steps you can take manually to challenge a player. Note that you have to signup for an account and have to be logged in to perform these steps. (Important: you have to sign-up for the ladder before you can challenge on that ladder too. Finall... |
You have to take 2 string inputs and output the sum of these two strings without converting them to int or using any numeric data type.
ex.
string one = "123";
string two = "456";
string sum = "579";
Assume the strings won't be larger than 10 digits.
This is code golf and shortest answer in characters wins. An ed... |
Challenge
On each of the 12 days of Christmas, output the appropriate verse of "12 days of Christmas", according to the date, otherwise output the chorus of "I Wish It Could Be Christmas Everyday".
Leading and/or trailing newlines (\n) and trailing spaces are permitted. You may not read from any external sources.
Basic... |
What general tips do you have for golfing in Go? I'm new to Code Golfing and looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Go.
Please keep to one tip per answer.
|
One of the games of the French TV show Des chiffres et des lettres, called Le compte est bon ('The total is right'), consists of the following :
You get a number A between 101 and 999 as well as six numbers E1,..,E6 chosen randomly, with possible repetitions, from {1,2,3,4,5,6,7,8,9,10,25,50,75,100}
The goal is to get ... |
NOTE: This question was migrated from https://stackoverflow.com/q/27134588/1442685
PHP QUESTION
Almost purely out of curiousity, how can I take an array like this:
array( 'fruit' => 'banana', 'drink' => 'milk')
And convert it to an array like this:
array( 'fruit=banana', 'drink=milk')
Requirements
Cannot use anonymo... |
The challenge
Get familiar with the Ulam spiral:
The aim is to print the spiral like in the picture above!
Rules
Write a function ulam(n)
where n is a odd positive integer and describes the size of the grid to print.
All non-primes numbers should be replaced with | horizontal and - vertical as in the picture above foll... |
First, study this puzzle to get a feel for what you will be producing.
Your challenge is to write a program or function which will output a circular graphic like the ones from the puzzle, given a (base 10) number between 1 and 100 (inclusive). This is similar to this challenge, except that you will be producing a graph... |
My friend and I were working on a lab in our AP Computer Science class and decided to code golf one one the problems since we still had half the class free after we finished. Here is the question:
Given a number n, is n divisible by each of its digits?
For example, 128 will pass this test- it is divisible by 1,2, and... |
Your job is to convert decimals back into the sum of the square roots of integers. The result has to have an accuracy of at least 6 significant decimal digits.
Input:
A number indicating the number of square roots and a decimal indicating the number to approximate.
Example input:
2 3.414213562373095
Output:
Integers s... |
You should all be familiar with the Conway sequence (a.k.a. 'look-and-say'-sequence) by now:
1
11
21
1211
111221
312211
etc
You can also start by any arbitrary number as starting point. Let f(s) be the next element of the sequence. Now for every given swe can find f(s). The reverse is not as trivial: it... |
Your goal is to write a perfect player for the game of Wythoff's Nim.
Rules of Wythoff's Nim
Wythoff's Nim is a deterministic two-player game played with two piles of identical counters. Players alternate turns, in which they do one of these:
Remove one or more counters from the first pile
Remove one or more counters ... |
Your goal is to implement Möbius inversion, a linear operation on a sequence of numbers that is used in combinatorics and number theory. Fewest bytes wins.
What is Möbius inversion?
Given a (finite) integer sequence f_1, f_2, ..., f_N, we can compute its divisor-partial-sum g, whose nth element g_n is the sum of all te... |
Consider a square of printable ASCII characters (code points 0x20 to 0x7E) for side length N, like the following (here, N = 6):
=\
g \
7
m+y "g
L ~
e> PHq
We also require each row and each column to contain at least 1 space and 1 non-space character. (The above example satisfies this.)
We define the neg... |
RNA, like DNA, is a molecule found in cells encoding genetic information. It consists of nucleotides, which are represented by the bases adenine (A), cytosine (C), guanine (G) and uracil (U).* A codon is a sequence of three nucleotides.
Proteins are large molecules which perform a vast array of functions, such as kerat... |
The Challenge
Create a program that brute-force* decodes the MD5-hashed string, given here:
92a7c9116fa52eb83cf4c2919599c24a which translates to code-golf
The Rules
You may not use any built-in functions that decode the hash for you if
the language you choose has such.
You may not use an online service to decode the ... |
Strings with Context
For the purposes of this challenge, a string with context is a triple of strings, called the left context, the data part, and the right context. It represents a substring of a longer string. We use the vertical pipe | as a separator, so an example of a string with context is cod|e-go|lf, where the ... |
Building a golfed rot13 encryptor is too easy because the letters are all the same order in the ASCII character space. Let's try a rot32 engine instead.
Your task is to build a function that takes a Base64 string as input and returns the same string but with each letter rotated 32 symbols from its original (in essence,... |
The minmod function is a variant of the familiar min, which appears in slope-limiting high-resolution schemes for partial differential equations. Given a number of slopes, it picks out the flattest slope, while taking care of relative signs between the slopes.
The function takes an arbitrary number of parameters. Then ... |
Semordnilaps (also known as heteropalindromes, semi-palindromes, half-palindromes, reversgrams, mynoretehs, reversible anagrams, word reversals, or anadromes) are words which are also words when spelled backwards. A few examples are:
Ward <=> Draw
Mined <=> Denim
Parts <=> Strap
Given a positive integer N (via functi... |
This was inspired by Print a Negative of your Code and Golf a mutual quine.
Consider a rectangle of characters, that meet the following restrictions:
Consists solely of printable ASCII characters
Dimensions both greater than 1
Each row and each column contains at least one space.
Each row and each column contains at ... |
Format
The format is a 64 bit value x representing a IEEE-754 double-precision binary floating-point number (a.k.a "a double"). x is assumed to represent a real number (not a NaN or Infinity).
Goal
The goal is to print/output the shortest string containing a decimal representation for which x is the closest IEEE 754 re... |
It's winter, and the time of year has come for it to start getting cold (and for strange colorful headcloths to start appearing... soon). Let's write some code to make avatar pictures and other images frozen over, to fit the theme!
Input
The input to submissions to this challenge should be an image (the image to m... |
Based on the "binary, but with twos" notation mentioned in this numberphile video, write a function that takes a single number as input and outputs all variations of that number in a "binary" system where twos are allowed.
Rules
Code must only be a function/method, not a full program
Input is an integer passed as the ... |
Objective
Find the most expensive path from the top-left of a square grid to the bottom-right such that its total cost is below a given threshold.
Scenario
You are given a square NxN grid.
You are given a maximum cost.
Every cell in the grid has a cost. The top-left cell has cost 0.
The cost of a path is the sum of th... |
Write a program or function that takes two numbers - x>3 and n>0 - as input, and finds all possible bases b where the digit 3 appears at least n times in (x in base b).
Input and output may be through command line or function arguments, stdin/stdout, graphical input/output, error messages, function returns, etc.
The co... |
Background
Consider a (closed) chain of rods, each of which has integer length. How many distinct hole-free polyominoes can you form with a given chain? Or in other words, how many different non-self-intersecting polygons with axis-aligned sides can you form with a given chain?
Let's look at an example. Consider a part... |
As you may know, in DNA there are four bases — adenine (A), cytosine (C), guanine (G) and thymine (T). Typically A bonds with T and C bonds with G, forming the "rungs" of the DNA double helix structure.
We define the complement of a base to be the base it bonds to — i.e. the complement of A is T, the complement of T is... |
The problem
Through a terrible procastination accident you are reborn as Scrooge McDuck for a day. To make the most out of the situation you decide to give away food to the poor. Since you also are a mathematician you store the food in a vector v(1,2,3).
You want to give each family approximately the same food. To mak... |
For the purpose of this challenge, we say that a regex pattern matches a string if the entire string is matched by the pattern, not just a substring.
Given two regex patterns A and B, we say that A is more specialized than B if every string that is matched by A is also matched by B but not the other way around.
We sa... |
You are to write a very small program within 100 characters. Your program must distinguish between masculine and feminine french nouns. The output should be un if it is masculine and une if it is feminine. Often, there are certain statistical rules you can follow (e.g. if it ends in an "e" it is more likely feminine th... |
CONGRATULATIONS to @kuroineko. Wins the bounty for excellent speed (672 moves) on the Gauntlet track.
LEADER:* Nimi scoring a lightweight 2129. Other entries are larger but showing some serious speed.
*Leader may change due to later entries.
Your task is to write a small program that can drive a racing car fast.
Rules
... |
You're given a true colour image. Your task is to generate a version of this image, which looks like it was painted using paint-by-numbers (the children's activity, not nonograms). Along with the image, you're given two parameters: P, the maximum size of the colour palette (i.e. the maximum number of distinct colours t... |
Your challenge today is to implement a t9-like functionality.
You will implement a function that will only have 2 parameters.
You will receive 1 phone number in a string and the content of a text file with a list of words (don't assume a specific newline style).
You can use the link https://raw.githubusercontent.com/en... |
Challenge
You are given the following function:- which is the same as:-
with the base cases q(r, b, L) = 1 whenever r ≤ L, q(r, 0, L) = 0, if r > L and q(r, 0, L) = 1, if r ≤ L.
Your task is to code a program that takes r as input, and outputs the value of q(r, r - L, L) for all L taking integer values from 1 to (r-... |
After spending a while on Stack Exchange, I can recognise most sites in the Hot Network Questions by their little icon (which is also their favicon), but certainly not all of them. Let's write a program which can! You're to write code which determines the site, given one of the (currently) 132 favicons, including Stack... |
The Hilbert curves are a class of space-filling fractal curves where every bend in the path is at a right angle and the curve as a whole fills up a square, with the property that sequences of consecutive segments are always displayed as contiguous blocks.
Traditionally, the curve is drawn as a series of very squiggly l... |
We define whitespace to be any of the three characters, tab (0x09), newline (0x0A) or space (0x20).
For this challenge, you're to write two programs or functions in the same programming language, which perform the following tasks:
Count the whitespace characters in a given string. For instance, the input
123 -_- a... |
The challenge is make a digital clock that exhibits ascii numbers in a 24-hour format like:
_ _ _ _
|_| |_| . |_| |_|
|_| |_| . |_| |_|
or
_ _ _
_| _| . |_| |_
|_ _| . | _|
and updates the screen every 1 minute (or every 1 second, for praticity reasons). It must reset to 00:00 after 23:5... |
Your task is to take an string containing an isotope of an element as input, encoded like the following example with the atomic number followed by a space and the IUPAC chemical symbol for the element:
162 Dy
and return the number of neutrons in an atom of that isotope.
In the above example, dysprosium-162 has 96 neut... |
James Bond is about to start a new mission and you are his computer scientist friend. As Tic Tac Toe is becoming more and more popular you decide that nothing would be more underhanded than a Tic Tac Toe encoder/decoder™.
For each line the decoder will follow the following steps:
Convert from 'O','X' and ' ' [space] ... |
I can have a large if/else condition for each 30 minutes but I'm looking for more math and Unicode based solution.
Here are clock emojis:
. If you lack proper rendering support, you can see them below (they're not in the same order and they may look different to what you see) or at the Unicode chart, page 4. They corre... |
This challenge is partly an algorithms challenge, involves some math and is partly simply a fastest code challenge.
For some positive integer n, consider a uniformly random string of 1s and 0s of length n and call it A. Now also consider a second uniformly chosen random string of length n whose values are -1, 0, or 1... |
Challenge
Write the shortest code that can sum all the time durations that appear in the stdin. The program must only consider the strings that match with one of the following patterns and ignore the rest.
HH:MM:SS (it will be interpreted as HH hours, MM minutes and SS seconds)
H:MM:SS (it will... |
I was working on a math question with a friend of mine, and we decided to write a script that finds the answer. The original question is as follows:
The difference of two natural numbers is 2010 and their greatest common denominator is 2014 times smaller than their lowest common multiply. Find all the possible solutio... |
Your goal is to check whether a completed Minesweeper board is valid. This means that each number is a correct count of mines in cells adjacent to it, including diagonals. The board does not wrap around.
As usual, you should give a function or program, and shortest code in bytes wins.
See also past challenges to genera... |
What better problem for PCG.SE than to implement PCG, A Better Random Number Generator? This new paper claims to present a fast, hard-to-predict, small, statistically optimal random number generator.
Its minimal C implementation is just about nine lines:
// *Really* minimal PCG32 code / (c) 2014 M.E. O'Neill / pcg-rand... |
You need to produce the word codegolf
Rules:
None of the characters of the word codegolf (i.e. 'c', 'o', 'd', 'e', 'g', 'o', 'l' and 'f') in either case can exist anywhere in the code.
Case of the word must be one of three:
All Upcase (CODEGOLF)
All Downcase (codegolf)
Capitalized (Codegolf)
You only need to produ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.