instruction stringlengths 34 53.1k |
|---|
Is there a programming language that supports single tape Turing machines specified in some format?
I am aware multiple formats for expressing them exist, but is there a standard one using which an acceptable answer can be published on this site?
If it doesn't exist can somebody create one? Golfing Turing machines has ... |
Task
Given the situation with this global pandemic, you've been enlisted to help maintain social distancing. Your challenge, should you choose to accept it, is to write a program that takes in the positions of a group of people and checks whether the group is following social distancing rules. Your program must output ... |
You are an employee of Microteque, a leading Silicon Valley startup creating smart microwave ovens for all kinds of strange places. Your customers can get their microwaves printed with patterns to match their kitchens, campers, man caves; even the kitchens of large nation-state facilities have shiny new branded microwa... |
The task
Given a folded and cut in places snowflake, "unwrap" it and output the result
Input
The base folded snowflake, without any cuts, looks like:
|\
| \
| \
| \
| \
| \
| \
| \
|________\
And the input will always resemble this.
No changed or added symbols will go out of the range of this tria... |
Given a number n, find x such that x! = n, where both x and n are positive integers. Assume the input n will always be the factorial of a positive integer, so something like n=23 will not be given as input.
Examples: n=1 -> x=1 (0 is not a positive integer), n=24 -> x=4
Shortest code wins.
|
You are the captain of a world-famous wrestling team. An Olympic-grade match is coming up, and you are determined not to let your team down. You also happen to be a competent programmer, so you are going to write a program to help your team win!
You have access to the strength ratings for each of your own team wrestler... |
Given a 24 hour time, e.g. 20:48, output the nearest time where each adjacent pair of digits has an absolute difference of 1, e.g. 21:01.
That is, each number in the output must differ from the numbers next to it by 1, and the output must be the closest time, forwards or backwards, for which this is true. Time can be c... |
Inspired by this code review question, I am curious to see what happens if we turn that into a code-golf challenge!
The description is easy, the input is an array or any similar data structure with only unsigned integers, the output is a boolean if the number of odd numbers is equal to the number of even numbers inside... |
Golf Me a Text Editor
(similar challenges: Create a simple line editor and Line editor (more text here))
I seem to have forgotten which program to use to open, read, and write text files. Something like Noteleaf or VSBro or ... You see my conundrum. But never fear! I know some people who can write one. But I'm a bit li... |
Write a function or program that accepts one character (or a string of length 1) as input, and outputs the number of times that character occurs inside the code.
This program must be a Proper Quine, only in the sense that it cannot, for example, read itself as a file, etc.
Input can be any character, printable or not... |
In this challenge, Turing machines operate on a zero-initialized binary tape that is infinite in both directions.
You are given an integer \$N\$, where \$1 \le N \le 20000\$. Your program has to output a Turing machine that takes exactly \$N\$ steps to halt, including the final step. Alternatively, you can write a prog... |
I've been playing around with a robot on the coordinate plane. This robot is able to tell me if it goes left, right, up, or down by reporting back a string consisting of the letters L, R, U, and D, such as DLURRDLURDLLLRRLRLDURRU. Each character represents a movement of one unit. However, it seems that the robot is goi... |
This is a very simple challenge.
Task
Whenever your code is run, your code should output the next sunset date and time in GMT for all capital cities on Earth. You should get the list of capitals from the below table. The dates and times should be outputted sorted by the name of the capital. You don’t need to output t... |
Congratulations to Neil for hitting 100k rep! As a tribute, we are going to study 'Neil numbers'.
Neil's user ID is 17602 and there's something special about the binary representation of this number:
$$17602_{10}=1\color{blue}{000}1\color{blue}{00}11\color{blue}{0000}1\color{blue}{0}_2$$
$$\begin{array}{c|c}
1&\color{b... |
Background
The game Grand Theft Auto: San Andreas went down in history also thanks to its wide selection of cheats. They're almost 90 and anyone who has ever touched this game, no doubt has tried them all!
One cheat is activated (on PC) typing in-game a secret keyword, and then boom, a jet pops out of thin air or perha... |
A program ordinal is a (possibly transfinite) ordinal which can be assigned to programs in some language depending on their output.
To be more specific:
Strings that give no output have ordinal 0
Programs that output a program of ordinal n have ordinal n+1
Programs P0 outputting multiple programs P1, P2... Pn have ord... |
A Belphegor number is a number of the form \$(10^{n+3}+666)*10^{n+1}+1\$ (1{n zeroes}666{n zeroes}1) where \$n\$ is an non-negative integer. A Belphegor prime is a Belphegor number that is also prime.
The \$n\$ values of the first few Belphegor primes are 0, 13, 42, 506 (A232448)
Task
Write a program that either:
take... |
You will be given two integers \$M\$ and \$N\$. Find the number of pairs \$(x,y)\$ such that \$1 \le x \le M\$, \$1 \le y \le N\$ and \$(x+y)\bmod5 = 0\$.
For example, if \$M = 6\$ and \$N = 12\$, pairs which satisfies such conditions are, \$(1,4), (4,1), (1,9), (2,3), (2,8), (3,2), (3,7), (3,12), (4,6), (6,4), (4,11),... |
Overview
The cover of a book will be provided in the following ASCII format:
______
| |
| |
| |
| |
------
The input can be in any reasonable format (eg. a list of strings, a nested list of characters, etc.)
Inside the "borders" of the cover, other printable ascii characters might appear, which contribute ... |
Background
Define a run in a list as a maximal contiguous subsequence of identical values. For example, the list
0 0 0 1 1 0 3 3 3 2 2
has five runs of lengths 3, 2, 1, 3, 2 respectively. (Think of run-length encoding.)
Then define a cut operation as removing one item from each run of a list. Applied to the list above... |
The ball game is a game in which a number of players sit together in a circle. Each player is first assigned a number \$ n \$, either 1, 2, or 3. The game begins with any starting player, and proceeds clockwise around the circle. The current player with the ball throws it to the next player. Who the next player is sole... |
A normal Brainfuck program starts out with an array of cells, all containing the number 0. This program, on the other hand, must be able to run starting with any number x in the leftmost cell. The only rule is that at the end of program execution, the "pointed-to" cell must be cell x. (The leftmost cell is cell 0).
Ea... |
You are the first engineer in a hot new startup, Lexographical. Our company is making waves by digitizing and indexing all words, real or not. The core of our product... Our secret sauce... Well, that's why we hired you :)
Because we're bleeding edge, we're enforcing the latest standards. Even the latest ones aren't go... |
Background
My user ID is 78410, or \$1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0_2\$. One interesting property of this number is that, in binary,
it doesn't have three consecutive identical digits, and yet
it has a substring \$100100100\$ which is three copies of \$100\$.
So, I define a Bubbler number as a positive integer who... |
Given an infinite arithmetically-progressive¹ sequence, compute the minimum length of a prefix with a product divisible by 2^8.
Sample cases & reference implementation
Here is a reference implementation that I wrote in Io.
1, 1 -> 10
2, 4 -> 8
3, 5 -> 10
2, 6 -> 5
7, 5 -> 6
4, 1 -> 9
10, 9 -> 7
256, 9 -> 1... |
The 2020-05-29 xkcd comic showed us the numbers that Randall Munroe feels would be most likely to result from multiplication, other than the correct answers. The table does seem to have some sort of twisted logic to it.
For your convenience, the Wrong Times Table is reproduced here in selectable format:
+-----+-----+--... |
Write two programs, each taking a string s and a number n ≥ 0, such that:
The first program prints s n times, separated by newlines.
The second program prints each character of s n times, with repeated characters separated by newlines.
Every character at column x, line y in one program equals the character at column y... |
We all know true and false, but what do speakers around the globe say?
+----------------------+------------+------------+
| Language | True | False |
+----------------------+------------+------------+
| Arabic | sahih | zaif |
| Armenian | irakan | kelc ... |
We all know what a quine is. A quine is a program which prints its own source code. And we also know about the printable ASCII characters. Well... this challenge mixes both.
Your mission, should you accept it, is to create an index quine. An index quine is a non-empty program, composed only of the printable ASCII chara... |
A first order separable ordinary differential equation is (arguably) the easiest type of differential equation to solve, and takes the form of
$$N(y)\frac{dy}{dx} = M(x) \\
y(x_0) = y_0$$
For two given functions \$N(y)\$ and \$M(x)\$ and an initial condition \$y(x_0) = y_0\$.
Your task is to take \$N(y)\$, \$M(x)\$, \... |
The riddle
In yesterday's newspaper, I found a puzzle in which a Rook should start in the lower-left corner of a 12x12 checkerboard and then, during a round trip, visit each field exactly once except for a selection which must be avoided. The puzzle came with a picture that identified the fields to be avoided as black:... |
Introduction
A double-castle number™ is a positive integer number that has a pattern of $$\underbrace{a\cdots a}_{m\text{ }a\text{s}}b\underbrace{a\cdots a}_{m\text{ }a\text{s}}b\underbrace{a\cdots a}_{m\text{ }a\text{s}}\underbrace{a\cdots a}_{n\text{ }a\text{s}}b\underbrace{a\cdots a}_{n\text{ }a\text{s}}b\underbrace... |
Overview
The sharpness of a word is the sum of the sharpness of each of its letters, using the following rules:
Sharp letters
A, and V each have a sharpness of 1
N and Z each have a sharpness of 2
M and W each have a sharpness of 3
Dull letters
C and U each have a sharpness of -1
S has a sharpness of -2
O has a shar... |
Background
A snake is a path over the cells of a square grid, such that it doesn't touch itself on a side of a unit square. Touching at a corner is allowed.
An example snake:
##.#.
.#.##
##..#
#.###
###..
Some example non-snakes:
###.#
#.#.#
#####
.#...
.####
###
.#.
##
##
Challenge
Given an empty grid with the two... |
Context
We're at war! You need to transfer an important message to your general to inform them from an imminent assault. The thing is, your enemy knows a lot about cryptography : you will need to be more creative in order to encode your message...
Task
Create a program that accepts an ascii message as input, and output... |
Introduction
Windows 95 used a very simple algorithm for verifying license keys. The scheme of an OEM license key always looked like this:
xxxyy-OEM-NNNNNNN-zzzzz
The day can be anything within 001-366, and the year cannot be lower than 95 or above 03.
xxx represents the day of the year the key was printed on (for exa... |
Related: Read a crossword
Task
Given a completed Crossword puzzle, extract the words in it with their respective clue numbers, with "across" (horizontal) and "down" (vertical) words grouped and ordered like a real crossword puzzle.
The words are numbered in the row-major order of their first letters. If an "across" wor... |
Write a program that outputs its input unchanged. However:
If all uppercase characters are removed from the program, it lowercases all uppercase letters.
If all lowercase characters are removed from the program, it uppercases all lowercase letters.
Transforming characters beyond the basic Latin [A-Za-z] range is opti... |
Challenge
You have a Chinese Checkers board looking like this:
board = [
[''],
['', ''],
['', '', ''],
['', '', '', '', '', '', ''],
['', '', '', '', '', ''],
['', '', '', '', ''],
['', '', '', '', '', ''],
['', '', '', '', '', '', ''],
['', '', ''],
... |
Related: Clearly parenthesize APL trains
Background
In the most basic form, APL has two kinds of tokens: arrays and functions. For this challenge, we will use a lowercase letter a-z for an array, and an uppercase letter A-Z for a function. Furthermore, we will assume each character is a token of its own; Fx is equivale... |
Objective
Given a string with single Unicode vulgar fraction, parse it to a rational number.
Valid inputs
A valid input is one of:
¼ U+00BC; one quarter
½ U+00BD; one half
¾ U+00BE; three quarters
⅐ U+2150; one seventh
⅑ U+2151; one ninth
⅒ U+2152; one tenth
⅓ U+2153; one third
⅔ U+2154; two thirds
⅕ U+2155; one fifth... |
The problem over here introduces an new type of strings: if you split the string into equal halfs and swap the pairs, it produces the same output as sorting the string. We call that a half-sort.
Given a purely ASCII string, check if the string is in a half-sort.
An example of a half-sort string
The string node is a hal... |
Given \$A = (a_1,\dots,a_k)\ k\ge2 \$ a sequence of positive integers, in which all elements are different.
Starting from \$i=2\$, while \$a_i\in A:\$ (until the last element)
If \$d=|a_i-a_{i-1}|\$ is not already in \$A\$, append \$d\$ to \$A\$
Increase \$i\$
Output the completed sequence.
This is code-golf
Example
... |
A magic square is an \$ n \times n \$ square grid, such that the sum of the integers on each row and column are equal. Note that the definition which will be used in this challenge is different than the one used by Wikipedia, since
diagonal sums are not accounted for
the numbers are not required to be distinct or in t... |
Introduction
On 30 May 2020, NASA and SpaceX launched a crewed rocket to the international space station on the SpaceX Demo 2 mission. This is the first time humans have been launched into orbit from American soil since the retiring of the Space Shuttle in 2011, and the first time ever that a private company has launch... |
How many ways can one place (unlabelled) dominoes on a square chequerboard such that the number placed horizontally is equal to the number placed vertically?
The dominoes must align with, and may not protrude, the chequerboard and may not overlap.
This is OEIS sequence A330658, 1, 1, 1, 23, 1608, 371500, 328956227, 112... |
The challenge is to golf a program when given a string composed of any number of asterisks, then a comma, than any number of asterisks, say which side has more.
The asterisk-strings can be empty.
Output
0 for ties.
1 for the left.
2 for the right.
Examples
Input: ***,**** Output: 2
Input: ***, Output: 1
Input: ***,*** ... |
It's time for another Mesoamerican calendar! The Xiuhnelpilli was used by the Aztecs (more properly, the Mexica) to name their years. Each year has a number and a sign. Here's part of the cycle:
Input; Output
1089; 13 Calli
1090; 1 Tochtli
1091; 2 Acatl
1092; 3 Tecpatl
1093; 4 Calli
1094; 5 Tochtli
1095; 6 Acatl
... |
Here's one for fans of Cabin Pressure. There is an episode in which the characters devise a new version of Fizz Buzz, which is simplified to contain absolutely no mathematics.
It has these rules:
If someone says "fizz", you say "buzz".
If someone says "buzz", you sing "'ave a banana"
If someone says your name, you say... |
This challenge is to golf an implementation of SKI formal combinator calculus.
Definition
Terms
S, K, and I are terms.
If x and y are terms then (xy) is a term.
Evaluation
The following three steps will be repeated until none of them apply.
In these, x, y, and z must be terms.
(Ix) will be replaced by x
((Kx)y) will be... |
This challenge is to take an alphabetical string as input and to apply the following conversion:
The first of each type of character of the string must stay, and must be immediately followed by an integer representing how many of these characters were in the original string. Any repeating characters must be omitted.
Al... |
Carcassonne is a tile-based game, where the objective is to construct Roads, Cities and Monasteries, in order to score points. The game works by players taking turns to draw and place tiles to construct a landscape, then claiming roads, cities and monasteries. An example landscape is:
There are \$19\$ distinct tiles (... |
Closely related: How high can you count?
Challenge
In your programming language of choice, write as many different identity programs/functions as possible, under the following constraints:
Each program should be a function or full program that is one of the following:
A function that takes a single positive integer ... |
Background
As you probably learned in biology class, DNA and RNA are composed of strands of nucleotides; each nucleotide consists of a chemical called a base together with a sugar and a phosphate group. The information stored in the DNA or RNA is coded as a sequence of bases. DNA uses the bases A, C, G, and T (standing... |
Challenge
Assume two vectors \$\mathbf{a} = (a_1,a_2,\cdots,a_n)\$ and \$\mathbf{b} = (b_1,b_2,\cdots,b_n)\$ are given in an \$n\$-dimensional space, where at least one of \$b_1,\cdots,b_n\$ is nonzero. Then \$\mathbf{a}\$ can be uniquely decomposed into two vectors, one being a scalar multiple of \$\mathbf{b}\$ and on... |
Blokus is a board game in which players take turns placing pieces on a \$ n \times n \$ square grid. In this version of the game, there will be just one person playing. The person is given \$ 21 \$ unique polyominoes, ranging from \$ 1 \$ to \$ 5 \$ tiles each. They then proceed to place down a subset of the pieces ont... |
This question is a sequel to this one, working in the opposite direction.
For a reminder of terminology, the letters L, R, U, and D represent one-unit movement of a robot on the coordinate plane in the directions left, right, up, and down respectively. Given a positive even integer n, generate and print all sequences ... |
Wow, time really flies! It's already been one year since the debut of the Code Golf Stack Exchange site design. Let's celebrate this milestone with a code golf challenge... to imitate the site logo!
Golf a program that outputs a graphic of a medal enclosed in curly braces {}, along with two lines of text containing COD... |
A SMILES (Simplified molecular-input line-entry system) string is a string that represents a chemical structure using ASCII characters. For example, water (\$H_2O\$) can be written in SMILES as H-O-H.
However, for simplicity, the single bonds (-) and hydrogen atoms (H) are frequently omitted. Thus, a molecules with on... |
Your task
In your language of choice: create a program that outputs 1
This 1 may either be a string or value equivalent to the number one.
The shifting catch
If you take the unicode codepoint (or whatever codepoint encoding your languages uses if not UTF) for each character in your program, and shift each of those valu... |
For example, let's look at the following ASCII art:
/\ - encloses a total of 2 cells - half a cell per slash
\/
/\ - encloses 4 cells fully and half of 8 cells, for a total of 8
/ \
\ /
\/
Your challenge is to write a program that determines (and outputs) the total area enclosed by ASCII art composed only of... |
Introduction
I crochet a lot, and lately I've started writing crochet patterns. However, while I work very well from notes such as rnds 2-6 (round number = x, original number of stitches = y): *dc x-2 stitches, 2 dc in next stitch* around (xy stitches), most published patterns spell out each row in more detail. I don't... |
Please note the special scoring for this challenge.
Given a non-empty string made of a-z, output the string immediately before it in the shortlex order.
Shortlex order
We enumerate strings in shortlex order by first listing the strings of length 0, then those of length 1, then length 2, and so on, putting them in alph... |
Given two integers, s and e, print the title of Black Mirror series #s episode #e.
Expected output is as below, case sensitive. Output for blank cells and invalid inputs is unspecified.
e↓s→ 1 2 3 4 5 ... |
Goal:
Get every integer from the string (not a number, but integer)
Multiply them
Output the result
Input:
5 kilograms of food eaten, 10 liters of water drank, 20 plates dirty, 40 mugs dirty, and only 3 people acted!
Output:
120000
How:
Result was 5 * 10 * 20 * 40 * 3
What do we count as an integer:
General:
If int... |
June 2020 is a month in which June 1st corresponds to Monday, June 2nd corresponds to Tuesday, ... June 7th corresponds to Sunday. For reference, here's the cal of June 2020.
June 2020
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 ... |
Imagine a simple SKI calculus expression - for example, (((S α) β) γ). As you can see, each node of the rooted tree has exactly two children. Sometimes though, the parentheses are omitted and the tree is unrooted (just to make the notation clear, I believe). The challenge is to put the parentheses back, so that the tre... |
Task
Given a matrix of numbers \$M\$ with \$r\$ rows and \$c\$ columns, and the magnification factor \$n\$, build the matrix with \$rn\$ rows and \$cn\$ columns where the original elements are spaced \$n\$ units apart and the gaps are filled by piecewise linear interpolation:
$$
\begin{bmatrix}
a_{11} & a_{12} ... |
Lucky dice rolls
In pen and paper roleplaying games dice are used for various chance calculations. The usual way to describe a roll is \$n\textbf{d}k\$ where \$n\$ is the number of dice and \$k\$ is the number of faces on a die. For example \$3d6\$ means that you need to roll the classical 6-sided die 3 times (or roll ... |
The challenge today is very simple. The task is to determine the TI calculator for which the submitted datafile was made.
The datafiles always start with a string **TI, the version (described below), and other data you can ignore.
Now, the versions you need to recognize are:
95* => TI-95
92P => TI-92+
92* => TI-92
89* ... |
Intro
Help! I'm stuck on a snow-covered mountain and I need to get down as fast as possible, preferably without dying. I have a map showing how high each part of the mountain is above the normal ground.
I am a novice skier, which means I like to stick to slopes that aren't too steep. I'm willing to go down just two mod... |
Related Challenge: Single Digit Representations of Natural Numbers
Task
Write a program/function that when given a non-negative integer \$n \le 100000\$ outputs an expression which uses all the digits from \$0\$ to \$9\$ exactly once and evaluates to \$n\$
The expression outputted by your program may only use the opera... |
Input
Name of a stackexchange site or any way to uniquely identify the site.
Output The hour of the day that had the largest number of answers posted over the previous 24 hours. E.g. 14:00-15:00 GMT.
You can take the input and give output in any easily human readable format.
Your code can access the Internet but only t... |
You are playing a famous game called \$1\text{D Array BattleGround}\$. In the game, the player can be stationed in any position from \$0\$ to \$10^5\$.
You are a Paratrooper in the game and have the ability to do two types of operation \$-\$
Advance, which would multiply your position by \$2\$
Fall-back, which would d... |
Inspired by certain puzzles on Flow Free: Warps.
Background
We all know that L-triominos can't tile the 3x3 board, and P-pentominos can't tile the 5x5 board. But the situation changes if we allow the board to wrap around in both dimensions:
L-triominos can tile 3x3 toroidal grid
The 3rd tile wraps around through all fo... |
This challenge is a relatively simple concept that I'm surprised has not been done yet. You will be given only an integer as an input. Your task is to find the date that is this number of days from January 1st, 1984. This challenge is uniquely for the Gregorian calendar (which is standard almost everywhere).
One restri... |
For this challenge, you will be given a long string as an input. With this string, you must create a dictionary.
Details:
This dictionary will contain all the words from the string - a word being any sequence of letters surrounded by non-letter characters (ASCII). Letter case of the entries of the dictionary should alw... |
The incenter of a triangle is the intersection of the triangle's angle bisectors. This is somewhat complicated, but the coordinate formula for incenter is pretty simple (reference). The specifics of the formula do not matter much for this challenge.
The formula requires lengths of sides, so it can be very messy for mos... |
Task
Write a program/function that when given a positive integer \$n\$ splits the numbers from \$1\$ to \$n\$ into two sets, so that no integers \$a, b, c\$, satisfying \$a^2 + b^2 = c^2\$ are all in the same set. For example, if \$3\$ and \$4\$ are in the first set, then \$5\$ must be in the second set since \$3^2+4^2... |
In the description of this challenge, the following board will be used as a reference for positions:
ABC
DEF
GHI
For instance, in a game of ordinary tic-tac-toe, B E A C G D F H I describes the following:
-X- -X- XX- XXO XXO XXO XXO XXO XXO
--- -O- -O- -O- -O- OO- OOX OOX OOX
--- --- ... |
Background
Entombed is an Atari 2600 game released in 1982, with the goal of navigating through a continuous mirrored maze as it scrolls upwards. In recent times, the game has been subject to research — despite the strict hardware limitations of the Atari 2600, it somehow manages to create solvable mazes every time. By... |
We've had Meta Regex Golf and Display OEIS Sequences. Now, it is time for Meta OEIS Golf.
Challenge
Given a sequence of integers, your program/function should output a program/function in the same language that then outputs the same sequence.
A simple example in Python would be
def f(sequence):
# generate a dictionar... |
Background
Shakashaka is a puzzle on a grid, whose objective is to place some half-squares (right triangles) on the empty cells so that all the remaining contiguous regions form rectangles, either upright or 45 degrees rotated. Here is an example puzzle with a solution:
Ignore the number clues for this challenge.
Cha... |
I'm posting my code for a LeetCode problem copied here. If you have time and would like to golf for a short solution, please do so.
Requirement
It has to only pass the LeetCode's Online Judge, if the language would be available.
If the language is not available, simply we should possibly keep the class Solution as we... |
If you haven't played the game Baba is You, I think you really should. Whether you’ve played it or not, have a go at implementing it as a code golf.
The idea behind this challenge is to have a bit more complicated, non-standard task with a bit longer answers.
Game rules
Alas, the challenge is not to implement the entir... |
Background
This challenge is about Convolutional neural networks, and its two main building blocks, namely Convolutional layer and Pooling layer.
For simplicity, we ignore the "depth" of the images and intermediate tensors, and just look at the width and height.
Convolutional layer
A convolutional layer works like a ke... |
Compute, O friend, the number of the cattle of the sun which once grazed upon the plains of Sicily, divided according to color into four herds, one milk-white, one black, one dappled and one yellow. The number of bulls is greater than the number of cows, and the relations between them are as follows:
White bulls \$=... |
Background
Mathematicians are interested in all kinds of algebraic structures, e.g. groups, rings, boolean algebras. Generally, we have several operations (addition, multiplication, meet, join, etc.), and some equational relationships on the operations (e.g. associativity of multiplication). This makes up an algebraic ... |
Given a matrix of size at least 3×3 formed by positive integers, determine if it contains at least one "U" pattern, defined as
+ + + - - - + +
+ + - N - N - +
+ + - N - N - +
+ + - N N N - +
+ + + - - - + +
where
N is the same number, repeated in those seven positions
- (optional) represents any number different than... |
Input a scientific notation number (base 10), output scientific notation in base 16 (as defined below).
Details
In scientific notation, all non-zero numbers are written in the form
$$ m \times 10^n $$
Where \$ n \$ is an integer, and \$ m \$ is a real number, \$ 1 \leq |m| < 10 \$.
Consider scientific notation in base ... |
Challenge
Premise
It's 2006, and Alice is trying to send Bob their her completed notes on their newly ended expeditions into the labyrinthine school library, which the two of them found suffers from a bad case of non-Euclidean geometry.1
For some reason, Alice originally created her notes, which consist of black text o... |
The challenge is to golf a program that checks if a statement of propositional calculus/logic is a logical tautology (i.e. it is true for all possible values of the variables).
Input
Input formulas will use P, P', P'' ect. as variables. They can either be true or false.
(P and P') means both P and P' are true.
(P or P'... |
This a simple question.
The start day is a Saturday and let the input be a non-negative number x.
The output should be the number of weekdays (Mon-Fri) in the next x days inclusive.
For example, if x = 3 then the output should be 2. For x from 0 onwards the output should be:
0,0,1,2,3,4,5,5,5,6,7,8,9,10,10,10,11,...
—... |
Task
Your task is to write a program that, taking no input, outputs a string that represents a formatted codegolf answer of itself. The pattern is the following:
[Language name][1], n bytes
=
```
source code
```
[1]: link-to-language
With the language name being the language that you wrote your program (as stated in... |
Write a program for a specific language that in different orientations performs different tasks.
Your code should have at least two non-empty lines and at least two non-empty columns and should complete at least one challenge from each category of challenges below when oriented in different ways.
Orientations
Your code... |
Help, I've been diagnosed with prosopagnosia! This means I'm no longer able to recognise faces.... :(
Can you help me?
The challenge
You will be given an image as a matrix of regular ASCII characters separated by new line characters, and your task is to determine if it contains a face. Faces will look something like th... |
Challenge
Given a matrix of digits (0-9), find the smallest (in terms of area) rectangular matrix of digits where one or more copies of itself, possibly rotated, can tile the original matrix. Reflection is not allowed (think of a collection of tiles on a wall or floor).
Input can be taken in any reasonable ways to repr... |
The goal of this challenge is to print the following tongue twister:
She sells seashells by the seashore,
The shells she sells are seashells, I'm sure.
So if she sells seashells on the seashore,
Then I'm sure she sells seashore shells.
This is more complicated than just calling your language's print equivalent. Since ... |
Given the measures of two of the interior angles of a triangle (x and y; the other angle can be easily calculated with 180 - x - y), draw a line segment that cuts this triangle into two isosceles triangles. You need to output the angle measures of both of your triangles.
However, because the base angles are the same, y... |
You are given a non-empty list of positive integers. Your task is to figure out how many distinct numbers can be obtained by applying the following algorithm:
Remove either the first or the last item from the list and initialize N to the corresponding value.
Remove either the first or the last item from the list. Let'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.