instruction stringlengths 34 53.1k |
|---|
Task
You're in charge of making a compass, of sorts.
Imagine your source code as the compass "needle" where running at different orientations produces distinct output.
Supported source code orientations are North, East, South, and West.
Example
Let's say you have source code:
ABCD
J K
WXYZ
We'll consider this the Nor... |
Challenge:
In the language of your choice, write a program that generates a leaderboard with random scores and outputs it, then take a new score as input and check if it can be placed in the leaderboard, and output which place it is in.
Specifications:
You must generate a list of 50 "random" scores, in descending orde... |
We are used to the term "squaring" n to mean calculating n2. We are also used to the term "cubing" n to mean n3. That being said, why couldn't we also triangle a number?
How to triangle a number?
First off, let's pick a number, 53716.
Position it in a parallelogram, whose side length equals the number of digits of the... |
Background
When you run tail -f file in bash, the file is outputted and then any subsequent appends.
However, when you remove something that has already been displayed, tail outputs:
tail: nameoffile: file truncated
Your Challenge
When given an input f, append tail: [value of f]: file truncated (with trailing & leadin... |
One of my favorite mathematical pastimes is to draw a rectangular grid, then to find all of the rectangles that are visible in that grid. Here, take this question, and venture for yourself!
Can you count the number of rectangles?
+-----+-----+-----+-----+
| | | | |
| | | | |
+-----+----... |
This is the cops' thread. The robbers' thread is here.
Your challenge is to write a program or function that, with a certain input, prints the exact string Hello, World! and a newline. Capitalization, spacing and punctuation must be exact.
Input may be taken via standard input, a file, or command-line/function argument... |
This is the robbers' thread. The cops' thread is here.
Your challenge is to take an uncracked submission from the cops' thread and find, for what input or inputs, the program will print Hello, World! and a newline. Capitalization, spacing, and punctuation must be exact.
Please comment on the cop's submission when you'v... |
Your task is to take a positive number as input, n, and output the length of the longest rep-digit representation of n in any base. For example 7 can be represented as any of the following
111_2
21_3
13_4
12_5
11_6
10_7
7_8
The rep-digits are 111_2 and 11_6, 111_2 is longer so our answer is 3.
This is a code-golf ques... |
September 1993 is known on Usenet as the September that never ended. Thus, for example, the day this question is being posted is Saturday, September 8740, 1993.
Your program or function should take any Gregorian date (with positive year) as input and return the same date as output if it's prior to September 1993 or the... |
In the beginning there was NCSA Mosaic, and Mosaic called itself NCSA_Mosaic/2.0 (Windows 3.1), and Mosaic displayed pictures along with text, and there was much rejoicing.
15 years later...
And then Google built Chrome, and Chrome used Webkit, and it was like Safari, and wanted pages built for Safari, and so preten... |
Note: This challenge has been moved to Polyglot the (non constant) OEIS! to avoid closure.
Introduction
We all know and love the on-line encyclopedia of integer sequences (OEIS). So what if we made an off-line version? Well, that would be kinda too easy, wouldn't it and how would you select a sequence with our standa... |
Given a positive integer n > 1 determine how many numbers can be made by adding integers greater than 1 whose product is n. For example if n = 24 we can express n as a product in the following ways
24 = 24 -> 24 = 24
24 = 12 * 2 -> 12 + 2 = 14
24 = 6 * 2 * 2 -> 6 + 2 + 2 ... |
Have you ever found a good challenge to answer, answered it and then found out somebody posted a solution with a better score in the same language?
Challenge
Write a program/function that takes a PPCG question ID and outputs a leaderboard.
A leaderboard consists of the rank, the language, the score, the author and the ... |
Reading a book is easy, but printing a book can be a bit tricky. When printing a booklet, the printer needs to have the pages arranged in a certain manner in order to be read from left to right. The way this is done is using a pattern like below
n, 1, 2, n-1, n-2, 3, 4, n-3, n-4, 5, 6, n-5, n-6, 7, 8, n-7, n-8, 9, 10,... |
Challenge
Given the name of a PPCG member, output their PPCG ID number. If the user does not exist, you may report an error or return any non-positive number. If there are multiple members with this name, you may choose to output only one ID or all of them.
Test Cases
"musicman523" -> 69054
"Dennis" -> 12012
"xnor" ->... |
You are the best and most famous hero of the area. Lately there have been rumors that a Hydra has been hanging out in a nearby ravine. Being the brave and virtuous hero that you are you figure you'll go check it out sometime later today.
The problem with hydrae is that every time you try to cut off their heads some ne... |
Task
The prepend,append-Sequence is defined recursively, like this
a(1) = 1
a(n) = a(n-1).n , if n is even
a(n) = n.a(n-1) , if n is odd
where the . represents an integer concatenation.
So the first few terms are: 1,12,312,3124,53124,531246,7531246,... This is A053064.
Your task is, given an integer a > 0 to return... |
Background
A Ruth-Aaron pair is a pair of consecutive positive integers n and n+1 such that the sum of the prime factors (counting repeated prime factors) of each integer are equal. For example, (714,715) is a Ruth-Aaron pair, since 714=2*3*7*17, 715=5*11*13, and 2+3+7+17=5+11+13=29. The name Ruth-Aaron pair was chosen... |
Surprisingly, I don't think we have a code-golf question for determining if a number is semiprime.
A semiprime is a natural number that is the product of two (not necessarily distinct) prime numbers.
Simple enough, but a remarkably important concept.
Given a positive integer, determine if it is a semiprime. Your ou... |
Some two-dimensional esolangs, such as Forked, and some non-esolangs, such as Python, can sometimes require spaces before lines of code. This isn't very golfy. Also, I'm lazy and writing a 2d lang that needs lots of spaces before code. Your task is to write a tool that makes these languages golfier.
Of course, this wil... |
Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro.
I am an evil farmer, and to drive up the price of wheat in my area, I've decided to burn the fields of all the farmers around me. I would really like to see the fields go up in flames (... |
Oh no! There are a bunch of meteoroids on my way through the universe ... what am I and my space ship, the SP4C3, supposed to do?
I need to manoeuver my shuttle through these rocks or I am done for!
Your Task
Write a program that guides my shuttle through a map of asteroids, using as few bytes as possible since I don't... |
Background
It can be shown that for any integer k >= 0, f(k) = tan(atan(0) + atan(1) + atan(2) + ... + atan(k)) is a rational number.
Goal
Write a complete program or function which when given k >= 0, outputs f(k) as a single reduced fraction (the numerator and denominator are coprime).
Test cases
The first few values ... |
Inspired by this.
Background
The evil farmer has decided to burn your wheat field down in order to drive up the prices. To ensure total destruction, he has also soaked your field in gasoline. Even more unfortunately, you happened to be walking on the field when it was lit on fire, and you must get out quickly to surviv... |
Inspired by this and this which was inspired by the first question.
I've set my farmers' fields on fire, but unfortunately they saw me do it! If I don't deal with this situation they could report me and then I'd get arrested! So, that shouldn't be too hard. All I have to do is kill them with fire!
The field will be an ... |
The Levenshtein edit distance between two strings is the minimum possible number of insertions, deletions, or substitutions to convert one word into another word. In this case, each insertion, deletion and substitution has a cost of 1.
For example, the distance between roll and rolling is 3, because deletions cost 1, ... |
In this question I defined a "chain" function as a function that:
is a permutation, meaning that every value maps to and is mapped to by exactly one value.
and allows any value can be obtained from any other value by repeated applications of the function or its inverse.
There are a lot of functions that do this and s... |
Inspired by this, this and this.
So, now that the evil farmer has set your field on fire, you naturally want to put it out. You have a bunch of friends who all have buckets, and you want a program to figure out where to place everyone to save as much of your wheat as possible.
Your Task:
Write a program or functio... |
Cubically is a fairly new esoteric language capable of creating short, golf-like answers for a very specific subset of problems. It is unique in that it stores memory in the form of a 3x3 Rubik's cube, making calculations far less trivial than in most languages. In Cubically, the programmer must rotate the internal cub... |
Now that we know how to properly square and triangle a number, we are going to learn how to parallelogram one. To parallelogram a number, we first arrange it as a parallelogram by stacking it on top of itself a number of times equal to the number of digits it has, and adding spaces to make it a parallelogram. So 123 ... |
Inspired by this Stack Overflow question: Sorting a list: numbers in ascending, letters in descending. Your task is to solve the following problem and, as this is code-golf, you should do so in as few as bytes as possible.
You should take a list of objects as input containing letters (any reasonable form: string, char,... |
Given an unsigned 16-bit integer N, your task is to determine whether its binary representation mapped inside a 4x4 matrix is matching a tetromino shape, and if so, which shape it is.
Matrix
Each bit of N is mapped inside a 4x4 matrix, from left to right and from top to bottom, starting with the most significant one.
E... |
Pascal's triangle is generated by starting with 1 and having each row formed from successive additions. Here, instead, we're going to form a triangle by alternating multiplication and addition.
We start row 1 with just a solitary 1. Thereafter, addition is done on the odd rows, and multiplication is done on the even r... |
Given a string of ASCII letters (upper and/or lower case), output the raw MathJax required to display that string bifurcating at each character, into superscripts and subscripts. For example, the inputs cat and horse would result in outputs which MathJax renders as the following, respectively:
Note that only one inpu... |
My Alarm Clock
I'm American, and so is my (digital) alarm clock. To set the alarm, it starts at the time it was previously. Hitting the hour button moves it up one hour, and hitting the minute button moves it up one minute. Hitting both buttons at the same time resets it to midnight (12:00 am), and counts as two button... |
Lost is a 2-D programming language where the start position and direction of the ip are entirely random.
This makes it very difficult to make deterministic Lost programs. However today we are not writing a deterministic program, we are writing an RNG.
Write a Lost program that takes no input and outputs a single digit... |
Your task is simple, write a single code snippet that when executed in one language outputs only the string 'abc' and when executed in another language outputs only the string 'cba'. The program should take no input.
This is a code-golf challenge.
|
The usual correlation coefficient (in 2d) measures how well a set of points can be described by a line, and if yes, its sign tells us whether we have a positive or negative correlation. But this assumes that coordinates of the points can actually interpreted quantitatively for instance as measurements.
If you cannot do... |
Challenge description
In taxicab metric, a distance between two points is defined as:
Consider a matrix with only zeros and ones:
0 0 0 1 0
1 0 0 0 0
0 0 0 0 0
1 0 0 1 0
1 0 0 0 0
Let's map each 1 to the distance to nearest different 1 in the matrix (of course, assuming that distance between two adjacent rows/column... |
Now that we know how to Square a Number my Way, we need an inverse operation, a way to Square Root a Number my Way. To square a number my way, you simply stack it on top of itself a number of times equal to the number of digits it contains, and then take read off every number that is formed both vertically and horizon... |
Anyone here a die-hard Bethesda fan? Maybe you prefer Obsidian Entertainment? Well, if you're either of those things than the following picture should be relatively familiar to you.
I've taken the liberty of preparing a rather unique ASCII-Art challenge, so here's the first clue as to what I'm going to have you do:
... |
The above image displays a hexagonal grid of hexagons. Each cell in the grid is assigned an index, starting from the center and spiraling counterclockwise around as shown. Note that the grid will continue indefinitely - the above picture is simply the first section. The next hexagon would be adjacent to 60 and 37.
You... |
Given two positive integers, W and H, output an ASCII-art box whose border is made of slashes (/ and \) with W "spikes" on the top and bottom edges, and H "spikes" on the left and right edges. The box's interior is filled with spaces.
A "spike" is simply two slashes coming together to form an arrow shape:
/\ \/
/ ... |
There are a few questions on this site about balancing brackets, and checking whether brackets are balanced. I propose it's now time to use those balanced brackets for something!
In mathematics and programming, brackets are like bubbles, isolating everything inside form everything outside so that whatever's inside can ... |
Challenge
Here at PPCG, we sure do like our sequences, so here's a fun another one.
Let's define a(n) as being the smallest non-negative integer X that is not equal to any a(k) (0 < k < n), and a(n-1) and X do not share any decimal digits. a(0) = 0
Given an input n > 0, output such a(n).
For example, for input n = 13, ... |
Chebyshev Polynomials are a family of orthogonal polynomials that pop up in all kinds of places in math, and they have a lot of quite interesting properties. One characterization of them is that they are the unique polynomials that satisfy \$T_n(\cos(x)) = \cos(nx)\$.
Challenge
Given an nonnegative integer \$n\$, you s... |
Its been a while since you killed that hydra, you basked in the glory for years, but now people are calling you washed up, a has been. Well its time you prove them wrong, you've heard the whereabouts of annother hydra. Simply kill it and you will be awarded all the glory you deserve.
You arrive at the armory to recei... |
Input:
Two strings (NOTE: the order of input is important).
Output:
Both words/sentences start on lines with one empty line in between them. They 'walk' horizontally 'next to each other'. But when they have the same character at the same position, they cross each other, and then continue walking 'next to each other'.
C... |
Given a list of integers, your task is to output the second largest value in the first k elements, for each k between 2 and the length of the input list.
In other words, output the second largest value for each prefix of the input.
You can output an arbitrary value for the first element (where k = 1), or simply omit th... |
Everybody knows pi the mathematical constant, the ratio of a circle's circumference to its diameter.
3.14159265358979323846264338327950288419716939937510...
You probably also know e the mathematical constant, the base of a natural logarithm.
2.71828182845904523536028747135266249775724709369996...
But... do you know p... |
Given an input list of non-empty strings, output an ASCII art representation of a tournament, based on the following drawing rules:
The number of strings is guaranteed to be of quantity 2,4,8,16,etc.
The first two strings play each other, and the next two play each other, and so on. This is the first round.
For each g... |
Given a string S and a list of indices X, modify S by removing the element at each index of S while using that result as the new value of S.
For example, given S = 'codegolf' and X = [1, 4, 4, 0, 2],
0 1 2 3 4 5 6 7 |
c o d e g o l f | Remove 1
c d e g o l f | Remove 4
c d e g l f | Remove 4
c d e g f ... |
The difference list of a list of integers is the list differences of consecutive members.
For example the difference list of
1, 3, 2 ,4
is
2, -1, 2
Your task is to take as input a difference list and output what the difference list would look like if the original list were sorted.
For example the difference list
2, 1... |
Think of a road as a number line, starting at 0 and continuing indefinitely:
.................................................................
There are two cars on the road: C and R. C is the cop who is trying to catch R, the robber. C starts at 0, and R starts somewhere on the road:
C.............................R..... |
Given a single integer x where 0 <= x <= 91 output a stack of bottles of beer with that many bottles (and shelves) missing. For simplicity sake I'll only show the first 6 bottles and what it would be for each of the first inputs.
Here's the stack of bottles, each number is the bottle you should remove for that input (1... |
The coefficient of relationship refers to how much DNA two persons have in common. A parent has 50% common DNA with their child (unless the parents are related), so to calculate it we have to find all pairs of directed disjoint paths starting at same node (common ancestor) and ending at each of the two siblings, and su... |
Well the title says it all.
Standard loopholes apply
Nothing to read from stdin, and output goes to stdout
1-byte-long programs are... nonsense. They don't qualify
A program with a single byte repeated is also a nonsense (like aaa)
Please mark it out if your program is a palindrome
Sample:
A program with source code... |
Define the "maximum sub-array" of a given array as "a (consecutive) sub-array that has the biggest sum". Note there's no "non-zero" requirement. Output that sum.
Give a description of your code if possible.
Sample input 1:
1 2 3 -4 -5 6 7 -8 9 10 -11 -12 -13 14
Sample output 1: 24
Description 1:
The biggest sum is yie... |
Given a list of lists find the shortest list that is a contiguous sublist of exactly one list.
For example if we had
[[1,2,3],
[1,2,3,4],
[2,4,5,6],
[1,2,4,5,6]]
the shortest contiguous sublist would be [3,4] since it only appears in the second list.
If there is no unique contiguous sublist (this requires at least ... |
Given a string as input, determine whether it is a noun or not.
You will be scored on the 1000 most common English words, by how many you correctly label as a noun or not.
The program or function which correctly classifies the most of those words in 50 bytes or less will win.
Nouns
A noun is a word that represents a th... |
Two lists A and B are congruent if they have the same length, and elements that compare equal in A compare equal in B.
In other words, given any two valid indices x and y:
If A[x] = A[y], then B[x] = B[y].
If A[x] != A[y], then B[x] != B[y].
For example, the lists [1, 2, 1, 4, 5] and [0, 1, 0, 2, 3] are congruent.
Th... |
Aliens have arrived, and they aren't friendly.
Turns out, they've been in the process of converting all matter in the universe into compute capability so they can have more fun in their VR simulations.
Our solar system is the last bit of space they haven't converted yet, and they're about to remedy this oversight.
Howe... |
Given a list of positive integers, output whether every adjacent pair of integers in it shares a prime factor. In other words, output truthy if and only if no two neighboring integers in the list are co-prime.
In yet other terms: given a list of positive integers [a1 a2 … an], output whether
gcd(a1, a2) > 1 && g... |
The date 0409·01·MO is New Year’s Day in the Ceres Calendar. Wish everyone and everything in the Asteroid Belt, Jupiter, Saturn and beyond a belated Happy New Year by writing a program to convert Julian Dates (JD) to Ceres Dates using these helpful landmarks:
JD ... |
Given as input a positive integer n>=1, output the first n rows of the following triangle:
1
1 0 1
0 0 1 0 0
1 1 1 0 1 1 1
0 0 0 0 1 0 0 0 0
1 1 1 1 1 0 1 1 1 1 1
0 0 0 0 0 0 1 0 0 0 0 0 0
1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
0 0 0 0 0 0... |
Write a piece of code that takes a string as input, and outputs a piece of code in the same language that, when run, will output the initial input string.
It must be able to handle any combination of characters A-Z, a-z, and 0-9.
Example in Python:
import sys
print "print('" + sys.argv[1] + "')"
Given the input of te... |
Given a list of positive integers that contains at least 3 distinct entries, output a permutation of that list that isn't sorted in ascending or descending order.
Examples
1,2,3 -> 2,1,3 or 3,1,2 or 1,3,2 or 2,3,1
1,2,3,3 -> 2,1,3,3 or 3,1,2,3 or 1,3,2,3 etc..
Thanks @Arnauld and @NoOneIsHere for the title!
|
Given a positive integer n >= 1, output the first n rows of the following structure:
#
# #
###
# #
# # #
## ##
#####
# #
# # #
# # # #
# ### #
## ##
## # ##
### ###
#######
The n-th 1-indexed row is the binary representation of n, mirrored without copying the last character, with # in place of 1 a... |
Many languages allow strings to be "added" with +. However this is really concatenation, a true addition would follow the group axioms:
It is closed (the addition of any two strings is always a string)
It is associative ( \$\forall a b . (a + b) + c = a + (b + c)\$)
There is an identity (\$\exists e . \forall a . a... |
Given any string, print it in the form of a triangle where the text runs up and down along each diagonal. For example, an input of "Hello World" should output:
d
l
r d
o l
W r d
o l
o W r d
... |
Write a program or function that takes in a quadratic equation and prints its factorized roots. The input can be taken in from any reasonable source, such as a function parameter, stdin, or a command line argument.
Edit: This is not intended to be a duplicate of other quadratic equation questions. While others simply p... |
We can define the Divisibility Streak k of a number n by finding the smallest non-negative integer k such that n+k is not divisible by k+1.
Challenge
In your language of choice, write a program or function that outputs or returns the Divisibility Streak of your input.
Examples:
n=13:
13 is divisible by 1
14 is divisib... |
We define the hyper-average of an array / list (of numbers) the arithmetic mean of the sums of its prefixes.
For example, the hyper-average of the list [1, 4, -3, 10] is computed in the following manner:
We get the prefixes: [1], [1, 4], [1, 4, -3], [1, 4, -3, 10].
Sum each: [1, 5, 2, 12].
And now get the arithmetic m... |
Given positive integer n > 2. We convert it to an array as follows:
If it is equal to 2 return an empty array
Otherwise create array of all n's prime factors sorted ascending, then each element replace with its index in prime numbers sequence and finally convert each element to array
For example, lets convert number ... |
Disclaimer: This is heavily inspired by "Polyglot the OEIS!" but fixes the problem that lead to closure (see the output section) and was re-posted as to not invalidate answers.
Introduction
We all know and love the on-line encyclopedia of integer sequences (OEIS). So what if we made an off-line version of the interesti... |
The title is valid Jelly Code which has the same output as L€€ except printed twice.
Background
You can skip this section without losing ability to complete the challenge
Some operations in Jelly try to convert its argument to a list first before applying the operation. One example is €, the mapping quick. This some... |
As we all know, negative press covfefe has been conspiring to bring down the American president for some months now.
There's also, definitely, an algorithm in play in that word. Covfe is a refreshing caffeinated beverage, and following the president's remarks it's clear the word can now be appended with successive f's ... |
Many programming languages are written using solely printable ASCII, tabs and newlines. These 97 characters are then stored in 8-bit bytes (which are actually capable of holding 256 different characters!), which is just terribly inefficient - especially in code-golfing, where every byte counts! In this challenge, you w... |
(Inspired quite heavily by this challenge)
In the original challenge you were to make a horizontal zipper, however, looking down at my hoodie, my zipper is much more vertical (and a little bit broken) :P
Input
You will be given a single string (s), and a pair of integers (a and b) in any format. Where:
a < (length-of-... |
There's a cool magic trick that works using the power of binary. The effect of the trick is as follows:
An audience member chooses some natural number in the range of 1 to x where x is chosen by the magician.
The magician hands the audience member some special cards. Each card contains some numbers from 1 to x.
The ... |
Gozinta Chains
(Inspired by Project Euler #606)
A gozinta chain for n is a sequence {1,a,b,...,n} where each element properly divides the next.
For example, there are eight distinct gozinta chains for 12:
{1,12}, {1,2,12}, {1,2,4,12}, {1,2,6,12}, {1,3,12}, {1,3,6,12}, {1,4,12} and {1,6,12}.
The Challenge
Write a progr... |
Challenge
Given an arbitrary list of 2-tuples, and a single element in one of those tuples, output its "partner", i.e. given a and [(i,j),...,(a,b),...,(l,m)], output b. You can assume all tuples are unique, and that all elements in tuples are strings. Further assume you do not have both (x,y) and (y,x).
Test cases
Inp... |
(Note: I'm not in the army so feel free to correct me if my formation is wrong, but I will not be changing the question. I will change any terminology mistakes though, because I'm trying to avoid air-cadet-specific wording choices)
(Note: this follows the standards for Canadian Air Cadets, not any actual army thing)
Ch... |
So we're all hopefully familiar with Spreadsheet 'A1' cell notation.
It's simply an alphanumeric representation of the positioning of said cell within a grid.
The letter(s) represent the column positioning of the cell, and the number represents the row.
The 'letter' part can consist of 1 or more letters from the 26 let... |
Your challenge is to write a polyglot that works in different versions of your language. When run, it will always output the language version.
Rules
Your program should work in at least two versions of your language.
Your program's output should only be the version number. No extraneous data.
Your program may use what... |
Warning : this is NOT a "hey, let's draw a cake in ASCII-art" challenge! Please keep reading ;)
Some time ago it was my birthday, I'm 33 now.
So there is this awkward social tradition consisting in inviting family and friends, putting number-like candles on a cake, sing songs and open gifts.
33
--------
Instead... |
The crazy mathematician owns a wide collection of numbers, and therefore the space he has left is quite limited. To save some, he must fold his integers, but unfortunately he is really lazy. Your task, if you wish to help him, is to create a function / program that folds a given positive integer for our number maniac.
... |
Let us say a substring is any continuous section of an original string. For example cat is a substring of concatenate. We will say that a proper substring is a substring that is not equal to the original string. For example concatenate is a substring of concatenate but not a proper substring. (single character strin... |
Given an input n, your program or function must output the smallest positive integer k such that n rounded to the nearest multiple of k is greater than n.
Example.
Given an input 20, the output value should be 3:
The nearest multiple of 1 is 20, which is not greater than 20.
The nearest multiple of 2 is 20, which is... |
The function TREE(k) gives the length of the longest sequence of trees T1, T2, ... where each vertex is labelled with one of k colours, the tree Ti has at most i vertices, and no tree is a minor of any tree following it in the sequence.
TREE(1) = 1, with e.g. T1 = (1).
TREE(2) = 3: e.g. T1 = (1); T2 = (2)--(2); T3 = (2... |
Description
There are an infinite number of ASCII strings. Write a program that will output every possible ASCII string exactly once.
The ordering does not matter, but you must be able to show that for any possible ASCII string s, there exists an integer n such that s is the nth string in the output. This restriction m... |
We've had a few challenges for base conversion, but all of them seem to apply to integer values. Let's do it with real numbers!
The challenge
Inputs:
A real positive number x, expressed in base 10. This can be taken as a double-precision float or as a string. To avoid precision issues, the number can be assumed to be ... |
Given a non-empty string consisting of only lower and upper case alphabetical characters and spaces ([a-zA-Z ]), reduce it to a snippet of the alphabet, starting with the first character.
To reduce a string, begin with the first alphabetical character, then remove every character after it that is not the next letter of... |
Make a program/function which takes in an integer from 0 to 999999999999 (inclusive) as input and returns how many syllables it has when spoken in English. Make your code short.
Specification
A billion is a thousand million, a trillion is a million million, etc.
A million has three syllables -- it's mill-ee-on, as opp... |
You might know Alan Walker from his ever popular song Faded. Now his "followers" are called Walkers and they have a logo, here is a simplified version:
\\
\\ //\\
\\ // \\ //
\\ // \\ //
\\ // \\ //
\\ // \\ //... |
There is a game called Get Home that is played on the a chess board. In this game there is a single piece that is moved by both players in turns. There are some rules to how the piece can be moved. On a turn a player must make one of the following moves for positive n.
n spaces up
n spaces to the left
n spaces up a... |
Given a matrix consisting of positive integers, output the path with the lowest sum when traversing from the upper left element to the bottom right. You may move vertically, horizontally and diagonally. Note that it's possible to move both up/down, right/left and diagonally to all sides.
Example:
1* 9 7 3 10... |
An Octothorpe, (also called number sign, hash or hashtag, or pound sign) is the following ASCII character:
#
Isn't that a fun shape? Lets make bigger versions of it! So here is your challenge:
Given a positive integer N, output an ASCII hashtag of size N.
For example, an ASCII hashtag of size 1 looks like this:
# #... |
I ran into this problem while working on another challenge I'm making for this site. In that challenge I utilize "Mario Kart 8 Scoring". The amount of points the player in kth place gets is represented by this 1-indexed array: [15,12,10,9,8,7,6,5,4,3,2,1]. So 1st place gets 15 points, 2nd place gets 12 points, etc.
It... |
I'm surprised this hasn't come up in a challenge yet.
Output the IP address of the machine you're running on. You are required to output both the local and external IP addresses.
Local IP address, ie along the default format of 192.168.x.x
Public IP address can be verified by using google https://www.google.co.uk/searc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.