instruction stringlengths 34 53.1k |
|---|
Challenge
Given the Cartesian coordinates of two or more distinct points in Euclidean n-space (\$\mathbb{R}^n\$), output the minimum dimension of a flat (affine) subspace that contains those points, that is 1 for a line, 2 for a plane, and so on.
For example, in 3-space (the 3-dimensional world we live in), there are a... |
Background
As you maybe know Ramanujan made this magic square by \$4x4\$ Matrix:
This works like all magic squares.
But the special thing in this square is that his birthdate is hidden in the first row, the 22\$^{nd}\$ Dec 1887.
Challenge
Can you make one for your birthdate?
Input
The User will give Input in this form... |
Our boolean operators are AND, OR, XOR, NAND, NOR, XNOR and, in conjunction with one of those operators, NOT.
Our numbers are \$1\$ and \$0\$.
The challenge is to write a program or function that calculates the results of the input.
Input
A string, array or other input format of your choice; containing alternating numb... |
Sandbox
Many of us have seen math problems where a shape made of unit cubes is dipped in paint, and the answer is the number of painted sides. We'll generalize that problem in this challenge.
Input
A 3-dimensional matrix of 0s and 1s.
Output
A non-negative integer
Challenge
Given a n by m by k matrix of 0s and 1s, we c... |
Sequel to Verify Tents and Trees solution.
Background
Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically adjacent to each of the trees, so that no two tents touch each other in 8 directions (horizontally, vertically, and diag... |
Background
Peter's Father, the Teacher of a dance-club, asks Peter a question:
Given are two natural numbers (\$\mathbb{N}\$ \$x\$ and \$y\$).
\$x\$ is the number of the garment types (e.g. shorts, shirts\$\dots\$) we have
\$y\$ is number of colors (e.g. green, blue, \$\dots\$) of each garment we have.
In the dance cla... |
When encountering a problem whose input is meant to be read sequentially, but you may also want to push back onto the input like a stack, which languages have the optimal boilerplates for doing so, and how?
For example, from Create a Boolean Calculator, we have a string like:
1AND0OR1XOR1
We want to "pop" 5 chars 1AND... |
Background
In the sport of Table Tennis (aka Ping-Pong or Whiff Whaff), two opponents play a sequence of rounds, where each round consists of players hitting a ball back and forth until one player (may or may not be the server) gains a point.
Table Tennis has some official rules that make for a good game, but we will u... |
My phone number (which I will not be sharing here) has a neat property where there is a two digit number, which when iteratively removed from my phone number will eventually remove all the digits. For example if my phone number were
abaababbab
Then by repeatedly removing ab we would eventually get nothing (I encluse ... |
Objective
Given a matrix of connected box drawing characters, count its genus, the number of plane sections it encloses.
Valid input
The box drawing characters are ─│┌┐└┘├┤┬┴┼╴╵╶╷ (U+2500 U+2502 U+250C U+2510 U+2514 U+2518 U+251C U+2524 U+252C U+2534 U+253C U+2574 U+2575 U+2576 U+2577). The matrix shall contain these c... |
Given two strings as input, return the result of XORing the code-points of one string against the code points of the other.
For each character in the first input string, take the code-point (e.g. for A, this is 65) and XOR the value against the corresponding index in the second string and output the character at the co... |
Let's begin with a thought experiment. You have a clock and a timer, in which you start the timer when the clock shows exactly hh:mm.00.
Clock: The clock employs 24-hour time. So the range of hh is 0<=h<23. (Because 23 inputs are unsolvable, you aren't required to handle that)
Timer: It starts exactly on 00.00. The nu... |
As it turns out, Python allows for 1j for to be compressed to 1jfor. However, jfor sounds like xnor. Since all similar-phonic phrases have something in common, there must be some property shared between jfor and xnor.
If we look at the ASCII representation of the first two characters of jfor in binary, we see:
j: 110... |
Ah, Tinder . . . the app that takes the code golf approach to online dating. With just a few well-chosen right swipes and a bit of luck (or a cute puppy pic), you too could have more matches than /(?!)/.
This code-golf challenge involves Tinder dates of a very different kind. Given a Tinder version number as input, hoo... |
Objective
Given a vertex figure consisting of regular convex polygons, determine whether it represents a convex uniform polyhedron.
What is a uniform polyhedron?
A uniform polyhedron is a polyhedron whose faces are regular polygons, while having the same vertex figure for each vertices. Generally a uniform polyhedron c... |
Inspired by this
Task
Your task is to output the average character of your code.
What is an average character?
Say we have a string golf().
We then take the ASCII value of each separate symbol, so our string is 103 111 108 102 40 41, and calculate the average of those values, rounded to an integer. In our case the aver... |
Background
In Minesweeper, you will often encounter a horizontal or vertical wall of one's and two's (not yet revealed cells are marked as ?):
... 1 1 1 1 2 2 2 1 2 1 1 ...
... ? ? ? ? ? ? ? ? ? ? ? ...
... A B C D E F G H ...
It is equivalent to a problem of recovering zeros and ones in a boolean array when only wind... |
Imagine a grid where the origin square \$(0,0)\$ is at the top left of the screen, and positive \$x\$ is rightwards whereas positive \$y\$ is downwards. Coloured squares are at various positions on the grid.
In a magical void separate from the grid are multiple snake-like strips of squares, each of a fixed length and a... |
Introduction
This problem is a challenge that has to do with DOM manipulation at scale and overcoming some issues that may be inherent in dealing with the DOM.
This challenge is interesting because limitations push us to think through things differently and lean on the strengths of languages different than what we usu... |
Background
A magic square is an n×n matrix consisting of one of each of the integers from \$1\$ to \$n^2\$ where every row, column, and diagonal sum to the same value. For example, a 3×3 magic square is as follows:
4 9 2
3 5 7
8 1 6
Here, each row, column, and diagonal sum to the magic sum of 15, which can be calculat... |
Background
Sometimes in calculus you're expected to calculate the sum of an infinite series. Sometimes these series are very friendly, like a geometric series, but add anything else onto it and it can quickly get complicated to solve by hand.
Sometimes I like to be lazy - a lot of sums can be found simply by adding the... |
The Cantor function is continuous everywhere and constant almost everywhere, but has an average slope of 1:
The function can be found recursively:
\$f_0(x)=x\$
\$f_{n+1}(x)=\left\{\begin{matrix}\frac{1}{2}f_n(3x)&x\in[0,\frac{1}{3})\\ \frac{1}{2}&x\in[\frac{1}{3},\frac{2}{3})\\ \frac{1}{2}+\frac{1}{2}f_n(3x-2)&x\in[\f... |
The task is to to compete for the shortest regex (in bytes) in your preferred programming language which can distinguish between English and Spanish with minimum 60% 90% accuracy.
Silvio Mayolo's submission (pinned as Best Answer) has secured his spot as the winner of original contest against any chance of being contes... |
Introduction:
Inspired by the Puzzling-stackexchange post with the same name, which I've answered four years ago:
Can you create a perfectly valid English sentence, which makes perfect sense, but which contains the word "and" in it, five times consecutively in a row ?
"Something-or-other and and and and and something-... |
Background
Milking the deck is the name given to the following card shuffling method:
'Pinch' the deck to remove the top and bottom cards simultaneously. (With lots of imagination, this action resembles milking a cow.) This pair of cards forms the base of a new pile.
Repeat, adding each pair of cards to the top of the... |
A superpermutation on n symbols is a string which contains every permutation of n symbols in its body. For instance, 123121321 is a superpermutation on three symbols because it contains 123, 132, 213, 231, 312 and 321 as substrings.
The Challenge
Given a string composed of n unique symbols (and, optionally, n), output ... |
Since this is a answer-chaining challenge, you might want to sort answers by oldest.
Your task is simple: Choose any printable ASCII character that's not chosen in the previous answers. And then, you need to print your chosen character in your program to standard output. (You can ONLY print your chosen character, with... |
A ripoff of this challenge. Go upvote it!
Objective
Given a rational number amongst \$[0,1]\$, apply the Cantor function to it and output the rational number that's produced.
The Cantor function
The Cantor function is continuous everywhere and constant almost everywhere, but has an average slope of 1:
The Cantor funct... |
This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here
A pretty common beginner style question is to print some string, but there's a catch! You need to do it without using any of the characters in the string itself!
For this challenge, we will find out who is the best at printi... |
This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here
A pretty common beginner style question is to print some string, but, there's a catch!, you need to do it without using any of the characters in the string itself!
For this challenge we will find out who is the best at prin... |
Related puzzle: Pathfinder (available on Puzzle Picnic)
Background
A robot is standing on a cell of a rectangular grid, where each cell has one or more gems except for the one with the robot. The robot can move to a horizontally or vertically adjacent cell in one step, and it picks up one gem from the cell it steps on.... |
In this question at Code Review they tried to find the fastest way to return the unique element in an array where all the elements are the same except one. But what is the shortest code that accomplish the same thing?
Goal
Find the unique element in an array and return it.
Rules
The input array will contain only integ... |
Task
Given a matrix, your program/function should output a row-equivalent matrix in checkerboard form ( \$A_{ij}=0\$ if and only if \$i+j\$ is odd).
Two matrices are defined to be row-equivalent if and only if one can be obtained from the other by a sequence of elementary row operations (EROs), where each ERO consists ... |
Background
I feel that for a site named code-golf we have a shockingly little amount of golf being played. Let's fix that.
Challenge
Determine whether the hole of a minigolf course can be reached after exactly a certain number of movements and whether it can be reached at all.
How to play
Inputs are an integer "power l... |
Summary
Videos which are sped up every time a particular word is said exist for everything from the Bee Movie to the classic Rick Roll. The goal for this challenge is to figure out how much you'd have to slow down the sped-up video in order to match the duration of the original video.
For example, the original Bee Movi... |
Background
A linear recurrence relation is a description of a sequence, defined as one or more initial terms and a linear formula on last \$k\$ terms to calculate the next term. (For the sake of simplicity, we only consider homogeneous relations, i.e. the ones without a constant term in the formula.)
A formal definitio... |
Legendre's Conjecture is an unproven statement regarding the distribution of prime numbers; it asserts there is at least one prime number in the interval \$(n^2,(n+1)^2)\$ for all natural \$n\$.
The Challenge
Make a program which only halts if Legendre's conjecture is false. Equivalently, the program will halt if there... |
There are two types of people in this world: users and admins. Let's find out who the real admins are.
The task is simple:
If the script is run with elevation, print 'True' and only 'True' (only trailing newlines permitted as extra). If the script is run as an unelevated user, print 'False' and only 'False', exceptions... |
Paper Folding for the win
"How many times can you fold a paper?" - This well known question led to many arguments, competition, myths and theories.
Well, the answer to that question depends on many properties of the paper (length, strength, thickness, etc...).
In this challenge we will try to fold a piece of paper as ... |
I am looking for a more efficient way of computing the following.
Let A and B be two vectors of non-negative integers of length a and b.
Let A0 and B0 be the padded versions of A and B, so that we pad the vectors by 0, until their lengths are a+b.
We now want to compute sort(A0 + pB0) where pB0 ranges over all distinct... |
Shift Tac Toe
Shift Tac Toe is a game that combines Tic Tac Toe and Connect 4 together. In this game, you start with a 3 by 3 board, and each row is connected to a slider that you can move left and right. At the start, the sliders all start to the very right(this means that you can't move the slider to the right on the... |
Task
Take the (integer) number of human years that the dog has lived, \$n\$, as input and return its age in dog years, \$d\$, to two decimal places.
The number of human years, \$n\$, will be between \$1\$ and \$122\$ inclusive: \$n \in [1,122], n \in \Bbb{N}\$.
According to BBC's Science Focus Magazine, the correct fun... |
I think everyone is familiar with the game of snakes & ladders1. Imagine we have a 10x10 board like this:
=============================================================
| | | | | | | | | | |
| 100 | 99 | 98 | 97 | 96 | 95 | 94 | 93 | 92 | 91 |
------+-----+-----+-----+---... |
A matrix is antisymmetric, or skew-symmetric, if its transpose equals its negative.
The transpose of a matrix can be obtained by reflecting its elements across the main diagonal. Examples of transpositions can be seen here:
\$\begin{pmatrix}11&12&13\\21&22&23\end{pmatrix}\rightarrow\begin{pmatrix}11&21\\12&22\\13&23\en... |
Draw an ASCII-art rainbow!
Input
An integer between 0 and 1000, inclusive.
Examples
Input 0:
/\
||
Input 1:
_
/ \
| |
Input 2:
__
/ \
| |
Input 3:
___
/ \
| |
The first row is a space followed by n underscores.
The second row is a slash followed by n spaces, and a backslash.
The third row is a pipe follow... |
Write a cat program, a quine, and a Hello World in the same language such that when two specific programs of the three are concatenated in a certain order, you get the third program. It does not matter which program is the first, second, and third are as long as all three types are represented once each.
e.g. if \$A\$ ... |
Thin Paper Folding
This is a "lighter" version of the challenge Paper Folding for the win. This challenge is being posted as a different challenge with many modifications in order to try and get wider range of interesting answers.
For anyone who is answering the first challenge, I marked the changes with bold (also no... |
Challenge
We once had a challenge to count domino tilings of m by n grid, and we all know that, for any fixed number of rows, the number of domino tilings by columns forms a linear recurrence. Then why not have a challenge to compute the linear recurrence?!
Let's define \$D_m(n)\$ as the number of domino tilings on a g... |
Given a directed network, with a single source and a single sink, it is possible to find the maximum flow through this network, from source to sink. For example, take the below network, \$G\$:
Here, the source is node 0 and the sink 5. We can see, from the minimum cut-maximum flow theorem, that the maximum flow throu... |
Inspired by this Puzzling challenge.
Challenge
Given a 2D rectangular grid where each cell is either an empty space or a wall, find the path (or one of the paths) from the top left cell to the bottom right, which satisfies the following:
Only movement to one of four adjacent cells is allowed.
The path breaks (or passe... |
Description
Count how many occurrences there are of the digit 1 between two given numbers \$[a, b]\$, inclusive.
For example, from 1 to 100 it should be 21:
1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 31, 41, 51, 61, 71, 81, 91, 100
The number 1 is repeated 21 times.
Rules
Each number in the input list is guarant... |
I was doing the bandit wargame from overthewire.org and because I am a script kiddie, I googled the answer for level 24.
password="UoMYTrfrBFHyQXmg6gzctqAwOmw1IohZ"
for i in {0000..9999}
//looping to try any possible pin code
do
echo $password' '$i >> wordlist.txt
//save password and possible pin code into wordlist
... |
RollerCoaster Tycoon 2's maze is the inspiration for this question. Credit to Marcel Vos for thoroughly breaking the classic RCT2 AI. The pathfinding AI in this question is the AI in the latest version of OpenRCT2 at the time of writing, which was updated in response to that video.
Suppose a guest enters a \$w \times... |
Introduction
Programmers have already solved the trolley problem (a classical problem in philosophy). In the usual trolley problem, we have a directed graph and each edge is weighted by the number of people tied to the track (edge). The objective of the usual trolley problem is to find a path through the graph that min... |
The challenge.
Make a program that produces a random series of 8 notes in the scale of E minor, and then harmonizes them.
Details.
Notes must be represented in output as a 1-2 char string, which designates the note and if it is sharped or not, followed by a number, which designates the octave. Examples would be C3, D#... |
This is a rock paper scissors competition. Algorithms will face each other in 100 rounds of rock paper scissors. Except that the algorithms will also be able to read the source code of each other!
Leaderboard
1. Chaos Bot (by Aiden4) - 27 Points, 168 bytes
2. Anti-99%-of-posts (by Lyxal) - 24 Points, 489 bytes
3. Psued... |
What is the shortest way to secure a site with Javascript?
I am new to Code Golfing, and this is what I've come up with so far. I bet that this could be improved though:
Challenge:
Make a script which redirects http:// to https:// with the least bytes of code
Attempts:
Original code (150ish BYTES!):
if (window.locati... |
The sequence discussed in this challenge is a variant of the Descending Dungeons sequence family. Specifically, the sequence generation rules:
(A_b = A's base 10 representation read as a base b number, A = A_10)
A(0) = 10
A(n) = 10_(11_(12_(...(n+9)_(n+10))))
Your goal is to make a program which accepts a nonnegative ... |
You are James and four of your friends (Bjarne, Eich, Rossum, Ada) are called for an interview. There are n interviewers, and they can each serve one person at a time, alphabetically. Each round of interview takes 20 min.
Let's take n = 2,
So, the first round started with Ada and Bjarne, takes 20 min (they're handle... |
The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of words in the string. In this case, output is 5, as it's the most often length of words in the string.
Definition of an alphabetical word (for this challenge): a string th... |
Source Code Byte Frequency
Write a program that get a single byte character as an input and prints the frequency of that byte in the program's source code as an output.
Examples:
Assuming my program is: ab#cd%b then the output of the program should be (each line is a separate execution):
input output
----- ... |
This is a challenge to write bots to play the 1st and 2nd players in the following simple poker game.
Rules of the poker game
There are two players, A and B. Each antes $10 into the pot, and is dealt a card, which is a real number in the range [0, 1).
Player A goes first, and may pass or bet. If A passes, then there is... |
Inspired by this Puzzling challenge, and easier version of my previous challenge.
Challenge
A 2D rectangular grid is given, where each cell is either an empty space or a wall. You start at the top left cell, and you need to exit through the bottom right cell. You can move to one of four adjacent cells in one step.
You ... |
You probably know the game mastermind:
The player tries to guess a code of 4 slots, with 8 possible colors - no duplicates this time.
Let's call those colors A through H, so possible solutions could be ABCD or BCHD.
Each time you place a guess, the game master will respond with two information: how many slots you got r... |
Put simply, you are to print out the following number:
0202020100110020122120012121100120121020202100012110002002010110211221012021112010200012112021220120022222102211121110110201220020202001111212210010100222100112101201122100222120201002002020200011110002211002202100022210212020112002020000120222111121112002112101000... |
Create a program that can be run in 4 different languages such that:
One language prints "Hello World!"
One language outputs its own source code
One language outputs 99 bottles of beer on the wall, that is:
99 bottles of beer on the wall
99 bottles of beer
Take one down, pass it around
98 bottles of beer on the wall
... |
I'm letting this one out of the sandbox. Hopefully it is well-written and make sense, feel free to improve.
So in order to make 1+ more popular (and ease the creation of golfed 1+ text-printing programs) here comes the metagolf challenge:
The 1+ Language
1+ is a fun deque-based esolang where 1 is the only literal, and ... |
Write the shortest possible program to remove all partial matched duplicates from a list and only retain the longest lines. Sort order does not matter.
For following inputs, the intent is to search for the string reminder followed by a number and retain the longest unique reminder + number lines.
Some rules
reminder i... |
Given a positive number n, rotate its base-10 digits m positions rightward. That is, output the result of m steps of moving the last digit to the start. The rotation count m will be a non-negative integer.
You should remove leading zeroes in the final result, but not in any of the intermediate steps. For example, for t... |
Given a distance in meters as an integer \$60\le d \le 260\$, return the number of clubs that may be used according to the following arbitrary chart, where both \$min\$ and \$max\$ are inclusive:
club | min | max
----------------+-----+-----
Driver | 200 | 260
3-wood | 180 | 235
5-wood ... |
The TV series "Breaking Bad" replaced the letters Br and Ba with a periodic-table like representation, printing [Br35]eaking [Ba56]d.
Create a program that takes a string input, does a replacement and prints an output.
The replacement shall subsidize any substring that matches an element symbol with the notation demons... |
Let me explain one by one the above terms...
We will call \$\text{Z-Factorial}(n)\$ of a positive integer \$n\$, \$n!\$ (i.e. \$n\$ factorial) without any trailing zeros.
So, \$\text{Z-Factorial}(30)\$ is \$26525285981219105863630848\$ because \$30!=265252859812191058636308480000000\$
We will call Modified Z-Factorial ... |
You've inherited a server that runs several apps which all output to the same log.
Your task is to de-interleave the lines of the log file by source. Fortunately, each line begins with a tag that indicates which app it is from.
Logs
Each line will look something like this:
[app_name] Something horrible happened!
App ... |
As TIO can show, every letter of the Latin alphabet is represented when it comes to languages. For every letter there is at least 1 programming language whose name begins with that letter. Your task is to create a polyglot in order to demonstrate that.
Your program should be runnable in between 2 and 26 different langu... |
Background
Tetris Grand Master 3 has a hidden grading system based on the shape of the stack at the end of the game, which is called Secret ">" Stacking Challenge. It consists of entirely filling the lowest rows except for the zigzag pattern which starts at the left bottom cell and spans the entire width:
#
.#########
... |
Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the Python language. We already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep within the python documentation.
So today I would like to ask y... |
Write three different programs such that when any one program is provided as input to one of the other two, you get the source of the remaining program as output. More explicitly, given programs \$A\$, \$B\$, and \$C\$, where \$f(g)\$ denotes the output obtained from inputting the text of program \$g\$ into program \$f... |
Write a quine which attempts to invert the case of as many ascii characters in the source code as possible. For example in javascript:
(x=function(y){return ('(x='+y+')(x)').toUpperCase();})(x)
Standard quine rules apply.
The score is given by number of bytes in the source code - number of case inversions. For examp... |
How do I remove all duplicates from list and order it based on count?
s = ["foo", "this", "lem", "foo", "lem"]
s = ["foo", "ebh", "wosv", "wosv", "ebh", "4whcu"]
#should return
>>> ["foo", "lem", "this"]
>>> ["ebh", "wosv", "foo", "4whcu"]
Rules:
Must be shorter than the below code in terms of byte size.
Order must b... |
CODE GOLF & Coding Challenges: In today's challenge, you'll be asked to print the following very special AND tricky AND satisfying Prime Number...! Are you golfers ready?
67796869327179767032383267111100105110103326710497108108101110103101115583273110321161111009712139115329910497108108101110103101443212111111739108108... |
The challenge:
Assuming you have \$ X \$ collections, each collection \$ C_i \$ has a name \$ N_i \$ and a capacity \$ N_i \$ of elements - Determine which collection will be overflowed first while counting the occurrences of the names in a cyclic list. Also print how many cycles of the list occurred.
Example:
4 Collec... |
Input
A bound m <= 4294967295.
Output
Consider values sampled uniformly at random from integers in the range 0 to m, inclusive.
Your output should be the expected (average) number of trailing zeros in the binary representation of the sampled value. Your answer should be exact, for example given as a fraction.
Example
... |
In the body of this challenge, \$\begin{pmatrix}n\\k\end{pmatrix}\$ is used to represent the number of combinations of \$k\$ elements of \$n\$, also written as \$\frac{n!}{k!(n-k)!}\$ or \$n\mathrm{C}r\$.
Any nonnegative integer \$m\$, for arbitrary natural (positive) \$r\$, can be written as a unique series of \$r\$ c... |
Let's just see how this goes
If you've ever listened to the radio program "I'm sorry, I haven't a clue", then you've probably heard of the game called "Mornington Crescent". For those who haven't, it's a game where players name random stations on the London Underground network. The first person to name "Mornington Cres... |
Write the shortest program that prints the sound my alarm clock makes, and stops after an inputted number of beeps.
For reference, here is the sound my alarm makes:
beep beep beep beep beep beepbeep beepbeep beepbeep beepbeep beepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeepbeep bee... |
Note
This is the decryption challenge. The encryption challenge can be found here.
Challenge
The challenge is to decrypt a given string, using the rules as specified below. The string will only contain lowercase alphabets, digits, and/or blank spaces. If you want to know how the input string has been encrypted, refer t... |
Number Splitting
Instructions
Oh no, my numbers have stuck together! Luckily, we can split them apart with code.
Your code should be a function that takes an integer input from stdin or as an argument. You must split the number into single digits, keeping the order and possible duplicates of these digits. The output sh... |
The challenge
Given point and a path of points, say whether or not the point is in the polygon that is created by the path.
Also return true if the point is on an edge of the polygon.
Input
A list of pairs of integers.
The first 2 integers represent the point.
The remaining pairs (3rd and 4th, 5th and 6th etc.) represe... |
The mean of a population \$(x_1,\dots,x_n)\$ is defined as \$\bar x=\frac1n\sum_{i=1}^n x_i\$. The (uncorrected) standard deviation of the population is defined as \$\sqrt{\frac1n\sum (x_i-\bar x)^2}\$. It measures how dispersed the population is: a large standard deviation indicates that the values are far apart; a lo... |
Your task here is to take a LifeOnTheEdge pattern and convert it to LifeOnTheSlope.
A LifeOnTheEdge pattern is composed of these four characters: |_L . A pattern corresponds to a certain arrangement of "on" edges in a square grid. The pattern is placed in the grid first with the characters in the cells, and each of the... |
In the face of some regrettable rules that turned the original into a glorified sorting task, I am posting a more challenging variant. Shout out to Luis Mendo for the suggestion of how to improve the original challenge.
You've inherited a server that runs several apps which all output to the same log.
Your task is to ... |
Challenge
Given an integer radius \$r \geq 0\$, write a program that prints each set of cartesian coordinates in a counter-clockwise spiral originating at \$(0, 0)\$ as shown here (for \$r = 3\$), with indices:
Input
The program should take \$r\$, a non-negative integer, as an input. The input is assumed to be valid a... |
This challenge has officially ended. Further submissions will not be competitive (but are still welcome!). View the scores here
In this challenge, submissions ("bots") should be Javascript functions which try to win as many races as possible. In each race, bots will have a limited amount of energy which should be use... |
Task
Given a non-negative integer \$n\$, evaluate the factorial \$n!\$.
The factorial is defined as follows:
$$
n!=\begin{cases}1 & n=0\\n\times(n-1)!&n>0\end{cases}
$$
Rules
All default I/O methods are allowed.
Standard loopholes are forbidden.
Built-ins are allowed.
There is no time or memory limit.
Giving imprecise... |
Task
Given an integer \$n\in[0,10^{12})\$ in any convenient format, return the number of strokes needed to write that character in simplified Chinese.
Background
Chinese numerals are expressed in base 10 with a system of digits and places, with an important distinction that digits are in groups of four, rather than thr... |
Similar in spirit to Number of distinct tilings of an n X n square with free n-polyominoes and Partition a square grid into parts of equal area, this challenge will have you count ways of partitioning a triangle in a triangular grid. The goal of this code-golf challenge is to write a program that outputs \$ a(n,m)\$, t... |
Background
Two numbers, \$a\$ and \$b\$, are said to be connected by a Brussels choice operation* if \$b\$ can be reached from \$a\$ by doubling or halving (if even) a substring (the substring must not be empty and may not contain any leading 0s but it can be 0) in the base-10 representation of \$a\$
*This operation is... |
Sandbox
Definition: A positive integer n is almost-prime, if it can be written in the form n=p^k where p is a prime and k is also a positive integers. In other words, the prime factorization of n contains only the same number.
Input: A positive integer 2<=n<=2^31-1
Output: a truthy value, if n is almost-prime, and a fa... |
Design a language and golf its interpreter so that it solves the following programming challenges in as few bytes as possible:
Hello World
cat
Fizz Buzz
List the first \$n\$ primes
Fibonacci Sequence
Sort a numerical list
Balanced parentheses/brackets/braces test
Rule 110 (as a proof of Turing completeness)
Challenge... |
Introduction
Recently I was trying out one of the more obscure use-cases of a modern smartphone: Calling someone by number. While typing it in, I noticed that some of my phonebook entries were displayed, even though the number I was trying to call was different! After some experiments, I figured out why.
What it does
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.