instruction
stringlengths
34
53.1k
Can this container hold this much liquid? Challenge Synopsis As you most likely know, liquids have an indefinite shape and a definite volume. As such, they always take the shape of their container. They cannot, however, expand to fill their container. Your job today is to determine whether or not a certain amount of li...
Challenge Return the full contents of your program, but inverted. How do your invert something? Well, Letters: Take the position of the letter in the alphabet, subtract from 26, and use the letter at that position and flip the case of the letter. E.g A becomes z, and p becomes J. Digits: Subtract from 9. E.g 6 becomes ...
Introduction In order to prevent keyloggers from stealing a user's password, a certain bank account system has implemented the following security measure: only certain digits are prompted to be entered each time. For example, say your target's password is 89097, the system may prompt them to enter the 2nd, 4th and 5th ...
Challenge Input: An integer \$b\$ between 2 and 62 (inclusive). Output: Count from \$1\$ to the equivalent of \$5000_{10}\$ in base \$b\$, using any reasonable representation for the digits. However: If the number is divisible by \$\lfloor b÷2+1\rfloor\$ (rounded down, e.g base 7 would be 7/2=3.5, 3.5+1=4.5, rounded t...
Your task is to create a program where if any one character is deleted, it will detect which character was deleted and then re-insert the deleted character in its own source file. For instance, if your program is RadiationHardened and it is modified to RadiaionHardened, then your program must output that the 5th byte (...
You will receive an array and must return the number of integers that occur more than once. [234, 2, 12, 234, 5, 10, 1000, 2, 99, 234] This will return 2, since each of 234 and 2 appear more than once. [234, 2, 12, 234] [2, 12, 234, 5, 10, 1000, 2] The list will never be more than 100k integers long, and the integer...
Write a program or function that, when given a string, filters out as many distinct bytes as it can and returns the cleaned string. However, since your program hates them, none of these bytes can be present in your own code. Your score will be the number of distinct bytes your program filters out from the input, with t...
Below Python code generates memory leak. Challenge: Fix the memory leak with minimal changes to the code as measured by Levenshtein distance to the original code. You may only change the code before t is initialised. When the del t line is removed the modified program should print I'm still alive! every second. PS: I ...
Given a decimal number k, find the smallest integer n such that the square root of n is within k of an integer. However, the distance should be nonzero - n cannot be a perfect square. Given k, a decimal number or a fraction (whichever is easier for you), such that 0 < k < 1, output the smallest positive integer n such ...
As you may know, the typical binary floating point numbers in a computer language are quite different than the typical integer numbers in a computer language. Floating point numbers can represent a much larger range, and can represent fractional amounts, however there is a trade-off that is frequently elided. The dista...
You will receive an integer less than 2000000000 and bigger than -2000000000 and you have to test what type(s) of number this is out of: Factorial Square Cube Prime Composite Triangular Positive Negative Here is a definition of all the different types of numbers: Factorial - A number That is equal to the product of a...
There's a little improv warm up game where you arrange yourselves in a circle and send zips, zaps, and zops around by pointing to a person and saying the next word in the sequence, then they do the same until all of you are warmed up or whatever. Your task is to create a program that gives the next word in sequence giv...
Goal Write a program or function that takes a positive integer n and randomly generate a legal series of pitches (henceforth called a Pitch string) of length n. Input A non-zero, positive integer n <= 100 Output Return a random string, or list of characters, that represent a possible, valid pitch string of length n. Th...
For a while now, I've been running into a problem when counting on my fingers, specifically, that I can only count to ten. My solution to that problem has been to count in binary on my fingers, putting up my thumb for one, my forefinger for two, both thumb and forefinger for three, etc. However, we run into a bit of ...
Hold up..... this isn't trolling. Background These days on YouTube, comment sections are littered with such patterns: S St Str Stri Strin String Strin Stri Str St S where String is a mere placeholder and refers to any combination of characters. These patterns are usually accompanied by a It took me a lot of time to m...
Suppose you have a string \$s_0\$ and someone else has a hidden string \$s_1\$. You don't know what \$s_1\$ is but they tell you that they can get from your string, \$s_0\$, to their string by making a certain number of moves \$d\$. Each move can be one of the following: Insertion : Add a character anywhere in the ...
Introduction: Inspired by a discussion that is already going on for many years regarding the expression \$6÷2(1+2)\$. With the expression \$6÷2(1+2)\$, mathematicians will quickly see that the correct answer is \$1\$, whereas people with a simple math background from school will quickly see that the correct answer ...
Background MENACE (Machine Educable Noughts And Crosses Engine) is a rudimentary shallow machine learning algorithm for the game Noughts and Crosses, created by British computer scientist Donald Michie in the 1960s. It was originally implemented with 304 matchboxes, each labelled with a board position and containing co...
A jumping number is defined as a positive number n which all pairs of consecutive decimal digits differ by 1. Also, all single digit numbers are considered jumping numbers. eg. 3, 45676, 212 are jumping numbers but 414 and 13 are not. The difference between 9 and 0 is not considered as 1 The challenge Create a program ...
I was browsing Stackoverflow and saw this question about tiling an MxN rectangle, and I thought it would be great for golfing. Here is the task. Given the dimension M and N, write a program that outputs how many unique ways a MxN rectangle (N is the number of rows, not columns. Not that it really matters) can be tiled ...
So I ran into this progressive/idle game cleverly called Idle Dice. Has a variety of random effects applied to a pretty typical progression formula game. Warning, time sink! Play at your own risk. However after you have 5 dice (summed the usual way) along with some bonuses for various matches (pair, two pair, three of ...
A very simple golf this time, but should be fun to do. Challenge Output your code, but rotated 45 (or -45) degrees. E.g: lorem ipsum dolor sit amet becomes t e m a t i ...
Your task is to take an array of numbers and a real number and return the value at that point in the array. Arrays start at \$\pi\$ and are counted in \$\pi\$ intervals. Thing is, we're actually going to interpolate between elements given the "index". As an example: Index: 1π 2π 3π 4π 5π 6π Array: [ 1.1, 1...
Gringotts isn't just a vault, but a reputable financial institution and wizards need loans too. Since you don't want to be screwed over by the Gringotts goblins, you decided it would be a good idea to write a program to calculate interest. Interest is compounded only yearly. Your task is to calculate total owed amount ...
Given a truth table and two images, use the truth table as a bitwise operation to the two images. For example with the truth table: 1 0 1 0 0 0 1 0 (Note that the top is the first image and the left is the second) and the two images (0, 2, 4) (a 1x1 image, with the numbers being RGB values) and (30, 20, 10): You wou...
This function should take four integer inputs (a,b,c,d) and return a binary word based on which values equal the maximum of the four. The return value will be between 1 and 0xF. For example: a = 6, b = 77, c = 1, d = 4 returns 2 (binary 0010; only 2nd-least significant bit is set corresponding to b being sole max value...
Your program should find the number of string pairs (pairs of 2) that contain all vowels (a e i o u), when given an integer N and N strings. There are easy ways to do this, but I'm looking for the quickest possible solution. Example: INPUT: 4 password unique orbiting ointmental OUTPUT: 2 EXPLANATION: password has a,o...
A store is having a big sale. If your price reaches $199 or more, you can reduce it by $100. You can buy each product only once. Here's an example list of products: (in order to simplify, the names of the products are represented by letters) +------+-------+ | name | price | +------+-------+ | A | 26.9 | | B | 2...
Background For this challenge, a 'metasequence' will be defined as a sequence of numbers where not only the numbers themselves will increase, but also the increment, and the increment will increase by an increasing value, etc. For instance, the tier 3 metasequence would start as: 1 2 4 8 15 26 42 64 93 130 176 because:...
I haven't been on PP&CG for a while, so I thought I would post something! Your task is to find how "smooth" a natural number is. Your method is to: 1: Convert the number to binary 2: Find the number of changes / switches 3: Find the length of the string (in binary) 4: Divide length by changes So, an example. 5. Sta...
Imagine this short function to clamp a number between 0 and 255: c = n => n > 0 ? n < 255 ? n : 255 : 0 Is this the shortest possible version of a clamp function with JavaScript (without ES.Next features)? P.S: Not sure if it's relevant but, the 0 and 255 are not random, the idea is to clamp a number as an 8-bit unsig...
Your task is to write a program which given an array and a number, you need to split the array into chunks with size is number. Rules Your program will receive an array A , as well as a positive integer n. The array should then be split into chunks of length n, if the length of the string isn't divisible by n any left...
In association football (also known as soccer), a penalty shoot-out is the second tie-breaker measure that may be used in a match which can't end in a tie, after extra time (i.e. association football overtime). In a penalty shoot-out, the main referee tosses a coin to determine at which goal the shoot-out happens, and ...
Tonight is card game night! You are the dealer and your task is to write a program to deal the cards to the players. Given an array of cards and the number of players, you need to split the array of cards into a hand for each player. Rules Your program will receive an non-empty array A , as well as a non-zero positive...
Input A string. Output The sum of all integers in the line. Constraints 1≤Length of line≤500 Sample test Case Input the 5is 108 seCONd4 a Output 117 Explanation Sum is: 5+108+4=117
Input: An integer \$n\$, which is guaranteed to be \$\ge3\$. An integer \$d\$, which is one of \$[-1,0,1]\$. Output: A road of size \$n\$, which will be in a north-west direction if \$d=-1\$; a north direction if \$d=0\$; or a north-east direction if \$d=1\$. The road will always be three spaces wide (or five in gene...
Task: Given an integer input, figure out whether or not it is a Cyclops Number. What is a Cyclops number, you may ask? Well, it's a number whose binary representation only has one 0 in the center! Test Cases: Input | Output | Binary | Explanation -------------------------------------- 0 | truthy | 0 | only ...
Problem Description We all love a Twix (because it is the best candy), but this is the kids' first Halloween --- we gotta grab at least one of each type of candy for them. Each Halloween all the residents of Numberline avenue send out an email saying what types of candy they'll be giving away this year. Oh! And we live...
Challenge This challenge will have you write a program that takes in two integers n and m and outputs the number non-intersecting loops on the n by m torus made by starting at (0,0) and only taking steps up and to the right. You can think of torus as the grid with wraparound both at the top and the bottom and on the si...
I came across this challenge from codewars. I wish to know how to solve this problem. The problem description is given below. Its elements are in range[1..n^2]. The matrix is filled by rings, from the outwards the innermost. Each ring is filled with numbers in the following way: The first number is written in the top ...
Employers love to see their employees working hard, while the employees would love to work less, especially those with a monthly rather than hourly payment. The laziest of employees are thinking about the world where every month starts with the same weekday and it makes them wonder if they would work more or less. T...
A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a permutation: $$ \pi(1) = 3,\quad \pi(2) = 4,\quad \pi(3) = 1,\quad \pi(4) = 2 $$ We can also have permutations on infinite s...
Introduction Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. The first challenge in this series is to output a(n) for a given n as input, where a(n) is A064413, also known as the EK...
Challenge: Input: A list of distinct positive integers within the range \$[1, \text{list-size}]\$. Output: An integer: the amount of times the list is riffle-shuffled. For a list, this means the list is split in two halves, and these halves are interleaved (i.e. riffle-shuffling the list [1,2,3,4,5,6,7,8,9,10] once wou...
A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy. Input The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine...
Background: The current Perfect Numbers challenge is rather flawed and complicated, since it asks you to output in a complex format involving the factors of the number. This is a purely decision-problem repost of the challenge. Challenge Given a positive integer through any standard input format, distinguish between wh...
This is a simple challenge. The task is to write code that outputs a 448*448 square image with 100% transparency. The output should follow the standard image rules.
Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of". The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any ...
This is an answer chaining puzzle, where each answer must add on to the last. The \$n\$th submission must output its own source code in the \$n\$th language and the \$n−1\$ languages before it. A language can be either a dialect or a major version of a language, so Python version 2.121 is only counted as version 2 and ...
Problem statement Pólya is playing about with his urn again and he wants you to help him calculate some probabilities. In this urn experiment Pólya has an urn which initially contains 1 red and 1 blue bead. For every iteration, he reaches in and retrieves a bead, then inspects the colour and places the bead back in the...
Challenge Design a compression algorithm specialized for compressing ASCII mazes. You will need to create both a compression algorithm and a decompression algorithm. Your score will be based on the size of your compressed mazes. Mazes These mazes are made primarily of the characters (floors), +, -, |, and # (walls), a...
Rectangles have this nice property - an \$n \times m\$ rectangle consists of exactly \$n \times m\$ characters! A.. more interesting property is that the rectangles can be aligned nicely in a multiplication table - for example, a \$3 \times 3\$ table: # ## ### # ## ### # ## ### # ## ### # ## ### # ## ### Your challe...
Background Though this is a bit late for Pi Day, I saw an article about Pilish and thought it would make a great challenge. Pilish is created by using a sequence of words where each word's length corresponds to a digit of pi. Example from Wikipedia: The following Pilish poem (written by Joseph Shipley) matches the fir...
So, you have a random list (random meaning it doesn't matter what order it is in) of numbers with a length of n, where n is a positive integer smaller than 1000 and larger than 1. The random list must contain every number from 0 to (n - 1). Eg: [0, 3, 2, 5, 1, 4] (where n is 6). Note: If there is more than one digit yo...
Challenge You have one string of input bytes, output only the last byte in it. Rules Your submission may be a program or function outputting the last byte in the input which is either a string, stdin or command-line arguments, and is non-empty. I was trying to solve this with brainfuck, however all languages are allo...
Shortest program wins, of course.
Your task here will be to write a very dumb AI capable of fetching all treasures on a map. Map The map is defined as follow: (artist-mode™-powered) Basic case: +-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| | | | | | | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | | | | | | | | | | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+ | | |T| | | | | | | ...
If I need to get the number of diagonal squares in all directions: I do the following formula 2 N − 2 − |x − y| − |x + y − N − 1| The above example has 13 and that's what the formula gives. Now, what if you wanted to get the diagonal squares, but only in one direction? The top right has 4 squares, the top left has 3, ...
Write a program that takes a single line string that you can assume will only contain the characters /\_‾. (That's forward and backward slash, underline and overline. You can use ~ in place of overline if you need since overline is not convenient ASCII.) For example, one possible input is: __/‾‾\/\_/‾ Your program nee...
Inspired by this game Challenge: Given an ASCII art string representing a number, output that number. Example: Input: &&&& ##### .====.. .&&& $$$$$. %% %% % % . +. . @@@ . @@ . = . = . ???? +++. && &&. % % = = $$$ . @@@@@ # # . ===. .$$$$$ ...
In Pascal's triangle each number is the sum of the two numbers directly above it, treating empty spots as zero: By rotating the triangle, we can cut out square matrices of varying sizes and rotations which I will call Pascal's matrices. Note that those matrices always need to contain the top \$1\$. Here are some examp...
Write a program that inputs the dimensions of a painting, the matting width, and the frame width for a framed portrait. The program should output a diagram using the symbol X for the painting, + for the matting, and # for the framing. The symbols must be space-separated. Trailing whitespace is alright, as long as the o...
You will be given an ASCII text. This text may have zero, one or many appearances of a split a character (let's assume it will be the space character ) You will also be given an offset integer value (zero based) anywhere between zero and the length of the text. You should calculate the relative offset inside the one sp...
Introduction (may be ignored) Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the second challenge in this series. The first challenge can be found here. In this challenge,...
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter: XYZABC VW DE U F T G S H RQ JI PONMLK Write a program that takes in a single letter character, A-Z, and...
Hehe, see what I did with the title? Anyways... Your job is to create a sudoku solver that accepts input in Morse code and creates output in Morse code. Here's the Morse code numbers for reference: 0: ----- 1: .---- 2: ..--- 3: ...-- 4: ....- 5: ..... 6: -.... 7: --... 8: ---.. 9: ----. Rules: The code must...
Challenge: Input: A positive integer \$n\$ Output: Create a list in the range \$[1,n]\$, and join it together to a string (i.e. \$n=13\$ would be the string 12345678910111213). Now we output a triangle using the prefixes or suffixes of this string, in one of the following four orientations based on the input integer: ...
Multiplicative Persistence Multiply all the digits in a number Repeat until you have a single digit left As explained by Numberphile: Numberphile "What's special about 277777788888899?" Numberphile "Multiplicative Persistence (extra footage)" Example 277777788888899 → 2x7x7x7x7x7x7x8x8x8x8x8x8x9x9 = 4996238671872 ...
There's a visual method for multiplication that is taught to Japanese schoolchildren [citation needed] that uses lines and crossings to get the answer. Image Source Your task is to implement this in ASCII art. You will be given two numbers to multiply. The output should be the corresponding ASCII art made up of \, /, ...
Given a list of jobs, which must be done in order, with each taking a slot to do, how long will it take to perform them all if after doing a job the same job cannot be done for the next two slots (cooling off slots)? However, a different job can be assigned in this cooling off slots. For example, [9,10,9,8] => output: ...
This riddle was inspired by that thread. Consider that you are super-hacker and try to break MD5 hashing algorithm by looking for a hash collisions for a given hash string which your friend gave to you. But this is a non-trivial task and you have a migraine disorder so you try to break the problem into smaller parts. F...
Your task is to take a 24 BPP sRGB image and output the same image upscaled 3x into red, green, and blue subpixels. The resulting image will be made entirely of pure black, red, green, and blue pixels. Each pixel from the source image, when zoomed, produces an arrangement of 9 sub-pixels that can be either on or off (i...
What are some tips for golfing in Turing Machine But Way Worse, a language made by MilkyWay90 and ASCII-only? Tips should be Turing Machine But Way Worse-specific and not be trivial (For examples that you shouldn't post, removing unnecessary whitespace or using shorter state names). EDIT: Added documentation to TMBWW
Given: a width, a height, and a set of sets of points. Output: An image where each set of points is connected and colored in (like a shape). Each shape must be a different color from all of the other shapes, but the actual color doesn't matter as long as each color is distinct. The shapes must be in order; whether you ...
Create a program or function which takes a list of strings as input, and outputs the longest string that is a substring of all input strings. If there are several substrings of equal length, and no longer substring, output any one of them. This may mean outputting the empty string. If there are several valid outputs, ...
I got into code-golfing recently and tried to write the smallest tautogram checker. A tautogram is a sentence in which all words start with the same letter, for example: Flowers flourish from France. Given a sentence as input, determine whether it is a tautogram. Test Cases Flowers flourish from France True This i...
OEIS sequence A020872 counts the number of restricted forests on the Möbius ladder Mn. The Challenge The challenge is to write a program that takes an integer as an input n > 1 and returns A020872(n), the number of restricted forests on the Möbius ladder Mn. This is code-golf, so shortest code wins. (An ulterior motiv...
Challenge: Your program will take two integers n and k as input, and output the smallest integer greater than (but not equal to) n that contains at least k occurrences of the digit 5. You can assume 1 ≤ k ≤ 15 and 1 ≤ n < 10**15. This is a restricted-time challenge. Your program must run on TIO for all of the test cas...
Inspired by this SO question. Challenge: Input: A string \$s\$ A character \$c\$ Output: Create a diamond-square ASCII art of the string in all four directions, with the first character of the string in the center and going outwards. Which is inside a square ASCII-art carpet, with the character as filler. This may so...
The sorting algorithm goes like this: While the list is not sorted, snap half of all items (remove them from the list). Continue until the list is sorted or only one item remains (which is sorted by default). This sorting algorithm may give different results based on implementation. The item removal procedure is up to ...
Introduction: I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the first one: Challenge: Input: Two integers Output: One of three distinct and unique outputs of your own choice. One ...
Challenge This is a simple one: Given a positive integer up to 1,000,000, return the closest prime number. If the number itself is prime, then you should return that number; if there are two primes equally close to the provided number, return the lower of the two. Input is in the form of a single integer, and output sh...
Turn-based tactics games like Advance Wars, Wargroove, and Fire Emblem are made up of a square grid of varying terrain with units of differing movement classes requiring different costs for each terrain type. We'll be investigating a subset of that problem. Challenge Your task is to determine if one location is reachab...
Task Your task is to write as short as possible program preferably in Brainf**k which determines the last digit of given number after it's conversion from decimal to binary system. Input An integer in decimal system consisting of up to 200 digits. There is a newline character (ASCII 10) after the given number Output On...
Introduction (may be ignored) Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the third challenge in this series (links to the first and second challenges). In this challen...
Given an integer k and either a block of text, or a 2d array that the inner arrays may have unequal lengths (that resembles a block of text), rotate every character or element in the k-th column up or down to the next position that exists. Example Rotate the 20th column of the following text (1-based): A line with more...
disclaimer: the Mean mean is made up by me Define the arithmetic mean of \$n\$ numbers as $$M_1(x_1,...,x_n)=\frac{x_1+x_2+...+x_n}{n}$$ Define the geometric mean of \$n\$ numbers as $$M_0(x_1,...,x_n)=\root{n}\of{x_1x_2...x_n}$$ Define the harmonic mean of \$n\$ numbers as $$M_{-1}(x_1,...,x_n)=\frac{n}{\frac{1}{x_2} ...
Introduction: I saw there was only one other badminton related challenge right now. Since I play badminton myself (for the past 13 years now), I figured I'd add some badminton-related challenges. Here the second (first one can be found here): Challenge: Some rules about badminton serves: A serve will always be done di...
Telephones in the United States (and perhaps some other places) have letters associated with some of the numbers. 2 = A, B, C 3 = D, E, F 4 = G, H, I 5 = J, K, L 6 = M, N, O 7 = P, Q, R, S 8 = T, U, V 9 = W, X, Y, Z No letters are associated with the number 0 or 1. Your challenge: Given any phone number in seven-digit...
Problem: In chess, there is a somewhat well known rule about draw by repetition. If the same position is repeated 3 times (or more) then the player intending to make the move which will cause the this repetition can claim a draw. Sometimes this is an easy task for an arbiter to spot, if the last few moves are just the ...
Your task is to take an ASCII art image and output it rotated clockwise by 45 degrees and scaled by a factor of \$\sqrt 2\$. The scaling comes from using a lattice pattern which introduces space between the characters. To explain it visually, a \$3 \times 3\$ block would be processed like so: 123 456 789 becomes 1 ...
Challenge For each character of the string except for the last one, do the following: Output the current character. Followed by randomly outputting from the following list a random number of times between 1 - 5 (inclusive): The current character The next character of the string The switchcase version of the character...
Take a positive integer \$k\$ as input. Start with \$n := 1\$ and repeatedly increase \$n\$ by the largest integer power of ten \$i\$ such that \$i \le n\$ and \$i + n \le k\$. Repeat until \$n = k\$ and return a list of all intermediate values of \$n\$, including both the initial \$1\$ and the final \$k\$. During this...
I'm surprised this hasn't been posted before! The Consistent Overhead Byte Stuffing (COBS) algorithm is used to delimit byte streams. We choose a frame marker (we'll use 0x00) and wherever 0x00 occurs in the stream it is replaced with the number of bytes until the next 0x00 occurs (we'll call this a milestone). This re...
We have X Girls and Y Boys in a class. If more girls sit together they will not behave. Similarly if more boys sit together they will not behave. Write a program/algorithm to get maximum same gender that will be seated if seating is done to efficiently to get them behave. Example 1: 5 girls and 1 boy Expected Output: ...
You are given four numbers. The first three are \$a\$, \$b\$, and \$c\$ respectively, for the sequence: $$T_n=an^2+bn+c$$ You may take input of these four numbers in any way. The output should be one of two distinct outputs mentioned in your answer, one means that the fourth number is a term in the sequence (the above ...
Challenge Robin likes having his variables declaration in the shape of an arrow. Here's how he does it: Input any number of strings Order them by ascending length Output them ordered by the middle to roughly form a negative arrowhead, like this (whichever order golfs the best): 5 or 4 3 2 1 1 2 3 4 ...
You're tasked with writing an algorithm to efficiently estimate cost of solving an Eni-Puzzle from a scrambled state as follows: You're given m lists of containing n elements each(representing the rows of the puzzle). The elements are numbers between 0 and n-1 inclusive (representing the colors of tiles). There are exa...
We define \$R_n\$ as the list of remainders of the Euclidean division of \$n\$ by \$2\$, \$3\$, \$5\$ and \$7\$. Given an integer \$n\ge0\$, you have to figure out if there exists an integer \$0<k<210\$ such that \$R_{n+k}\$ is a permutation of \$R_n\$. Examples The criterion is met for \$n=8\$, because: we have \$R_8...
I recently had a problem to solve at work where I had two lists: a master list, and a smaller list that contains a subset of the items in the master list potentially in a different order. I needed to reorder the master list in such a way that the items in the subset would appear in the same order without changing the o...