instruction
stringlengths
34
53.1k
Your task is to form an expression equaling \$ 11111111111 \text{ (11 ones)} \$ using only the following characters: 1+(). Keep in mind that the result is in base 10, and not some other base like binary. Of course, these expressions should follow the order of operations. Furthermore, the only operations which should be...
Background This challenge is about A004001, a.k.a. Hofstadter-Conway $10000 sequence: $$ a_1 = a_2 = 1, \quad a_n = a_{a_{n-1}} + a_{n-a_{n-1}} $$ which starts with 1, 1, 2, 2, 3, 4, 4, 4, 5, 6, 7, 7, 8, 8, 8, 8, 9, 10, 11, 12, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16, ... John Conway proved the following proper...
The task Given an image as input, your task is to do the following: Resize the image so it is At least 2 times smaller, but still has the same width/height ratio by taking every second (if resized to 2x) pixel in both horizontal and vertical directions and using those in the pixel art image. Example: a 4x4 image [a...
Challenge Premise Bob is a novice pianist who can only play sequences of single notes. In addition, he does quite an interesting thing: for every note after the first, if it's higher than the previous note was, he uses the finger directly to the right of the previous finger used; if lower, to the left; if the same pitc...
The goal of this challenge is to check and extend the OEIS sequence A334248: Number of distinct acyclic orientations of the edges of an n-dimensional cube. Take an n-dimensional cube (if n=1, this is a line; if n=2, a square; if n=3, a cube; if n=4, a hypercube/tesseract; etc), and give a direction to all of its edges ...
Two Deterministic Finite Automata or DFAs can be checked to see if they accept same set of strings in polynomial time. See section 3.3 of this for a long list of methods and this SO question/answer for a much shorter list. Input Your input will be two DFAs. In order to be able to test your code, I have provided DFAs i...
Background Penney's game is a two-player game about coin tossing. Player A announces a sequence of heads and tails of length \$n\$, then player B selects a different sequence of same length. The winner is the one whose sequence appears first as a substring (consecutive subsequence) in repeated coin toss. Conway's algor...
A recent SO question asks for a convenient one-liner to generate a list of numbers and their negative counterparts in Python. Given two integers \$1≤a≤b\$, generate all the integers \$x\$ such that \$a≤|x|≤b\$. The result may be printed or returned in any order or structure, as putting the result into a list and sortin...
Challenge Premise Bob lost1 Alice's precious grand piano. Big mistake. Alice has now stolen Bob's low-orbit ion cannon. Alice refuses to just make up with Bob, so let's help her give him a light tap on the roof. Suppose that from the top Bob's house looks like a lattice polygon, where all points have integer coordinate...
Background Given a triangle \$ABC\$, extend its three sides by the opposite side length, as shown in the figure below. Then the six points surprisingly lie on a circle called the Conway circle, whose center coincides with the incenter (the center of incircle, the circle that is tangent to the three sides from the insid...
The player has to keep guessing a number from 1 to 10 until they guess the correct number to win the game. If they make an incorrect guess, they're told if their guess was too low or too high. Each line has to render below the previous line for me to accept the solution as the new code for the game (However, you can st...
Let's say I have a .env file with the following contents: CF_WORKERS_ACCOUNT_ID=abcdef34632114 CF_WORKERS_API_TOKEN=abcdef34632114def3463def3463 FAB_DEV_ZONE_ID=434932843272439874329 I'm doing a screencast, and I want to quickly cat .env to show what's in the file, without broadcasting the exact values, since they're ...
Frustration is a solitaire card game which is played by calling out the sequence: “Ace”, “Two”, “Three”, ... , "Nine", "Ten", “Jack”, “Queen”, “King”, “Ace”, “Two”, etc. With each call, you simultaneously flip over a card from a shuffled deck of 52 cards. You win the game if you get through the entire deck without ever...
Task Given a string as input, generate a "blurred" version of that string. Input Your input will be a single-line string of ASCII characters, containing a minimum of 2 alphanumeric characters Output A string that is the "blurred" version of the input string. A blurred string is one where every alphanumeric character fr...
Given a number N from 2 to 8, place any nonzero number of queens on a grid of any size so that every queen has exactly N queens (counting itself) in each of its row, column, and each diagonal. This challenge has a significant restricted-time runtime limit. Your code must finish all N from 2 to 8 (combined) within the 6...
A Bit of Background The exterior algebra is a central object in topology and physics (for the physics concept cf. fermion). The basic rule dictating the behavior of the exterior algebra is that \$yx = -xy\$ (and consequently \$x^2 = -x^2 = 0\$). Applying this rule twice we see that \$yzx = -yxz = xyz\$. The product of...
Challenge Premise I've got multiple pretty numbers all in a row. Each is a decimal digit. 0s are weakly attracted to 0s, 1s are attracted to 1s a little more strongly and so on until 9. I don't know why — it must be something I ate. As a result, a sort of two-way sideways sedimentation occurs until the higher values ar...
Infinite Snake is just like the video game Snake, except for that the snake is infinitely long, there are no items to eat, and the Snake needs to move in a repeating n-step move pattern (e.g. right, up, right, up, right, down). The only constraint is that you can't crash back into yourself. Challenge Your goal is to wr...
Challenge Premise Euler diagrams consist of simple closed shapes in a 2-D plane that each depict a set or category. How or whether these shapes overlap demonstrates the relationships between the sets. I'm a spoilt brat who thinks Euler diagrams are hard to draw. For any Euler diagram, I want to know the minimum number ...
The Hamming distance between two strings is the number of positions they differ at. You are given a set of binary strings. The task is to find the length of the shortest route that visits all of them at least once and ends where it started, in a metric space where the distance between two strings is the Hamming distanc...
Background Conway's Soldiers is a version of peg solitaire played on an infinite checkerboard. The board is initially full of pegs below an infinite horizontal line, and empty above it. Following the ordinary peg solitaire rules (move a peg by jumping over another one horizontally or vertically, removing the one that w...
Logic gates are functions which perform basic logic operations. In this problem, we will account for the following 6 logic gates: AND, OR, XOR, NAND, NOR, and XNOR. Each of these takes two boolean inputs \$ a \$ and \$ b \$, and outputs a boolean. Below are the truth tables which show the output of each gate given two ...
You are employed as Administrator in charge of Road Maintenance and Planning. The intelligence division of the Agency for Road Maintenance and Planning has come up with a brilliant and not at all inefficient way to take random sample pictures of the roads: missiles with cameras on them. In this genius and not at all w...
The barfoos, a hypothetical alien species, go about charity in an interesting way. Every morning, barfoo Specialists come up with an ordered list of causes to donate to, and for each cause they recommend what quantity of resources should be donated. That wasn't the weird part. Here's the weird part: A random civilian b...
A quote from MO.SE answer: Although it is well known that Conway was able to quickly calculate the day of the week of any given date, it is less well known that one part of the algorithm is easy to remember and useful in practice: In any given year, the following dates all fall on the same day of the week: 4/4, 6/6, 8...
Convert NFA to DFA as quickly as possible. Input Your input will be an NFA. In order to be able to test your code, it needs to be able to handle an NFA in the following format. This is taken directly from GAP (and slightly simplified). Automaton( Type, Size, Alphabet, TransitionTable, Initial, Accepting ) For the inp...
Your job is to implement bitwise addition. To ensure that this is done, you will compute and print the result of addition without carry (or bitwise XOR). Then, you will compute the carry of the addition (bitwise AND) and multiply it by two (bitwise left shift). If the carry is nonzero, then you add the carry and the pr...
With all the gyms closed down with the COVID-19 situation, we have to exercise with the weight we have lying around at home. The problem is, we have a small selection of plates at varying weights, and can't immediately determine if we can create a setup at the desired weight. Given an unsorted array of weighted plates...
Task Write a function or program that takes n as a parameter and prints the first n self-divisors. Definition of Self-divisor A positive integer is called a “self-divisor” if every decimal digit of the number is a divisor of the number, that is, the number is evenly divisible by each and every one of its digits. Exampl...
We say two positive integers are anagrams of each other if the digits in one of them (in decimal representation) can be rearranged to form the other. Leading zeros don't count. For example, 110020222 is an anagram of 212102020, but not of 221100011; neither is 22002211 even though it can be written as 022002211. Intere...
My dog ate my calendar, and now my days are all mixed up. I tried putting it back together, but I keep mixing up the days of the week! I need some help putting my calendar back together, with the days in the correct order. And since I need my calendar put together as fast as possible, don't waste my time by sending me ...
Write a program that outputs the number 0. That's a bit trivial, isn't it? Let the length of your program be \$S\$. Write a program that outputs the number 0. When your program is cyclically shifted \$i < S\$ bytes left, it should output \$i\$. To cyclically shift a string \$i\$ bytes left means to move the last \$i\$ ...
Write a program that outputs the number 0. That's a bit trivial, isn't it? Let's sort all distinct permutations of your code in lexicographical order. When any of these codes are run, it should output the its location in the array (0-indexed or 1-indexed). This means that your code must be the lexicographically smalles...
You find yourself in a strange place. A frighteningly dark maze, lit only by dim candles resting in the occasional hallway. Numerous paths lie only in impassable darkness, foreboding and-- ...Hm? What? Pick up a candle and carry it with you? No, no, that would be extremely rude. The Task Given a maze as input, output t...
Background Conway chained arrow notation is a notation to express very large numbers. It consists of zero or more positive integers separated by right arrows, e.g. \$2 \to 3 \to 4 \to 5 \to 6 \$. Assuming \$p, q, a_1, \dots, a_n\$ are positive integers and \$X\$ is an abbreviation for a nonempty chain \$a_1 \to a_2 \to...
(This is A065825.) The sequence defaults apply, so you can pick another format other than this one. Given an input integer n, find the smallest number k so that there exists an n-item subset of {1,...,k} where no three items form an arithmetic progression. Procedure Here, we calculate A065825(9). We assume you have alr...
The Golden Ratio Bureau is obsessed with this new thing they call base-phi. You see it and decide to code-golf, as is your natural instinct. To be specific, base-phi is a number system like base 10, except it uses the number phi, or the golden ratio, as its base. A ones digit would be x*10^y, but in base phi 10 is repl...
Consider the Tetris pieces, but made out of some number of (hyper)cubes instead of four squares, where two blocks are considered the same if one is a rotation, reflection, or translation of another. The goal of this challenge is to take two positive integer input values, n and k, and count the number of \$n\$-celled po...
The skip-pure numbers are defined with this rule: A(0) = 1 A(1) = 1 A(n) = the smallest positive number not in the sequence such that A(x) + A(x-2) for any x never appears For example, the term A(2) is 2, because 1 has already appeared. The term A(3) is 4, as A(2) + A(0) = 3 and 3 is disallowed by the third line of th...
You are given a list of at least two positive integers as input. The challenge is to find such a position of a cut that minimizes the absolute difference between the sums of the two parts (to the left and to the right of it). The position should be given as the index of the first element after the cut. This is tagged c...
Given a list of 2 or more strictly positive integers, sum the first and last half of the list, with the middle element being counted only in the right half if the list has an odd number of elements Some examples of the middle element being counted in the right half: [1, 2, 3, 4] -> Left: [1, 2]; Right: [3, 4] ...
This is based off this challenge. Given an input string, check whether the string is blurry. What's a blurry string? A blurry string is a string that's contained in the set of all blurrified pure-ASCII strings. Take a non-blurrified pure-ASCII string abc as an example. You repeat every character of this twice: aabbcc ...
So I was playing around with this emulator of the Intel 4004 and decided I wanted to set a challenge for myself. The first use for the 4004 was in a calculator, so I decided that I would try to code golf every operator on said calculator(addition, subtraction, multiplication, division, decimal points, and the square r...
With this challenge we pay homage to everyone around the whole world fighting against the coronavirus crisis; particularly represented are the people tied to medicine, as the Rod of Asclepius is a symbol associated with medicine and health care. For that matter, we resort to some ASCII art found at asciiart.eu (wrongfu...
Inspired by This answer to a Puzzling question Background - exponentiation by squaring If you don't want to read the background, or don't understand it, there's a worked example in Java, linked at the bottom of the post. \$a^{2^{x+1}} = a^{2^{x}} * a^{2^{x}}\$ Therefore to find \$a^b\$ (where \$a\$ and \$b\$ are base-1...
Your task is to get two numbers, and output the digit sum of them. We'll define digit sum as the following: take the decimal (base 10) digits of each of them, and pad with 0s the shortest number (e.g. [1,9], [0, 7]) sum the digits as vectors (e.g. [1, 16]) convert the number back from base 19, and output it (e.g. 1*19...
This might be a very basic question in terms of math, x % constant = x_modulus (x + some_number) % constant = y_modulus Given the value of x_modulus, y_modulus, (x + some_number) and constant(common in both), output the value of x itself based on these values.
Russian roulette It's Russian roulette! The rules are simple. Shoot a revolver with n slots for bullets and one round inside at your head and you might not die! This Question is different from other Russian roulette questions because it takes input to change the chance of exiting with an error. Task: Make a program tha...
The task Today's special offer: consonants and punctuation for FREE! Your program or function will be given as input the first 6 paragraphs of Lewis Carroll's famous novel Alice's Adventures in Wonderland, with all vowels [aeiouAEIOU] removed and all other characters left intact. It must output the original text, byte-...
You are given an \$ 25 \times 25 \$ square lattice graph. You are to remove certain nodes from the graph as to minimize your score, based on the following scoring system: Your score will be the \$ \text{number of nodes removed} \$ \$ + \$ the \$ \text{size of the largest connected component} \$. In the smaller \$ 4 \ti...
Given a rectangular board of cells with some number of holes in it, determine whether it is possible to complete a "holey knight's tour" (That is, a path that visits every non-hole cell exactly once using only chess knight moves, not returning to the starting cell) that starts on the top-left cell. For the sake of comp...
(The \$\mathbb{Q}\$ in the title means rational numbers.) Background Conway base 13 function is an example of a strongly Darboux function, a function that takes every real number on any open interval \$(a,b)\$. In other words, for any given real numbers \$a, b, y\$, you can find a value \$x\$ between \$a\$ and \$b\$ su...
Given integers k and n, generate a sequence of n unique k-tuples of pairwise coprime integers. Every such tuple must occur once eventually, that is, for any existing k-tuple of pairwise coprime integers, some n will eventually generate it. The output may be printed or evaluated in any list/tuple-like form. Definitions ...
The goal of this challenge is to extend the OEIS sequence A334581. Number of ways to choose \$3\$ points that form an equilateral triangle from the \$\binom{n+2}{3}\$ points in a regular tetrahedral grid of side length \$n\$. The sequence begins 0, 0, 4, 24, 84, 224, 516, 1068, ... Example For example, if we take sid...
Your task is to take as input a single string (or list of characters, list of code points, etc.) and return the length of the longest substring with no character appearing more than once. Aside: This challenge is similar to Longest Non-Repeating Substring, but without the source restriction ranking submissions by their...
Context After attempting to program in Grass for the entire morning, you decide to go outside and mow some real grass. The grass can be viewed as a string consisting exclusively of the following characters: wWv. w denotes tall grass which takes \$ 1 \$ unit of energy to mow. W denotes extremely tall grass which takes \...
Background Conway immobilizer problem is a puzzle that reads like the following: Three positions, "left," "middle," and "right," are marked on a table. Three cards, an ace, a king, and a queen, lie face up in some or all three of the positions. If more than one card occupies a given position then only the top ca...
Background The Zundoko Kiyoshi function originates from this tweet by kumiromilk. Translated from Japanese, it reads roughly as follows: The test for my Java lecture had a problem that said "Implement and describe your own function". I made it continuously output either "zun" or "doko" randomly; if the sequence "zun",...
Story Martians have been observing Aussie rules football matches from space with great curiosity. Having totally fallen in love with the game, they have been inspired to start their very own football league. However, being dim-witted creatures, they are unable to comprehend the scoring system.* We know that in Aussie r...
The Rubik's Snake (or Rubik's Twist) is a toy consisting of several triangular prisms strung together in a line in such a way that the pieces can be rotated about one another in 90 degree turns. Any snake can be described by an ordered sequence of rotations (format described below). Some sequences do not describe phy...
Background You may be aware that periods in between letters in gmail addresses are ignored. Email sent to example@gmail.com, exam.ple@gmail.com, and e.x.a.m.p.l.e@gmail.com all end up in the same place! This is a great way to have multiple different emails addresses for things like signing up for free trails, or filter...
You are the electoral strategist for a sudden late entrant in the 2020 US presidental election. Your task: print out the names of states* your candidate will win, totalling at least 270 electoral college votes. Background Each state (and Washington DC) in the US system has an arbitrary number of "electoral college vot...
This idea came to me when I saw my little brother playing with my calculator :D The task Taking a integer as an input, print that many graphical square roots under each other, like this: n = 1 ___ \/ 1 n = 3 _______ / _____ / / ___ \/\/\/ 3 n = 5 ___________ / _________ / / _______ / ...
Introduction A picross, also known as a nonogram, is a logic puzzle in which the player is given an initially blank grid and must shade in particular boxes on the grid to reveal an image. Numbers are written on the top and the left side, and they explain the image's coloration: each number corresponds to an unbroken li...
The task Given a multiline string with ascii art operators and numbers, parse the expression! Possible symbols Numbers: (3x4) / /| | --- ___ _| | --- ___ _| | --- | | |_| | | ___ |_ | --- ___ |_ | | --- ___ / / | ___ |_| | | --- ___ |_| | --- ___ | | | | --- Operators: (3x3) | -+- | ---...
Related to, but not a duplicate of, this challenge. Basics This is a clock: ****** ** | ** ** | ** * | * * | * * | * * | * * | * * ...
United States senators are sorted into three classes, based on what year their six-year term starts. Since each state has two senators, each state has a senator in two of the three classes. Given a full state name and a class number (1, 2, or 3), output truthy if that state has a senator of that class, and falsey if th...
Inspiration The longest words that can be typed with only the left hand on a standard QWERTY keyboard are "sweaterdresses", "tesseradecades", and "aftercataracts" (Source: Wikipedia). Challenge Given as input a "keyboard" \$K\$ and a string \$S\$ determine whether \$S\$ can be typed using only the left hand on keyboard...
Given a non-empty list of digits 0 though 9, output the smallest number that can be produced by an expression formed by reordering these digits and introducing exponentiation signs ^, with adjacent digits getting concatenated as multi-digit numbers. Exponentiation is evaluated as right-associative. For example, [4, 2, ...
Integers in cosine From trigonometry we know that \$\sin(a) =-\cos(a + \frac{(4*m + 1)\pi}{2})\$ where \$a\$ is an angle and \$m\in\mathbb{Z}\$ (integer). The task For an input of a positive integer \$n\$ calculate the value of the integer \$k\$ with \$n\$ digits that minimizes the difference between \$\sin(a)\$ and \$...
Produce this square snowflake. XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XX X X X X X X X X X X X X X X XX X XXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXXX XXXX X XX X X X X X X X X X X X X XX X X XXX XXXX XXXX XXXX ...
Background Conway criterion is a method to test if a given polygon can tile (i.e. cover without overlapping) an infinite plane. It states that a polygon can tile the plane if the following conditions are met: The given polygon does not have any holes in it. It is possible to choose six consecutive1 points \$A,B,C,D,E,...
This challenge is a riff on Dion's challenge "Is this a rectangle?". The goal of this challenge is to write a program to decide whether or not some collection of tuples of integers represents a hypercube of some dimension. Background A hypercube is a generalization of a square. A \$0\$-cube is a single point. A \$1\$...
Inspired by Braille graphics and Build an analog clock. The goal there is to create a tool that use terminal console to draw and animate a clock by using UTF-8 fonts \U2800: ⠀ to \U28FF: ⣿. 00:[⠀] 01:[⠁] 02:[⠂] 03:[⠃] 04:[⠄] 05:[⠅] 06:[⠆] 07:[⠇] 08:[⠈] 09:[⠉] 0A:[⠊] 0B:[⠋] 0C:[⠌] 0D:[⠍] 0E:[⠎] 0F:[⠏] 10:[⠐] 11:[⠑] 12:...
The task Given an ascii string, output a program in my esolang MAWP that outputs the inputted string when run. Useful functions in MAWP Numbers from 0-9: Pushes the number to stack M Takes the top two numbers off stack and pushes the sum to stack A Takes the top two numbers off stack and...
Intro Beauty lies in the eye of the beholder. Output lies in the choice of the compiler. There are some codes that give different outputs based on what language they are executed in. Take for instance, the code given below: # include <stdio.h> # define print(a) int main(){printf("C is better"); return 0;} print("Python...
Leon's story Leon is a professional sling shooter and he comes to a shooting range everyday to practice. A casual target is not a challenge for him anymore so before shooting he first covers the target of radius 1.0 with k rectangle stickers. He then fires n shots that cannot hit the stickers. What's special about Leo...
Background Consider the shape \$T(n)\$ consisting of a triangular array of \$\frac{n(n+1)}{2}\$ unit regular hexagons: John Conway proved that \$n = 12k + 0,2,9,11\$ if and only if \$T(n)\$ can be tiled (i.e. exactly covered without overlapping) with \$T(2)\$. At the same time, he also proved that no coloring argument...
My mom really wants me to eat broccoli, but I hate it and never want to eat it. Mom wants to trick me so she cuts it into small pieces, puts it in a salad and mixes it. Help me find out if the salad contains broccoli! Input: Array of mixed letters of all the ingredients. For a single broccoli ingredient it could be: [c...
On a toroidal square grid (you can wrap around) where each cell indicates one direction (^ > v <) if we pick a cell and start to walk following these directions, we will eventually get stuck in a loop. We may end up in a different loop, depending on our starting cell. Not all the cells we encounter constitute our term...
You step into the restroom, and notice that the toilet paper has missing! It occurs to you that someone had stolen it. Strangely enough, the first thing you would like to know is the amount of toilet paper the thief stole. Task You are given three integers \$ I \$, \$ R \$, and \$ G \$, the details of the toilet paper,...
Challenge Given a positive integer n, you must calculate the nth digit of \$e\$, where \$e\$ is Euler's number (2.71828...). The format of the output can be a number or a string (e.g., 3 or '3') Example # e = 2.71828... nthDigit(3) => 8 nthDigit(1) => 7 nthDigit(4) => 2 Shortest code wins.
I came across an interesting tiling of the plane using squashed hexagons in a popular math book. All the six edges of the squashed hexagon are the same length. Two opposite corners are right angles and the rest four corners are 135 degrees each. This shape allows four squashed hexagons be arranged so that they meet at ...
The task Given a positive integer c, output two integers a and b where a * b = c and each a and b is closest to sqrt(c) while still being integers. Test cases Input: 136 Output: 17 8 Input: 144 Output: 12 12 Input: 72 Output: 9 8 Input: 41 Output: 41 1 Input: 189 Output: 21 9 Rules a, b and c are all positive int...
We define \$a(n)\$ as the 1-indexed position of \$n\$ in the sequence of positive integers with the same binary weight, i.e. the same number of 1's in their binary representation. This is A263017. Given a positive integer \$n\$, your task is to determine how many positive integers \$k\$ satisfy: $$k-a(k)=n$$ For instan...
The variable star designation is an identifier for a variable star (a star that fluctuates in brightness). It consists of either a 1-2 letter code or (when the letter code is no longer sufficient) a 'V' followed by a number. This code is followed by the genitive of the star constellation the star is found in (eg. "RR C...
Challenge You have been given a string of digits 0-9.1 Your task is to shuffle this string, but every index must have a different value than it did before the string was shuffled. For example: In : 287492 Out: 892247 If this is not possible, return false or something similar. (null, undefined, etc.) In : 131 Out: fals...
If you are given an array of numbers between 1 and 100 and an integer n, you must remove any instances of an item that appear greater than n times. For example: In : [92, 41, 81, 47, 28, 92, 84, 92, 81], n = 1 Out: [92, 41, 81, 47, 28, 84] The most aesthetic/simple algorithm wins. And since this is a popularity-contes...
It's time to conclude the series of John Conway challenges of mine. Background A FRACTRAN program consists of an ordered list of fractions. The program starts by taking a single integer as input. Each iteration of the program, it searches the list for the first fraction such that multiplying the number by that fraction...
Partially inspired by this question. Overview The execution of Goggle kids Code starts with an empty binary tape with 100 items, with the pointer starting at the index 0: 00000... ^ At the end of the execution, you can assume that the tape is implicitly outputted. Instructions Goggle kids Code is a simple language inv...
Task Write a program or function that takes as input a time in UTC, and outputs the equivalent time in 5 different cities around the world. The cities displayed are up to the programmer, but the time must be different in each city. To prevent golfers from using overly obscure city names, the city names used must appear...
Input: A string (or the closest thing to that in your language) Output: The same string but converted to sentence case Rules: For this challenge, sentence case can be considered "The first letter of each sentence is capitalized. The rest are lowercase." (i.e. proper nouns do not have to be capitalized) If the input do...
Back in 2018, there has been introduced new law in Poland to ban trading on sundays, but certain exceptions have been made (listed below). The task today is to determine, can one trade on the sunday provided by the user (according to these rules). Rules You can trade only if one of the following is satisfied: The day ...
Given a strictly positive integer, N, produce an output satisfying the following: Produce an array of length N. Every string (i.e. "word") in the array is of length N. Every letter in the word is unique. Every first letter of the words are unique between each other. The remaining items of each word are equal to each o...
A great Python golfing tip is to omit needless spaces. But if you are like me, you don't always have the time to search for which spaces to remove. If only there was a way to speed up the process... Task Given a single line of Python, as input, return/output a new line which omits all needless spaces. The table below s...
The world is full of Turing-complete programming languages. Just about every useful language (and most useless ones) are Turing-complete. Some even became Turing-complete by accident. Often this is great, since every Turing-complete language supports the same power of universal computation. But the power of Turing ...
Background Bilibili is a China-based video sharing platform, similar to Nico Nico Douga in Japan, and Youtube around the world. Since the establishment, Bilibili had been using the AV code to reference a video. An AV code is a string of 3 or more characters, starting with av and followed by a natural number, like av820...
I've invented an SQL-like language. Let's call it SelectQL. You can't INSERT anything, you can only SELECT, and I don't have the time for an interpreter. How about you help? The Challenge Write a full program or a function that takes in a database of tables and a valid SelectQL SELECT string, interprets the string, and...
What all languages have a construct similar to python's eval, so you can write code during runtime and run it? A list would be helpful for certain programming challenges - ones where it is obvious an eval is either necessary or highly efficient.
I'm looking for a program such that, given a finite list of strings, can find short regexes to match exactly all of them and nothing else. Since there are multiple languages that express regexes differently, there can correspondingly be multiple regex generators. Each answer must discuss regex generation in one langaug...