instruction stringlengths 34 53.1k |
|---|
Introduction
A childhood game designed to help children learn to count in french in Canadian schools is played as follows:
Students go around the room counting up to 11
A number greater than 11 cannot be said
A student can say either 1, 2, or 3 numbers
If a student says the number 11 then they are removed from the nex... |
Write the shortest program or function which generates these 1000 numbers or a sequence (0- or 1-indexed) which begins with them.
[0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1,
0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,... |
I'm looking to find the fastest racer around. Show me your fastest lap around this 18x14 track shown below.
______
/ \
/ \
/ ____ \
/ / \ \
/ / \ \
| | | |
| | | |
| | | |
| | | |
\ \ / /
\ \____/ /
\ ... |
Challenge :
Given an integer n as input. Create a diamond that is 2x the given number n.
Input :
Input is integer n and 2 < n ≤ 3000.
Output :
Output will be a string and it will be in form of a diamond consisting of + with an addition line at the start showing n using +
Examples :
D(3) :
+++
+
+++
+++++
+++++
++... |
I've been recently playing through 'The Weaver' and I think it presents an interesting challenge for code-golf.
Premise:
The Weaver is a game wherein you are given a number of ribbons coming from 2 directions 90 degrees apart and your goal is to swap them at certain intersections to achieve a desired output.
Like th... |
Do you love watching cool timelapses of constructions or other massive work done in minutes? Lets make one here.
We will be looking at an excavator digging quarry, making pictures each day to see whole progress. And your task is to show us this process!
Quarry is defined by the width of its first layer.
Excavator is de... |
Challenge :
Given a string rotate every char by its index. e.g --> 'Hello' should be 'Hfnos'.
Input :
Input is given as string s length of string is 2 < s ≤ 100. Input will either be alphabet , number or one of the following whitespace , ! , @ , # , $ , % , ^ , & , * , ( , )
Output :
Output will be a string with all... |
Specifically, Conway's PRIMEGAME.
This is an algorithm devised by John H. Conway to generate primes using a sequence of 14 rational numbers:
A B C D E F G H I J K L M N
17 78 19 23 29 77 95 77 1 11 13 15 15 55
-- -- -- -- -- -- -- -- -- -- -- -- -- --
91 85 51 38... |
Let's start by defining a reflection of a character in a string:
Given a string with distinct lowercase alphabetical letters with no spaces such
as abcdefg, define a reflection of a letter in the string c as
moving it (without changing the order of any other letter) to a new
place in the string such that the num... |
Task
Given 2 positive integers n and k, where n > k, output the number of surjections from a set of n distinguishable elements to a set of k distinguishable elements.
Definition
A function f: S → T is called a surjection if for every t∈T there is s∈S such that f(s) = t.
Example
When n=3 and k=2, the output is 6, since ... |
Today was AP exam registration day at my school, and while I was meticulously bubbling in the pages and pages of information required, the idea for this challenge hit me. So, given a string of letters and numbers, output an appropriately filled out bubble chart.
Rules:
For each character in the input string, replace t... |
I got to wondering yesterday if I could write a program to comb through a given word search and output the answers. It was actually surprisingly easy. Now I wonder just how small we can get.
Rules
Your first input is a string or collection of n lines, each of which is n characters long
Your second input is a list of ... |
In light of today's date...
A factorial of a number n, is the product of all the numbers from 1 to n inclusive.
The Challenge
Given an integer n where 0 <= n <= 420, find the sum of the digits of n!. It's that simple :P
Notes: I feel like this challenge isn't too simple, as some languages have a very hard time storing ... |
This challenge is completely ripped offheavily inspired by All Light, developed by Soulgit Games.
Challenge
You are an electrician, and it's your job to wire up all the lights to the battery.
The lights and battery are laid out in a grid.
You can connect a light or battery to the nearest light or battery to its north,... |
AKA: Generate Clickbait From an Array.
Given an array of integers, generate some cringe-worthy clickbait based on its arrangement and length:
If it's 20 elements or less, you can make a Top X List. Parameters: length of the array.
Prime numbers are celebrities, so anytime two of them are next to each other it'll pass ... |
This is my first challenge on ppcg!
Input
A string consisting of two different ascii characters. For example
ABAABBAAAAAABBAAABAABBAABA
Challenge
The task is to decode this string following these rules:
Skip the first two characters
Split the rest of the string into groups of 8 characters
In each group, replace each ... |
Let's start by re-defining a reflection of a character in a 2-d array of characters:
Given a square 2-d array of characters with distinct lowercase alphabetical letters, define a reflection of a letter in the matrix as swapping it with the character directly across from it through the center of the square.
Thus, a re... |
Swapping two elements in a vector/matrix is very simple in Octave:
x='abcde';
x([4,1])=x([1,4])
x =
dbcae
Unfortunately, I have yet to find a way to do this inside an anonymous function. While the function below is syntactically correct, it only gives back the two elements that are swapped, not the entire x vector... |
Here's an interesting sequence discovered by Paul Loomis, a mathematician at Bloomsburg University. From his page on this sequence:
Define
f(n) = f(n-1) + (the product of the nonzero digits of f(n-1))
f(0) = x, with x as any positive integer, written in base 10.
So, starting with f(0)=1, you get the following sequence
... |
I just love this simple cypher, it's so fun reading not-quite human-readable words and filling the gaps...
Ot wes thi bist uf tomis, ot wes thi wurst uf tomis,
ot wes thi egi uf wosdum, ot wes thi egi uf fuuloshniss,
ot wes thi ipuch uf biloif, ot wes thi ipuch uf oncridaloty,
ot wes thi siesun uf loght, ot wes thi ... |
Background
The Royal Netherlands Meteorological Institute defines a heat wave* as a series of at least 5 consecutive days of ≥25°C weather (“summery weather”), such that at least 3 of those days are ≥30°C (“tropical weather”).
The tropical weather doesn't have to be measured consecutively: for example: 30, 25, 30, 26, ... |
Your task is to automatically complete URLs like the address bar in most browsers is doing. We will use the following (simplified) rules:
If the input string starts with http://, ftp:// or https://, return the string unchanged.
Otherwise, if the input string contains a dot ., e.g. in.put then the HTTP is assumed and ... |
This challenge was posted as part of the April 2018 LotM challenge
Brain-Flak is a turing-tarpit language which has gained quite a lot of fame here on PPCG. The memory of the language is composed by two stacks, but a "hidden" third stack was discovered by Wheat Wizard, leading to some interesting new ways of thinking ... |
Given two positive numbers N >= 2 and N <= 100 create a matrix which follows the following rules:
First Number starts at position [0,0]
Second Number starts at position [0,1]
Third number goes below First Number (position [1,0])
Following numbers goes in "slash" direction
Range of numbers used is [1, N1 * N2]. So, num... |
TL;DR
Record (left-right)/length for each pair of consecutive elements. If they're 0 or negative, don't record it.
Once this is done, take these actions. Don't update quotients:
Increment right and decrement left for (0, .3)
Remove from the array at >=.3
Print both elements for >.5
Print the remaining array. Have s... |
The input consists of i rows with neighbors information. Each ith row contains 4 values, representing the neighbor of i to the North, East, South and West directions, respectively. So each value represents a neighbor at the given direction of the ith row, starting from row 1, and can go up to 65,535 rows. The 0 value i... |
Where am I now?
Given a string d, containing only the letters NSWE, determine the coordinates I've traveled (from left to right, consuming greedily) and the final coordinate where I reside.
The rules for reading coordinates from left-to-right:
If the next character is N or S:
If the character after the N or S is anot... |
Challenge
You will create a function which takes a matrix filled with letters from the alphabet and determine if a 2x2 square composed of vowels exists.
If a 2x2 square of vowels is found, your function should return the top-left position (row-column) of the square.
If no 2x2 square of vowels exists, then return the ... |
This question is similar to Biggest Square in a grid.
Challenge
Given a matrix of 1 and 0 in a string format "xxxx,xxxxx,xxxx,xx.." or array format ["xxxx","xxxx","xxxx",...], You will create a function that determines the area of the largest square submatrix that contains all 1.
A square submatrix is one of equal widt... |
Make a quine but with a twist.
Statement
The quine prints its code but puts its first character at the end.
(You can do it in reverse but include that note in your answer)
The output must then be a program which is also an solution.
Example: Assume your code was foobar, running it will return oobarf which will be anoth... |
Find the area of a region of unit cells given its perimeter loop as a sequence of 90-degree turns.
For example, take the three-cell region
XX
X
whose perimeter loop we draw
L<S<L
v ^
S R>L
v ^
L>L
Each turn is marked as left (L), straight (S), or right (R). Starting from the R, the turns are RLLSLSLL. So, given in... |
The goal of this challenge is to determine if a move is a legal English Checkers move.
This challenge will use an 8x8 board. A moved piece should be treated as a man (not a king) that can only move diagonally forward. The board will have 0 or more black pieces and 1 or more white piece. One white piece will be current... |
How the encoding works
Given a list of bits:
Hold a prime (starting with 2)
Have a list
For each bit in the input
If it's the same as the previous bit, add the prime you're holding to the list
If it's different, hold the next prime and add that to the list
Return the product of all the numbers in your list
For the ... |
Challenge
Create a function that takes an string as a parameter. (Easy as far)
This string will contain
Single digit numbers
Letters from the alphabet
Question marks (Of course)
Your function will check if there are exactly 3 question marks between every pair of two numbers that add up to 10 or more. If so, then your... |
Cross posted from my anagolf post (note: may contain spoilers, post mortem).
Output the following text exactly.
You may have additional trailing whitespace on each line, and trailing newlines as well.
Shortest code, in bytes, wins.
... |
Make an upside down triangle of positive integers. Every number in the triangle must be distinct. Each number is the summation of its two parents (similar to how Pascal's triangle is constructed, but upside-down). Construct it in such a way that the bottom number is minimized.
For example, for input n = 4, here is a po... |
Challenge:
You'll be given an ASCII image of a pile of weights as input, and must output the combined weight of the pile.
Format:
There are 5 different weights, weighing 1, 2, 5, 10, 20 Passerees (or some other arbitrary unit).
The weights looks like this, in ascending order:
1: __
|__|
2: ______
|______|... |
Output either the text below, or a list of lists of integers (more details below).
0
10 1
20 11 2
30 21 12 3
40 31 22 13 4
50 41 32 23 14 5
60 51 42 33 24 15 6
70 61 52 43 34 25 16 7
80 71 62 53 44 35 26 17 8
90 81 72 63 54 45 36 27 18 9
91 82 73 64 55 46 37 28 19
92 83 74 65 56 47 38 29
93 84 75 66 57 48 39
... |
Related, both rope, nail and falling, but reversed and some other differences
Consider a loop of rope hanging on n nails on a row. Given a table showing whether the rope would fall down when each possible set of nails were removed, please provide a possible roping way. You may assume such a solution exist.
Here, "fall ... |
Challenge:
Your job is to create a simple interpreter for a simple golfing language.
Input:
Input will be in the form of string separated by spaces.
You can replace space separation with what you want
Output:
Output the result (a number or a string) obtained after performing all operations. If there are more than on... |
In Chess, a Knight on grid \$(x, y)\$ may move to \$(x-2, y-1)\$, \$(x-2, y+1)\$, \$(x-1, y-2)\$, \$(x-1, y+2)\$, \$(x+1, y-2)\$, \$(x+1, y+2)\$, \$(x+2, y-1)\$ or \$(x+2, y+1)\$ in one step. Imagine an infinite chessboard with only a Knight on \$(0, 0)\$:
How many steps is required for moving a Knight from \$(0, 0)\$... |
Challenge
In this challenge you will construct trees, in the form of ASCII Art using recursion. Basically you will generate the ASCII version of the Fractal Tree
Input
Number of iterations 0 < N <= 5
Output
The Nth iteration of the Fractal Tree. It must be a matrix of 63 rows and 100 columns. (i.e. 6300 printable ch... |
A Pillai prime is a prime number \$p\$ for which there exists some positive \$m\$ such that \$(m! + 1) \equiv 0 \:(\text{mod } p)\$ and \$p \not\equiv 1\:(\text{mod }m)\$.
In other words, an integer \$p\$ is a Pillai prime if it is a prime number, if there exists another positive integer \$m\$ such that the factorial... |
We've had a lot of quine challenges, but a lot of the quine formats are similar, lets create some variance in our quines.
Your task is to create a selection of programs in the same language (at least 2), all of which output their own source code, however, none of these programs can share any characters.
For example, if... |
Inspired by the challenge A pile of weights.
Challenge
Given an integer as a weight in pounds, output an ASCII barbell that can represent the weight. Weights will come in the form of the barbell (which will weigh 45lbs) and plates with the following weights: 45lbs, 35lbs, 25lbs, 10lbs, and 5lbs. Weights will be repre... |
Challenge :
Given two non-negative integers (X and Y > 1) calculate the sum of digits of their powers . i.e : sum of digits of X ^ Y .
Input :
Two non-negative integers X and Y
Output :
The sum of digits of X raised to power Y X ^ Y.
Examples :
5 , 2 ---> 7
9 , 4 ---> 18
3 , 17... |
Schlosberg Numbers
In issue 5 of Mathematical Reflections, Dorin Andrica proposed the problem of characterising the positive integers n such that is an even integer. Eight people submitted correct solutions showing that these are the integers n for which is even. The published solution was by Joel Schlosberg, so I c... |
Given a list of case-insensitive ASCII letter strings ("words"), output whether the entire list can be found on some four-by-four configuration ("board") of letter squares, in which no square can be used more than once in a word, and in which words are formed by moving from any square to any adjacent square including d... |
Adapted from the UIL - Computer Science Programming free response question "Carla" for 2018 District.
Introduction
In UNIX-like operating systems, each file, directory, or link is "owned" by a "user", who is a member of a "group", and has certain "permissions" represented by a ten-character string such as "drwxrwxrwx".... |
In this challenge, you will write an interpreter for 2Ω (transcribed as TwoMega), a language based loosely on brainfuck with an infinite-dimensional storage space.
The Language
2Ω contains three pieces of state:
The Tape, which is an infinite list of bits, all initialized to 0. It has a leftmost element, but no rightm... |
Background
A triangular grid is a grid formed by tiling the plane regularly with equilateral triangles of side length 1. The picture below is an example of a triangular grid.
A triangular lattice point is a vertex of a triangle forming the triangular grid.
The origin is a fixed point on the plane, which is one of the ... |
Challenge :
Sort the vowels (only vowels) in the given string .
Note :
Vowels are the following characters: A, E, I, O, U
Vowel sorting is cyclic i.e. After rearrangement the first vowel of sorted string goes where the original first vowel was
Input :
A string line, the original line (consisting of alphabets and wh... |
Introduction
The challenge itself was something I came across and had to try and figure out for a personal of project of mine. I ended up branching out and asking family members if they could provide an equation to meet the requirements.
Note: I have (with the help of others) found a solution for this but now I'm just ... |
Challenge :
Check if the given number forms a number staircase or not
Input :
A integer (greater than 0 and not decimal). NOTE : You can take input as string , array of digits.
Output :
a truthy / falsy value depending on whether the number forms a staircase or not
Number staircase :
A number staircase is an integer... |
In Elixir, (linked) lists are in the format [head | tail] where head can be anything and tail is a list of the rest of the list, and [] - the empty list - is the only exception to this.
Lists can also be written like [1, 2, 3] which is equivalent to [1 | [2 | [3 | []]]]
Your task is to convert a list as described. The ... |
I would like to convert ASCII art to something that takes less bytes. I have string like this:
my $string = ' ██ ████ █';
And I would convert this to something like this:
print "█" x 1."█" x 1."█" x 1"█" x 1"█" x 1;
So I would write this in one line and convert to using x operator. How can achieve ... |
Challenge:
In a hypothetical scenario, the countdown timer for a race has random intervals between the counts, to prevent premature starting, e.g.
3 (0.82 seconds pass), 2 (0.67 seconds pass), 1
Input:
nothing
Output:
Write a program (or function) that prints the 3 numbers with a random time interval from 0.50 seco... |
Challenge:
Given an array of non-negative whole numbers numbers in the range of 0 to Infinity, Check whether all of them are primes or not. (You can take input as a string too if you want)
Input:
Input: An array of numbers
Output: The array with every element replaced by one of these:
-1 -----> If 0, 1
... |
Write a function or program that encodes a string into a Code 39 format barcode, where each character is encoded as five bars separated by four gaps. Either two of the bars and one of the gaps are wide and others are narrow (10*4 codes), or three of the gaps are wide and none of the bars are (4 codes). This gives 44 di... |
Given a string of printable ASCII text (including newlines and spaces) that contains at least one character that is neither a newline nor a space, output a truthy value if the string is rectangular, and a falsey value otherwise. Additionally, the source code for your solution must be rectangular.
A string is rectangula... |
Background
In France, and probably in the rest of the European Union, any food available for sale must list the ingredients that compose it on its packaging, in weight percentage descending order. However, the exact percentage doesn't have to be indicated, unless the ingredient is highlighted by the text or an image on... |
Let's say that this array is how many press-ups I've achieved each day in the last 28 days:
[
20,20,20,30,30,30,30,
35,35,40,40,40,45,45,
50,50,50,50,50,50,50,
60,70,80,90,100,110,120
]
As you can see, it's taken a steep upward trend in the last week, and that's the part of this data I'm most interested in. Th... |
Letter dice are common in word games. It can be fun to try to spell funny words with boggle dice, for instance. If you grab a handful of dice, chances are you won't be able to spell certain words. This challenge is a generalization of that idea.
Challenge
Given a list of dice which each have at least 1 face and a word,... |
This challenge is related to some of the MATL language's features, as part of the May 2018 Language of the Month event.
Introduction
In MATL, many two-input functions work element-wise with broadcast. This means the following:
Element-wise (or vectorized): the function takes as inputs two arrays with matching sizes. ... |
Have fun with this one, The Powder Toy is a interesting challenge for golf, especially with filt logic.
The thing that makes TPT a challenge is the many many many many ways to approach a problem: Should I use Cellular Automaton rules, SWCH logic, Filt logic, subframe filt logic, and/or wall logic?
As such, a location f... |
This was inspired by a math problem I saw somewhere on the internet but do not remember where (UPDATE: The original problem was found on the math riddles subreddit with a proof provided that it is possible, also see this Math SE post), asking for a proof if the following process is possible for any arbitrary pair of in... |
(Related)
Given an integer n > 1,
1) Construct the range of numbers n, n-1, n-2, ... 3, 2, 1 and calculate the sum
2) Take the individual digits of that number and calculate the product
3) Take the individual digits of that number and calculate the sum
4) Repeat steps 2 and 3 until you reach a single digit. That digit ... |
Let an 8x8 chessboard be represented by any two distinct values, with one value being an empty square and the other being a queen. In the following examples, I use 0s as the empty squares and 1s as queens. For example:
is given by
1 0 1 1 1 0 0 0
1 0 1 0 1 0 1 1
1 0 1 0 1 1 0 1
0 1 0 1 0 1 0 0
0 1 1 0 0 1 0 1
1 0 0 0 ... |
In this challenge, you will play the noisy iterated prisoner's dilemma.
The Prisoner's dilemma is a scenario in game theory where there are two players, each with two options: cooperate, or defect. Each player does better for themself if they defect than if they cooperate, but both players would prefer the outcome wher... |
Inspired by this comment chain...
I wanna enklact my way out of this challenge but I can't...
@ETHproductions to enklact (v): to implement a lookup table using a subsection consisting of unique elements.
Enklacting is a very useful way to compress a lookup table. For example, let's say you had the following list of ... |
The Challenge
Given a list of words and a grid of letters, your job is to determine which of the given words can be found on the grid in all 8 directions (forward, backward, up, down, and the 4 diagonal directions), much like a word search. The grid is toroidal, so the grid wraps around on the edges. Letters can be reu... |
Mölkky
Mölkky is a Finnish throwing game. The players use a wooden pin (also called "mölkky") to try to knock over wooden pins of almost similar dimensions with the throwing pin, marked with numbers from 1 to 12. The initial position of the pins is as follows:
(07)(09)(08)
(05)(11)(12)(06)
(03)(10)(04)
(01)... |
Input :
Two decimal integers m and n that respectively give the number of rows and columns of the table.
m and n are greater than or equal to 1.
Output :
A table in HTML that has m rows and n columns.
The table should be displayable by a modern browser of your choice. Most browsers will display everything properly even... |
Background
If you do much code golfing, you're likely aware of the bitwise XOR operation. Given two integers, it gives another integer with 1s in the bits where the two inputs differ. So, for example, 1010 XOR 0011 = 1001.
It turns out to be very useful in game theory, where it's better known as the "nim sum". If you ... |
Blackjack, also known as twenty-one, is a comparing card game between yourself and a dealer, where each player in turn competes against the dealer, but players do not play against each other.
Play goes as follows, the dealer deals you a card. The dealer then deals them-self a card, face down. The dealer then deals yo... |
Challenge
Let's imagine an N-tuple of integers between 0 and M inclusive, and let's call it F.
There are (M + 1) ** N possible Fs in total.
How many such Fs satisfy all of the following inequalities (index is one-based)?
F[n] + F[n+1] <= M for 1 <= n < N
F[N] + F[1] <= M
Write a program or function that takes two pos... |
Inspired by last week's APL lesson.
Given an uppercase 2D seat map and a 1D list of customers, return the seat map and the customer list but modified as follows (to indicate occupied seats and seated customers):
For each unique letter in the input passenger list, lowercase that many (or all, if there are not enough) of... |
Originally posted (and deleted) by @Tlink, which was most likely inspired from this StackOverflow question.
Since it was a shame it got deleted, because it seemed like a good challenge in general, I figured I'd repost it with proper formatting and rules. (I've tried contacting @Tlink and get his/her permission to post ... |
As a celebration of good old Notepad, we are going to treat carriage returns and line feeds as what they originally meant, rather than what they are (ab-)used for today.
Given a string consisting of printable ASCII plus line feeds (␊; LF; esc \n; hex 0A; dec 10) and carriage returns (␍; CR; esc \r; hex 0D; dec 13), cau... |
I love functional programming in Octave, but it's rather unwieldy in practice. I'm wondering about the shortest way to define an anonymous recursive function.
I have some ideas, but I'm wondering if there is a way to combine these ideas to make them even shorter (or equally short but more versatile). For the sake of th... |
Imagine an arsonist walking around the town and picking its victims according to a very specific pattern (Or, alternatively, Imagine a bee flying around the garden and picking its flowers to pollenize according to a very specific pattern). Let's say the town is an N × N matrix, where N is an integer higher than or equa... |
The 21 Hairstyles of the Apocalypse
Given a a list of numbers between 1 and 21 (or 0 and 20) output a "stitched together" drawing of the following faces (see rules for stitching information):
___ ,,, ooo === +++ ### -*~*-
(o o) (o o) ... |
Given a nonempty list of positive integers \$(x, y, z, \dots)\$, your job is to determine the number of unique values of \$\pm x \pm y \pm z \pm \dots\$
For example, consider the list \$(1, 2, 2)\$. There are eight possible ways to create sums:
\$+ 1 + 2 + 2 \to +5\$
\$+ 1 + 2 − 2 \to +1\$
\$+ 1 − 2 + 2 \to +1\$
\$+ 1... |
Input: An array I of k positive integers. The integers will be no larger than 100 and k ≤ 100.
Output: Your code must output all possible arrays O of non-negative integers of length k with the restriction that 0 ≤ Oi ≤ Ii. To get from one array to the next you may add or subtract 1 to one value in the array. Your co... |
The Premise:
You are writing a C driver for a screen for use on an embedded system. The screen uses a tortured version of SPI that requires data to be sent LSb (least-significant-bit) first, but MSB (most-significant-byte) first.
A fast way to do this (if you have the memory) is to use the integer value of each byte to... |
The setup:
A social network reports the number of votes a post has in two ways: the number of net upvotes (total upvotes - total downvotes), and the % of votes that were upvotes, rounded to the nearest integer (.5 rounds up). The number of net upvotes is an integer (not necessarily positive), and the second is guarant... |
Challenge :
Given a string split at specific positions and capitalize the first character of the given word. Capitalize the first word's first char if and only if it was already capitalized
Input :
A string s and a character c.
Ouput :
The string with each occurrence of c replaced with the first char capitalized
Exam... |
Input
A non-empty encoded string consisting of printable ASCII characters (in the range 32-126), where some missing letters have been replaced with _.
Output
A decoded string of the same length with all letters in lowercase, including the missing ones.
How?
Edit: As mentioned by @Deusovi in the comments, this is a vari... |
The challenge here is to find the longest uninterruped arc around a unit circle with a random amount of points distributed in random positions around it.
Here is a diagram to assist my explanation:
The red line indicates the largest arc between any two points that is not interrupted by any other points. The challenge ... |
Challenge
Given an integer n ≥ 4, output a permutation of the integers [0, n-1] with the property that no two consecutive integers (integers with absolute difference 1) are next to each other.
Examples
4 → [1, 3, 0, 2]
5 → [0, 2, 4, 1, 3]
6 → [0, 2, 4, 1, 3, 5]
7 → [0, 2, 4, 1, 5, 3, 6]
You may use 1-indexing instead... |
See similar question for 2D case: Find the longest uninterrupted arc
The challenge here is to find the longest uninterruped great circle arc around a unit hypersphere in N dimensions, with a random amount of hyperspheres distributed in random positions around it.
Here is a diagram in two dimensions to assist my explana... |
This challenge is related to some of the MATL language's features, as part of the May 2018 Language of the Month event. Associated challenge: Function clipboard: paste.
Introduction
MATL has several clipboards, where you can store values (copy) to be retrieved later (paste). Some clipboards are automatic, which means... |
Your goal is to alternate uppercase and lowercase letters, while ignoring non-alphaneumeric characters.
Input => Output
abc => aBc OR AbC
a c => A c OR a C
abc123abc => AbC123aBc OR aBc123AbC
Shortest answer wins.
|
Introduction:
In the northern hemisphere (i.e. Europe, North America, etc.), the seasons are divided like this:
- Spring: March, April, May
- Summer: June, July, August
- Autumn: September, October, November
- Winter: December, January, February
In the southern hemisphere however (i.e. Australia, South America, etc.), ... |
It's a common problem to navigate in a 2D matrix. We've seen it many times and will see again. So let's help future us and develop the shortest solutions to generate all eight possible steps in a 2D matrix.
Challenge
Your code must output the following 8 pairs of -1,0,1 in any order:
(0,1)
(0,-1)
(1,0)
(-1,0)
(1,1)
(1,... |
Given this list of all the words in english and a string with s_me missi_g lett__s, find one way to fill in the letters. Do note that some words on the list contain special characters (! & ' , - . /) and numbers
Input:
This list and a string with missing letters.
The input sentence can contain or be missing any of thes... |
When writing a message with fridge magnets, you'll often find yourself substituting a 1 for an I. In this challenge, your goal is to find out if a message can be written using the letters of another message. The allowed substitutions are:
A = 4
B = 8
C = U
E = M = W = 3
G = 6 = 9
I = 1
L = 7
N = Z
O = 0
R = 2
S = 5
Fo... |
Challenge
Given an integer n ≥ 4, output a permutation of the integers [0, n-1] with the property that no two consecutive integers are next to each other. The value of a permutation pi is the sum of abs(pi[i] - i) for all indices i.
Examples
(1, 3, 0, 2) has value 6
(0, 2, 4, 1, 3) has value 6
(0, 2, 4, 1, 3, 5) ha... |
In this variant of the Four fours puzzle your should use up to x x's (and no other number) and a defined set of operations to reach every number from 0 to 100. If x = 4 then you can use up to four 4s and this question becomes the classic four fours puzzle (except you can use up to four 4s rather than having to use exac... |
Given a single digit integer and a three digit integer, output a mathematical formula that uses only the single digit and a given list of operators to equal the three digit integer.
Input: A one digit positive integer (1-9) and a three digit integer (100-999)
Output: A mathematical formula meeting the following requir... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.