instruction stringlengths 34 53.1k |
|---|
Given an input of a list of days of the week, output the shortest sorted
representation of the list.
The format of the input is a string consisting of one or more of the
two-character substrings Su (Sunday), Mo (Monday), Tu (etc.), We, Th,
Fr, and Sa. The input may not necessarily be given in sorted order.
To convert t... |
Task
Write a program that will output another distinct program, and so on, while using as few distinct characters (and as few bytes) as possible.
For example, program 1 should output program 2, and when program 2 is executed, it should output program 3. This can be nested as deeply as needed, but must be at least 3 dis... |
Time for another easy challenge in which all can participate!
The multinomial theorem states:
$$(x_1 + x_2 + \cdots + x_m)^n = \sum_{k_1 + k_2 + \cdots + k_m = n} \binom n {k_1, k_2, \dots, k_m} \prod_{1 \le t \le m} x_t^{k_t}.$$
The expression in parentheses is the multinomial coefficient, defined as:
$$\binom n {k_1,... |
The goal of this challenge is to complete a list of consecutive nested header numbers when given a start and an end. When given 1.1.1 and 1.1.5 you should generate 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5
Specific Rules
Your entry must take in a start, end, and multiple optional range parameters. Parameters can be taken fo... |
Challenge:
Some ascii-art is a pain to make, but makes code comments easier to read, especially when the code is dense. The challenge is to make a simple tool that converts comments to simple ascii-art with arrows. The comments to modify are delimited by empty comments.
For example, supposing Haskell comment syntax, co... |
Newton's theory of gravitation says that the gravitational force between two point masses is
F=(Gm1m2)/ r2
Where
G is the gravitational constant: 6.674×10−11 N · (m/kg)2
m1 is the mass of the first object
m2 is the mass of the second object
r is the distance between their centers of mass
Challenge
You need to simul... |
I've been around for a while, watching you golf and I really enjoy it.
I came up with a challenge for you all so let's begin!
Challenge
I assume that everyone knows what Finite State Machine (FSM) is, I will edit the the description if needed.
Your program will take only one input consisting in a string that represent... |
A while ago I purchased a new wallet which is able to hold 8 cards (4 on both side). However, I seem to have way more cards than that and I need to make choices on which ones I want to carry with me. Some cards I use more often than others, but the cards I prefer to carry with me are not necessarily the ones I use most... |
We've had a couple of challenges about the Ulam spiral. But that's not enough.
In this challenge we will plot a triangular Ulam spiral (as opposed to the usual, square Ulam spiral). Here's a sketch of what the spiral looks like.
As we know, the Ulam spiral arranges all natural numbers in an outward spiral, and marks o... |
Inspired by this question over on Math.
Let the prime factorization of a number, n, be represented as: \$P(n) = 2^a\times3^b\times5^c\times\cdots\$. Then the number of divisors of n can be represented as \$D(n) = (a+1)\times(b+1)\times(c+1)\times\cdots\$. Thus, we can easily say that the number of divisors of \$2n\$ is... |
A nonogram is a Japanese puzzle game in which the goal is to draw a black-and-white picture according to a list of contiguous regions, like so:
Define the nonographic magnitude of a row or column to be the number of contiguous black regions in that row or column. For example, the top row has a nonographic magnitude of... |
Given an input of a string consisting entirely of qs representing quarter
notes and es representing eighth notes, output the indices of the quarter
notes that are syncopated.
Syncopation is complex, but for
the purposes of this challenge, our definition of "syncopated" will be very
simple: a quarter note that starts on... |
In this challenge, you will write a program which outputs a program which is the double the length of the original program. The outputted program should output a new program a program double its length.
Examples
If my program is a:
< a
> aa
< aa
> aaaa
< aaaa
> aaaaaaaa
Rules
No quine built-ins
The original program... |
About Functional-Basic
Functional-Basic (FB for short) is a language that only allows numbers and lists. Basic features, such as the if statement are missing in an attempt to simplify the language.
Everything in this language is immutable. input is always assigned to the script input, which can be either a number or a ... |
Task
Read the contents of a table given a set of coordinates.
Table formatting
Tables will be in this basic format:
|[name]|[name]|
---------------------
[name]| [val]|[val] |
[name]| [val]|[val] |
Column names are always unique within columns. Row names are also unique within rows. This includes names that are ... |
Your challenge is extremely simple. Given a year as input, print all the months in that year that will contain a Friday the 13th according to the Gregorian calendar. Note that even though the Gregorian Calendar wasn't introduced until 1582, for simplicity's sake we will pretend that it has been in use since 0001 AD.
Ru... |
Introduction
RNA is the less famous cousin of DNA.
Its main purpose is to control the production of proteins in cells through a process called translation.
In this challenge, your task is to implement a part of this process where the RNA is split into codons.
This challenge is thematically related, but concentrates on ... |
CleverBot is a conversational AI that works fundamentally by repeating responses from real humans it has heard previously. It starts off pretty dumb, but once the database becomes (a lot) larger it begins sounding more like an actual person!
How your program should work
Output Hi!
Receive the user's reply as a string
... |
Introduction
Right now I'm participating a chess tournament. I got inspired by the tournament schedule. Right now, I'm in a competition with three other players. That means with the four of us, we are playing 3 rounds. The schedule goes as following:
Round 1: 1-4 3-2
Round 2: 3-4 2-1
Round 3: 1-3 4-2
This is also know... |
This challenge is based on the idea of Plouffle's Inverter.
Write a program in any language that does the following:
Takes as input a non-negative rational number X written in decimal, for example 34.147425.
Returns a mathematical expression using only non-negative integers, whitespace, parentheses, and the following ... |
For this challenge, you need to print out the fingerings for various brass instruments.
The notes an instrument can play (as well as their fingerings) are listed below:
Cornet Baritone
Trumpet Bugle French Horn Euphonium Tuba
A#0 0
B0
C1 ... |
You have a phone plan that lets you talk 180 minutes a day. Every day that you go over your daily limit you have to pay a fine of F = Men, where M is the number of minutes you went over and n is the number of days you have gone over (e.g if I went 20 minutes over the daily limit and it's my 2nd day going over, I have t... |
John Doe used to be one of the fastest QWERTY keyboard typists in the world, but a recent head injury caused by a stampeding herd of downgoats has critically hampered his ability to type accurately. In a desperate effort to retain his reputation as a typing prodigy, he has tasked us with the creation of a spellchecker ... |
The task is to display ascii table for a given array.
Input
The input is an 2D matrix. The matrix's row length is same with the length of an array. Alternatively, you can take input of an 2D matrix with the first row is a header. The outer dimension is the row.
Example Input:
[["License","2008-05-08","2009-03-11","2011... |
The Sylvester-Gallai theorem says: Suppose you have a finite list of points in the plane. Suppose further that not all of those points are collinear (lie in a single line). Then there is some line containing precisely two of the points. (That is, there's some line on which two of the points lie, but not more than two.)... |
Write a program or function to estimate as closely as possible the number of syllables in English words.
The input list is here: 1000 basic English words. There are only 997 words because a few duplicates were removed.
For each word, output a line containing the word, a comma (,), and the number of syllables and no oth... |
Let z be a complex number. z is an nth primitive root of unity if for a certain positive integer n and for any positive integer k < n .
Challenge
Write a full program or function that, given a positive integer n as input, outputs all of the nth primitive roots of unity. You may output them in polar form (e^θi or e^iθ,... |
Introduction to Bézout's identity
The GCD of two integers A, B is the largest positive integer that divides both of them leaving no remainder. Now because of Euclid's property that each integer N can be divided by another integer M as follows:
there exist pairs u,v such that ... |
Given an input of a string consisting of any message from our site
chatroom taken
from the list described and linked below, output either a truthy or a falsy
value attempting to predict whether that message was starred or not in 50 bytes
or less.
You may use any truthy or falsy
values, but they must be
identical (i.e. ... |
In this challenge, you will write a program to output how many decimal places are in the input string and trim the input if needed.
Examples
-12.32
2
32
0
3231.432
3
-34.0
0 -34
023
0 23
00324.230
2 324.23
10
0
00.3
1 0.3
0
0
-04.8330
3 -4.833
Rules
Input will be a string which can be taken through, STDIN, f... |
Palindromic prime problems are pretty common, but that's not what this question is about. In this challenge, the number doesn't have to be a palindrome, its prime factors do.
Task
Your code has to take a single positive integer as input. Then check if any of the permutations of the prime factors of that integer are pal... |
A polynomial with coefficients in some field F is called irreducible over F if it cannot be decomposed into the product of lower degree polynomials with coefficients in F.
Consider polynomials over the Galois field GF(5). This field contains 5 elements, namely the numbers 0, 1, 2, 3, and 4.
Task
Given a positive intege... |
The residents of Flapus use a base-8 number system. The numbers are:
0 - Kuzla
1 - Ponara
2 - Boqkel
3 - Colopee
4 - Vruenat
5 - Foham
6 - Stikty
7 - Kricola
For numbers over 7, the full name of the last digit comes first, followed by apostrophe and the first characters of the other digit(s), up to and including the fi... |
A two-dimensional array of size n×n is filled with n*n numbers, starting from number 1. Those numbers are to be sorted per row in ascending order; the first number of a row must be greater than the last number of the previous row (the smallest number of all (1) will be in [0,0]). This is similar to the 15 puzzle.
This ... |
Introduction
Skat is a traditional German card game for 3 players. The deck consists of 32 cards: Ace, King, Queen, Jack, 10, 9, 8, 7 in all 4 suits (Clubs, Spades, Hearts, Diamonds).
In every round there one player plays solo while the other two play against him.
At the start of a round each player is dealt 10 cards, ... |
A simple register calculator
This challenge involve a simple register calculator that works in the following way:
It has some registers named A,B,C,...,Z, each of them can contain an integer, they are all initialized to 0.
It executes instructions of 3 characters: The first character of any instruction is one of +,-,*... |
Inspired by this question from our rivals friends over at Code Review.
Definitions
A super array is an array where each new element in the array is larger than the sum of all the previous elements. {2, 3, 6, 13} is a super array because
3 > 2
6 > 3 + 2 (5)
13 > 6 + 3 + 2 (11)
{2, 3, 5, 11} is not a super array, becaus... |
Back-story
After typing up your essay on your new Macbook, you look up at the screen and realize that you typed in ten pages of gibberish! Or is it? On further inspection, you come to find that your Option key was stuck this whole time and these special Option-key characters correspond to the ASCII keys on your keyboar... |
Your goal is to output all the "sides" (corners, edges, faces, etc.) of an N-dimensional unit hypercube, where N is non-negative. A "side" is defined as any (N-M)-dimension surface embedded in N-dimensional space, where 1 <= M <= N.
The hypercube spans the space [0, 1] in each dimension. For example, for N=2 the square... |
We all already crossed the look and say sequence, and where asked to guess the next element. As its name tells it very well, you just have to say what you see :
1
1 1
2 1
1 2 1 1
1 1 1 2 2 1
3 1 2 2 1 1
...
But, what if we had to use a different base to describe it? You could count it in base 3 as this OEIS squence do... |
Introduction
tl;dr
In this challenge you have to calculate the moon's phase for a given date.
This challenge is inspired by the game psycho social audiovisual experiment "Superbrothers: Sword & Sworcery EP". In S:S&S EP the moon's phases are important to the outcome of the adventure as some events occur only at a spec... |
The PGP Word List is a set of 512 English words for verbally communicating strings of bytes, such as authentication codes or hashes. It is used in secure VoIP software as well as in some other important applications, such as the DNSSEC Root KSK Ceremonies held four times a year.
It consists of 256 two-syllable words a... |
Generate the sequence number of bases in which n is a palindrome (OEIS A126071).
Specifically, the sequence is defined as follows: given a number n, express it in base a for a = 1,2, ..., n, and count how many of those expressions are palindromic. "Palindromic" is understood in terms of reversing the base-a digits of t... |
.i xu .e'o lo zunsnagri cu drani loka jboge'a
Given an input of a string consisting of two characters, output whether it is a
valid consonant cluster in Lojban.
Here is a quote from CLL 3.6 detailing the
rules for a valid consonant cluster pair (or rather, an invalid one):
1) It is forbidden for both consonants to be ... |
Given a side-view of a mini-golf course and the power of the swing, determine if the ball will make it into the hole.
A course will be in this format:
____ ____ _
__/ \ / U \
__/ \ / \_
\_/
The ball starts directly before the first piece of ground o... |
Introduction
The childhood song Eeny, meeny, miny, moe was often used to select who was "it" when playing tag. Everyone would stand in a circle and point at one person selected at random. They would sing:
Eeny, meeny, miny, moe,
Catch a tiger by the toe.
If he hollers, let him go,
Eeny, meeny, miny, moe.
As t... |
Quick musical refresher:
The piano keyboard consists of 88 notes. On each octave, there are 12 notes, C, C♯/D♭, D, D♯/E♭, E, F, F♯/G♭, G, G♯/A♭, A, A♯/B♭ and B. Each time you hit a 'C', the pattern repeats an octave higher.
A note is uniquely identified by 1) the letter, including any sharps or flats, and 2) the octav... |
From a challenge in a programming book long ago, PNZ is a game where the user must guess three unique digits in the correct order.
Rules:
A random 3 digit number with no repeating digits is generated. (This is what the user is trying to guess)
The user inputs a guess of 3 digits, which is to be evaluated by the progra... |
Introduction
While studying, I tried to come up with several ways to cheat a multiple choice test. It basically is a compressed version of the multiple choice answers. The method goes as following:
The answers to the test:
BCAABABA
These can be converted to 3 different arrays, which indicates true or false if the curr... |
Every day, every minute, ... every microsecond, many decisions are made by your computer. In high-level languages, these typically take the form of statements like if, while and for, but at the most basic level there exist machine language instructions called branch/jump instructions. Modern processors queue instructio... |
Introduction
Suppose you and your friend are playing a game.
Your friend thinks of some particular sequence of n bits, and your task is to deduce the sequence by asking them questions.
However, the only type of question you're allowed to ask is "How long is the longest common subsequence of your sequence and S", where ... |
Introduction
There is an Apple tree trunk positioned between -2 to 2 on the x-axis, where some apples fall down around it:
| |
| |
<-------|---|------->
-2 2
Everyday, n apples fall down. Each apple maintains its x coordinate as falls straight to the ground.
But if it lands on top of anoth... |
Everybody loves geometry. So why don't we try and code golf it? This challenge involves taking in letters and numbers and making shapes depending on it.
The Input
The input will be in the form of (shapeIdentifier)(size)(inverter).
But what are shapeIdentifier, size, and inverter?
The shape identifier is the identifie... |
URLs are getting too long. So, you must implement an algorithm to shorten a URL.
i. The Structure of a URL
A URL has 2 main parts: a domain and a path. A domain is the part of the URL before the first slash. You may assume that the URL does not include a protocol. The path is everything else.
ii. The Domain
The domain ... |
If you've read the book Contact by Carl Sagan, this challenge may seem
familiar to you.
Given an input of a set of mathematical equations consisting of a number, an
unknown operator, another number, and a result, deduce which operators
represent addition, subtraction, multiplication, or division.
Each input equation w... |
This is Markov.
Markov's golf ball rolls around randomly.
Markov's ball will hole however he strikes it.
Markov is smart.
Be like Markov.
And this:
is an anthill in Langton's backyard.
The anthill is big enough to hold Markov's golfball, MarGolf. However, the anthill moves and changes direction depending on the surro... |
Introduction
Arrays can also be seen as a field for a bouncing ball. This of course sounds very vague, so here is an example of an input:
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[9, 8, 7, 6, 5, 4, 3, 2, 1]
[1, 2, 3, 4, 5, 6, 7, 8, 9]
The challenge is to output the bounced arrays. These are made from diagonal patterns which bounce... |
(FB, or Functional-Basic, as found here Interpret Functional-Basic)
Task
Implement a linting program for FB, similar to JSLint for JavaScript.
Error types
Invalid identifier
Identifiers can only have upper and lower case ASCII letters.
Locations:
The identifier right after a let expression
The identifier in a for loo... |
A connected graph is a graph that contains a path between any two vertices.
Challenge
Build a [2-input NAND-gate] circuit that determines whether a 4-vertex graph is connected.
(A gate's 2 inputs can be the same input bit or other gate.)
Output True if the graph is connected, and False otherwise.
Input
The six possib... |
Recently, the PPCG design leaderboard has been having some trouble parsing answer html headers.
In this challenge you'll be taking your own shot at parsing answer headers.
Example Test Cases
These example inputs (NOT actual test cases), just so you can get the idea of how inputs might be like
Input: <h1>Python 3, 32... |
The goal of this challenge is to compute the set of equivalence classes over the transitive closure of a symmetric, reflexive relation. For those who don't know what that means, here is a brief introduction into the relevant terms:
A relation ◊ is symmetric if a ◊ b ↔ b ◊ a. It is reflexive if each object is related to... |
Introduction
Some days ago I needed a metronome for something. I had none available so I downloaded an app from the App Store. The app had a size of 71 MB!!!
71 MB for making tic-toc...?!
So code-golf came into my mind and I was wondering if some of you guys could improve this.
Challenge
Golf some code that outputs s... |
A helicopter starting at the top left corner is descending (in a 2D space, for the purpose of this question) towards the ground. It has an autopilot mode and a manual mode.
The autopilot mode behaves as follows:
If the space directly below is free, descend to it.
Otherwise move a step left or right, totally at random.... |
Note: a 1000 point bounty is still available for this challenge, which I will create and award if anyone takes the top score without using built-in compression.
Below is a 386x320 png representation of van Gogh's Starry Night.
Your goal is to reproduce this image as closely as possible, in no more than 1024 bytes of c... |
Introduction
Doppelkopf is a traditional German card game for 4 players. The deck consists of 48 cards (9, 10, Jack, Queen, King, Ace of each suit while every card is in the game twice), so each player gets 12 at the start of a round.
There are always 2 teams which are determined by the distribution of the Queens of Cl... |
Challenge
You will be making a program/function that takes a string input of length n, and:
Puts the kth char at the center of the space, where k = (n+1)/2. This will be the location of your ground zero.
Puts the rest of the non-whitespace chars randomly arranged around ground zero. The Pythagorean distance from the c... |
You live in a rectangular neighborhood which is completely partitioned into N rectangular plots, i.e. there are no gaps or overlaps. Plots do not necessarily have the same width/height as other plots. All widths/heights are positive integers. Your goal is to output all shared edges between plots.
Inputs
The input may c... |
The Möbius function is an important number theoretic function.
Your submission should accept a positive integer \$n\$ and return the value of the Möbius function evaluated at \$n\$.
Definition
The Möbius function \$μ(n)\$ is defined as follows:
$$\mu(n) = \begin{cases}
\hphantom{-}1, &n\text{ is squarefree and has an e... |
Introduction
Prime numbers are simple, right? Well, now you get your chance to find out!
Challenge
You must write a program or function that takes an input n and outputs the first n prime numbers.
Example Input and Output
Input: 10
Output: 2,3,5,7,11,13,17,19,23,29
Rules
You must not include any of the following built... |
Given an input of a series of characters representing movements on a hexagonal
grid, output the final coordinates of the "pointer."
Our hexagons will be numbered like so (imagine a rectangular grid with every odd-numbered column shifted downwards slightly):
_____ _____ _____ _____
/ \ ... |
Introduction
Everyone's first program outputs Hello World!. This program should be very simple, that's all you have to do.
Challenge
Output the string Hello World! to the STDERR.
Rules
If your language doesn't support STDERR or STDERR doesn't exist for it, you can output it to it's corresponding error system.
You can'... |
Given a list of the populations of each state, output, from greatest to least, the number of votes that state gets in the electoral college.
Input: The first number represents the total number of votes to distribute; it is followed by a list of and populations. In this example, abbreviations for states are used, but an... |
The task
In this challenge, your input is a non-empty list of positive integers, given in the native format of your language.
Your output is that same list, in the same format, with some elements removed.
You shall remove every occurrence of 1, every second occurrence of 2, every third occurrence 3, and so on.
In gener... |
In this challenge, you are passed two words: Your job is to determine if they are adjacent.
Two letters are adjacent if:
They are the same letter, or
They are lexicographically adjacent.
For example, J is adjacent to I,J, and K only. Z is not adjacent to A
Two words are adjacent if:
They are the same length, and
Ea... |
Introduction
tl;dr
Continuously output the current distance from the Earth to the Sun.
Simplified, the orbit of the Earth around the Sun is an ellipse. So the actual distance between both is constantly changing. This distance can be calculated for any given day using this formula:
The equation can be split into the f... |
Clock is an interesting card game, as it requires no skill. It is a single player game, and the same card configuration always leads to a win or a loss. In this challenge, you need to figure out whether a given card configuration wins or loses. You can play the game here.
The game is played as follows:
Thirteen pil... |
Final results are here !
Introduction
In 2042, the world has become overpopulated. Globalization, overcrowding, new lifestyles and a global lack of hygiene has caused a new pandemic to spread. During those hard times, state leaders have to manage the situation. You can't let your population be decimated, but maybe you ... |
In this challenge, you will remove duplicate words from each sentence.
Examples
Hello Hello, World!
Hello, World!
Code Code! Golf Code
Code! Golf Code
Hello hello World
Hello World
Programming Golf Programming!
Programming Golf!
Specification
Input will be a string of ASCII characters.
A sentence is defined a... |
In my previous challenge, I
drew the first diagram mostly by hand (with the help of vim's visual block
mode). But surely there must be a better way...
Given an input of two dimensions, a width and a height, output a hexagonal grid
with those dimensions in ASCII art.
Here's the diagram referenced in the intro (with min... |
I have a specific number in mind, but it's part of a challenge I'm doing, and I don't want people to do (all) the work for me.
Here is a number which has the same digits, but shuffled:
5713167915926167134578399473447223554460066674314639815391281352328315313091488448321843
8892917486601064146636679920143691047671721184... |
In that Coding Golf, you should convert one coding convention with TitleCase to lower_case_with_underscores. And... vice versa!
Specification
Change the casing in a following way:
If underscore character is a delimiter, change the casing to Title Case without any of delimiter.
If there are multiple words with no delim... |
There is a network of up to 26 nodes (named A to Z or a to z as per your wish). Every pair of nodes may be connected or disconnected. A node may be connected to at most 4 other nodes. Your task is to draw the network in a 2D diagram. Input will be given such that this task is possible (see more constraints in output se... |
I have a crank-operated music box that can play a series of four notes. When I turn the crank, it plucks one of four strings, depending on the position of the crank and the direction of the turn. When the crank is turned due north, the box (with its strings numbered 1 through 4) looks like this:
1 | 2
|
O
4... |
Australians love public holidays, and drinking. Yesterday, the 26th January, was Australia day, which is a public holiday. I was glad to not be at work yesterday, and eager to know the next time I get a public holiday! Unfortunately, I had a bit too much to drink, and I'm not able to work it out for myself.
Write a pro... |
Introduction
In chemistry there is a type of extension, .xyz extension,(https://en.wikipedia.org/wiki/XYZ_file_format), that prints in each line
a chemical element, and the coordinates in the plane of the element. This is very useful for chemists to understand chemical compounds and to visualize the compounds in 3D. I ... |
Given an input of a list of blocks to drop at certain points, output the height
of the resulting "tower."
The best way to explain this challenge is by example. The input will be a list
of 2n integers representing n blocks. The first integer is the block's x
position, 0-indexed, and the second is how wide the block is. ... |
Introduction
Everyone should know IPv6 by now. IPv6 has very long, cumbersome addresses.
In 1996 some very intelligent people created a scheme to encode them much better in RFC 1924. For reasons I cannot understand, this hasn't been widely adopted. To help adoption, it is your task to implement a converter in the langu... |
I am standing at point (0,0) in a H x W map where the altitude is represented by digits, for example:
1132
2221
1230 # H = 3, W = 4
I'd like to experience the views from every peak, which in this case are the areas with altitude 3. However, climbing up hills is not an easy task, and I am also running out of time.
... |
You want to open a new zoo. It'll be amazing. But being the cheapskate that you are, you only want to afford three-letter animals (everyone knows that an animal's cost is proportional to the length of its name). There goes your dream of making people pay to see an elephant. But suddenly you have a brilliant idea. If yo... |
0h n0 is a very simple and enjoyable game, a bit like Sudoku or minesweeper.
Game rules
(I recommend using the tutorial in the game if you can, it is very simple and useful)
The puzzle starts with an n * n board containing some fixed pieces and some empty cells, and the solver must find a way to fill the empty cells wi... |
Someone's given us a string, but all bracket-like characters have been changed into normal ones, and we don't know which, or even how many there were. All we know is that if L1,L2,L3,...,LN were different kinds of left brackets and R1,R2,R3,...,RN were different corresponding kinds of right brackets, all being distinct... |
A Stack Exchange script determines which five comments on questions or answers are initially seen on the main page of sites through the number of upvotes on them; the five comments with the highest number of votes are displayed. Your task is to recreate this behavior.
Write a full program or function taking input throu... |
Background
It's well known in mathematics that integers can be put into a one-to-one correspondence with pairs of integers.
There are many possible ways of doing this, and in this challenge, you'll implement one of them and its inverse operation.
The task
Your input is a positive integer n > 0.
It is known that there e... |
Introduction
There is a plantation defined by one big square-board like this one:
The numbers inside each small square represents its area's value/cash/...
The farmer needs help to find the N squares that connected (it means all N squares should have at least one shared border) give him the greatest value.
For example... |
Easy As ABC, also known as "End View", is a puzzle where you are given an empty grid with letters around it; you must partially fill in the grid so that exactly one of each letter is in every row and column; in addition, letters at the end of a row (or column) must be the first letter visible in that row (or column) fr... |
In this challenge you will be creating an image preview compression algorithm. It's goal is to
reduce an arbitrary image file to a 4 KiB preview image, that can be used to quickly identify images
with very little bandwidth.
You must write two programs (or one combined program): a compressor and a decompressor. Both mus... |
If you think this could be fun, but too much work, consider participating in this much smaller challenge.
A bit of fun (and possibly frustration!) for 2016... Dyalog's "puzzle of the year". Enjoy!
The Objective
Find Dyalog APL (download) expressions (other languages are allowed, see Eligibility below) involving exactl... |
/* I hope such question is suitable for here*/
As the batch scripts are pretty limited, hybrid files that embed a code from another language into a batch file are used a lot lately.
Though usually there are some requirements for a good hybrid script:
The embedded code should be usable as-it-is - without any ugly batc... |
The challenge is very simple. Given an integer input n, output the n x n identity matrix. The identity matrix is one that has 1s spanning from the top left down to the bottom right. You will write a program or a function that will return or output the identity matrix you constructed. Your output may be a 2D array, or n... |
Task
Your task is to write a program that will output ASCII boxes at the locations specified by the input.
Input
You will be given a list of numbers. The format here is a bit flexible, in that you can use any deliminator you want (e.g. 1,2,3,4, 1 2 3 4, [1,2,3,4]). The list is in groups of 4 and specifies the xywh of e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.