instruction stringlengths 34 53.1k |
|---|
Anomalous Cancellation (from Wolfram Alpha):
Anomalous cancellation is a "canceling" of digits of a and b in the numerator and denominator of a fraction a/b which results in a fraction equal to the original. Note that if there are multiple but differering counts of one or more digits in the numerator and denominator t... |
Given an input of a color in #rrggbb hex format, output its RGB complement in
the same format.
The RGB complement R2G2B2 of any color
R1G1B1 is defined as the color with
R2 value 255 - R1, B2 value 255 -
B1, and G2 value 255 - G1.
Hex digits may be either in uppercase (#FFAA20) or lowercase (#ffaa20). The
case of the i... |
2015 was the year of the goat! In this challenge, you will figure out which animal represents the year. To avoid making this challenge to complex you won't need to calculate Chinese new year.
Because they are only 12 animals in the Zodiac, your code will need to be as short as possible.
Examples
Your program must get t... |
In the Bitcoin protocol, 2016 is a very special number. The "difficulty" of finding a hash to create a new block is adjusted every 2,016 blocks to approximate changing once every two weeks.
This number was chosen is because the difficulty adjusts itself so that every block takes about 10 minutes to be found, and in two... |
Given a decimal in the form of <float>, <precision>, you draw the graphical representation of the decimal part (i.e. fraction) of the float. Examples:
Input: 6.75, 4, output:
6||| 7
----
6.75 (first number from the input) is the number to explain, 4 (the second number from the input) is the number of dashes below t... |
Background
The greatest common divisor (gcd for short) is a convenient mathematical function, since it has many useful properties.
One of them is Bézout's identity: if d = gcd(a, b), then there exist integers x and y such that d = x*a + y*b.
In this challenge, your task is to visualize this property with simple ASCII a... |
In this challenge you will need to determine whether it's Pi Day, Pi Minute, or Pi Second.
Because Pi is irrational, it wants your code to be as short as possible.
Examples
No input is provided, your program should use the system time. I've just added it for clarity
March 14, 2016 0:00:00
Pi Day
December 25, 2015 3:14:... |
The Rules
Each submission must be a full program or a function.
The program must take all instances of the string 2015 from the input (1 string), replace it with <s>2015</s>* (with <s> or <strike>). At the end, if there has been at least one 2015 in the string, you must add a newline and this string: *2016. I'm a year... |
Your task is simple. Post a snippet in any language that if the snippet is repeated n times, will output n in decimal, octal, and hexadecimal, in that order, separated in spaces. n is an integer larger than zero. There is no leading zeroes. Shortest answer wins
Example
If the snippet is ABC then the test case is
ABC
1... |
Your challenge:
You are on the 0th floor of a infinitely tall building. At any floor, you can walk to the window and drop an egg. Your goal is to figure out the highest floor that the egg can withstand without breaking. However, you have a maximum of 3 eggs to use to figure this out, but you need to minimize the numb... |
What general tips do you have for golfing in Forth (and its clones)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Forth (e.g. "remove comments" is not an answer).
|
Task
Take a single Unicode character as input.
Output a program in the same language that also obeys this specification, but which does not contain the input character.
If your program is run with input a, and then the output program is then run with input b, then the program it outputs is ALLOWED to contain character... |
Given an input of a "hotel" in ASCII art with a single room marked, output the
room number according to certain rules.
Here's an example of an ASCII hotel:
##
##
##### ##
##### ###### ##
##### ###### ##
##### ###### ##
Here are a few more things about the ASCII hotels:
Eac... |
Write a function or program than can do simple arithmetic (addition, subtraction, multiplication and division) in both base 10 and base 2.
The function will take a mathematical expression as input, and output the correct result in the correct base. The input will be n numbers separated by one or several operators (+ - ... |
Some friends and I have played some DSA (a mainly german tabletop RPG much like D&D). I was wondering what the chance on passing rolls are, so you will have to write some code to calculate it.
Your character is defined by stats (from 8 to 14) and (TV) Talent values (0 to 21). For now we will use climbing as an example.... |
Introduction
For the ones wondering what Befunge exactly is, it is a two-dimensional stack based language made in 1993 by Chris Pressy. I made 7 brain teasers that need to be solved in Befunge-93. This is quite an experimental challenge, but I thought it's worth a shot :). A full list of all commands used in Befunge-93... |
In this challenge, you will be "reversing" the alphabet or swapping a-z with z-a. This is commonly known as the Atbash cypher.
Because this transformation makes the output look like some foreign language, your code will need to be as short as possible.
Examples
abcdefghijklmnopqrstuvwxyz
zyxwvutsrqponmlkjihgfedcba
Pr... |
You are to write a sequence of 10 programs p1 p2 ... p10 that satisfy the following properties:
pK prints pK+1 for K from 1 to 9
p10 prints p10
When the first K programs are concatenated, the resulting program p1...pK prints p1...pK.
Each program pK must be larger in byte size than the previous program pK-1.
All progr... |
The challenge
Write a function or a program that takes a string composed of one or more subjective personal pronouns, separated by + signs, as an argument. The output must be a single pronoun, that is the result of the relation defined in the next paragraph.
Of course, feel free to edit as you wish to correct those gra... |
The challenge
Well, I think it is quite clear, isn't it? You have to make a function or a program that takes a string as an argument and outputs the corrispondent Yoda-speaking.
This is code-golf, so least number of bytes wins.
The input
The input could be any string without linefeed. You can translate a string if it i... |
Your code is going to generate a very simple ASCII-art representation of DNA, forever. It will take two numbers as input in any format you want: as a list, as arguments to a function, on stdin, etc.
A floating-point interval I in seconds between 0.0 and 1.0 (inclusive)
A zoom level Z as an integer from 1 to 64 (inclus... |
Given an input of a Spanish verb in its infinitive form, output the verb
conjugated in all 6 forms of the indicative imperfect.
To conjugate an infinitive in the imperfect, remove the infinitive ending (-ar,
-er, -ir, and sometimes -ír) and add the imperfect endings listed below. There
are three irregular verbs in the ... |
Consider a sequence based on recurrence relations, f(n) = f(n-1)+f(n-2), starting with f(1) = x1, f(2) = x2. For x1 = 2, x2 = 1, the sequence begins like this:
2 1 3 4 7 11 18 29 47 76 123 199 322 521 843
Concatenating this into a string will give:
213471118294776123199322521843
Now, divide this list i... |
You must make the shortest program to always find the optimal solution to a simplified Frogger game on a 9x9 grid.
Course Elements:
L - Log (Length: 3-4). When you hop on a log, it carries you with it.
V - Vehicle (Length: 1-2)
Speed (1-2): On the left hand side of the row will be the speed that elements in the row... |
Inspired by this SciFi.SE question.
Background (with minor spoiler):
In the movie The Martian, protagonist Mark Watney uses an ASCII table to look up hexadecimal values of ASCII characters so he can attempt to communicate back to Earth.*
Challenge
With no input, output the following ASCII table exactly like this:
D... |
You have been chosen to make a program that creates some pretty ASCII bar charts. Here is the input format:
[List of words (they can have spaces)] [an integer >= 0]
Bar 3
This is so cool 4
IDK-Why 6
The input will have multiple lines in this format, each one representing one bar in the graph. The output format of a gr... |
This challenge was xnor's idea, taken from Digital Trauma's challenge donation thread.
Your challenge is to write a program that, as xnor put it, "procedurally generate[s] the splotchy black-and-white marbled pattern on the covers of composition notebooks":
Your program can either display it on the screen or save it ... |
Inspired by this excellent challenge (from which the bulk of this text is blatantly duct-taped) – and my highschool philosophy project...
I define the following operators:
Fuzzy Conjunction a ×F b is a × b
Fuzzy Division a ÷F b is a ÷ b
Fuzzy Negation –F b is 1 – b
Fuzzy Disjunction a +F b is –F ((–F a) ×S (–F b) which... |
There exists a brain game called Enumerate (which I made, based on Takuzu). Your challenge is to play this game.
Task
Solve a game of 4x4 Enumerate/Takuzu.
Receive a starting grid via STDIN or command line.
Output the solved grid via STDOUT or writing to file.
Rules
A game is characterized by a 4x4 board, made up o... |
Your task is to write a program or function that detects accents in UTF-8 input. The catch is that your code must be written entirely in an 8-bit character encoding. The code will output a single integer which is the count of the number of accented letters in the input. Since Unicode is huge, the test input will consis... |
As a spin-off to my challenge over at Puzzling, your goal is to output 2016.
Rules:
You must include the numbers 10 9 8 7 6 5 4 3 2 1 in that order. They can be used as individual integers or concatenated together (like 1098), but the 10 may not be separated into 1 and 0 - no character(s) may be present between the di... |
Inspired by the Lego gear ratios challenge by Keith Randall.
I, too, plan on building a giant lego robot that will eventually be able to destroy the other robots in the never-before-mentioned competition.* In the process of constructing the robot, I will be using a lot of gear trains to connect different parts of the r... |
Introduction
Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row loses. An interesting fact is that the maximum amount of crosses before someone loses, is equal to 6:
X X -
X - X
- X X
... |
The Champernowne constant is a number that is constructed by concatenating the first n numbers, with n tending to infinity. It looks something like this:
0.123456789101112131415161718192021222324252627282930...
Now, I will describe to you the Rien number. It can be thought of as a minimization of the Champernowne cons... |
Japanese kana characters correspond to a single sound in the Japanese language. With the exception of ん (n), every other kana consists of a consonant part and a vowel part. There is a natural ordering to Japanese kana, a sort of "alphabetical order", which is typically arranged in a 10 by 5 table:
| a i u ... |
When I was younger, I use to play a word game called Word chain. It was very simple. The first player chooses a word; the next player says another word that starts with the same letter the previous word ended with. This goes on forever until somebody gives up! Trick is, you cannot use the same word twice (unless everyb... |
Given any of the following characters (or a newline):
`1234567890-=~!@#$%^&*()_+qwertyuiop[]\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:"zxcvbnm,./ZXCVBNM<>?
Your program must output the row that it is on the keyboard
Because my keyboard is (almost) out of battery, your code must be as short as possible
The keyboard your pro... |
The purpose of this challenge is to find the general term of a given arithmetic or geometric sequence.
Explanation
The formula for an arithmetic sequence is as follows
an = a1 + (n-1)d
where a1 is the first term of the sequence, n is the index of the term, and d is the common difference between the terms. For a geomet... |
Introduction
In the field of mathematics known as topology, there are things called separation axioms.
Intuitively, you have a set X and a collection of subsets of X, which we can think of as properties.
The system is well separated, if one can distinguish between all items of X based on their properties.
The separatio... |
Given an input of four integers x1, y1,
x2, and y2, output whether a white king in chess
(with coordinates (x1, y1)) could catch a black pawn
(with coordinates (x2, y2)) and capture it if the
pawn is moving to promote to a queen as fast as possible.
The coordinates of the board are as follows:
first coordinate... |
Consider the Atbash transformation:
A|B|C|D|E|F|G|H|I|J|K|L|M
Z|Y|X|W|V|U|T|S|R|Q|P|O|N
Where A ⇔ Z and L ⇔ O, e.g. There is an interesting property that some words share. When some strings are translated to their atbash-equivalent, said translation is the original word reversed. I call these Atbash Self Palindromes.
... |
If you're not familiar, Diceware is a method for creating passwords using an ordinary die from a pair of dice as a hardware random number generator.
For the sake of fun, let's ignore anything about the security of computer's random number generators.
Write a function or program that prints or returns a single five-cha... |
Making a versatile integer printer is nice and all, but writing a single code that prints a lot of different numbers is cumbersome. Wouldn't it be easier to make a script that outputs a number, but also gives you a new script to get the next number?
Challenge:
Write a code that outputs a single integer N and an executa... |
The first Letters, Get Moving! was very popular, but had limited participation. This one will be easier to solve, but hopefully involve some tricks in golfing.
You are given a string of only lowercase letters. For each letter, with position in the alphabet m, move it so it becomes the mth letter from the end. If the va... |
Your task is to create a program which takes a black-and-white outlined image (example images are below) and fills it in with colour. It is up to you how you section off each region and which colour to fill it with (you could even use an RNG).
For example:
As you can see I am clearly an artist of a superior calibre wh... |
Given a unicode character C (or the first character of a string input), output that character's hex representation. Case does not matter. The output ranges from \u0000 to \u9999.
Test cases
A => 41 (65_10 === 41_16)
ʣ => 2A3 (675_10 === 2A3_16)
Ω => 3A9 (937_10 === 3A9_16)
7 => 37 (55_10 === 37_16)
(null byte) => 0 (... |
Every programmer knows that brackets []{}()<> are really fun. To exacerbate this fun, groups of interwoven brackets can be transformed into cute and fuzzy diagrams.
Let's say that you have a string that contains balanced brackets, like [{][<(]})>(()). Step one is to rotate the string 45 degrees clockwise. (In Mathema... |
Description
Here's a very superstitious hotel elevator in Shanghai:
It avoids the number 13, because thirteen is unlucky in the Western world, and it avoids the digit 4, because four is unlucky in parts of Asia. What if this hotel was taller?
Read a positive even integer n from STDIN, representing the n... |
Given the ASCII art of two vectors, find the resultant vector's magnitude and degree.
Input
This can be received via STDIN, read from a local file, or provided through a function call. Here is an example of a two vector input:
^------>
|
|
|
x
This represents a change of 4 units north and 7 units east. Every input's ... |
There are many puzzles with matches that involve adding, removing, or moving a certain number of matches to create new numbers or shapes. This is like that with a digital clock.
Given a valid time on a 12-hour digital clock, output the digit that requires moving the fewest lines to make it so every visible digit on the... |
Every programmer knows that rectangles □ are really fun. To exacerbate this fun, these cute and fuzzy diagrams can be transformed into groups of interwoven brackets.
This challenge is the inverse of my previous.
Let's say you have a group of interlocking rectangles like so:
+------------+
| |
+--+-+ ... |
Actually not inspired neither by Atbash Self Palindromes nor by Generalized Gematria Calculator.
Given a string s of length n, output the Revu'a sequence, which is the first character of s, the first two characters of s, ... the first n–2 characters of s, the first n–1 characters of s, the entire s.
The string will onl... |
You may remember in first or second grade using expanded form to learn about place value of numbers. It's easier to explain with an example, so consider the number 123. In expanded form it is represented as 100 + 20 + 3, which helps a young mind visualize place value. It is reminiscent of how you say it: one hundred (p... |
Inspired by this conversation in chat.
Your goal in this challenge is to emulate a ninja and count how many deaths he has left.
Specs
You ninja starts out with 9 deaths left. He also gets an integral starting health as an input.
Then, he takes as input a list of events in his life that alter his health. These can be ne... |
Based on Chunky vs. Smooth Strings.
Squiggles /\_/\/\__/\/\/\/\_/\_/\ are fun to make on a keyboard when you are really bored. But not all squiggles are created equal. Some squiggles are smooth, like \___/, and some are chunky, like /\/\/\/\. Others are just downright broken, like ////_\\\
Inside every squiggle of N... |
Given an input of two integers n and m, output an ASCII ladder of length
n and size m.
This is an ASCII ladder of length 3 and size 3:
o---o
| |
| |
| |
+---+
| |
| |
| |
+---+
| |
| |
| |
o---o
This is an ASCII ladder of length 5 and size 1:
o-o
| |
+-+
| |
+-+
| |
+-+
| |
+-+
| |
o-o
This is an AS... |
7-segment digits can be represented in ASCII using _| characters. Here are the size 1 digits:
_ _ _ _ _ _ _ _
| _| _| |_| |_ |_ | |_| |_| | |
| |_ _| | _| |_| | |_| _| |_|
Larger sizes are formed by making each segment proportionately longer. Here are a couple size 3 digits.
___ ... |
A list of positive integers can be visualized as a quantized mountain range where each list entry represents the height of one vertical section of the mountains.
For example, the list
1, 2, 2, 3, 4, 3, 5, 3, 2, 1, 2, 3, 3, 3, 2, 2, 1, 3
can become the range
x
x x
xxxxx xxx x
xxxxxxxx xxxxxx x
x... |
This challenge is about printing the abacaba sequence of a specific depth.
Here is a diagram of the first 5 sequences (a(N) is the abacaba sequence of depth N, upper/lowercase is just to show the pattern, this is not needed in the output of your program):
a(0) = A
a(1) = aBa
a(2) = abaCaba
a(3) = abacabaDabacaba
a(4) =... |
Hexagonal grids have been become a fairly popular twist for challenges about 2-dimensional data recently. However, it seems that the equally interesting triangular grids have been largely neglected so far. I'd like to rectify that with a rather simple challenge.
First, how do we represent a triangular grid? Consider th... |
Mr. William Shakespeare wrote plays. A lot of plays. In this tarball containing every single one of his works, each one of his plays is one long file.
It needs to be split into Scenes for a stage production. Because actors are impatient, your code needs to be as short as possible.
Task:
Your task is to write a program ... |
The split-complex numbers, also known as "perplex numbers" are similar to the complex numbers. Instead of i^2 = -1, however, we have j^2 = 1; j != +/-1. Each number takes the form of z = x + j*y.
In one attempt to limit the complexity of this challenge, I will use the symbol - to represent negation, as there will not... |
Introduction
In the strategy game Starcraft 2, there are three "races" to choose from: Terran, Zerg, and Protoss. In this challenge we will be focusing on the Protoss and the iconic phrase "You must construct additional pylons!" This message is stated when you run out of supply to build your army. So, to help out the S... |
A leaper is a category of fairy chess piece which moves by "jumping." A normal knight is a (1,2)-leaper, meaning each move involves moving a distance of 1 square in an orthogonal direction and 2 squares in the perpendicular direction.
.o.o.
o...o
..N..
o...o
.o.o.
There are many different leapers. The (1,3)-leaper is... |
[I decided to salvage Ben Reich's question How many unique ways are there to achieve a score in Football? but it ended up being so different that it's only suitable as its own question not spliced into his.]
Challenge: Given a number, calculate how many order-independent ways there are to score that number as a winning... |
Because rickrolling is the greatest meme on Earth, you [know the rules and so do I] are to write the shortest code that can textually rickroll the unsuspecting reader. Let [you down] there be an input text which contains letters, punctuation, and spaces. Anytime a [lie and hurt you] phrase from the first two stanzas ... |
Your challenge is to format a list of words across multiple lines that are no longer than a given number of characters, so that each line contains as many words as possible and no words are unnecessarily cut off.
Input
The input will be a space-separated list of words and then a number that is at least 4.
Output
The ou... |
While we're on a triangular grids kick, I'd like to point out that there is an equivalent to polyominoes on a triangular grid. They are called polyiamonds, and they are shapes formed by gluing equilateral triangles together along their edges. In this challenge you are going to be deciding which subsets of a triangular ... |
I've been working on another stack-based golfing language called Stackgoat. In this challenge you'll be writing a Tokenizer for Stackgoat (or really any general stack-based languages).
Examples
"PPCG"23+
["PPCG", '23', '+']
'a "bc" +
['"a"', '"bc"', '+']
12 34+-"abc\"de'fg\\"
['12', '34', '+', '-', '"abc\"de'fg\\"']... |
Overview
Given an image in plain PPM (P3) format as input, for each pixel p in the image, replace each of the following 4 pixels' red, green, and blue with the floored average value of the respective channels of all 4 pixels:
p itself
The pixel located at p's location when the image is flipped vertically
The pixel loc... |
Given a number n > 77, write a program or function that finds a set of distinct positive integers such that the sum of the set equals n, and the sum of the reciprocals of the set equals 1.
Example for 80:
80 = 2 + 4 + 10 + 15 + 21 + 28 ⟶
1/2 + 1/4 + 1/10 + 1/15 + 1/21 + 1/28 = 1
Your program or function must... |
Background
Your friend, a linguist, has recorded and analyzed some simple conversation snippets in various languages.
Being quite absent-minded, they have forgotten which language each snippet was in.
You must help them by creating a program that analyzes the sentence structures and rules out impossible cases.
Input
Yo... |
Here's a deceptively challenging geometry puzzle for you!
Given a circle A, and n other circles B[n], find the total area contained within A that is not within any circle of B.
Your code should be as short as possible.
Input
Your input should contain the following information:
A floating-point number to represent the ... |
What could be more polar opposites than chess and demolition derby. You would think that no one who enjoys one would enjoy the other... until today.
Rules
The starting position is a standard chess board:
RNBQKBNR
PPPPPPPP
PPPPPPPP
RNBQKBNR
Looks normal enough, until you find out it's an EVERY PIECE FOR ITSELF, ... |
I like ascii art and I get bored a lot, so I found some ascii characters and started to make random things, 8-bit mario castle, mazes, and arches. I found that the arches could easily be stacked in a neat way.
╔═══════╗
║╔═════╗║
║║╔═══╗║║
║║║╔═╗║║║
╨╨╨╨─╨╨╨╨
Challenge
Create a program, function, or any other standard... |
Given an input of an integer n and a list of positive integers m1,
m2, ..., output a list of integers m1',
m2', ... where mx' is defined as the average of
mx-n through mx+n.
When calculating these averages, ignore indices that are out of bounds (and
adjust what you are dividing the sum by accordingly). n will always be... |
Write a function or program that outputs Quater-imaginary base displayed as binary digits. The number base is 2i, where i is the square root of -1. See Complex Number for more details on i. Each digit position can go from 0 to 3 (quaternary), as each real and imaginary part is -4 times as large as the previous real and... |
Countries own a series of territories on a 1D world. Each country is uniquely identified by a number. Ownership of the territories can be represented by a list as follows:
1 1 2 2 1 3 3 2 4
We define a country's edgemost territories as the two territories closest to either edge. If the above list was zero indexed, cou... |
In Salesforce CRM, every object has 15-character alphanumeric ID, which is case-sensitive. If anyone's curious, actually it's base-62 number.
However, tools used for data migration and integration may or may not support case sensitivity. To overcome that, IDs can be safely converted to 18-character case-insensitive alp... |
Two rows of a matrix are orthogonal if their inner product equals zero. Call a matrix with all rows pairwise orthogonal an orthogonal matrix. A circulant matrix is one where each row vector is rotated one element to the right relative to the preceding row vector. We will only be interested in matrices where the entries... |
Introduction
We've have a few base conversion challenges here in the past, but not many designed to tackle arbitrary length numbers (that is to say, numbers that are long enough that they overflow the integer datatype), and of those, most felt a little complicated. I'm curious how golfed down a change of base code like... |
Challenge:
Write a function or program that accepts a list of boolean values and returns all of the ranges of True's.
Test Cases:
f [F] = []
f [T] = [[0,0]]
f [T,T,F,T] = [[0,1],[3,3]]
f [F,T,T,F,F,T,T,T] = [[1,2],[5,7]]... |
LOOP
This challenge is based around a modified version of the programming language LOOP.
A program may be of any of the following forms:
P;Q, where P and Q are subprograms
Subprogram P is executed, then subprogram Q is executed.
x++, where x is a variable
Variable names are the letter x followed by a whole number... |
The scenario
After a long day's work slogging in the office and browsing stackexchange.com, I finally walk out the door at 16:58, already weary with the day. Because I am still only an intern, my current mode of transportation is on bicycle. I head over to my trusty Peugeot Reynolds 501, but before I can sail away on i... |
Introduction
You're probably familiar with zip bombs, XML bombs, etc. Put simply, they are (relatively) small files which produce enormous output when interpreted by naïve software. The challenge here is to abuse a compiler in the same way.
Challenge
Write some source code which occupies 512 bytes or less and which com... |
This challenge is pretty simple. As input, you take in a regular expression.
Then, you output a truthy/falsey of whether or not your source code matches the regular expression. It's that simple! Just two more things:
No quine builtins; you may, however, access the code's source code by file IO, etc.
This is code-golf,... |
Powerball is an American lottery that has recently gained attention because the current jackpot (as of January 11, 2016) is the largest lotto prize in history, at about $1.5 billion (USD).
Powerball players choose 5 distinct numbers from 69 numbered white balls, and 1 one "Powerball" number from 26 numbered red balls. ... |
You probably do know that the different reputation levels on Stack Exchange are formatted differently when seen from the questions page / a post. There're all the rep-formatting rules:
if a user has 1 to 999 (one to three digits) rep, it's left as-is.
if a user has 1000 to 9999 rep (four digits), it receives the comma... |
Introduction
A229037 has a quite intriguing plot (at least for the first few terms):
There is the conjecture, that it might indeed have some kind of fractal property.
How is this sequence constructed?
Define a(1) = 1, a(2) = 1 then for each n>2 find a minimal positive integer a(n) such that for every arithmetic 3 term... |
Given a string with a multiple people's investment data, find out how much profit/loss they recorded.
The string only contains capital and lowercase letters, like this:
AABaBbba
Each letter represents a person - a capital letter means buy, a lowercase letter means sell. The price of the stock they are investing in (C... |
There's a really important problem in cellular automata called the Majority problem:
The majority problem, or density classification task is the problem of finding one-dimensional cellular automaton rules that accurately perform majority voting.
...
Given a configuration of a two-state cellular automata with i + j cel... |
Introduction
This challenge consists in finding the greatest number removing y digits from the original number n which has x digits.
Assuming y=2 n=5263 x=4, the possible numbers removing y=2 digits are:
[52, 56, 53, 26, 23, 63]
So, the greatest number is 63 which must be the output for this example.
Another logic wo... |
In a fictional 2D world, a set of 2D printing instructions for an object can be represented by a list of integers as follows:
1 4 2 1 1 2 5 3 4
Each number represents the height of the object at that particular point. The above list translates to the following object when printed:
#
# # #
# ###
## ####... |
Sometimes it is useful to run a math problem with multiple inputs. The goal of this challenge is to make a program that eases this task.
Number-generating expressions
You must support 3 types of expression:
Single number generator: Very simple, just a literal number
Multi-number generator: A tad more complicated. Thee... |
People, it's a popularity contest, you have to do somthing cool here.
Think about cool ways of breaking the code in most languages, not about validating for everyting!
Initially this challenge is NOT for esoteric languages. But I didn't disabled them as I expect voters to be fair enough to downvote answers based... |
I was intrigued by the design of this graphic from the New York Times, in which each US state is represented by a square in a grid. I wondered whether they placed the squares by hand or actually found an optimal placement of squares (under some definition) to represent the positions of the contiguous states.
Your code... |
Your goal is to map a piece of text to a sine curve of the form:
a sin ( mx - b )
Where a and m are non-zero rational numbers, b is a rational number, and the calculations are in radians.
It doesn't really matter where the origin of your graph is, as long as you fit all the letters in your output. Also, it must be ASCI... |
Today you need to solve a very practical problem: How many loops do you need to have a certain number of sheets on your toilet paper roll? Let's look at some facts:
The diameter of a bare toilet paper cylinder is 3.8cm
The length of one sheet of toilet paper is 10cm.
The thickness of one sheet of toilet paper is 1mm. ... |
There is an existing "game" where pirates rationally divide gold coins according to certain rules. Quoting from Wikipedia:
There are 5 rational pirates, A, B, C, D and E. They find 100 gold coins. They must decide how to distribute them.
The pirates have a strict order of seniority: A is superior to B, who is superior... |
Given two words, spoonerise them by switching their initial consonant clusters. Fewest bytes wins.
plaster man -> master plan
blushing crow -> crushing blow
litigating more -> mitigating lore
strong wrangler -> wrong strangler
def ghi -> ghef di
few years -> yew fears
The consonants appearing before the first vowel (a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.