instruction stringlengths 34 53.1k |
|---|
IPv4 addresses are 32 bits wide, and thus the size of the address space is 232, or 4,294,967,296. However, this is only a theoretical upper-bound. It is not an accurate representation of all the addresses that may actually be used on the public internet.
For the purposes of this challenge, it is assumed that all addr... |
Seems like we do not have this one yet, so here we go:
The Challenge
Write a program or function that takes a date as input and outputs the day number of the year. You may not use any builtins for that!
Rules
As usual you may write a full program or a function.
The format of the input is up to you, but it has to conta... |
Given an input of two strings with sequences of underscores representing
corresponding words, output the sentences with the "blanks" filled in.
The best way to describe this challenge is by example. Here is an example
input:
programming _____________ and code golf
programming puzzles ______ code ____
And here is the c... |
Your task is to write a function or program that takes two non-negative integers i and k (i ≤ k), and figure out how many zeroes you'd write if you wrote all whole numbers from i to k (inclusive) in your base of choice on a piece of paper. Output this integer, the number of zeroes, to stdout or similar.
-30% if you al... |
This isn't very widely known, but what we call the Fibonacci sequence, AKA
1, 1, 2, 3, 5, 8, 13, 21, 34...
is actually called the Duonacci sequence. This is because to get the next number, you sum the previous 2 numbers. There is also the Tribonacci sequence,
1, 1, 1, 3, 5, 9, 17, 31, 57, 105, 193, 355, 653, 1201...
... |
Write a program or function that takes in two integers that represent the X and Y coordinates of a point on a Cartesian plane.
The input may come in any reasonable format as long as the X value comes before the Y. For example, 1 -2, (1,-2), [1, -2], or 1\n-2 would all be fine for X = 1, Y = -2.
Print or return a single... |
In a popular image editing software there is a feature, that patches (The term used in image processing is inpainting as @mınxomaτ pointed out.) a selected area of an image, based on the information outside of that patch. And it does a quite good job, considering it is just a program. As a human, you can sometimes see ... |
The cross product of two three-dimensional vectors \$\vec a\$ and \$\vec b\$ is the unique vector \$\vec c\$ such that:
\$\vec c\$ is orthogonal to both \$\vec a\$ and \$\vec b\$
The magnitude of \$\vec c\$ is equal to the area of the parallelogram formed by \$\vec a\$ and \$\vec b\$
The directions of \$\vec a\$, \... |
Here is another simple one:
The Challenge
Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance.
The coordinates will be rational numbers; the only limits are the restrictions of your language.
Lowest dimension is 1, highest is whatever your language can handl... |
Introduction
Pareidolia: From Ancient Greek; παρα (para, “concurrent, alongside”) + εἴδωλον (eídōlon, “image”). The tendency to interpret a vague stimulus as something known to the observer, such as interpreting marks on Mars as canals, seeing shapes in clouds, or hearing hidden messages in music. Source: Wiktionary.... |
Write a function or program that outputs the number of each type of element (vertex, edge, face, etc.) of an N-dimensional hypercube.
As an example, the 3 dimensional cube has 1 cell (i.e. 1 3-dimensional cube), 6 faces (i.e. 6 2-dimensional cubes), 12 edges (i.e. 12 2-dimensional cubes) and 8 vertices (i.e. 8 0-dimens... |
Introduction
A known fact is that Jon Skeet can code Perl and make it look like Java. In this challenge you will try to do something similar.
Challenge
Write a piece of code of any length that can be executed without any errors/exceptions in two different languages. Your program can take inputs, give outputs, whatever ... |
Quinary is like binary, except that 1 is represented by the text of the program, and 0 is represented as the backwards text of the program.
The Fibonacci Sequence is the well known sequence
F(0) = 0, F(1) = 1, F(n) = F(n - 1) + F(n - 2)
Write a program that takes some input n and outputs the nth fibonacci number in qui... |
The winding number is the integer number of net counterclockwise revolutions an observer must have made to follow a given closed path. Note that any clockwise revolutions count negative towards the winding number. The path is allowed to self intersect.
Some examples (shamelessly taken from Wikipedia) are given below:
... |
The Scenario
I am building a fancy oscilloscope but I need your help. The oscilloscope can display any number of individual waveforms at the same time (e.g. sine waves) but I don't know how to synchronise the display so it doesn't jump around too much.
The Challenge
Your program or function will take a series of floati... |
Your task is to generate the nth term of the RATS sequence, where n is the input. The RATS sequence is also known as the Reverse Add Then Sort sequence. This sequence can also be found here: http://oeis.org/A004000.
test cases:
0 > 1
1 > 2
2 > 4
3 > 8
4 > 16
5 > 77
6 > 145
7 > 668
For example, the output for 5 is 77 b... |
Lets say we have this existing data:
Total - 10
Won - 7
Lost - 3
Longest Winning Streak - 5
Longest Losing Streak - 2
Now you need to write a function which generates an array of random boolean values (true representing a win and false representing a loss) which fulfills the above criteria.
So, in this case the o... |
Task
Your task is simple. Write a program or function which takes three positive integer arguments \$n\$, \$k\$, and \$b\$ in any order, such that \$2 ≤ b ≤ 36\$, and returns or outputs the nth (1-indexed) base-\$b\$ digit after the decimal point of the rational number (\$b^k-1)^{-2}\$.
The output must be correct for \... |
I have an ASCII-art box and I need a program to open it.
Examples
Input:
-------
| |
|_____|
Output:
/
/
/
/
/
/
/
| |
|_____|
Specification
The first line will only consist of -, at least 3 of them
The middle rows will start with | have spaces, and end with |
All the middle rows will b... |
Take as input 3 floating point numbers, which represent the x, y, z coordinates of a point. Return a truthy or falsey value indicating whether the point is inside the regular icosahedron centred at the origin, with top and bottom vertices at (0, 0, 1) and (0, 0, -1), and with one of the upper ring of middle vertices in... |
EDIT: I will be accepting an answer Monday, 2/15/2016. May the bytes be ever in your favor!
In his "Print the N-Bonacci Sequence" challenge, @DJMcGoathem describes the N-bonacci sequences, wherein the previous N numbers are summed, instead of the traditional 2 of the Fibonacci sequence (said to be the "duonacci sequenc... |
Given an input of any valid Glypho program,
output its "human-readable" counterpart.
Glypho is an interesting esolang idea:
The instruction reference is given here. For each instruction, the characters
abcd represent the symbols composing each instruction. a refers to the first
unique symbol, b refers to the secon... |
The inspiration for this challenge should be ridiculously obvious at the time of posting.
The Task
You must create a Shut the Box style program (not function, program). The basics of shut the box are:
Players attempt to shut the box by turning a set of levers labelled 1-9. They must do so by flipping levers. The sequen... |
Given input of a positive integer n, write a program that completes the following process.
Find the smallest positive integer greater than n that is a perfect square and is the concatenation of n and some other number. The order of the digits of n may not be changed. The number concatenated onto n to produce a perfect... |
How strings are twisted
The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps to the top. It works like this:
aaaa
bbbb
cccc
Becomes:
a
ba
cba
----
cba
cb
c
With everything under the line wrapping to the top. Real example... |
The goal of this challenge is to make a program that outputs the nth letter of its source code where n is given as input to the program. Like most quine challenges, you are not allowed to read your source code as a file or use any builtin quine functions.
Input
An integer 0 <= n < len(program).
Output
The nth character... |
Given an input of an ASCII art "road," output the road with all dead ends
labelled.
This is a road:
########.....######..#..###
#......#######....#..#..#.#
#.##......#...#####..#..###
#..#####..#....#..#######.#
#......#...#####.....##...#
#..###.#...#...###...#..###
##########.#..#..##..#.##.#
..#......#.######.#..#.#... |
In case there's any doubt: Nan = Non-numeric datatype for the purposes of this challenge.
Write a program or function that takes a matrix / array as input, as well as a list of column indices.
The challenge is to remove the rows where all elements in the specified columns are Nan. It doesn't matter if other elements ... |
You love watching the snow falling outside, but you know it won't be snowing much longer. You could take a video, but decide to make a snow animation because ... um ... you need to practice your animation skills!
Snow
Snow is simply the * symbol here. Half of the snow moves at 1 char per frame, while the other half mov... |
The task is simple: consolidate an array of ints. Consolidating this array consists of the following:
All instances of 0 need to be moved to the end of the array.
There should be no 0s between the non-zero integers.
All non-zero indices should retain their order.
Challenge
Consolidate an array in the least amount of ... |
Your job is quite simple, write a program that prints Hello, world!, that when twisted creates a program that prints Twister!.
How strings are twisted
The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps to the top. It kinda loo... |
We can roll up the natural numbers in a rectangular spiral:
17--16--15--14--13
| |
18 5---4---3 12
| | | |
19 6 1---2 11
| | |
20 7---8---9--10
|
21--22--23--24--25
But now that we have them on a rectangular grid we can unwind the spiral in a different order, ... |
The basic idea is to write a program that twists itself, and the twisted version untwists itself. The first program will just be the twisting algorithm described here, and when given its own source code as input, outputs a program that reverses the twisting algorithm.
How strings are twisted
The twisting algorithm is v... |
The "Look and say" or "Say what you see" sequence is a series of numbers where each describes the last.
1
11 (one one)
21 (two ones)
1211 (one two, one one)
111221 (one one, one two, two ones)
312211 (three ones, two twos, one one)
and on and on...
https://oeis.org/A005150
Anyway, this is a regular code golf challenge... |
Your Challenge:
For a golf Course Of Inputted 'n' length to hole where:
'n' is a whole number and a multiple of 5 between 150 and 500
and
1 integer in code = 1 metre
You must calculate the least amount of swings it can be completed in using a combination of clubs and ranges.
Here is a visual representation of what t... |
You're going to replicate the 90's cup holder joke software.
Here's what's it did, and you have to do:
Display the message Do you need a cup holder?
If the user confirms, enter an infinite loop that keeps opening the CDROM drive.
If the user doesn't confirm, silently exit.
You may display the message using either a ... |
I know, the title cracks you up
Given an amount of money, output the fewest number of coins that make up that amount.
Examples
0.1
1 dime
0.01
1 penny
0.28
1 quarter 3 penny
0.56
2 quarter 1 nickel 1 penny
1.43
5 quarter 1 dime 1 nickel 3 penny
Spec
100 cents in a dollar.
The values of each type of coin is:
pe... |
Write a script that writes to standard output, or your language's equivalent, 100 lines of (valid) Java code that begins with:
class Tuple1 {public Object _0;}
class Tuple2 {public Object _0,_1;}
class Tuple3 {public Object _0,_1,_2;}
class Tuple4 {public Object _0,_1,_2,_3;}
class Tuple5 {public Object _0,_1,_2,_3,_4;... |
Subleq is a programming language with only one instruction. Each instruction contains 3 parameters. Code and data space is the same. How it works:
A B C
A, B and C are signed ints. Instructions are executed in the next way:
*B = *B - *A
if(*B <= 0) goto C;
One post is one tip. Write your tips for Subleq here!
Online ... |
Introduction
Finally the movie company is financing your film. They have given you a maximum budget and they also set the running time of your movie.
Now you can start with the pre-production. You have a bunch of scenes already planned, but not all of them will fit into the budget and the film would get way too long as... |
Your boss wants you to write code like this:
public static boolean isPowerOfTen(long input) {
return
input == 1L
|| input == 10L
|| input == 100L
|| input == 1000L
|| input == 10000L
|| input == 100000L
|| input == 1000000L
|| input == 10000000L
|| input == 100000000L
|| input == 1000000000L
|... |
Jelly is a tacit, golf-oriented programming language by our very own Dennis. It’s popping up in answers here more and more often, beating other golf-y languages like Pyth and CJam, both by using its own code page and its powerful chain system to succinctly express programs.
Let’s collect some useful tips for golfing in... |
Introduction
Here in Germany the ruling on work times is very strict. If you work 6 or more hours a day, you have to take at least a 30 minute break. If you work 9 or more hours, you need to take a 45 minute break. If you work less than 6 hours, you don't have to take any breaks.
Of course you can split those breaks, ... |
While idly twisting my Rubik's cube around, my son noticed that it kept going back to the solved state. I'm pretty sure he thought this was some sort of voodoo magic at first, but I explained that if you keep repeating the same sequence of moves, it will always return to its original state. Eventually.
Of course, being... |
A "rhyme scheme" is a string of letters a to z, such that the first occurrences of the characters are in ascending order (without gaps), starting from a. For example (with first occurrences marked):
abccdbebdcfa
^^^ ^ ^ ^
The number of rhyme schemes of length N is given by the Bell numbers B(N). (OEIS A000110)
The C... |
Introduction
Let's observe the following sequence (non-negative integers):
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ...
For example, let's take the first three numbers. These are 0, 1, 2. The numbers used in this sequence can be ordered in six different ways:
012 120
021 201
102 210
So, let's say that ... |
The Collatz Sequence (also called the 3x + 1 problem) is where you start with any positive integer, for this example we will use 10, and apply this set of steps to it:
if n is even:
Divide it by 2
if n is odd:
Multiply it by 3 and add 1
repeat until n = 1
10 is even, so we divide by 2 to get 5. 5 is odd, so we... |
Given an input of a Pig,
SickPig,
DeadPig,
QuinePig, or
DeafPig program, choose one of those
"languages" randomly and interpret the input as that "language."
First, randomly choose between one of the five members of the "Pig series":
Pig
If the choice was Pig, mimic the reference
interpreter by doing the following:
F... |
I've recently realized how vim works great for golfing, especially for kolmogorov-complexity. Also, according to meta vim is a perfectly acceptable 'programming language' at least, for the scope of this site, that is.
What general tips do you have for golfing in Vim? I'm looking for ideas which can be applied to code-g... |
Write some code that takes a single non-negative integer \$n\$ and outputs the \$n\$th power of phi (\$\phi\$, the Golden Ratio, approximately 1.61803398874989) with the same number of decimal digits as the \$n\$th Fibonacci number.
Your code must produce the correct sequence of digits for all inputs up to at least 10 ... |
This is a problem from NCPC 2005. Roy has
an apartment with only one single electrical outlet, but he has a bunch of power strips.
Compute the maximum number of outlets he can have using the power strips he
has. The number of outlets per power strip is given as input.
It turns out that if the number of outlets of the... |
Your should write a program or function that determines the language of a given word.
The task is to recognize some of the 5000 most common words in 4 languages:
English
German
Italian
Hungarian
The word lists can be found in this GitHub repository.
You are allowed to make mistakes in 40% of the provided test cases. ... |
Saw this in a PHP challenge. The objective is to make a chessboard with 64 squares (8*8) with the minimum amount of code.
Simple enough, I made mine in PHP in 356 bytes (not impressive, I know) and I would like to see some other aproaches.
This can be made in a language of your choice, as long as you keep it vanilla, s... |
As we all know, meta is overflowing with complaints about scoring code-golf between languages (yes, each word is a separate link, and these may be just the tip of the iceberg).
With so much jealousy towards those who actually bothered to look up the Pyth documentation, I thought it would be nice to have a little bit mo... |
Given four RGB LEDs and 8 colors, your task is to light up each LED in order with a color, and cycle through the LEDs as you cycle through the colors; with only one LED lit up at a time.
So for 8 colors across 4 RGB LEDs, it would look like this (at a hardware level (since there are three channels for each LED)):
LED1 ... |
For each row and then column of a matrix, we can add an extra entry with the sum of the last two entries in that row or column. For example with the following input matrix:
[ 1 1 1 ]
[ 2 3 4 ]
The resulting matrix would be:
[ 1 1 1 2 ]
[ 2 3 4 7 ]
[ 3 4 5 9 ]
Given an input of an integer N and an [X,Y] matrix of siz... |
Background
I have a row of powerful magnets and a bunch of metal objects between them.
Where will the magnets pull them?
Input
Your input is an array of non-negative integers, which will contain at least one 1.
You can use any reasonable format.
The 0s of the array represent empty space, and the 1s represent fixed magn... |
Write a program or function that takes in a positive integer N. Output a list of all the distinct decimal numbers that can be written in exactly N characters using digits (0123456789), decimal points (.), and negative signs (-).
For example, some numbers that would be in the N = 4 output list are 1337, 3.14, .999, -789... |
The Task
The task is very simple. Given an array containing only integers and strings, output the largest number and the smallest number.
Test Cases
Input: [1, 2, 3, 4, 5, 6, 7, 8]
Output: 1, 8
Input: [5, 4, 2, 9, 1, 10, 5]
Output: 1, 10
Input: [7, 8, 10, "Hello", 5, 5]
Output: 5, 10
Numbers in strings are not consi... |
Problem
One day, you boss walks up to you and tells you he needs to know the time. He still insists after you pointing at the clock directly above your head, and confesses he has a severe case of dyscalculia, which causes him to not even be able to see numbers on a clock. While you're still left wondering how someone u... |
Leonardo da Pisano a.k.a Fibonacci was instrumental in bringing the Hindu-Arabic numeral system into Europe. Before that, mathematicians there worked in base sixty with Roman numerals.
For example, the square root of two might be approximated as: one and twenty-four parts of sixty and fifty-one parts of three-thousand-... |
Your task is to find the length of the coastline of a map of islands provided in
an ASCII map. The input map will consist of 1 or more # characters that
indicate land, and spaces which indicate water. The coastline is considered to
be any edge between land and water, including inland lakes and islands.
Your solution sh... |
Given an input of a single positive integer, output the "cross-alternate sum"
that corresponds to that integer.
Take the example of the input n=5. To find the cross-alternate sum, first
create a square grid of width and height n that, reading from left to right
and top to bottom, starts at 1 and increases by one each p... |
Isn't it annoying when you're working with floating point numbers and your code doesn't work because two numbers are not equal by the least significant bit? Now you can fix that!
Write some code that takes two floating point numbers in any IEEE 754 binary format and returns TRUE if:
the two numbers are exactly equal
f... |
The other day my chemistry teacher was explaining to us about scientific notation (using a small number and multiplying it by powers of ten to express large numbers more easily), which brought me back a few years to when I first learnt it. After learning the basics, we had done a bunch of typical maths questions, some ... |
Wouldn't it be neat if programming functions could be inverted, just like the mathematical function they implement?
Write a function (or program) that takes one input x in any form, that outputs ln(x).
When the bytes of the program are reordered/reversed so that the first byte now is the last byte, it should take one ... |
This challenge is inspired by this other.
The challenge
Write a program or a function in any programming language that given as input a string representing a time in English (see below, for further details) it outputs or prints the equivalent in the 24 hours "digital" format HH:MM.
Shortest code in bytes wins, standard... |
I have a chocolate bar and I need help eating it so you'll be writing a program just to do that.
Explanation
The first line is the input. Examples are separated by an empty line.
7
____
__|__|
|__|__|
|__|__|
|__|__|
6
_______
|__|__|
|__|__|
|__|__|
5
____
__|__|
|__|__|
|__|__|
0
1
____
|__|
Spec
... |
In trigonometry, there are certain angles known as "special angles". This is because when you take sin, cos or tan of one of these angles, you get a result that is easy to remember because it is a square root of a rational number. These special angles are always multiples of either pi/6, or pi/4. Here is a visualizatio... |
You are to approximate the value of:
$$\int^I_0 \frac {e^x} {x^x} dx$$
Where your input is \$I\$.
Rules
You may not use any built-in integral functions.
You may not use any built-in infinite summation functions.
Your code must execute in a reasonable amount of time ( < 20 seconds on my machine)
You may assume that inp... |
Implement a function diff that takes as input three integers x, y, and z. It should return whether subtracting one of these numbers from another gives the third.
Test cases:
diff(5, 3, 2) yields True because 5 - 3 = 2
diff(2, 3, 5) yields True because 5 - 3 = 2
diff(2, 5, 3) yields True because 5 - 3 = 2
diff(-2, 3, 5)... |
Kirchhoff's law says that when you sum up all the currents (positive for the currents going to a junction, and negative for current leaving a junction), you will always get as result 0.
Look at the following diagram:
Using Kirchhoff's law, you can see that i1 + i4 - i2 - i3 = 0, so i1 + i4 = i2 + i3.
Given two lists, ... |
I like making dank memes out of my own images. But all those so called "quick meme" sites just have too much code. I realized that the only way to make the dankest meme generator is to ask you guys at PPCG to golf one for me. So let me give you the low down on what you have to do.
Specs
Take an image as input as a fil... |
The American football championship, Super Bowl 50, is happening today at 11:30pm UTC (and you can watch it live online). This challenge was made to celebrate it.
In an American football game, two teams compete to get the most points and there are six ways to score these points. We'll give each an abbreviation:
Field ... |
You are given a single printable ASCII string containing no newlines, and a multiline "mold", containing spaces (), and hashes (#).
You must go character by character in the string, and replace hashes using the characters from the string in left-right, top-bottom order. If the string is too short to fill the mold, you ... |
Challenge
Inspired by this SMBC comic, discussed on reddit, math.stackexchange, and calculus7, the challenge is to return the lowest base such that a number is "fouriest."
Description
[From the comic]
"It's called a Fourier Transform when you take a number and convert it to the base system where it has more fours, thu... |
The keypad on my office phone has the following layout:
[1] [2] [3]
/.@ ABC DEF
[4] [5] [6]
GHI JKL MNO
[7] [8] [9]
PQRS TUV WXYZ
[*] [0] [#]
+ _
Task:
Write a program that, given an input string, returns a list of instructions that my fingers need to follow in order the type/dial the message/number... |
Background
Most everyone is familiar with the Fibonacci numbers \$F(n)\$:
\$0, 1, 1, 2, 3, 5, 8, 13, 21, ...\$
These are formed by the recursion function \$F(n) = F(n-1) + F(n-2)\$ with \$F(0)=0\$ and \$F(1)=1\$. A000045
A closely related sequence is the Lucas numbers \$L(m)\$:
\$2, 1, 3, 4, 7, 11, 18, 29, ...\$
Th... |
Given two inputs, a string \$s\$ and a decimal number \$n\$, output the string multiplied by that number.
The catch is that the number can be a float or an integer.
You should output the string \$\lfloor n \rfloor\$ times and then the first \$\lfloor (n - \lfloor n \rfloor) \cdot |\,s\,|)\rfloor\$ characters again.
Oth... |
Given an input of a string representing a function definition, output the
string with newlines and spaces inserted so that the function's arguments are
newline-separated and aligned.
The input string will follow the following pattern:
First, it will start with a prefix, which is always at least one character
long and ... |
The Enigma machine is a fairly complex cipher machine used by the Germans and others to encrypt their messages. It is your job to implement this machine*.
Step 1, Rotation
Our enigma machine has 3 slots for rotors, and 5 available rotors for each of these slots. Each rotor has 26 different possible positions (from A t... |
One way to construct a regular heptadecagon starts with drawing a horizontal line of length 1 from the center to a vertex. Then the distance along that line from the center to the second vertex is cos(2π/17). All other vertices are easy to get.
The goal of this challenge is to print (or produce in any other conventiona... |
Suppose you have 2 languages, A and B. A string s is a semiquine in A and B if it satisfies the following conditions:
s is a quine in language A.
s is a polyglot in A and B.
The output of running s as a B program is a different string s', which is a quine in B.
The goal of this challenge is to write a semiquine in tw... |
A Norwegian Birth Number consists of 11 digits, composed the following way:
DDMMYYiiikk
DD is the day (from 01-31)
MM is the month (from 01-12)
YY is the year (from 00-99). It's not differentiated between 1900 and 2000
iii is the "individual number"
kk are two control digits
iii is determined by birthyear and gender... |
A simple challenge for your Monday evening (well, or Tuesday morning in the other half of the world...)
You're given as input a nested, potentially ragged array of positive integers:
[1, [[2, 3, [[4], 5], 6, [7, 8]], 9, [10, [[[11]]]], 12, 13], 14]
Your task is to determine its depth, which is the greatest nesting-dep... |
Write a square root function taking a single input – positive, negative or sign‑less (zero is sign‑less) – that outputs its approximate principal square root, correct up to six decimal places past the decimal point (truncate after the sixth decimal place).
Employing scientific notation (1E3 = 1 × 10³ = 100) or similar ... |
Challenge
Your submission should consist of 2 or more programs each written in distinct languages. They can be arbitrarily numbered from 1 to k.
Each program p, given a natural number n should print the next n prime numbers (initially, the next prime is the 0-th prime, 2) on a single line, followed by a single blank n... |
You should write a program or function that given a list of positive integers multiplies each element with the smallest positive integer possible to create a strictly increasing list.
For example if the input is
5 4 12 1 3
the multiplications will be
5*1=5 4*2=8 12*1=12 1*13=13 3*5=15
and the output will be the incre... |
The van der Corput sequence is one of the simplest example of low-discrepancy sequence. Its n-th term is just 0.(n written in base 10 and mirrored), so its first terms are :
0.1, 0.2,0.3,0.4, 0.5,0.6,0.7, 0.8,0.9,
0.01, 0.11,0.21,0.31, 0.41,0.51,0.61, 0.71,0.81,0.91,
0.02, 0.12,0.22,0.32, 0.42,0.52,0.62, 0.72,0.82,0.92... |
The determinant of a 2 by 2 matrix
a b
c d
is given by ad - bc.
Given a matrix of digits with dimensions 2n by 2n, n ≥ 1, output the result obtained by recursively computing the determinant of each 2 by 2 sub-block until we reach a single number.
For example, given the input
3 1 4 1
5 9 2 6
5 3 5 8
9 7 9 3
After one ... |
Introduction
Note: this is not some kind of method to encourage cheating. As Cᴏɴᴏʀ O'Bʀɪᴇɴ already said, studying is the best solution for passing a test :3.
Consider the following answers to the multiple choice test:
ABCBCAAB
Here is a table which indicates whether the answers match:
A B C B C A A B
A 1 0 0 0 ... |
Football is the sport where players kick the ball, not carry it. Some confused individuals might call this soccer.
A football team has one goalkeeper, and 10 players out on the pitch. There are many formations used in football, that dictates where each player should be (the player of course moves around, but it's the ... |
The task
This challenge is very simple.
Your input is a rectangular 2D array of integers, sized at least 1×1.
It can be taken in any reasonable format.
Your output shall be the input array, but with all entries not on the first or last row or column set to 0.
It must be in the same format as the input.
For example, if ... |
I'm pretty sure there's not a better way to do this but figured it couldn't hurt to ask.
I'm tired of typing out a='abcdefghijklmnopqrstuvwxyz'.
Cool languages have Range('a'..'z') or similar
What can we come up with with JS that's as short as possible??
for(i=97,a='';i<123;){a+=String.fromCharCode(i++)}
is longer tha... |
What general tips do you have for golfing in Retina? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Retina (e.g. "remove comments" is not an answer). Please post one tip per answer.
For reference, the online compiler is here.
@Sp3000 pointed out there i... |
A couple months ago, we had a discussion on meta about increasing the reputation awarded for upvotes on questions. Here's the basics of our current reputation system for votes:1
A question upvote U is worth 5 reputation.
An answer upvote u is worth 10 reputation.
A question or answer downvote d is worth -2 reputation.... |
While there are only a few users of the Vitsy programming language right now, I wish to create a place for tips for golfing in Vitsy.
What general tips do you have for golfing in Vitsy? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Vitsy (e.g. "remove ... |
Inspired by this. No avocados were harmed in the making of this challenge.
Hello I have challenge I need help juic an avocado so I need program to tell me how long to juic avocad for
Observe this ASCII art avocado:
######
# #
# #### #
# # p# #
## #### #
# #
######
This avocado consists... |
Given an image of a goat, your program should best try to identify whether the goat is upside down, or not.
Examples
These are examples of what the input may be. Not actual inputs
Input:
Output:
Downgoat
Spec
Your program should be at most 30,000 bytes
The input will contain the full goat
The picture will always cont... |
The Champernowne Constant is the irrational number 0.1234567891011... extending ad infinum.
We've done a question about it before. But this question is about its reciprocal, known as the Inverse Champernowne Constant. This is approximately 8.10000007.
Given a string of between one and three digits (every 3-digit stri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.