instruction stringlengths 34 53.1k |
|---|
This is a cops-and-robbers challenge based around defining languages and proving they are Turing complete.
This is the cops' thread. The robbers' thread is here.
Cops
As a cop, you will prepare two things:
A formal specification of a programming language, or other computational system. (Computational systems are defin... |
This is a cops-and-robbers challenge based around defining languages and proving they are Turing complete.
This is the robbers' thread. The cops' thread is here.
Robbers
The cops will post definitions of Turing-complete languages. Your task is to crack them by proving that they are indeed Turing complete. See the cops'... |
This challenge is inspired by the meme Men of Culture.
The meme involves blanking out parts of the original caption,
Ah, I see you're a man of culture as well.
to make it appear as if the character is saying something else.
Your challenge is to write a program that, given an input, show how the original sentence can ... |
Input is in this format:
image fontwidth fontheight rowwidth xoffset yoffset xgap ygap non-existent charstart thetextitself
thetextitself: The text that should be rendered from the image.
image: The image filename. Implementation may vary; it could be either the filename from your computer, an image URL, or something ... |
Introduction
A sequence of numbers is passed in as the input. The program has to generate the lowest degree polynomial possible. This was my first programming project in college and it would be interesting to see how much smaller the solution could have been.
Challenge
The input is a list of integers separated by a com... |
Description :
Given x and y positions of two circles along with their radii, output the area of intersection of the two circle.
Input :
You will be given following input :
array 1 = x and y positions of circle a
array 2 = x and y positions of circle b
radius = radii of the two congruent circles
Input method :
([12 ,... |
You're given the map of a cinema theatre as a boolean matrix: 0 represents a free seat, 1 - occupied. Each Finn who walks in chooses the seat farthest away (Euclidean distance) from the nearest occupied one, or if several such exist - the first among them in row-major order. Output a matrix showing the order seats will... |
Your challenge is simple: write as long of a pristine program as possible in the language of your choice using only unique bytes. (The full definition of a pristine program, copied from that link, is at the bottom of this question.)
That's right, no strings attached. Your code doesn't have to do anything at all, just r... |
For a computer language, a reserved word is a word that cannot be used as an identifier, such as the name of a variable, function, or label. For other computer languages, keywords can be considered as the set of the language instructions.
Challenge
Using your language of choice, write a code in the chosen language that... |
Recursively define a "valid arithmetic expression":
Any natural number is a valid arithmetic expression.
If s is a valid arithmetic expression, then so is (-s).
If p and q are valid arithmetic expressions, then so is (p+q).
In the above, a "natural number" is recursively defined as follows:
0 1 2 3 4 5 6 7 8 9 are n... |
look! It's an ASCII maze! Soo coolzors, amazeballs and stuff.
+-+-----+---+
| | | |
| | ++ | |
| | ++ +-+ |
| | |
+-------+ | |
| | |
+---------+-+
But, but, but... it's a pain to work out which direction all the parts of the maze are going. I just want to draw the layout and the maze make it... |
This sentence employs two a’s, two c’s, two d’s, twenty-eight e’s, five f’s, three g’s, eight h’s, eleven i’s, three l’s, two m’s, thirteen n’s, nine o’s, two p’s, five r’s, twenty-five s’s, twenty-three t’s, six v’s, ten w’s, two x’s, five y’s, and one z.
Such sentences are called autograms. Your task is to write a p... |
Given an input integer n >= 10, output the average of all deduplicated rotations of the integer.
For example, for input 123, the rotations are 123 (no rotation), 231 (one rotation) and 312 (two rotations). The average of those is (123 + 231 + 312) / 3 or 222.
As another example, take 4928. The rotations are 4928, 9284,... |
This is a CC-BY-SA challenge from the CCSC Mid-South Programming Contest 2018.
Author(s): Brent Yorgey
Source: Consortium for Computing Sciences in Colleges Mid-South Programming contest 2018
https://ccsc18.kattis.com/problems/ccsc18.mountainrange
Good news: you have been hired to do all the special effects for a fil... |
Your mission is to build an algorithm (program or function) that can optimize packing fruit from a conveyor belt into bags to be sent off to retailers, optimizing for a largest number of bags.
Each bag has to weight at least a certain amount, but any excess is lost profit since that weight could be used to fill another... |
Back in the day, telephone autodialers used punched cards with one column for each digit of the number to be dialed. Columns had seven rows. The first three rows represented the numbers (1,2,3), (4,5,6), and (7,8,9) respectively. The last three rows rotated this arrangement by 90°: (1,4,7), (2,5,8), and (3,6,9). The mi... |
Challenge :
Your job is to find the given number N.
Input :
You will be given a string in the following form:
dN ± Y = X
Where:
d, N, X, Y are all numbers with d , X , Y being integers (not decimals).
Output :
Solve the equation and output the value of N rounded. Round up if decimal is greater than or equal to 0.5... |
Given string S representing a dollar amount, make change for that amount of money use the least number of coins to make the change and record the amount of each coin in a list. Here are the coins available to use and their value.
Coin : Value
Dollar Coins : $1.00
Quarters: $0.25
Dimes: $0.10
Nickels: $0.05
Pennies: $0.... |
Interleaved sequences represent an arbitrary merging of some number of sequences.
An interleaved sequence can be made by appending elements to a list one by one from some number of lists, choosing the next element from some list each time. Therefore, an interleaved sequence will contain exactly the same elements of all... |
Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals. For example, -x2 can be expressed as ∫x∫111dtxdu.
E := 1 | var | ∫EEEdvar
Any reasonable input/output method is allowed.
Examples:
Your score will be the your code length... |
This is a KOTH challenge for the dollar bill auction game in game theory. In it, a dollar is being sold to the highest bidder. Bids go up in increments of 5¢, and the loser also pays their bid. The idea is that both players escalate the bidding war far beyond the value of a dollar in order to cut their losses.
Let's ho... |
Description
You are given the results of a range function where every element has been rounded down to the nearest whole number. Your goal is to recover the original list.
For example, the following function (in Python3) will produce an input for your program:
from numpy import arange, floor
def floored_range(A, B, C):... |
Take the numbers 0, 1, 2, 3, 4, ... and arrange them in a clockwise spiral, starting downward, writing each digit in its own separate square.
Then, given one of four distinct and consistent ASCII characters (your choice) representing an axis, and an input integer n, output the first n terms of the sequence described by... |
Challenge :
Given a word, check whether or not it is an isogram.
What :
An isogram is a word consisting only of letters with no duplicates (case insensitive). The empty string is an isogram.
Examples :
"Dermatoglyphics" ---> true
"ab" ---> true
"aba" ---> false
"moOse" ... |
Challenge:
Take a string of upper or lower case letters as input (optional), and calculate the score that string would get in a game of Scrabble in English.
Rules:
The score of each letter is as follows (use this even if there are other versions of the game):
1 point: E, A, I, O, N, R, T, L, S, U
2 points: D, G
3 point... |
The Seidel Triangle is a mathematical construction similar to Pascal's Triangle, and is known for it's connection to the Bernoulli numbers.
The first few rows are:
1
1 1
2 2 1
2 4 5 5
16 16 14 10 5
16 32 46 56 61 61
Each row is generated as follows:
If the row number is even (1-indexed):
Bring... |
Challenge
A simple challenge: given two or more strings, output all of the substrings that are in each string.
Rules
Input is always a comma separated list of strings
Strings should be outputted from longest to shortest length without duplicates
Strings should preserve whitespace
Examples
Input: aaa,aa
Output:
aa
a
... |
99 Varieties of Dosa is a popular chain of roadside dosa stalls across South India. This is inspired by a combination of this chain and the classic CodeGolf challenge "99 Bottles of Beer".
Recreate the variant of the menu of the popular '99 Varieties of Dosa' listed below.
(Note: Despite the name, the list contains 10... |
Given integers N , P > 1 , find the largest integer M such that P ^ M ≤ N.
I/O:
Input is given as 2 integers N and P. The output will be the integer M.
Examples:
4, 5 -> 0
33, 5 -> 2
40, 20 -> 1
242, 3 -> 4
243, 3 -> 5
400, 2 -> 8
1000, 10 -> 3
Notes:
The input will always be valid, i.e. it will always be integers g... |
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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.