instruction stringlengths 34 53.1k |
|---|
Consider a grid of NxN unique elements. Each element has a letter (from A to the Nth letter, inclusive) and a number (from 1 to N, inclusive). Hence, each number/letter pair is in the grid exactly once.
Your job is to arrange a grid such that:
Each row, column, and diagonal (including wrapping) contains each letter a... |
Introduction
A palindromic closure of an input string is the shortest palindrome that can be constructed out of the input string where the final palindrome starts with the input string.
For this challenge, we will consider a two-way palindromic closure such that
Left Palindromic Closure of an input string is the short... |
Write some statement(s) which will count the number of ones in an unsigned sixteen-bit integer.
For example, if the input is 1337, then the result is 6 because 1337 as a sixteen bit binary number is 0000010100111001, which contains six ones.
|
There are many types of binary operations, which can be categorized by their associative properties and their commutative properties.
A binary operation () is associative if the order of operations between operands does not affect the result — i.e. if (a(bc)) = ((ab)c).
A binary operation () is commutative if the orde... |
Without changing the actual function, call it in such a way that it prints "True"
void Puzzle(out int x, out int y)
{
x = 0;
y = 1;
Console.WriteLine(x == y);
}
Online Tester
|
Your friend is trying to break into a vault that has a peculiar locking system: it requires a certain number of gentle knocks in a particular spot. Your friend discovered the number (which is in the range 1...99999) and possesses a gadget that produces the required knocks. However, the gadget is a Brainfuck interpreter... |
Write a function or complete program that takes a positive number n and performs n steps of an iterative algorithm for calculating π that has quadratic convergence (i.e. it approximately doubles the number of accurate digits at every iteration) then returns or prints out 2n correct digits (including the beginning 3). O... |
Introduction
This challenge is inspired by Grime, my 2D pattern matching language.
Basically, you are given a "grammar" that describes two-dimensional grids of characters, and your job is to generate a grid according to the grammar.
In addition, the grid should be as small as possible in a certain weak sense.
Input
You... |
Let's get right in to it.
Your challenge is to make a program that does these things depending on its input:
If the input is a number, output "Prime" if the number is a prime number and "Not prime" if the number isn't a prime number. You can assume the number is > 1.
If the input is two numbers, output every single p... |
The challenge is really simple: given a number, you split its digits into an array of smaller numbers such that the resulting numbers are non-decreasing. The catch is that you have to split it such that the array length is maximal.
Confused?
You are given a positive integer via STDIN (or closest alternative), command-... |
Introduction
Local genius Calvin's Hobbies recently challenged us to trace the hue of an image.
It is recommended to read his challenge beforehand, but to highlight the main points:
The trace of hue in an image can be found by starting at one pixel, finding its hue angle(hue = atan2(sqrt(3) * (G - B), 2 * R - G - B)),... |
Write a program or function that takes in a list of positive integers. Each of these integers represents the side length of a square on a 2D plane. Each square can be moved to any integer coordinates in the plane, but it can't rotate and it can't overlap other squares.
Using a different printable ASCII character for ea... |
Background
The so-called "Urinal Protocol", describing the order in which individual urinals are picked in a men's bathroom, has been discussed in multiple places. One version is given in this xkcd blog post. This question concerns a slight variation:
Arrangement: n urinals in a line.
Protocol: each new person selects... |
Write the shortest possible program which takes a numeric input and outputs the result of adding 42 to the input.
f(x) -> x + 42
There's only one restriction. Your program can only be composed of rod logic characters...
The definition for a rod logic character is a one that is composed purely of straight lines. They ... |
Inspired by this question, your goal today is to encode an URL in brainfuck.
My browser has been hacked! The location bar has been turned into a brainfuck interpreter. I need a program that turns an URL into a brainfuck program. My computer is also very slow, so if the brainfuck program is small it's better.
Oh and I o... |
Since it was Pi day recently, I have noticed a number of challenges that ask you to calculate pi.
Of course, a quiche lorraine is not quite a pie (you can claim a Bonus Score¹ of +1 if you guessed the challenge off of the title). As such, your job is to write an algorithm or method that looks like it approximates Pi at... |
A little known fact about vampires is that they must drink the blood of victim that has a compatible donor blood type. The compatibility matrix for vampires is the same as the regular red blood cell donor/recipient matrix. This can be summarized by the following American Red Cross table
Type You Can Give Blood To... |
Duodyadic tiles are kinds of square function blocks that take two inputs, one from their top side and one from their left side, and have two outputs, one on their right side and one on their bottom side. Each of their outputs is a separate function of both of their inputs.
For example, if # represents a generic tile, t... |
Introduction
The Baker's map is an important dynamical system that exhibits chaotic behavior.
It is a function from the unit square to itself defined intuitively as follows.
Cut the square vertically in half, resulting in two rectangles of size 0.5×1.
Stack the right half on top of the left, resulting in one rectangle... |
Given a polynomial, determine whether it's prime.
A polynomial is ax^n + bx^(n-1) + ... + dx^3 + ex^2 + fx + g, where each term is a constant number (the coefficient) multiplied by a nonnegative integer power of x. The highest power with a nonzero coefficient is called the degree. For this challenge, we only consider p... |
There are 21 items in Minecraft that you can craft using only wood and items crafted from wood:
axe
boat
bowl
button
chest
crafting table
door
fence
gate
hoe
ladder
pickaxe
planks
pressure plate
shovel
sign
slab
stairs
stick
sword
trapdoor
This list assumes that the 6 different types of wooden planks/slabs/doors/etc... |
Today your goal is to decrypt a secret message using AES. Given a ciphertext and key you will decrypt and print the message.
Your program may be in any language. It will be run with input on stdin, and its output on stdout will be checked for correctness.
The first line of input on stdin will be the 16 byte key, enco... |
The Chinese Remainder Theorem tells us that we can always find a number that produces any required remainders under different prime moduli. Your goal is to write code to output such a number in polynomial time. Shortest code wins.
For example, say we're given these constraints:
\$n \equiv 2 \mod 7\$
\$n \equiv 4 \mod ... |
This challenge is to generate a random floating-point number between 2 limits.
You may use any language so long as it can be called from the command line, and runs on linux. It must also be able to work with negative numbers.
Due to the comment below: You may use fixed point math to come up with a result in-fact fixed ... |
Introduction
Elite was the first space trading video game, written and developed by David Braben and Ian Bell and published by Acornsoft for the BBC Micro and Acorn Electron computers in in September of 1984.
The Elite universe contains eight galaxies, each with 256 planets to explore. Due to the limited capabilities ... |
Introduction
Suppose that you are handed a random permutation of n objects.
The permutation is sealed in a box, so you have no idea which of the n! possible ones it is.
If you managed to apply the permutation to n distinct objects, you could immediately deduce its identity.
However, you are only allowed to apply the pe... |
While looking at the ARM instruction set, you notice that the ADD instruction has the so-called "Flexible second operand", which can be abused for quick multiplication. For example, the following instruction multiplies register r1 by 17 (shifting it left by 4 bits and adding to itself):
ADD r1, r1, r1, LSL #4
; LSL mea... |
I have a serious problem. I have some text files where I keep my very important numbers -- all of the important ones! And twos, and threes..
These numbers were so important that I couldn't entrust them to those newfangled decimal or binary number systems. I kept each number encoded in unary, as so:
+--+
... |
Write a program or function that takes in a positive integer (via stdin, command line, or function arg) and prints or returns a string of that many of these small triangles tiled together, alternating which way they point:
/\
/__\
This sole triangle is the output if the input is 1.
If the input is 2, the output is
... |
Rövarspråket
Rövarspråket is a word game played by Swedish children, from the books about Kalle Blomkvist by Astrid Lindgren.
The basic rules are as follows (from Wikipedia):
Every consonant (spelling matters, not pronunciation) is doubled, and
an o is inserted in-between.
Vowels are left intact.
A few examples:
"h... |
My friend and I have this game that we play with words. It is a fun pastime and it involves "canceling out" letters in a word until there is nothing left. I am really tired of him being so much faster than me at it, so it is your job to implement it and let me finally beat him. Obviously, since I have to make the progr... |
This question is the inverse of this one by James Williams.
Rövarspråket
Rövarspråket is a word game played by Swedish children, from the books about Kalle Blomkvist by Astrid Lindgren.
The basic rules used during encoding are as follows (from Wikipedia):
Every consonant (spelling matters, not pronunciation) was doub... |
UPDATE: Added a Python framework to get started.
The space-station has been overtaken by crusher-bots. You must direct as many of
our expensive and fragile tech-bots called "rabbits" to an exit teleporter
before the station self-destructs, but the crusher-bots are patrolling the
corridors.
Your program is given an ASCI... |
The SUDSI sequence (sum, difference, swap, increment) is a curious integer sequence that appears to exhibit rather chaotic behavior. It can be generated as follows:
Let S be an infinite list of the natural numbers: 1 2 3 4 5 6 .... Let Si denote the one-indexed ith element of S. So initially, S1 is 1, S2 is 2, etc. (t... |
We have a lot of IPV4 address, to group into subnets, so we need a tool for doing this:
Our list is very ugly, not ordered and sometime in subnet notation, sometime in simple address.
Sample:
192.168.5.16/30
192.168.5.18
192.168.2.231/27
192.173.17.0/24
192.168.1.5/32
192.168.5.18/32
192.168.3.0/24
192.168.2.231/27
192... |
There are 16 distinct boolean functions for two binary variables, A and B:
A B | F0 | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | F13 | F14 | F15
-----------------------------------------------------------------------------------------
0 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 ... |
Given a positive integer n output the sum of the first n decimal digits of the fractional part of πn.
Example input and outputs:
1 → 1
2 → 14
3 → 6
4 → 13
5 → 24
50 → 211
500 → 2305
5000 → 22852
Built-in functions computing digits of π or evaluating either power seri... |
Write a program that takes no input and prints Hello, World! to stdout or your language's closest alternative. The catch is that each line in your program must only contain printable ASCII characters and it must be in lexicographical order, a.k.a. sorted.
Here are all 95 printable ASCII characters in order:
!"#$%&'()*... |
Given a text and a number N, output, in a human readable format, the set of the character N-grams with their respective percentages.
The smallprint
The text can be read from a file, stdin, passed as string parameter to a function or any other common way i forgot to mention
The number N can be hardcoded, but only if i... |
I've searched around, and cannot find a challenge too similar to this one--however, it would not surprise me if this is not the first of its kind. My apologies if I've overlooked something.
The Challenge
This challenge is intended to amuse those of every skill level and users of every language. Your task, in itself, is... |
I really love sliding tile puzzles, but recently, I haven't had time for them. Hence, I need a program to give me my fix of sliding-tile puzzles, specifically Klotski puzzles.
Your input will be in the following format:
#######
#001gg#
##.222#
.######
where # represents walls, . represents an open area, g represents ... |
I recently moved to an apartment overlooking the inner ring-road of town, and every day, a beautiful scene unfolds. The traffic lights are apparently so confusing (mostly because the Dutch are used to complex intersections, and this one is too simple for them to wrap their heads around), that the intersection invariabl... |
A top-front-side puzzle is a puzzle where you are required to construct a 3-D shape of (usually cubic) blocks given three orthogonal views: a top view, a front view, and a side view.
For example, given a top, front, and side view as follows:
Top: Front: Side:
. . . . . . . . . . . .
. x x . . x ... |
Your task is to build a vim script or provide a sequence of keystrokes that will operate on a single line of text with up to 140 printable ASCII characters (anywhere in a file, with the cursor starting anywhere in the line) and reverse every space-separated string in the sentence while keeping the strings in the same o... |
This image was made by overlaying 7 differently colored rectangles on top of each other:
The black and maroon rectangles are unobstructed, that is, no other rectangles are above them.
Write a program that takes in an image such as this and remove any single unobstructed rectangle, outputting the resulting image.
Exam... |
I'm a lazy but efficient person, as many of you probably are as well. So, whenever I'm doing something I want to do it with minimal effort. Which is why I'm asking you to solve this problem for me.
What I have here is a document of sorts. On every line of this document is a single word or short phrase. The document is ... |
There are popular check digit algorithms such as Luhn and then there are good ones, for example the Damm algorithm. The only possible reason behind the popularity of algorithms such as Luhn is that there exist code golfed implementations of them. This means that we as a community have the power to change the world by p... |
You should write a 100-byte long brainfuck (BF) program.
One character will removed from it in every possible way the resulting 100 new (99-byte long) programs. E.g. for the program ++.>. the 5 subprograms are +.>., +.>., ++>., ++.. and ++.> .
Your score will be the number of unique outputs the 100 programs generate. ... |
The internet has failed. DDoS attacks are now rampant and widespread. It is up to you to take control and repair the internet.
Each bot will control 20 nodes in this network. Every node is either active or safe, has an owner, and has a strength, which starts at 2. Every active node is connected to all other active n... |
Background
You are the apprentice of a powerful wizard, and your master is currently developing a spell for creating an inter-dimensional labyrinth to trap his enemies in.
He wants you to program his steam-powered computer to analyze the possible layouts.
Programming this diabolical machine is highly dangerous, so you'... |
Given string X, convert it to Java Style string, as defined below:
Strings may only contain numbers and letters(signs are not allowed)
Strings must not start with numbers
Strings must start with Capital letter
Strings may not contain two capital letters in a raw.
As for conversion you may perform the next actions
Re... |
Write a program or function that takes in a positive integer N (via stdin/command line/function arg) and prints or returns a string representation of a two dimensional random walk that is N steps long, drawn out of slashes: / \ (plus spaces and newlines for spacing).
A 2D random walk starts at the origin of an infinite... |
Sum of squares
Goal: Write a given natural number as sum of squares. Thanks to Lagrange, Fermat and Legendre we know that you can write any positive integer as sum of (one), two, three, or maximal four squares of integers.
Your task is to write a program/function which takes a natural number via stdin/argument and outp... |
Goal
Using the programming language of your choice, write the shortest program to eliminate comments from a string representing a C program.
Input
The string can be taken as any form of input, but it may also be taken as a variable.
Instructions
Two different kinds of comments are to be removed:
multiline comments, ... |
This challenge is specific to languages of the APL family. Although it might be solvable in other languages, please do not expect this to be easy as it depends on some specific concepts of this language family.
Many array oriented languages have the concept of a box (also called enclosure). A box encapsulates an array,... |
This is inspired by my python-ideas "new module loader" prank.
Your task is to write a cat-like program that does the following:
Read the file on disk labeled files. Assume it exists. No error handling necessary.
The file contains a list of files separated by newlines. The file names may contain spaces. Print the file... |
UPDATED SCORING: As this challenge is more difficult than I anticipated, I have adjusted the scoring. A program that can solve a single mirror input is a valid answer. More sophisticated programs get a bonus to their score.
There have been several puzzles on PPCG to find a laser path in a box of
mirrors. In this puzzle... |
This contest is officially over. The Blue Team won!
I autoran two sets of 50 battles and amazingly, Blue won all 100 of them. Looking at the stats, it is clear that the cooperative entries of PhiNotPi and Sp3000 were the real heroes. Great job you two! In fact, if you disqualify every other member of the Blue Team, the... |
A positive integer N is K-sparse if there are at least K 0s between any two consecutive 1s in its binary representation.
So, the number 1010101 is 1-sparse whereas 101101 is not.
Your task is to find the next 1-sparse number for the given input number. For example, if the input is 12 (0b1100) output should be 16 (0b100... |
Background
Many moons ago, in a galaxy much like our own, a young BrainSteel attempted to invent a board game. He believed that he, too, could find an amazingly simple set of rules that would generate wonderfully strategic gameplay. He drew up the first set of rules--it looked promising. He played with his thoughts, an... |
Alak was invented by the mathematician A. K. Dewdney, and described in his 1984 book Planiverse. The rules of Alak are simple:
Alak is a two-player game played on a one-dimensional board with eleven slots on it. Each slot can hold at most one piece at a
time. There's two kinds of pieces, "x" and "o". x's belong t... |
I like to golf in dc, but I'm sometimes frustrated because dc doesn't have bitwise operations.
Challenge
Provide four named functions which implement the equivalent of the c bitwise operations &, |, ~ and ^ (bitwise AND, OR, NOT and XOR). Each function will take two operands (~ takes only one) which are at least 32-bi... |
Write a square block of code that is N characters wide and N characters tall, for some positive integer N.
For instance, your N may be 5 and the block look like this:
ThisI
sMy5B
y5Cod
eBloc
kOkay
This block needs to behave as follows:
When the top row is extracted and run as a program, the exact text row needs to be... |
You have been hired as a research assistant, and asked to create a small program
that will build rat mazes. The rat box is always 62x22 and has an entrance (a)
and exit (A) for the rat, like this (input 1):
#######a######################################################
# ... |
Before reading this I suggest reading this little puzzle: https://puzzling.stackexchange.com/questions/11408/longest-word-with-adjacent-letters-on-a-keyboard
I want you to make a program that takes one argument, a word (only lowercase letters), and outputs "Yes" if the word can be typed with adjacent keys on the keyboa... |
The Background
So, we all know the classic proof that goes like this:
a = b
a² = ab
a² - b² = ab - b²
(a-b)(a+b) = b(a-b)
(a+b) = b
b+b = b
2b = b
2 = 1 (Ha ha!)
Of course, the mistake is that you can't divide by 0. Since a = b, a - b = 0, so there was a hidden division by 0.
The Challenge
You have to replicate thi... |
What general tips do you have for golfing in Whitespace? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Whitespace (e.g. "remove comments" is not an answer).
Please post one tip per answer.
|
You should write a program or function that given an N by N equally spaced square grid and a solid inscribed circle outputs or returns the number of grid squares which are overlapped partially or fully by the solid circle.
0-sized overlaps (i.e. when the circle only touches a line) are not counted. (These overlaps occu... |
The question is simple but the answer maybe not!
suppose that you have the following lists that all of them are ordered (not consecutive):
x = ['one', 'two', 'four']
y = ['two', 'three', 'five']
z = ['one', 'three', 'four']
as you can see there is a logic in each of the above lists for example in x we have the follow... |
In this task, we consider arrays of positive integers such as this:
3 18 321 17 4 4 51 1 293 17
The input comprises a pair of such arrays both of arbitrary, possibly distinct, positive length. Determine if a total ordering ≤X ⊂ N × N, where N is the set of positive integers, exists such that both input arrays are in o... |
BS is a card game where the object of the game is to lose all of your cards.
A game consists of four players and a 52-card deck. Each player is randomly dealt 13 cards. Normally, cards are labeled 2 - 10, Ace, Jack, Queen, King, but for simplicity, the cards will be labeled with a number from 0 - 12 inclusive. Although... |
In this challenge, users will take turns completeing three fairly simple coding tasks in programming languages that are allowed to be progressively older.
The first answer must use a programming language that was made in the year 2015. Once there is at least one answer from a 2015 language, answers may use programming ... |
Just last night I was reading a book which had a chapter on the Partition Problem; the Partition Problem is basically about splitting a set of numbers into two smaller sets of equal size.
To visualize it, the book contained the following picture:
It shows how, given an input of k boxes, each with height n, you can cre... |
Develop a program which takes two arrays of decimal numbers, and compare the sum of whole numbers only and the decimal part. If the sums of the whole numbers are the same, and the decimal parts of Array a are a subset of the decimal parts of Array b, return True. Otherwise, return False.
Example-1 :-
Array a ={2.5,3.0,... |
Today your goal is to invent URL compression. You must write two programs: a compressor and a decompressor.
The compressor will be called with one URL on stdin and its output will be read on stdout.
The decompressor will be called with the output of the compressor on stdin, and must produce the exact URL passed into t... |
My attempt at stating this question, but with a more objective solving criterion.
Your task is to build a program or function that takes a solved Sudoku grid S in the format of your choice and attempts to generate a problem grid with as few clues as possible that has S as its unique solution. (It doesn't matter what me... |
Here is a simple ASCII art ruby:
___
/\_/\
/_/ \_\
\ \_/ /
\/_\/
As a jeweler for the ASCII Gemstone Corporation, your job is inspect the newly acquired rubies and leave a note about any defects that you find.
Luckily, only 12 types of defects are possible, and your supplier guarantees that no ruby will have more ... |
People have written many things allowing one thing to be visualized as another. Now I propose being able to translate letters to music! Its your job to write a program that takes a text file and outputs a sound file with each letter converted to a specific note from C3-C8.
Disclaimer - I don't actually expect the music... |
The Collatz sequence starting from a positive integer n is defined in this way:
if n is even then divide it by 2 (n' = n / 2)
if n is odd then multiply it by 3 and add 1 (n' = 3n + 1)
Repeat the above iteration until n reaches 1.
It is not known (it's a major unsolved problem in number-theory) if the sequence will ev... |
Background
One source of ennui in tabletop role-playing games is dealing with rolls involving many dice. Casting a Disintegration spell may be instantaneous, but rolling and adding together 40 dice certainly isn't!
A number of suggestions for handling this are discussed at rpg.stackexchange.com. Some of them, however, ... |
Sometimes when I'm doodling, I draw a rectangle, start with a diagonal from one of the corners, and then just trace out a line by "reflecting" it whenever I hit a side of the rectangle. I continue with this until I hit another corner of the rectangle (and hope that the aspect ratio of my rectangle was not irrational ;)... |
Background
You have recently been hired by a small accounting firm.
The world of accounting is somewhat foreign to you, so you're not sure whether you are following all the professional guidelines.
In particular, you don't know when you should round all those numbers, and in which direction, so most of the time you jus... |
The accepted winner is isaacg, with his 7-bit ASCII answer. However, the challenge isn't over yet - this bounty is awarded to the shortest answer. If, somehow, you get all the first characters of all the other answers down into 10 bytes, you will win the bounty. This includes all the characters from Round 2's GolfScrip... |
In anticipation of MathJax being temporarily disabled, the rendered MathJax in this question has been replaced with images. You are still welcome to post answers but you'll have to view the rendered MathJax on another site.
PPCG just got MathJax! This means we can now easily include well formatted mathematical formulas... |
You don't need to know these languages to participate. All necessary information has been provided in this question.
You should write a program or function which given a brainfuck (BF) code as input outputs its tinyBF equivalent.
BF has 8 instructions characters: +-><[],. and tinyBF has 4: =+>|. Converting works the fo... |
I'm working on something and came across this after I interpreted some brainfuck code. It looks like another esoteric language but I'm not sure what. Anyone know?
(CB;:9]~}5Yz2Vw/StQr*)M:,+*)('&%$#"!~}|{zyx875t"2~p0nm,+jch'`%
|
Consider these five ASCII art sea creatures:
Standard fish: ><> or <><
Speedy fish: >><> or <><<
Sturdy fish: ><>> or <<><
Stretchy fish: ><<<> or <>>><
Crab: ,<..>,
Write a program that accepts an arbitrary string of the characters <>,.. If there is a way to interpret the entire string as a series of non-overlapping... |
Background
Slime molds are awesome.
If you place them on a surface with food sources, they will spread their tendrils to find the food, after which they form a network of connections between the sources.
In this challenge, you shall simulate a slime mold looking for food.
Moreover, this particular mold will stop once i... |
This is inspired by the Brainf*** to tinyBF converter challenge.
Brainf**k (which will be henceforth referred to as BF) is a well-known estoric programming language, so I won't go over it too much here.
Nameless language is a binary-looking version of BF. See the linked page for more info.
Your challenge is to implemen... |
Background
An L-system (or Lindenmayer system) is a parallel rewriting system that, among other things, can be easily used to model fractals. This question concerns deterministic, context-free L-systems. These consists of an alphabet of symbols, an initial axiom string and a set of rewrite rules mapping each alphabet s... |
You should write a program or function which takes a non-negative integer N as input and outputs or returns two integers (negative, zero or positive) X and Y.
Integers are meant in the mathematical sense as there are infinitely many of them.
The implemented function has to be bijective. This means that for every N it h... |
Write a program that takes as close to 1 second Wall-time sharp to execute in your language.
Anything goes except to have the processor sleep / pause / wait, by either internal or relying on external processes.
It should be interesting to see that adding one character more somewhere will more easily bring you to the co... |
Everyone always wants to implement Conway's Game of Life. That's boring! Let's do cops and robbers instead!
You'll have two teams: the cops and the robbers. Each team has 5 members with 50 health each. The program will loop continuously. Each iteration, the following will occur:
For each team, print the first letter (... |
In the game Tetris, there are 7 types of bricks or Tetriminoes, which are mathematically known as tetrominoes because they are all made with 4 square segments:
The have the names I, J, L, O, S, T, and Z, that correspond to their approximate shapes. Counting 90° rotations, there are 19 unique shapes in total:
I
I
I
I
... |
Background
A binary Hankel matrix is a matrix with constant skew-diagonals (positive sloping diagonals) containing only 0s and 1s. E.g. a 5x5 binary Hankel matrix looks like
a b c d e
b c d e f
c d e f g
d e f g h
e f g h i
where a, b, c, d, e, f, g, h, i are either 0 or 1.
Let's define a matrix M as Hankelable if the... |
Given a set of formulas like this:
bacb
bcab
cbba
abbc
Give an algorithm that finds the number of unique results you can get when each variable is substituted for either "0" or "1" in every formula.
There are (k!)^2 formulas, each with 2k-1 variables and k^2 terms. Express your asymptotics in terms of k.
Fastest algor... |
Your task here is to write an AI for a simple robot battle. The class to be implemented is provided at the bottom of this post, and source of the controller can be found here.
Requirements
Write a class which implements the abstract Bot class, provided at the bottom of this post
You must provide a 0-argument construct... |
An acyclical grid is a mapping of an acyclical graph (that is, a tree) where each node has no more than four edges onto a toroidal rectangular grid such that each cell of the grid is occupied by a node. Here is an example of an acyclical grid:
┴─┐╵╵│└┘└╴╶┴┬
╴╷╵┌┐│╷┌┬┐╶┐├
╷│╷╵│├┘│╵└╴│╵
┘└┴┐│└┬┤┌─┬┴─
╷╶─┤│╷╵├┤╶┘╶┐
│╶┐└┤... |
Introduction
In this challenge, your task is to find generalized subsequences of strings.
The subsequences are not necessarily contiguous, and they can also "wrap around" the string, going past its end and starting again from the beginning.
You'll want to minimize the number of wraps, though.
More formally, let u and v... |
You are a robot. You are stranded in a small cage with weird humans wearing weird suits looking at you. Your solar panel is malfunctioning, and your energy is running out. On the wall there is a riddle, and if you answer correctly the humans will grant you access to an energy source (yay!). However your RAM unit is lea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.