instruction stringlengths 34 53.1k |
|---|
This is the robbers' thread. For the cops' thread, click here.
Cops' Task
For the cops' thread, click here.
Robbers' Task
Find an uncracked submission on the cops' thread. (A submission may only be cracked once.)
Unscramble the code to find a working quine.
Post an answer on the robbers' thread. Include the language, ... |
Challenge:
Write a lossless encoder/decoder that is able to compress its own source code.
Usage:
progname encode
Encodes data provided on the standard input, writes the encoded representation of the data to the standard output.
progname decode
Decodes data produced by progname encode. Reads the encoded data from the s... |
You are a taxicab driver in San Francisco. As is typical of taxicab drivers, you are navigating a grid where the only valid directions you can move are the left, right, up, and down. However, San Fransisco is very hilly so the distance between two adjacent intersections is not necessarily the same. More specifically, t... |
Identify whether an IP address is internal, global, link-local, or reserved.
Input should be an IPv4 address in decimal octets separated by periods.
Output should be 0 for link-local (RFC 3927), 1 for internal (RFC 1918), 2 for global IPs (Internet), and 3 for otherwise reserved addresses.
All these address types are d... |
Balancing Act
A see-saw (supposedly from the French 'ci-ça', meaning 'this-that') forms a third of the holy trinity of playground equipment, along with the similarly ubiquitous slide and swing. A see-saw is in perfect balance if, and only if, the sum of the moments on each side are equivalent. A see-saw can therefore b... |
Note: This challenge is finished. Submissions are still welcome but can not win.
This is the cops' thread. The robbers' thread goes here.
Write a code that outputs the integer 1. If you add, remove or substitute a single character (of your choosing), the code should output the integer 2. Change one more character (th... |
This is the robbers' thread. The cops' thread goes here.
Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made.
The winner will be the robber that crac... |
Steganographic Squares
Your job is to take in a string, and generate an NxN image that represents this string. You must also write the algorithm that takes in the image and turns it back into a string as well. The scoring will be will include the byte count of both algorithms:
"Encryption" Algorithm + "Decryption" Algo... |
A sestina is a format of poem that follows an interesting pattern that we can generate. It has six stanzas of six lines each, where the last words of each line in the first stanza make up the line endings in each successive stanza, rotated in a set pattern. (There's also a three-line stanza at the end, but we won't wor... |
Why don't you grow up?
In the past week a meme involving the young actor Aaron Bailey became trending in most Brazilian social networks. Entitled "why don't you grow up" it consists in repeating a sentence replacing its vowels with is (it's a bit more complicated than that, I'll explain below). As I want to be a cool g... |
Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C.
Program B, when run in language B produces Program A, and running program B in language A produces program C.
Program C, when run in language A or language B, prints "Wrong language!".
Prog... |
The challenge
Simply write a program that outputs its own source code.
Nothing more than a regular quine.
The problem
We don't have a computer so we have to run the program on a programmable logic device (such as an FPGA, a CPLD, a gate array ...).
The rules
Any device available on the market (such as a printer connec... |
Given an input of a list of words, output the words with their letters arranged
diagonally:
p
r
o
p g
u r
z a
a z m
n l m
d e i
c s n
o g
d
g e
o
l
f
(The above should be the output for the input programming puzzles and code golf.)
To be precise, each word starts on the first co... |
Introduction
In mathematics, a polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional figurate numbers.
The number 10, for example, can be arranged as a triangle:
*
**
***
****
But 10 cannot... |
My Downgoat avatar has several distinct features
These features can however also apply to any other animal.
Specification
Given an image of an animal (technically can be anything), you must apply the Downgoat properties to it.
Border pixels are the outer most pixels of the image.
The background color is defined as th... |
Out Steganograph Me
As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them.
The Challenge
Your goal is to write a function or program that when given a string as an input, outputs an image. Then, in a seprate program/function, accept that same image... |
The challenge here is to accurately depict the flower of life (which is a sacred geometrical figure according to some) in the language of your choice.
The design consists an arrangement of circles and partial circles of radius 1 as shown whose centres arranged on a triangular grid of pitch 1, plus one larger circle of... |
Hearts is a trick-taking card game for 4 players. Each trick is taken by the player who played the highest card of the leading suit. At the end of each hand, the players incur a penalty score depending on the penalty cards they have taken; the task is to determine the scores under Microsoft Hearts rules.
Input
Input is... |
Briefing
You are a bot, in a 2D grid that extends infinitely in all four directions, north, south, east and west. When given a number, you must move the bot so that you get to the target number.
Here's how the grid works:
You can move in 4 directions: north, south, east or west. Once you move off a cell, you are not al... |
It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words!
Walking words
Walking words are words which will respond to certain characters. For the purpose of this challenge the trigger characters are [u, d, r, l] from up down right left.
Whenever you encounter su... |
In this challenge, you are going to create a Fellowship with the goal of defeating all other fellowships in battle.
A fellowship (team) consists of 3 characters. Each character moves independently of the rest of their team, but they will need to work together when fighting your enemy. Teams will face each other head t... |
The Art of Word Shaping
Given a binary matrix and a string of letters, replace all 1's in the matrix, moving from top to bottom and from left to right within each row, with the letters of the string. Once the letters have been formed into the shape of the matrix, print the matrix, replacing 0's with spaces. It's probab... |
A monotonic subsequence is a sequence of numbers \$a_1, a_2, ..., a_n\$ such that
$$a_1 \le a_2 \le ... \le a_n \\
\text{or} \\
a_1 \ge a_2 \ge ... \ge a_n$$
[1, 3, 3, 7, 9, 13, 13, 100] is a monotonic (non-decreasing) subsequence, as well as [9, 4, 4, 3, 0, -10, -12] (this one is non-increasing), but [1, 3, 6, 9, 8] i... |
Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly.
For example, let's check the number 100.
1003 is 1000000.
The set of digits in 100 is {0, 1}.
The set of digits in 1000000 is {0, 1}.
Therefore, 100 should give a truthy value.
Test case... |
Input:
Firstly
An array of three cards representing the cards played by each player formatted like
[JD][TH][9S]
Representing
Jack of Diamonds, 10 of Hearts, and Nine of Spades.
As you always sit across from your team-mate in Euchre, the second element represents your team mate's play. Here, the TH.
Secondly
A Single ... |
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places.
In traditional compass notation, a string is made up of only 2 of these characters (like NNW or ESE). Here you must also accept strings that contain all 4 (like WNNNSE). Using only 2 symbols allows hu... |
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list:
AAA BBBB CCCC DDDD EEEEE FFFFF GGG H H
A A ... |
There is a helicopter flying 500 meters from the ground. It can fly up 100 meters, which takes 1.0 secs. Or if it doesn't fly up it will fall 200 meters, which also takes 1.0 secs - This means if the instruction is anything other than "Fly" the helicopter falls. Build a program that takes input of a list of instruction... |
(randomly inspired by this question)
Let's make a drawing from some pipes | and hyphens -. Choosing a subset, if chosen carefully, you can form a rectangular box or block shape (meaning that the corners are formed by |- or -|). For this challenge, we're concerned only with identifying the corners -- the vertical and ho... |
Poker hands are ranked from best to worst as follows:
Straight flush - five cards of sequential rank, all of the same suit
Four of a kind - four cards of the same rank and one card of another rank
Full house - three cards of one rank and two cards of another rank
Flush - five cards all of the same suit
Straight - five... |
I need help making a brick road to go beside my brick wall!
\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \
\__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__
__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\
\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \_... |
Task
Your goal, should you choose to accept it, is to write a program, that, given an input string (or array of characters), outputs every possible permutation of the letters in that string. I'm finicky with my output, so it should be sorted alphabetically, with no duplicates.
Example:
Input: buzz
Output:
buzz
bzuz
bzz... |
There's something (well, many things ) that really annoys me. It is when dictionaries (English, not Pythonic) use the defining word itself to define the word, also called circular definitions. Example:
reticence: the quality of being reticent
-- Apple Dictionary
Circular definition: a definition that is circular
--... |
This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a lot easier than this one here
This Challenge
Given a bunch of rectangles, figure out whether or not they fill a rectang... |
Introduction
I have a room full of magic mirrors.
They are mysterious artifacts that can duplicate any item, except another magic mirror.
More explicitly, a duplicate version of the item will appear on the other side of the mirror, at the same distance.
However, if there is another magic mirror in the way on either sid... |
A "Giza number", also colloquially known as a Timmy Number is any number where the digits represent a pyramid (A134810). For example, "12321" is a giza number because it can be visualized like this:
3
2 2
1 1
However, something like "123321" is not a Giza number because there are two digits at the top of the py... |
Problem
The goal is as the title says to find the \$n\$th prime such that \$\text{the prime}-1\$ is divisible by \$n\$.
Explanation
Here is an example so you understand the question, this is not necessarily the way it ought to be solved. It merely as a way to explain the question
given \$3\$ as an input we would first ... |
Introduction:
I think we all know it, and it has probably been translated in loads of different languages: the "Head, Shoulders, Knees and Toes" children song:
Head, shoulders, knees and toes, knees and toes
Head, shoulders, knees and toes, knees and toes
And eyes and ears and mouth and nose
Head, shoulders, kne... |
And in particular the second law: the entropy of an isolated system undergoing an irreversible process increases with time.
For this challenge,
An "isolated system" will be taken to be a program or function (abbreviated as "program" from now on);
The "irreversible process" will be execution of code;
The passing of "ti... |
Input: Two integers n and k given in any form that is convenient for your code
Output A random non-decreasing sequence of k integers, each in the range 1 to n. The sample should be chosen uniformly from all non-decreasing sequences of k integers with integers in the range 1 to n.
The output can be in any reasonable f... |
In mathematics, matrix multiplication or the matrix product is a binary operation that produces a matrix from two matrices. The definition is motivated by linear equations and linear transformations on vectors, which have numerous applications in applied mathematics, physics, and engineering. In more detail, if A is an... |
Input
A dictionary with string keys and string values.
Output
The 'inversedict' of this dictionary.
How to make an inversedict
An inversedict is a dictionary with string keys and string array values. The keys are the values from the original dictionary, and the values are the keys from the original dictionary with th... |
A stochastic matrix is a matrix of probabilities used in the context of Markov chains.
A right stochastic matrix is a matrix where each row sums to 1.
A left stochastic matrix is a matrix where each column sums to 1.
A doubly stochastic matrix is a matrix where each row and each column sums to 1.
In this challenge, we ... |
Given only a straightedge and compass, inscribe a rhombus inside the given rectangle, sharing two opposite points.
Input
Input is the dimensions of the rectangle. In the example shown, that would be 125, 50. You can take input in whatever way is most convenient (as two integers, list, strings, etc).
The larger dimensi... |
A Hilbert Curve is a type of space-filling curve, and it basically maps a line to a plane. Each point in the line corresponds to just one point in the plane, and each point in the plane corresponds to just one point on the line. Shown are iterations 0 through 4 of the Hilbert Curve:
Iterations 0 up to 4:
The objec... |
For today's fractal challenge, draw at least 5 iterations of Sierpinski's triangle! (Shown below is Sierpinski's trinagle)
The resolution of the image must be sufficent that the smallest triangles are at least one pixel in size, and all triangles should be approximately equillateral - pixel art that draws a right-tria... |
How well do you know the site? Let's find out.
This is a cops-and-robbers challenge. Robber's thread.
As a cop, you need to:
Find a non-deleted, non-closed challenge on this site to answer. The challenge cannot have the following tags: cops-and-robbers, popularity-contest, code-trolling, underhanded, busy-beaver, k... |
How well do you know the site? Let's find out.
This is a cops-and-robbers challenge. Cop's thread.
As a robber, you need to:
Find a non-deleted, non-closed challenge that matches a cop's submission. The challenge cannot have the following tags: cops-and-robbers, popularity-contest, code-trolling, underhanded, busy-... |
Introduction
The Sierpinski Arrowhead Curve is a curve that's limit is Sierpinski's Triangle.
It first starts like this:
_
/ \
Then, each line is replaced with a rotated version of the first one:
_
/ \
\ /
_/ \_
Next:
_
/ \
\ /
_/ \_
/ \
\_ _/
_ \ / _
/ \_/ \_/ \
Your task
Given a ... |
Given a non-empty string, keep removing the first and last characters until you get to one or two characters.
For example, if the string was abcde, your program should print:
abcde
bcd
c
However, if it was abcdef, it should stop at two characters:
abcdef
bcde
cd
Trailing newlines and trailing spaces at the end ... |
Inspired by Find the “unwrapped size” of a list.
Define the Recursive Size, RS, of a list containing no lists as its length (number of items contained) and the Recursive Size of a list containing any lists as the sum of its length and the Recursive Size of those lists.
Challenge
Write a program or function that outputs... |
Let me tell you about a simple number system. (which I made up just for this challenge)
This system contains the functions (), [], {}, and <>.
1. ()
When () is given no arguments, it evaluates to 0.
When () is given one or more arguments, it evaluates to the sum of the arguments.
2. []
When [] is given no arguments, it... |
Thanksgiving in the United States is coming up on November 24th. Many people will have a large dinner with their families, traditionally including turkey and many side dishes. This typically means the family members must coordinate who's going to bring each of the various dishes. In this challenge, the goal is to write... |
Once I wrote a JavaScript program that would take as input a string and a character and would remove all characters except for the first one and the character given as input, one by one.
For example, computing this with inputs codegolf.stackexchange.com and e for the character yields:
codegolf.stackexchange.com
cdegolf... |
Challenge
Implement a program that given three strings a, b, and c, substitutes all instances of the substring b in a with c.
In other words, implement Ruby's String#gsub with strings instead of regexes (a.gsub b, c).
Rules
Standard loopholes apply.
You may not use a builtin that performs this exact task.
This is code... |
This challenge is inspired by this other challenge, which you may want to read first for some context. However, a competitive answer is likely to look very different, so after reading some posts on Meta I decided it was best posted as a separate question.
The goal here is to write a polyglot program; that is, a program... |
Background
We already have a challenge about throwing SIGSEGV, so why not a challenge about throwing SIGILL?
What is SIGILL?
SIGILL is the signal for an illegal instruction at the processor, which happens very rarely. The default action after receiving SIGILL is terminating the program and writing a core dump. The sign... |
Many old Game Boy games often required string input from the user. However, there was no keyboard. This was handled by presenting the user with a "keyboard screen" like so:
The 'character pointer' would begin on letter A. The user would navigate to each desired character with the D-Pad's four buttons (UP, DOWN, LEFT a... |
I'm new to Japanese Mahjong and have trouble calculating the scores. Please help me write a program to calculate it.
Introduction
(aka you can skip this boring part)
Mahjong is a popular tile game in Asia. Different rules have evolved and systematically established in various regions. Japan, being an isolated island st... |
You task for today: draw a dragon curve!
In case you don't know what a Dragon Curve is, here is an introductory ViHart video (Really cool, please watch!)
Your task: draw a dragon curve, iterated at least 9 times. You don't have to show iterations 1 through 9, you just have to show the final curve produced after complet... |
Brief Problem Explanation
Write a program to find the minimum distance between two points traveling only on rays emanating from the origin and circles centered on the origin.
Explanation of Premise
Now let's imagine we are on a plane, and on this plane we are only allowed to travel in special ways. We are allowed to tr... |
Write a program that outputs as many characters as possible, with two conditions:
The program must be 256 bytes or shorter
The program must almost surely eventually halt. In other words, the only thing not permitted in response to this question is an infinite loop.
For the purposes of this problem, any built-in psudo... |
Background
This question is similar to this one. I have provided all of the information needed below. If you are familiar with the other challenge then note that we are ranking all defenses instead of seeing the effectiveness of a single attack. This is important because it means that the tables are inverses of each ot... |
Definitions:
A line is a possibly empty sequence of characters terminated by a “newline character.”
A “newline character” is a character that cannot be a component of the aforementioned character sequence.
A line number comment is a character sequence that does not alter the meaning of source code in the programming l... |
The Challenge
Given a CSV input, output a proper unicode table using box characters.
Formatting
The table will be formatted using the following rules:
Column width will be equal to the longest value of that column
All table data will be left justified
Each table will assume the first csv row to be the header
The table... |
What's great about golfing is not having to deal with errors. Except this time you won't get off so lightly! I need to do some arithmetic with certain limitations, and I wan't to know what goes wrong if anything.
Challenge
Given a list of signed integer values [n1..n11], give the following result or the first error tha... |
Challenge description
Let's start with some definitions:
a relation is a set of ordered pairs of elements (in this challenge, we'll be using integers)
For instance, [(1, 2), (5, 1), (-9, 12), (0, 0), (3, 2)] is a relation.
a relation is called transitive if for any two pairs of elements (a, b) and (b, c) in this rel... |
Let's take a look on a typical loop, which usually performs 8 iterations:
for (int x=0; x<8; ++x);
You have to make it infinite!
It's a popularity-contest for all languages that support such form of for loop. So solution with highest score (upvotes minus downvotes) wins.
If your language has the other form of for loo... |
Remember those brute-force programs to crack password that show every combination they are trying? More precisely, at one point, the n first characters are fixed (they have been guessed successfully), and every possible character for the remaining ones is being tested. You've probably seen some in movies, or in some so... |
Introduction
A disk is a linear container with blocks indexed 0 through size-1.
A file is a named list of block indexes used by that file.
An example filesystem is expressed like this:
15 ALPHA=3,5 BETA=11,10,7
"The disk has 15 blocks, the first block of file ALPHA is the disk block at index 3..."
The disk map could b... |
Your challenge is to create a regex that matches every string permutation of itself, and nothing else. The match must also be case-sensitive.
So, for example, if your regex is:
ABC
It should match (and only match) these strings:
ABC
ACB
BAC
BCA
CAB
CBA
It shouldn't match things like:
AABC (contains an extra A)
ABCD (... |
Output a full formal poof of such statements such as 1+2=3, 2+2=2*(1+1) etc.
Introuction
If you know Peano Arithmetic you can probably skip this section.
Here's how we define the Natural Numbers:
(Axiom 1) 0 is a number
(Axiom 2) If `x` is a number, the `S(x)`, the successor of `x`, is a number.
Hence, for example S(S... |
You are a traveller crossing the desert between two towns. You cannot carry enough water to get across without stopping. This is a variation of a classic puzzle.
The Rules
A desert looks like this: a WxH grid of mostly empty space. The space marked S is where you start, E is where you want to end, and a square marked w... |
Generate a cipher given a number and string
Your task is simple. Given a string s and a number 0 <= n <= 9 as inputs, insert a pseudo-random printable ASCII character between each character of the string n times. Such that for each character of s there are n random characters between them. Spaces should be trimmed.
Inp... |
Wikipedia says about Polar Coordinates:
In mathematics, the polar coordinate system is a two-dimensional coordinate system in which each point on a plane is determined by a distance from a reference point and an angle from a reference direction.
This seems perfect for describing hexagonal grids. Take the following he... |
Goal:
A tree can be represented as a nested list: the list elements represent nodes, and a node is a pair of the node name and node children.
Your program takes as input a nested list of pairs, and should output a pretty tree.
Examples:
Here are four example test cases below
["stump",[]]
["trunk",[["branch",[["leaf... |
Today we're going to build a pyramid out of letters! Here's an example letter pyramid for the first 5 letters:
Write the first 5 letters with a space between, first ascending and then descending.
A B C D E D C B A
Do the same thing for the first four letters on the line above, but with two extra leading spaces:
A B... |
Summary
Implement FizzBuzz in Python, with the fewest possible tokens.
Challenge
Write a program that prints the decimal numbers from 1 to 100 inclusive. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print... |
I love /usr/share/dict/words; it's so handy! I use it for all my programs, whenever I can! You're going to take advantage of this ever so useful file to use, by testing a word's individuality.
Input
A word; defined in this challenge as any string of characters
/usr/share/dict/words in some format; you may hard code i... |
This challenge is based on the game Layerz.
Given, on stdin or as a function argument, a 2D rectangular array of cells where each cell contains either a blank (you may choose to use 0s instead of blanks at no penalty), a 1, a 2, a 3, or a 4; find a way to divide it into valid regions (as defined below) such that each n... |
The challenge is to calculate the digit sum of the factorial of a number.
Example
Input: 10
Output: 27
10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27
You can expect the input to be an integer above 0.
Output can be of any type, but the answer sh... |
Your task, if you choose to accept it, is simple.
Objective
You must make a program that, when run, prints some (as many as you want) terms in a sequence that you choose. The sequence must be a valid OEIS sequence. The twist is that when you take the characters from your code that make up your sequence, string them tog... |
First line is made with ceil(n/2) elements where each element is: <space><odd-number><space>
Second line is made with ceil(n/2) elements, but each element is / \ only.
You may assume n >= 0 and n <= 10.
Examples
Input: 3
1 3
/ \/ \
Input: 10
1 3 5 7 9
/ \/ \/ \/ \/ \
Example in Python 3, 103 bytes:
lambda a:p... |
Inspired by Display a chain of little mountains with an odd number on the top of it! by @sygmei.
Why have a chain of mountains when you can have one massive one?
Make a program that takes an input number and prints a mountain with every odd number up to the input number.
(Where "south west" means directly below and to ... |
EDITS:
Added link to the plain-text (multiple strings) test data
Added BLANK,EDGE and TIE2 test cases (see Test Data section) (11/25)
Updated the JSON test cases (some lines were ill-formatted) (11/24)
Renju match gone bad ! (well, technically these guys are playing Go, but who cares) Wikisource
TL;DR
Take a 15x15 ... |
Take a non-nested array as input. Turn it into a matrix by using the following method:
Let's say my array is [1, 2, 3, 4, 5]
First, I repeat that array 5 times: (the length)
[[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5],
[1, 2, 3, 4, 5]]
Then, I read it along the diagonals:
[[1],
[2, 1],
[3... |
Tamagotchi and Giga Pets were small electronic devices which simulated a little virtual pet. This pet had several stats, like health, hunger, etc.
I recently wrote this example:
import msvcrt,os,sys;d=m=100;h=s=t=p=0;f=10
while 1:
os.system('cls'if os.name=='nt'else'clear');print("health:",d,"\nhunger:",h,"\nsleep:",... |
Write a program with the following properties:
When run as-is, the program produces no output (i.e. 0 bytes of output).
There is a location within the program (of your choice: it could be at the start, end, or somewhere in the middle) with the following property: modifying the program via placing any string there will... |
Introduction
Today I went fishing alone with my canoe, unfortunately I fell asleep and the stream brought me away, I lost my oars, now it's night and I am lost in the ocean! I can't see the coast so I must be far away!
I have my cell phone but is malfunctional because it got wet by the salty water, I can't talk or he... |
Task
Given a Boolean matrix, find one (or optionally more) subset(s) of rows which have exactly one True in each column. You may use any algorithm, but must support very large matrices, like the last example.
One possible algorithm (Knuth's Algorithm X)
While there is no requirement to use this algorithm, it may be you... |
The Golfer Adventure
This is the first challenge ! There will be more challenges later that will require data from the previous challenge :)
Chapter 1 : The Vase
Let's imagine a minute.. You are a powerful God, your powers are limitless but require one thing : Souls.
Each soul is here represented by a byte, each byte y... |
Introduction
I'm a real big fan of the SBU (Short But Unique) challenges that crop up on PPCG all of the time. The CUSRS is a system designed to refactor strings, a CUSRS function takes 2 parameters and outputs 1 String.
Challenge
Produce a program, function, lambda or acceptable alternative to do the following:
Given ... |
Background
An unlabelled tree may look like this:
o
/ | \
o o o
| / \
o o o
To linearize this tree, we first label each node o with it's number of child nodes:
3
/ | \
1 0 2
| / \
0 0 0
and then write the numbers in a list in a breath-first manner, meaning line by line and left to right:
[3... |
Your challenge is to write a program or function that hiccups a string. It should take a string as input (via any standard method), then follow these steps:
Generate a (not necessarily uniformly) random integer n between 1 and 10, inclusive.
Wait n seconds.
Print the initial/next n chars of the input, or the rest of t... |
...but hey, no need to be strict.
Given a non-empty array of strictly positive integers, determine if it is:
Monotone strictly decreasing. This means that each entry is strictly less than the previous one.
Monotone non-increasing, but not strictly decreasing. This means that each entry is less than or equal to the pre... |
A sculptor is tasked to creating icicle sculptures for the new museum in Greenland. He has been given specifications by his boss, which consists of two numbers: [s, m] or size and melt. Size must be an odd number. He was given some photos of real icicles:
vvvvv [5, 0]
vvv
v
vvvvvvv [7, 0]
vvvvv
vvv
v
vvv... |
Your task is to, given an array of signed 32 bit integers, recompile it with its inverse deltas. For example, the list
1 3 4 2 8
holds the deltas:
2 1 -2 6
which are then negated, yielding:
-2 -1 2 -6
and recompiled, yielding:
1 -1 -2 0 -6
as the final result.
Input/Output
You will be given a list/array/... |
Challenge
Write a full program/function to Demolish a given building at the rate 1 floor per second.
INPUT
Input is a building through STDIN(or whatever is called in your language) or through an ARGUMENT of a function.
t=0 s
|
|#|
{#}
|# #|
|# # #|
|# # #|
|# # #|
TTTTTTT
input consists of :
| marks sta... |
You will write a simple program that prints exactly 1 2 3 4 5 6 7 8 9 10 to STDOUT, Console, or your language's closest output method. No other visible output should be seen. Any other code executed must be back-end only.
This is answer-chaining, so the catch is that you must include the previous answer's source code i... |
Let's use the four basic operations, addition +, multiplication *, subtraction - and division / (float, not integer).
Stewie's sequence is defined as follows:
x = [x(1), x(2)] // Two initial numbers (one indexed)
x(3) = x(1) + x(2)
x(4) = x(2) * x(3)
x(5) = x(3) - x(4)
x(6) = x(4) / x(5)
x(7) = x(5) + x(6)
... and s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.