instruction
stringlengths
34
53.1k
Every positive integer can be expressed as the sum of at most three palindromic positive integers in any base b≥5.   Cilleruelo et al., 2017 A positive integer is palindromic in a given base if its representation in that base, without leading zeros, reads the same backwards. In the following, only base b=10 will be c...
We have objects that oscillate between two integer points, [l, r], at the speed of one unit per time unit, starting at l on t=0. You may assume l < r. For example, if an object oscillates on [3, 6], then we have: t=0 -> 3 t=1 -> 4 t=2 -> 5 t=3 -> 6 t=4 -> 5 t=6 -> 4 t=7 -> 3 t=8 -> 4 Etc. But objects oscillate continu...
Non-math explanation This is an explanation that is meant to be approachable regardless of your background. It does unfortunately involve some math, but should be understandable to most people with a middle school level of understanding A pointer sequence is any sequence such that \$a(n+1) = a(n-a(n))\$. Lets pick apar...
How can I shorten: p=gets.to_i a=gets b=gets.to_i If my input is an integer, followed by a string, followed by an integer?
Let's say you have a positive integer N. First, build a regular polygon, that has N vertices, with the distance between neighbouring vertices being 1. Then connect lines from every vertex, to every other vertex. Lastly, calculate the length of all lines summed up together. Example Given the input N = 6, build a hexagon...
iOS 11 has a bug that makes the result of 1+2+3 to be 24. This is related to the animation speed, but anyway: The task is to make 1 + 2 + 3 == 24. But only that. So you should provide a function that correctly sums most sequences but returns 24 when the arguments are 1, 2 and 3 in any order. Example inputs: 1 2 => 3 3 ...
related What's assignable to what? In this challenge you will be given two types, A and B and determine if A is assignable to B, B is assignable to A, or neither. The Type System (I will use t to represent any type) Basic Types Basic types are represented by a single capital letter, such as X. They are basically class...
Write a non-empty program or function that when called outputs a single value, 1 or 0, and when called multiple times, the output numbers produce the binary representation of your program's source code (in the same code page from which your code is compiled/interpreted). For instance, if your source code was abc (in AS...
Given a positive integer n, output the smallest base b >= 2 where the representation of n in base b with no leading zeroes does not contain a 0. You may assume that b <= 256 for all inputs. Test Cases 1 -> 2 (1) 2 -> 3 (2) 3 -> 2 (11) 4 -> 3 (11) 5 -> 3 (12) 6 -> 4 (12) 7 -> 2 (111) 10 -> 4 (22) 17 -> 3 (122) 20 -> 6 (...
There's never really been a definitive ASCII-cards challenge AFAIK. So, using the following deck of ASCII cards: .------..------..------..------..------..------..------..------..------..------..------..------..------. |2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--....
Challenge Given a list, determine if grouping the list into runs of increasing and decreasing elements will result in a list of equal-sized lists. In other words, "turning points" of the list are spaced out evenly. Example Here's an example: 0, 3, 7, 5, 2, 3, 6 0, 3, 7 increases, 7, 5, 2 decreases, and 2, 3, 6 increase...
I've been really interested with sequences that follow the property \$a(n+1) = a(n - a(n))\$ recently, so here's another question about these sequences. In particular we are concerned with sequences from the integers to the natural numbers. A periodic sequence with the above property is an n-Juggler if and only if it...
Your task today is to write a program or function that takes an array of integers, and counts the number of times, reading it left to right, that the value changes. This is easier to show with an example: [1 1 1 2 2 5 5 5 5 17 3] => [1 1 1 **2** 2 **5** 5 5 5 **17** **3**] => 4 Test case: Input | Output [] ...
Inspired by this video by tecmath. An approximation of the square root of any number x can be found by taking the integer square root s (i.e. the largest integer such that s * s ≤ x) and then calculating s + (x - s^2) / (2 * s). Let us call this approximation S(x). (Note: this is equivalent to applying one step of the ...
The Illuminati commands you (with their mind control) to output the following string: ^ /_\ /_|_\ /_|_|_\ /_|/o\|_\ /_|_\_/_|_\ /_|_|_|_|_|_\ /_|_|_|_|_|_|_\ /_|_|_|_|_|_|_|_\ /_|_|_|_|_|_|_|_|_\ Rules: Trailing spaces are allowed for each line. Leading spaces in each line...
Task Create a program or a function that is valid in multiple programming languages, and when compiled/interpreted as a different language outputs "Hello, World!" in a different natural language. For example, a valid solution might output Hello World! (English) when compiled and run as C, Hallo Welt! (German) when comp...
Given a textual representation (case-insensitive full name or 3 character abbreviation) of a month return the number of days in the month. For example, december, DEC, and dec should all return 31. February can have either 28 or 29 days. Assume the input is a month in one of the correct forms.
Your task is to make a program that measures how fast you can type the letters of the English alphabet. The program shall only accept lowercase letters a to z in alphabetical order. Each letter is echoed as typed on the same line (without new line or any other separators between letters). If you type an invalid char...
Suppose an infinite tiling of hexagons composed of |/\ characters. / \ / \ / \ / \ | | | | | \ / \ / \ / \ / etc. | | | | \ / \ / \ / Given input n > 0, output a triangular portion of that tiling as depicted in the below examples, anchored with a _ in the middle of a hexagon: n=1 \_/ n=2 \/ \/ ...
Given an email address, the result of a transformation applied to that email address, and a second email address, return the output of the same transformation applied to the second email address. The email addresses will all have the following structure: A string of positive length containing alphanumeric characters an...
Upon the rumor that Codegolf will have a Rock-Paper-Scissors tournament you look into the topic of square-free words. A word made of the letters R, P, S is square-free if it does not contain a sequence that repeats twice. That is to say, the word can not be written as a x x b where a and b are words of any length and ...
Note: In this post, the terms 'character' and 'color' mean essentially the same thing This image: can be represented as ....'''333 .eeee'''3e ..dddd33ee %%%dd####e (mapping colors to ascii characters) The four color theorem states that "given any separation of a plane into contiguous regions, producing a figure cal...
Challenge: Inputs: A string containing printable ASCII (excluding spaces, tabs and new-lines) A boolean † Output: The parts of the String are divided into four groups: Lowercase letters Uppercase letters Digits Other Based on the boolean, we either output the highest occurrence of one (or multiple) of these four gr...
In this thread we use 32-bit signed integers (assuming the usual two's complement). For simplicity I shall call this type Int32. The range is from -2147483648 through 2147483647. Any two values can be successfully multiplied (the result is an Int32 as well) since we use multiplication without overflow checking (we only...
Write the shortest code measured by byte count to generate an ASCII grid composed of rhombi, given the following parameters: m - number of complete rhombi in one row n - number of rows s - side of the smallest rhombus r - level of nesting - how many rhombi are there inside the "base ones" (which are fonud between the...
Your challenge is to write N snippets of code such that, when you concatenate the first K ≥ 1 together, they produce the number K. The higher N, the better. Here's the catch: you may not use any character more than once across your snippets. Rules You may use the same character multiple times in one (and only one) sni...
Web safe colors are in intervals of 51, they include 0, 3, 6, 9, c, and, f as digits in hex (such as #993333), or 0, 51, 102, 153, 204, 255 in decimal. Your task today is convert a given color to a web safe one. You may read more about web safe colors on Wikipedia. Input You will take in 3 integers between 0, 255 inclu...
Code a program or function to construct an interactive canvas on the screen of at least 400 pixels x 400 pixels in size. The canvas can be any color you wish, bordered or borderless, with or without a title bar, etc., just some form of obvious canvas. The user will click on two distinct areas of the canvas and the prog...
For the purposes of this challenge, a polyphthong is defined as a contiguous slice of a String, that only contains vowels, and has length at least 2. Given a non-empty String as input, your task is to output all the polyphthongs it contains. For example, "abeoic" has the following contiguous slices (space-separated): a...
Print the following output of a happy coincidence addition pattern: 8 8 8 88 +888 ---- 1000 Rules: No leading spaces except the ones already present There can be a trailing newline + sign needs to be displayed Order of parcels needs to be the same No winner. It is code-golf per language.
This is a pretty simple one. if the user enters "Hello World" your code should output "dlroW olleH" I was inspired by the multiplication question recently posted. I know this is probably easy in bash. As this is code-golf, least bytes wins.
Introduction: When we think about Ladybugs, we usually think of a red or dark orange bug with black spots. Although this isn't necessary true, since there are also black with red/orange spotted ladybugs, or ladybugs without spots at all, we mainly picture ladybugs something like this Asian Ladybug: Another thing to no...
Write a program or a function that accepts the list of outputs from a logic function and outputs the LaTeX code for its truth table. The inputs should be labeled as lowercase letters a-z, and the output should be labelled as F. The length of list of inputs will always be shorter than 2^25, which means that number of in...
RLE Brainfuck (related to BF-RLE) The hypothetical RLE (Run-Length Encoding) dialect of Brainfuck accepts the symbols for the 8 commands and also accepts digits. The digits are used to represent the number of successive repetitions of a command, thus allowing run-length encoding of the source code. 8> is equal to >>>>>...
This is the Cop post. The Robber post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written backwards: 1, 4, 9, 61, 52, 63, 94, 46, 18, 1, 121, 441, ... Note that leading zeros are trimmed away (100 becomes 1, not 00...
This is the Robber post. The Cop post is here. Your task is to take an integer input N and output the Nth digit in the sequence OEIS A002942. The sequence consists of the square numbers written backwards: 1, 4, 9, 61, 52, 63, 94, 46, 18, 1, 121, 441, ... Note that leading zeros are trimmed away (100 becomes 1, not 00...
A Latin Square is a square of size n × n containing numbers 1 to n inclusive. Each number occurs once in each row and column. An example of a 3 × 3 Latin Square is: [[1, 2, 3], [3, 1, 2], [2, 3, 1]] Another is: [[3, 1, 2], [2, 3, 1], [1, 2, 3]] Given an integer input n where n > 0, determine how many Latin Square...
You will be given two Arrays / Lists / Vectors of non-negative integers A and B. Your task is to output the highest integer N that appears in both A and B, and is also unique in both A and B. You may assume that there is at least one such number. Any reasonable Input and Output method / format is allowed. These Looph...
A special case of Ramsey's theorem says the following: whenever we color the edges of the complete graph on 18 vertices red and blue, there is a monochromatic clique of size 4. In language that avoids graph theory: suppose we place 18 points around a circle and draw all possible line segments connecting them in one of...
It is trivially possible to create a bijective function from \$\mathbb{Z}\$ (the set of all integers) to \$\mathbb{Z}\$ (e.g. the identity function). It is also possible to create a bijective function from \$\mathbb{Z}\$ to \$\mathbb{Z}^2\$ (the set of all pairs of 2 integers; the cartesian product of \$\mathbb{Z}\$ an...
Hexagonal tessellations, or tilings of the plane, are three-colorable -- meaning that using only three colors, such as Red, Blue, and Green, every hexagon can be colored without any two hexagons that share a border sharing a color. A partial example showing such a pattern. Given a partial hexagonal tiling in ASCII (via...
Your input is a list/sequence/vector/array of 5-255 positive integers, not necessarily unique. You may assume whatever input format is most suitable, and that each integer (as well as the quantity of integers) is chosen uniformly at random from the range 5-255. The goal is to output the same list, in the same (or equi...
I was looking for this page to help me enhance my first answer with SQLite, but I couldnt find one. So here we are! What general tips do you have for golfing in SQLite? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to SQLite. Please post one tip per answe...
Note: This is #3 in a series of array-manipulation challenges. For the previous challenge, click here. Moving Average of a List The moving average of a list is a calculation resulting in a new, smoothed out list, created by averaging small overlapping sublists of the original. When creating a moving average, we first...
The infinite monkey theorem states that, given infinite time, a machine sending an endless stream of random characters will always type any given text. That sounds to me like a great idea for a challenge. Process In order to monkey-ize a string A, the following steps should be taken: Take an empty string. We will call...
In Dungeons & Dragons 5th edition (as well as most other editions), there exists a magic item called the Deck of Many Things. It is an incredibly powerful item, as the cards all have very strong positive or negative effects. To use the deck, a character declares a number, and then draws up to that number of cards, with...
Challenge Given a list of positive integers, find if there exists a permutation where taking up to one bit from each of the integers, a binary number consisting of all 1s can be created. The number of bits in the resulting binary number is equal to the highest MSB in the list of integers. Output Your code must output o...
If we define a Fibonacci-like sequence as fk(n) = (fk(n-1) + fk(n-2)) % k, for some integer k (where % is the modulo operator), the sequence will necessarily be cyclic, because there are only k2 different values for (fk(n-1), fk(n-2)). However, this cycle doesn't usually include all possible pairs of values, so dependi...
Given a string s, return the smallest contiguous substring you can remove to create a palindrome. Examples: 800233008 -> 2 racecarFOOL -> FOOL abcdedcba -> (empty string) ngryL Myrgn -> "L " (or " M") 123456789 -> 12345678 (or 23456789) aabcdbaa -> c (or d) [[]] -> [[ (or ]]) a -> (empty stri...
The prime cluster of an integer N higher than 2 is defined as the pair formed by the highest prime strictly lower than N and the lowest prime strictly higher than N. Note that following the definition above, if the integer is a prime itself, then its prime cluster is the pair of the primes preceding and succeeding it. ...
Consider the process of "picking" a nested list. Picking is defined as follows: If the argument is a list, take an element from the list at random (uniformly), and pick from that. If the argument is not a list, simply return it. An example implementation in Python: import random def pick(obj): if isinstance(obj, ...
Before you leave, you do not have to understand much musical notation to do this challenge. EXPLANATION In standard sheet music, double clefs go across the page serving as reference points to the notes, letting you know what note should be played. If you are not already familiar with the treble and bass clef, here i...
It is common to need to make a page selection interface. It typically looks like this: prev 1 ... 3 4 [5] 6 7 ... 173 next Which means there are totally 173 pages, and you are on the 5th page currently. This challenge requires you take the total number of pages and the current page number as input, and output a string...
Challenge: Output all distinct permutations of a, potentially long, list of positive integers. You may assume that the vector has less than 1,000 numbers when testing, but the process should in theory work for any vector with more than one number regardless of size. Restrictions: You must restrict the memory usage to ...
Title is made up, from 'Sequence Index Digit Not'. Challenge: Given an integer n which is >= 0, output the n'th number of the following sequence. Here are the first 50 items, with it's (0-indexed) index above it: 0 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 31 32 33 34 35 36 37 38 ...
Your challenge today is to take a multiline string, and output the biggest square contained within the string that includes the top left corner. A square string is one where: Each line has the same number of characters The number of characters on each line is equal to the number of lines. Consider the following poss...
Expand a number Your task is to expand an integer greater than 0 in the following manner: Split the number into decimal digits and for each digit generate a list according to these rules: if the digit is odd, the list starts with the digit and goes down to 1; if the digit is even, the list starts with the digit and go...
The Challenge Your task is to create a program or function that outputs the following with no input: a bb ccc dddd eeeee ffffff ggggggg hhhhhhhh iiiiiiiii jjjjjjjjjj kkkkkkkkkkk llllllllllll mmmmmmmmmmmmm nnnnnnnnnnnnnn ooooooooooooooo pppppppppppppppp qqqqqqqqqqqqqqqqq rrrrrrrrrrrrrrrrrr sssssssssssssssssss tttttttttt...
In my language Pyramid Scheme, there is a slightly funny construct: the empty triangle: ^ - When given no arguments, it returns 0. To generate 1 using this construct, we could use this: ^ /!\ ^--- - This simply passes 0 to the negation function. We can continue negating this result: ^ /!\ ---^ /!\ ^--- - ...
Background For my code-golf submissions in C, I need a processing tool. Like in many other languages, whitespace is mostly irrelevant in C source (but not always!) -- still makes the code much more comprehensible for humans. A fully golfed C program that doesn't contain a single redundant whitespace often is barely rea...
Final Result The competition is over. Congratulations to hard_coded! Some interesting facts: In 31600 out of 40920 auctions (77.2%), the winner of the first round won the most rounds in that auction. If example bots are included in the competition, the top nine places won't change except that AverageMine and heurist ...
The purpose of this challenge is to determine if a collection of one-dimensonal pieces can be tiled to form a finite continuous chunk. A piece is a non-empty, finite sequence of zeros and ones that starts and ends with a one. Some possible pieces are 1, 101, 1111, 1100101. Tiling means arranging the pieces so that a si...
What general tips do you have for golfing in QBasic? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to QBasic (e.g. "remove comments" is not an answer). Tips pertaining to the QB64 emulator are also welcome. It has some extra features that aren't in Micros...
Given the output of the cop's program (o), the byte-count (n) and the number of unique bytes (c) used, come up with a corresponding piece of code that is n bytes long with c unique bytes which matches the cop's output o. This is the cops thread. Post solutions that are to-be-cracked here. The robbers thread is located...
Given the output of the cop's program (o), the byte-count (n) and the number of unique bytes (c) used, come up with a corresponding piece of code that is n bytes long with c unique bytes which matches the cop's output o. This is the robbers thread. Post solutions that you cracked here. The COPS thread is located here....
Given a square integer matrix as input, output the determinant of the matrix. Rules You may assume that all elements in the matrix, the determinant of the matrix, and the total number of elements in the matrix are within the representable range of integers for your language. Outputting a decimal/float value with a fra...
Consider the following sequence: 1, 0, 1, 2, 4, 1, 6, 8, 0, 1, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 1, 0, 2, 4, 6, 8, 0, 1, ... The even digits start from 0 and are grouped into runs of increasing length. They are arranged cyclically, meaning that they are sorted in ascending order until 8 is reached, and then cycled back fr...
I'm hungry. Let's microwave something. Given a numerical input of between 1 and 4 digits, output the number of seconds that the microwave should run. Details The trick is figuring out if the user is inputting seconds or a combination of seconds and minutes. The ones and the tens places should be interpreted as seconds ...
Rectangle covers Suppose you have a matrix of bits, for example the following. 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 0 1 We would like to find a rectangle cover for this matrix. It is a set of rectangular subsets of the matrix that don't contain any 0s, but together contain all th...
Given a positive integer input N, output the two non-negative numbers, a and b, where a < b, with the lowest possible mean value that will result in the number N being part of the recurring relation sequence: f(0) = a f(1) = b f(n) = f(n-2)+f(n-1) In case there are more than one solution where the mean of a and b are ...
In this challenge, your task is to take an anion and a cation, and output the chemical formula of the compound. Input rules Take in 2 strings (in any order) representing the anion and cation, e.g. F, NH_4, or Al. To take in the charge of each ion, you can either have it as part of the string separated by a caret (e.g...
Given an n-dimensional array filled with numbers, output which p-dimensional array has the largest sum. Input An n-dimensional array of numbers, or your language's equivalent. You can assume this is a rectangular array, or not. n, the number of dimensions in the array. (doesn't need to be called n) p, the number of di...
Your task is to, given an unsigned integer n, find the largest number which can be created by removing a single byte (8 consecutive bits) of data. Example Given the number 7831, we first convert it to binary (removing any leading zeroes): 1111010010111 We then find the consecutive group of 8 bits which, when removed,...
Alternate Title: Tally Your Prison Sentence on the Wall Given a number n, output tallies grouped into the traditional 5-per-group and 50 per row. Examples 1 | | | | 4 |||| |||| |||| |||| 5 |||/ ||/| |/|| /||| 6 |||/ | ||/| | |/|| | /||| | 50 |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ ||/| ||/| ||/| ||/| ||/...
Background The Thousand Character Classic is a chinese poem written around the 4th Century CE in China, and memorized by large populations since then. The name comes from not only its length, but its number of characters: each character occurs only once in the text. It is commonly used to teach children chinese charact...
Given a list of unique strings that are anagrams of each other, output an anagram of those words that is different from each word in the list. The strings will be alphanumeric, and there is guaranteed to be a valid anagram. The program or function can, but doesn't have to be non-deterministic, meaning given the same in...
Introduction Every rational number between 0 and 1 can be represented as an eventually periodic sequence of bits. For example, the binary representation of 11/40 is 0.010 0011 0011 0011 ... where the 0011 part repeats indefinitely. One way of finding this representation is the following. Start with r = 11/40, then rep...
Given a string, return whether the string is a substring of the program's source code. Standard quine rules apply, meaning you cannot read your own source code. The length of the input is guaranteed to be less than or equal to the length of the program. You may return any two distinct values, not necessarily truthy and...
Bobby's booby-trapped safe requires an n-digit code to unlock it. Alex has a probe which can test combinations without typing them onto the safe. The probe responds Fail if no individual digit is the same as that in its corresponding position in Bobby's code. Otherwise it responds Close, including when all digits are c...
Input The input is a single positive integer n Output The output isn with its most significant bit set to 0. Test Cases 1 -> 0 2 -> 0 10 -> 2 16 -> 0 100 -> 36 267 -> 11 350 -> 94 500 -> 244 For example: 350 in binary is 101011110. Setting its most significant bit (i.e. the leftmost 1 bit) to 0 turns it into 001011110...
Minecraft inventory management is hard. You have 17 diamonds, but you need 7 to craft an enchantment table, a pickaxe, and a sword. Do you pick them up and right click 7 times? Or do you right click once and right click twice and take the 7 left? It's so confusing! for those of you who are now confused, don't worry, I'...
Task Given a letter (A, B, C), and a number (0-10), output the size of the matching standard paper size (Series A and B) or the matching standard envelope size (C series) in millimetres in the format aaaa x bbbb where aaaa and bbbb are the width and height measurements in millimetres as per ISO216 (Series A & B) or ISO...
Mathematical Background Let A be an N by N matrix of real numbers, b a vector of N real numbers and x a vector N unknown real numbers. A matrix equation is Ax = b. Jacobi's method is as follows: decompose A = D + R, where D is the matrix of diagonals, and R is the remaining entries. if you make an initial guess solutio...
An EAN-8 barcode includes 7 digits of information and an 8th checksum digit. The checksum is calculated by multiplying the digits by 3 and 1 alternately, adding the results, and subtracting from the next multiple of 10. For example, given the digits 2103498: Digit: 2 1 0 3 4 9 8 Multiplier: 3 1 ...
BCD difference Given an integer n, convert it to BCD (binary-coded decimal) by replacing each decimal digit with its 4-digit binary representation 234 -> 0 0 1 0 0 0 1 1 0 1 0 0 Then rotate the list of binary digits in order to find the largest and smallest numbers, representable by this list without other rearrange...
It is well known that a person on a grid under the influence of alcohol has an equal chance of going in any available directions. However, this common-sense statement does not hold in the realm of very small drunkards, whose behavior is very much as if they take every available path at once, and the possible paths they...
Background In C, there is a function to help parse command-line arguments: getopt. Getopt takes the argument count (argc), the argument list (argv), and a string representing the options the program should take (optstring). The option string (optstring) is a series of option characters each followed by one colon (for a...
Write a program that reviews posts for the Close Votes queue on Stack Overflow. Since it's near-impossible to write a bot that can accurately review posts in the actual queue, we're instead going to use a grossly oversimplified version of the queue and its rules. Your program should take in the body of a question as a ...
Goal Morse code is often represented as sound. Given a stream of bits that represent whether sound is on or off, translate the stream into letters and numbers and spaces. Specifics The bit stream is analysed based on the length of repeating ON/OFF bits. 1 ON bit is a dot 3 ON bits are a dash 1 OFF bit delimits dot...
Task Take input string separated by space. Sort the words alphabetically. Print them out vertically in 3 columns separated by space(s). Challenge All three column's heights should be as evenly weighted as possible. All three column's should be left aligned. This is code-golf, so shortest code wins! Example If the i...
There are several ways to create headers on posts on the Stack Exchange network. The format that's most commonly1 used on PPCG seems to be: # Level one header ## Level two header ### Level three header Note the space after the hash marks. Also, note that trailing hash marks are not included. Challenge: Take a (possib...
A bipartite graph is a graph whose vertices can be divided into two disjoint set, such that no edge connects two vertices in the same set. A graph is bipartite if and only if it is 2-colorable. Challenge Your task is to, given the adjacency matrix of an undirected simple graph, determine whether it is a bipartite grap...
Make me an icecream cone please We have a ton of great ice cream places here in New England. Most of them are closed for the winter now, so... .-@@-. (======) (--------) (==========) (__________) \/\/\/\/\/ \/\/\/\/ \/\/\/ \/\/ \/ GOAL Output the above icecream cone exactly. (or return it from ...
A number is whole if it is a non-negative integer with no decimal part. So 0 and 8 and 233494.0 are whole, while 1.1 and 0.001 and 233494.999 are not. Input A floating-point number in the default base/encoding of your language. For example, the default integer representation for Binary Lambda Calculus would be Churc...
According to TIO there are two types of programming languages: Practical (seen in many corporate environments as a development standard). Recreational (if seen in a corporate environment, you're probably fired). Your Task Mix together one language from each of these realms to achieve the simple goal of calculating th...
Task: Given an integer number in decimal number system, reduce it to a single decimal digit as follows: Convert the number to a list of decimal digits. Find the largest digit, D Remove D from the list. If there is more than one occurrence of D, choose the first from the left (at the most significant position), all oth...
Introduction I don't see many regex challenges on here, so I would like to offer up this deceptively simple one which can be done in a number of ways using a number of regex flavours. I hope it provides regex enthusiasts with a bit of fun golfing time. Challenge The challenge is to match what I've very loosely dubbed a...
Consider a triangle where the Nth row (1-indexed) is the array of the first N positive integer powers of N. Here are the first few rows: N | Triangle 1 | 1 2 | 2 4 3 | 3 9 27 4 | 4 16 64 256 5 | 5 25 125 625 3125 ... Now if we concatenate those powers into a single sequence, we get OEIS A075363: 1, 2, 4, 3, 9, 27, 4...
Alternate name: ChessMoveQ Given a list of up to 32 elements, each consisting of 4 elements, and a second list with 4 elements, determine whether the move detailed in the second input is a valid chess move. The first list indicates the position of all 32 pieces on the board. Each element will follow the structure <colo...
Task Given a representation of a line, output the number of quadrants that that line passes through. Valid Representations of a Line You can represent a line as Three signed integers A, B, and C which share no common factor and where A and B are not both zero, representing the line Ax + By = C, Four signed integers X1...