instruction stringlengths 34 53.1k |
|---|
All those questions that are duplicates... Ignored and marginalized by society. It is just not... right. We have to do something. There surely must be love for them too.
They feel appreciated if a piece of code outputs a link to a duplicate question. But the duplicate questions are not so easily impressed. They are swe... |
Challenge
The objective is simple, in the shortest amount of bytes, write a function or program that takes a number and prints its double factorial.
The input must be taken from stdin or a function argument, and it must print the resulting double factorial to stdout.
Inbuilts are disallowed
|
Eh!
You know, the problem with us Canadians is that sometimes, after a long day of moose hunting and dam repairing, we forget our way back to our cabins! Wouldn't it be great if our handy laptop (which, is always at our side), had some way to point us home? Well, it's been long told that, if you display a compass on yo... |
A move sequence is a sequence of moves (turns) on a Rubik's Cube (for the notation look down below). Beside the empty move sequence, there are many other other move sequences, that have no effect on the cube at all. We call these move sequences identity sequences.
Some of these identity sequences are obvious to determ... |
Every player has a number. Can yours be the farthest from them all?
Requirements
Write a Java, Python 2, or Ruby function named choose() that accepts three arguments:
an integer - the number of rounds already completed
an integer - the number of players
an array of strings - the results of each previous round
each s... |
I love my encryption but I need a program that is dedicated to making a caeser cipher. It will take an input string and will output a ciphered text with the number to decode it. The number can be made whatever you want
The shortest code wins!
|
Your program or function should output all the 36 4-perfect numbers in increasing order separated by newlines.
An n positive integer is a k-perfect number (multiply perfect number) if the sum of its divisors including itself (i.e. the sigma function of n) equals k*n.
For example 120 is a 3-perfect number because 1 + 2... |
Introduction
I want to find the substring with the most 1's in a sequence of 0's and 1's.
Input
Your program has two inputs, the sequence and the substring length.
The sequence is any number of 0's and 1's:
01001010101101111011101001010100010101101010101010101101101010010110110110
The substring length is any positive ... |
This is a code golf challenge. Just like the title says, write a program to covert a string of ascii characters into binary.
For example:
"Hello World!"
should turn into
1001000 1100101 1101100 1101100 1101111 100000 1010111 1101111 1110010 1101100 1100100 100001.
Note: I am particularly interested in a pyth implemen... |
Using one programming language write 5 single-line programs, each of which outputs a different line of the first verse to Harry Nilsson's 1972 song "Coconut" when run individually:
Brother bought a coconut, he bought it for a dime
His sister had another one, she paid it for a lime
She put the lime in the coconut, she ... |
This a code challenge. The winner will be the person to provide the most efficient implementation of the solution in terms of algorithmic complexity.
Using the dictionary found in '/usr/share/dict' (on OS X and Linux), your task is to find the word with the most anagrams of itself in the dictionary, and print all of th... |
In Conway's Game of Life, a cell is in a state of either on or off, depending on the on-and-off state of the eight cells surrounding it.
We can simulate this using a logic gate network with some sort of clock signal that updates every cell all at once. Your task in this problem is to build the logic gate network for a ... |
This code-golf challenge is based on the following puzzle:
You have an odd number of tokens whose weights are known whole numbers, and they don't all have the same weight. Show that there's a token you can remove so that the remaining tokens can't be split into two equal-size sets that have the same total weight.
Her... |
Older cellphones have 3 or 4 characters mapped to each number from 2-9 and that number must be pressed a certain number of times to get the required character. Let's assume our cellphone has this map:
1:1
2:abcABC2
3:defDEF3
4:ghiGHI4
5:jklJKL5
6:mnoMNO6
7:pqrsPQRS7
8:tuvTUV8
9:wxyzWXYZ9
0:<space><newline>0
If you wan... |
Introduction
Jim and Bob are playing badminton doubles against two other players, but mid-game they face a dilemma:
After a fast-paced rally they have no idea who has to serve next and where they have to stand for the next serve.
Bad enough they only know the scores in order.
Rules:
To help them out, you have to know t... |
You have to create a function range, such that it takes two (integer) arguments a and b (a < b) and returns all the numbers in between them. So:
range(5, 10) // should output 6, 7, 8, 9
range(-5, 2) // should output -4, -3, -2, -1, 0, 1
range(5, 0) // can throw an error/empty/null/undefined/whatever (a is not < b)
// b... |
In this pixelated font of uppercase letters of the alphabet, all the characters are 5 units wide and 5 tall.
███ ████ ███ ████ █████ █████ ████ █ █ █████ █ █ █ █ █ █
█ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ █ ██ ██
█████ ████ █ █ █ ████ ████ █ ██ █████ █ ... |
You should write a program or function that receives a positive integer N as input and prints out the first N characters of your code. If N is larger than the length of your code you should continue output your code cyclically.
Reading your source code in any way and reading from file, stdio, etc. are disallowed.
Examp... |
This challenge is to find the longest chain of English words where the first 3
characters of the next word match the last 3 characters of the last word. You will use
an common dictionary available in Linux distributions which can be downloaded
here:
https://www.dropbox.com/s/8tyzf94ps37tzp7/words?dl=0
which has 99171 E... |
For those with a little linear algebra background, the challenge is as simple as this: determine the eigenvalues and eigenvectors of a given complex 2x2 matrix. You may skip ahead to The Challenge for I/O details, etc. For those who need a little refresher on eigensystems, read on.
Background
The characteristic equatio... |
There are P parking spaces in a parking lot, though some spaces are occupied by cars represented by octothorpes # while the free spaces are dots .. Soon there arrive T trucks, each of which will take up exactly L consecutive spaces. The trucks don't have to be parked next to each other.
Your task is to create a program... |
Write two code fragments, which we will call s_zero and s_one.
Program (l, n) consists of l copies of s_zero and s_one corresponding with the digits of n in binary, padded with s_zero on the left.
For example, if s_zero = foo and s_one = bar then
Program (4, 0) = foofoofoofoo
Program (4, 1) = foofoofoobar
Program (4, 2... |
I am learning Ruby and wrote my first nontrivial code to solve this problem.
The challenge is to generate the first n elements of the Stöhr sequence, S, which is defined as follows:
S[0] = 1
S[n] is the smallest number that cannot be expressed as the sum of two distinct previous elements in the sequence.
Thus the seq... |
This is an answer-dependent challenge! The order of answers matters, and your exact task depends on the last answer that was posted. You might want to sort the answers by oldest.
Let's piece together some code! Here are 1920 random (printable ASCII) characters. Think of them as a big heap of unsorted jigsaw puzzle pi... |
Final results are here !
Introduction
The game takes is strongly inspired by Manu's Game of Town. It takes place in a world of swords and magic. The king who ruled the whole continent just died, and the lords of the many city-states are now fighting over territory. You are one of these lords and your goal is to conquer... |
Given an integer N, count how many ways it can be expressed as a product of M integers > 1.
Input is simply N and M, and output is the total count of distinct integer groups. Meaning you can use an integer more than once, but each group must be distinct (3 x 2 x 2 would not count if 2 x 2 x 3 is present).
Constraints
1... |
Challenge
Write a solver for the Chess Light puzzle game, in the smallest amount of code.
The input will be a representation of a chessboard, how in yours is up to you. My examples below is textual, in which some squares may already be occupied by black peices. Some of the unoccupied squares are designated with a #, al... |
You just have to ouput exactly all the numbers from 1 to 10 separated by spaces.
Your programme should work all the times even if a random character is deleted before compiling/interpreting.
This is code-golf so shortest code in bytes win!
|
Can you find initial conditions for either Rule 110 or Conway's Game of Life to emulate the other? That is, produce output (in any form, not necessarily the familiar pixel grid) which corresponds directly to the other.
Rule 110 takes an infinite one-dimensional binary array as input, and outputs an infinite one-dimensi... |
This is my first code golf challenge, as such I am not entirely certain if it is suitable as a Code Golf challenge, but it's all a learning experience.
The challenge is that in as few characters as possible, using whichever language you prefer, develop a code to complete the following:
Take a value from stdin
Return a... |
Objective/Restrictions:
May only be answered with programming language that has function syntax (or procedure, method, lambda, macro, statement grouping and labelling) .
Create a function with at least 2 argument/parameter, that generates an array containing 7 random strings, each string contains 3 characters, string... |
This challenge will behave more or less like a traditional code-golf. The only difference is that instead of scoring answers by their number of characters or bytes, users will assign
weights to different characters in the comments and the program with the lowest cumulative weight will win.
Challenge
Your task is to wri... |
Rules/Objectives:
The program must be executed using ./program-name without shell parameter/arguments.
the program-name may not contain any of characters in /etc/passwd, that is acdepstw
You may not open any other file, including own's source code, only /etc/passwd that should be read.
The program must print the conte... |
Input
An alphanumeric string s.
Output
The shortest string that occurs exactly once as a (contiguous) substring in s.
Overlapping occurrences are counted as distinct.
If there are several candidates of the same length, you must output all of them in the order of occurrence.
In this challenge, the empty string occurs n ... |
This challenge is not about the game Snake.
Imagine a 2d snake formed by drawing a horizontal line of length n. At integer points along its body, this snake can rotate its body by 90 degree. If we define the front of the snake to be on the far left to start with, the rotation will move the back part of the snake and t... |
Suppose you are given a set of non-intersecting intervals of integers [a1,b1],[a2,b2],[a3,b3],...,[aN,bN]. (Where [a,b] is the set of integers greater than or equal to a and less than or equal to b.)
The interval at index X covers bX - aX + 1 values. We'll call this number cX.
Given that each interval can either be...
... |
This is a code golf challenge to see the shortest implementation of an automated guesser in the pen and paper game bulls and cows.
The game works as follows:
A (usually 4 digit) secret code with only distinct integers 0-9 is picked by one player. A second player guesses codes that each receive a rank. This rank contai... |
This is based on xkcd #153.
Make a program or named function which takes 2 parameters, each of which is a string or a list or array of bytes or characters. The second parameter will only contain characters drawn from lrfu (or the equivalent ASCII bytes). It should be interpreted as a series of instructions to be perfor... |
Challenge
The challenge is to create a program which takes a date, a latitude, and a longitude, and prints the time of the sunrise on that date for the given location.
The program must work for any valid date between January 1, 2000, and December 31, 2999.
Internal and external sunrise functions are disallowed. Date l... |
I'm currently trying to solve a tricky/silly challenge and i've come to a dead end.
The challenge is basically to form a one-liner /bin/sh compatible command line
which essentially outputs "Hello World" without directly typing White space or Tab characters in the command itself.
for example something like -
echo Hello ... |
Background
This is a continuation of my earlier challenge, where the task was to compute the shape of a sculpture obtained by dropping magnets into a huge pile.
Good news: the eccentric artist liked your work, and has another project for you. He still works with magnetic sculptures, but has decided to expand his art st... |
Number fight game
Setup
Each ai is given a random number from 1 to 100. The starting number is the average of these two numbers.
Gameplay
Each ai knowing its own target, the opposite target and the current number, chooses which function to apply to the current number.
WIN conditions
The first ai that reaches its ... |
The Game
Recently, much of my time has been taken up by an addicting game on my phone, called Logic Dots, which inspired me to write this challenge. It's easier to explain the rules if I show you the game display, so here is a screenshot of an unsolved, and solved puzzle:
Now here, there are three main things to noti... |
Take an array of integers containing negative numbers, positive numbers and zeros. Group it with one iteration and in place such that all of the negative numbers come first, followed by all of the zeros, followed by all of the positive numbers.
Example:
Input: 5, 3, 0, -6, 2, 0, 5
Output: -6, 0, 0, 3, 2, 5, 5
Note th... |
We've all seen the famous painting of Marilyn Monroe created by Andy Warhol.
Let's try to replicate that effect with the usual suspects.
Your task is to write a program/programs that do as many as possible of the following tasks:
With one image as the input, generate four color palettes from that image and print a 4x... |
An incremental word chain is a sequence of words of a vocabulary such that each word is the result of either prepending or appending a single character to the previous word, ignoring capitalization. An example of such a chain can be found below.
I → is → his → hiss
Your task is to write a program that for a given voc... |
You decided to organize a rock-paper-scissors championship to find out who is the best. You don't want to let luck to decide the winner so everyone has to give you his or her tactic in writing before the competition. You also like simple things so a move of a competitor (showing rock, paper or scissors) has to be based... |
Inspired by this recent article telling of a French programmer who wrote a 487 byte 2-player (human vs. human) chess program in Assembly, I wondered how small chess programs could be in other languages.
Details
The program must only accept legal chess moves.
Declaration of check/checkmate is not necessary (just desira... |
Your friend isn't too good with computers so as a practical joke someone scrambled the letters (a-z) on his keyboard. When he sit down and tried to type his name looking at the keyboard he realized that the letters are scrambled and asked your help.
You are smart so you know that if he types his name and then repeatedl... |
This is based on this challenge and Geobits's/CarpetPython's idea to improve it:
Keep your distance!
For this challenge, the distance between two numbers is measured on a loop, so, for example, the distance between 0 and 999 is 1. This should prevent strategies like always picking the lowest or highest number from winn... |
I'm looking for some solution in returning values in main function, I need to shorten my program more, return 0 takes too much characters of my code, I need to return 0, or my code fails. I know that in C there can be no return statement, and then program will use result of last operation - but on which operations I ca... |
This is a new kind of challenge inspired by the Recover the mutated source code problem.
You should write two programs or functions both in the same language. The first one should solve Task #1 and the second one should solve Task #2.
Your score will be the sum of the longer program and the Levenshtein distance betwee... |
In statistics, sometimes it's useful to know whether two data samples come from the same underlying distribution. One way to do this is to use the two-sample Kolmogorov-Smirnov test.
Your task will be to write a program that reads in two unsorted nonnegative integer arrays and calculates the main statistic used in the ... |
The task is to count the number of distinct substrings of length k, for k = 1,2,3,4,.....
Output
You should output one line per k you manage to complete with one number per output line. Your output should be in order of increasing k until you run out of time.
Score
Your score is the highest k you can get to on my compu... |
Input
A nonnegative integer n, and a nonempty string s containing only alphanumeric characters and underscores _.
The first character of s is not _.
The underscores of s are interpreted as blank spaces that can be filled with other characters.
We define an infinite sequence of "infinite strings" as follows.
The string ... |
Your task is to implement an Enigma encryption machine. Your program will accept the machine initialization information followed by a string of text to be encrypted.
Initialization vector will be
Rotors used (Left to right). Will be three characters. Rotors 1-5 are valid.
Initial rotor settings (A-Z) Left to right.
R... |
Your kindly neighbour, Doctor Tree, just gave you three magical creatures called Codémon. There's a battle tournament in the nearby town of Colorville. Are you the very best, like no one ever was?
Overview
This is a battle tournament. Each player controls a team of three monsters, and the objective is to knock out (k... |
Your should write a program or function that takes a 4-character string as input and outputs a value indicating if the string is an English word or not. You are allowed to make mistakes in 15% of the provided testcases.
Input details:
Input is a 4-character string containing only the lowercase English letters (a-z).
Ou... |
About the Series
I will be running a little series of code-golf challenges revolving around the theme of randomness. This will basically be a 9-Hole Golf Course, but spread out over several questions. You may participate in any challenge individually as if it was a normal question.
However, I will maintain a leaderboa... |
Your program will control a mining robot searching underground for valuable
minerals. Your robot will tell the controller where you want to move and dig,
and the controller will provide feedback on your robot status.
Initially your robot will be given an image map of the mine with some mining
shafts already present, an... |
Landslides
In this challenge, your job is to predict the extent of damage caused by a massive landslide.
We use the following simplified two-dimensional model for it, parameterized by an initial height h >= 0 and a critical coefficient c > 0.
You start with a cliff of height h, and it is assumed that the terrain is com... |
Stack Exchange currently has 134 question and answer sites. This includes all beta sites (such as PPCG) but not Area 51 proposals nor any meta sites, except for the "mother meta".
To answer this question, choose one of those sites and write a program where every line of code is an anagram of the title of a different qu... |
Consider a function plot like this:
###########
#################
####################
... |
Write a full program to calculate the inverse of a 4-by-4 matrix.
Rules
The sixteen values of the initial matrix must be hard-coded to variables, as follows:
_ _
|a b c d|
|e f g h|
|i j k l|
|m n o p|
- -
Then print the values of the inverse matrix, row by row, with each number separated by some delimiter... |
Introduction
Scientists have recently found a new type of bacteria that replicates in odd ways. To reproduce, two bacteria each split into 3 (for a total of 6) and pairs combine (resulting in 3 bacteria, two parents, one child). However, the bacteria can only split if it has a partner. For example, 2 bacteria split and... |
Challenge
Write the shortest snippet of code possible such that, when N copies of it are concatenated together, the number of characters output is N2. N will be a positive integer.
For example if the snippet was soln();, then running soln(); would print exactly 1 character, and running soln();soln(); would print exactl... |
Consider the set of 16-character strings containing only the 95 printable ASCII characters. There are 9516 ≈ 4.4×1031 such strings.
Imagine these strings are put into a list and sorted lexicographically (which is the way most languages will sort a list of strings). What is the largest contiguous slice of this list you ... |
When playing the piano, I realized that to play a chord right, I usually need to remember just which tones of the chord are played on white and which on black keys. The rest is usually handled by the "autopilot".
Let's write a program that given a 7th chord, it outputs which of its tones are to be played on black (char... |
Introduction
You may remember sudoku, where there can only be one of each number in each row, column and block of nine.
The general idea is that if the array contains but one element, you can submit that as a deterministic solution. If there are already filtered arrays (by rows, columns and 3×3 blocks) the remainder ca... |
Let f be the function that maps a bitfield ({0 1}) of size n+1 to bitfield of size n by applying XOR to the ith and i+1th bit and writing the result in the new bitfield.
Example: f("0101") = "111"
Informal calculation:
0 XOR 1 = 1
1 XOR 0 = 1
0 XOR 1 = 1
Let f_inverse be the inverse function of f. Since the inverse ... |
Background
Two strings s and t are called k-Abelian equivalent (shortened to k-equivalent in the following) for a positive integer k if the following conditions hold:
The length-k-1 prefixes of s and t are equal.
The length-k-1 suffixes of s and t are equal.
The strings s and t have the same multisets of length-k cont... |
About the Series
First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post.
Although I have a bunch of i... |
The video game Minecraft is all about placing and removing different types of blocks in the 3D integer lattice that makes up the virtual world. Each lattice point can contain exactly one block or be empty (an "air" block officially). In this challenge, we will only be concerned with one vertical 2D plane of the 3D worl... |
Now with BONUS for run-time placement.
Write a program to fill a text box with the identifiers used in your program while keeping your program
small. With all the identifiers you have used (excluding those you created) in
your program, fill a 12x6 box with as many as you can. You get extra points for
identifiers that ... |
In this challenge, your input is a string of lower-case letters like this:
insertspacesbetweenwords
and a dictionary like the that from my other challenge. You may assume that the dictionary file contains only lower-case letters and line-feed characters. Furthermore, the last character in the dictionary file is a line... |
Privileged Strings
The set of privileged strings is defined recursively as follows.
All strings of length 0 or 1 are privileged.
A string s of length at least 2 is privileged, if there exists a shorter privileged string t that occurs in s exactly twice, once as a prefix and once as a suffix. Overlapping occurrences ar... |
Background
Most (halfway decent) text editors allow you to navigate text using the arrow keys. Up and down allow you to navigate lines, while left and right move across a line but also wrap around. Furthermore, if the line is shorter than your cursor's X position, the cursor appears at the end of the line but returns... |
Challenge
Write the shortest program that converts a human readable time interval to date components of the form:
{±YEARS|±MONTHS|±DAYS|±HOURS|±MINUTES|±SECONDS}
Sample cases
Each test case is two lines, input followed by output:
1 year 2 months 3 seconds
{1|2|0|0|0|3}
-2 day 5 year 8months
{5|8|-2|0|0|0}
3day 9 ... |
A curious kid uses a program which can factorize a number or an expression into the following form: p1^e1 * p2^e2 * ... * pn^en . Exponents equal to 1 are omitted e.g. 360 = 2^3 * 3^2 * 5
The kid types this output into the program as new input but they don't understand the ^ sign so sometimes they skip one or more of t... |
Here is a simple, bite-sized (byte-sized?) code golf: given a non-empty list of positive integers less than 10, print a block-diagonal matrix, where the list specifies the size of the blocks, in order. The blocks must consist of positive integers less than 10. So if you're given as input
[5 1 1 2 3 1]
Your output coul... |
I have one hundred vaults, each one within another. Each vault has a password, consisting of a single number.
95 43 81 89 56 89 57 67 7 45 34 34 78 88 14 40 81 23 26 78 46 8 96 11 28 3 74 6 23 89 54 37 6 99 45 1 45 87 80 12 92 20 49 72 9 92 15 76 13 3 5 32 9... |
Background Story
Bob was handed the following assignment for his programming class. Please note: this is not the actual challenge.
Homework assignment 11: Twin primes
Input: an integer n ≥ 8, taken from STDIN.
Output: a message to STDOUT, depending on n:
If n is not a prime number, output Not prime.
If n is a prime n... |
Background
The game of Morra is a simple game. In the "original" version, several players simultaneously throw out a number 0-5 with their hands while guessing the total sum of everyone's hands. The version I'll use here has been modified to increase the potential for non-trivial strategy, and it is described below:
... |
Intro -
Nearest neighbour comparison between two arrays is something that can be done very efficiently when only 1 variable per array is involved, because it can be done by sorting and then performing a rolling comparison. However, for a 2 variable comparison this sort operation cannot be done anymore and another smart... |
Quines are fun. Polyglots are fun, too. Polyglot Quines exist, but we can raise the bar even higher.
Write a file that contains a valid program for languages α, β, and γ. When the file is executed (possibly after compiling it) as a language α or β program, the program's output shall be of the same form as a valid submi... |
In the C standard library, header names end with a .h suffix:
stdio.h
In C++, those header names are available in an alternative form, with a c prefix instead:
cstdio
Write a function that converts the first form into the second. You can do the conversion in-place, or leave the original string intact and return a new... |
Happy Valentine's Day! To celebrate this day of love and happiness (or sadness and loneliness for those of us who are single...), let's write some code to create some hearts!
Specifically, if you take this challenge upon you, you are to write code to output a heart/hearts as an image file, with the ability to easily ch... |
The Vigenère cipher is a substitution cipher where the encryption of each letter of the plaintext depends on a different character in a keyword. This stops you using simple methods of frequency analysis to guess the correct substitution. However, the keyword is repeated if it is shorter than the plaintext. This is a... |
Input
Your input is a single string, separated by newlines into 2n+1 lines of length 2n+1, for some integer n ≥ 0. The integer n is not part of the input; you'll have to compute it from the string. The lines are composed of the "direction characters" >^<v. If newlines pose a problem, you can replace them by vertical pi... |
I see GolfScript, Pyth, CJam and similar languages can make compex-ish algorithms in few bytes. This terseness makes think about genetic programming applications (using said languaes as the thing being mutated).
I assume that to make a good GP language, it should have following characteristics:
Programs are typically ... |
The Hamming(7,4) code goes back to 1950. Back then Richard Hamming worked as a mathematician at Bell Labs. Every Friday Hamming set the calculating machines to perform a series of calculation, and collected the results on the following Monday. Using parity checks, these machines were able to detect errors during the co... |
Scenario:
Imagine a situation where you wish to share a unique alphanumeric code. Perhaps it is a one-time-use coupon code you hand write on business cards, or some other scenario where it is desirable to have a code where mis-keying the entry is unlikely to produce valid result and the another valid code is not readil... |
The challenge
This challenge is going to be a classic king of the hill game of RPS. You must write a program that takes two command line arguments, a string of all the moves that you have made, and a string of all the moves that your opponent has made. The program will then return either 'r', 'p' or 's' for rock, paper... |
Given:
A natural number S.
A list of N rational weights W that sum to 1.
Return a list L of N non-negative integers, such that:
(1) sum(L) = S
(2) sum((S⋅W_i - L_i)^2) is minimal
In other words, approximate S⋅W_is with integers as closely as possible.
Examples:
1 [0.4 0.3 0.3] = [1 0 0]
3 [0 1 0] = [0 3 0]
4 [0.3 0.... |
This is the same question as Solve the CodeSprint4 Leibniz code golf challenge in Python in 66 characters. The variation is that I'm a C programmer. My code for the above question is:
#include <math.h>
main(){
int i,t,p;
scanf("%d",&t);
while(t--)
{
double s=1;
scanf("%d",&p);
for(i=1;i<p;++i)
s+=pow(-1... |
The video game Minecraft is all about placing and removing different types of blocks in the 3D integer lattice that makes up the virtual world. Each lattice point can contain exactly one block or be empty (an "air" block officially). In this challenge, we will only be concerned with one horizontal 2D plane of the 3D wo... |
Boys and girls are excited to see Fifty Shades of Grey on the silver screen, we just want to code without being bothered, so here's a challenge to pick our brain.
You have to:
Print on the screen fifty squares filled each with a different shade of grey
If your language of choice lacks image processing capabilities, yo... |
Given a URI like:
postgres://username:password@hostname:PORT/dbname
Extract it all into an array data-structure, like so:
['postgres', 'username', 'password', 'hostname', 'PORT', 'dbname']
More info: http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax
Rules
No use of external libraries or web-services
Scoring
Y... |
Story:
Lucy asked George what his Lucky Number was. After some contemplation, George replied that he had several Lucky Numbers. After some brief confusion, Lucy asked George what his first n Lucky Numbers are. George then asked you, his buddy, to write him a program to do the work for him.
The Challenge:
You will write... |
The Devil's Staircase is a fractal-like function related to the Cantor set.
Your task is to replicate this funky function — in ASCII art!
Input
A single integer n >= 0, indicating the size of the output. Input may be given via STDIN, function argument or command-line argument.
Output
The ASCII-art rendition of the Dev... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.