instruction
stringlengths
34
53.1k
In Excel, the columns range from A-Z, AA,AB,AZ,BA,..,BZ and so on. They actually each stand for numbers, but rather are encoded as alphabet strings. In this challenge, you will be given a string of alphabets, and you must calculate the column it corresponds to. Some tests: 'A' returns 1 (meaning that it is the first c...
Background Sudoku is a number puzzle where, given an \$ n \times n \$ grid divided into boxes of size \$ n \$, each number of \$ 1 \$ to \$ n \$ should appear exactly once in each row, column and box. In the game of Chess, the King can move to any of (at most) 8 adjacent cells in a turn. "Adjacent" here means horizonta...
This question has a similar set up to Find an array that fits a set of sums although is quite different in its goals. Consider an array A of length n. The array contains only positive integers. For example A = (1,1,2,2). Let us define f(A) as the set of sums of all the non-empty contiguous subarrays of A. In this cas...
You probably all know the 7-segment display which can display among other things all digits from \$0\dots 9\$: Challenge We only consider the segments \$\texttt{A}\dots\texttt{G}\$, your task is to decode a single digit given which segments are turned on. This can be encoded as an 8-bit integer, here's a table of each...
There is a challenge Let's play tennis by Daniel. He proposes to place a court in the North-South direction. My proposal is to create a court to play tennis in the East-West direction too. You have to print a tennis court, but you have to do it in the fewest bytes possible because of confidential reasons. Tennis court...
Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted. An IPv4 address is a 32-bit numeric address written as four numbers separated by periods. Each number can be zero to 255. We need to write a...
Input: A valid 6 HEX digit color code wihout a # prefix Valid: 000000 FF00FF ABC123 Your job is to find to which one of these: Red: FF0000 Green: 00FF00 Blue: 0000FF White: FFFFFF Black: 000000 the input color is the closest too, in this case you try to only match it to black or white when the RGB is the same v...
A barcode of EAN-13 symbology consists of 13 digits (0-9). The last digit of this barcode is its check digit. It is calculated by the following means (the barcode 8923642469559 is used as an example): Starting from the second digit, sum up all alternating digits and multiply the sum by 3: 8 9 2 3 6 4 2 4 6 9 5 5 9 |...
Here's a reasonably trivial sequence which is not in the Online Encyclopedia of Integer Sequences. Start with an empty sequence then define each term as the number of characters required to write out, in English, all of the digits of the sequence so far without spaces.* For reference the number of characters of all of ...
Goal In light of the World Series being around the corner, I need a program that can read the box scores and tell me what inning it is. This is complicated slightly because baseball uses an odd method to record the score. They don't write down the at-bat team's score for the inning until they've scored a run (and are s...
Given an inconsistently indented piece of html code your task is to return the same text but correctly indented Indent space = 4 Assume input will be non-empty. Input can be taken as string or array/list of lines Opening and closing tags must be on the same line as long as there is not any other tag inside. <td></td>...
My two kids like to play with the following toy: The colored areas with the shapes inside can be touched and the turtle then lights the area and plays a sound or says the name of the color or the shape inside. The middle button changes the mode. There is one mode in which the areas play different musical notes when to...
Given an input array having minimum length 2 and maximum length 9 having any initial values output an array having length 2 consisting of the 1-based indexes of the array represented as either an integer or string in forward and reverse order. The values of the array or string do not matter and are ignored. For example...
Background Variable declaration statement in C consists of three parts: the name of the variable, its base type, and the type modifier(s). There are three kinds of type modifiers: Pointer * (prefix) Array [N] (postfix) Function () (postfix) You can specify a list of function arguments inside the parens, but for the s...
Input Two lists with binary values (list_a, list_b) of equal length=>3. Output Two lists with binary values (smoothed_a, smoothed_b) with minimal Forward Difference while keeping the same sum before and after processing sum(list_a) + sum(list_b) == sum(smoothed_a) + sum(smoothed_b). Forward Difference being the absolut...
The premise of this is simple: A 10% chance is pretty unlikely, but everyone knows that a one-in-a-million chance is a sure thing! So, write code that implements the following "dramatic" probability rules: Take in a floating point P from 0 to 1 representing the unmodified chance of some plot-related event, and a boole...
The non-negative integers are bored of always having the same two* neighbours, so they decide to mix things up a little. However, they are also lazy and want to stay as close as possible to their original position. They come up with the following algorithm: The first element is 0. The \$n^{th}\$ element is the smalle...
My birthday is in a month, and this is a slice of tasty cake. .-""-. .-" "-. |""--.. "-. | ""--.. "-. |""--.. ""--..\ | ""--.. | | ""--..| ""--.. | ""--.. | ""--..| In the fewest number of bytes, construct this slice of cake for me. Y...
Let's say I've got some ASCII art: ___ ,"---". : ; `-.-' | | | | | | _.-\_/-._ _ / | | \ _ / / `---' \ \ / `-----------' \ /,-""-. ,-""-.\ ( i-..-i i-..-i ) |`| |-------| |'| \ `-..-' ,=. `-..-'/ `------...
Introduction A recursive acronym is an acronym that contains or refers to itself, for example: Fish could be a recursive acronym for Fish is shiny hero, notice how that also contains the acronym itself. Another example is Hi -> Hi igloo. Or even ppcg paints -> ppcg paints cool galaxies pouring acid into night time star...
This tweet lists the possible orders for Wings of a Chinese restaurant1: When ordering Pizza I usually calculate what size gives me the best Pizza-price ratio which is a simple calculation. However minimizing the price of an order at this restaurant isn't such a simple task, so I'd like to be prepared for my next orde...
Background Challenge is inspired by this question. The 1-expression is a formula that in which you add and multiply the number 1 any number of times. Parenthesis is allowed, but concatenating 1's (e.g. 11) is not allowed. Here is an example to get the 1-expression for \$19\$: (1+1)*(1+1)*(1+1+1+1)+1+1+1 = 19 Total num...
Use any programming language to display numbers divisible by 1000000 that are greater than 1 and less than 10000000. Each number should be displayed in new line. Your program should display exactly: 1000000 2000000 3000000 4000000 5000000 6000000 7000000 8000000 9000000
Isn't it annoying when you're taking a picture, but the background detracts from the actual substance of the image? I'd say it is. I need to know how much I should crop so that I get rid of this problem! But - as usual - I am quite lazy, so I need someone to do this for me... Task & Rules Given a binary matrix represe...
The task is to convert a string representing a number in decimal (base 10) representation to duodecimal (base 12). The input is thus a string, the output should be printed. The input number can be positive and negative, can be integer or rational. The decimal and duodecimal representations will have a finite number of ...
Here you can see g-code parser, written in JavaScript to use in microcontroller (like espruino). But you can run it in browser, because it don't use any specific features. function gcode(str){ //Removes comment, parses command name and args const [,f,args] = (str.match(/^([GM]\d+) ([^;]+)/) || [,"",""]); //A1.2...
Write a program or function that takes input: all resistors available and a resistance value and outputs a truthy value of whether or not it is possible to get the resistance by using those resistors. Rules: Any format for input will do. There will be at least 1 available resistor and your program should output for at ...
I feel tired to do "find the pattern" exercise such as 1 2 3 4 (5) 1 2 4 8 (16) 1 2 3 5 8 (13) Please write a program that finds the pattern for me. Here, we define the pattern as a recurrence relation that fits the given input, with the smallest score. If there are multiple answers with the same smallest score, using...
Inspired by this StackOverflow question. Input: We'll take three inputs: A delimiter-character D to split on A character I between two of which we ignore the delimiter character (I know, that sounds vague, but I'll explain it below) A string S Output: A list/array containing the substrings after the split. Example: I...
(thanks to @JonathanFrech for the title) Challenge Write a program or function that, given a collection of positive integers \$S\$ and a positive integer \$n\$, finds as many non-overlapping subcollections \$T_1, T_2, ..., T_k\$ of \$S\$ as possible, such that the sum of every \$T_m\$ is equal to \$n\$. Example Given \...
Background Most of you know what a Fibonacci number is. Some of you may know that all positive integers can be represented as a sum of one or more distinct Fibonacci numbers, according to Zeckendorf's Theorem. If the number of terms in the optimal Zeckendorf Representation of an integer n is itself a Fibonacci number, ...
Input: A decimal Output: The input truncated How to truncate them? The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in consecutive order. The two step-by-step examples below should clarify what I mean by that: Example 1: Input: 17.46940822 Ste...
There is a "sorting algorithm" sometimes called Stalin sort in which in order to sort a list you simply remove elements from the list until it is sorted in increasing order. For example the list [1, 2, 4, 5, 3, 6, 6] When "sorted" using Stalin sort becomes [1, 2, 4, 5, 6, 6] The three was removed because it was out ...
I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question Introduction Your challenge today is to output the lyrics of "99 bottles of beer": 99 bottles of beer on the wall, 99 bottles of beer. Take one down...
Inspired by "You had me at hello" Introduction For those who don't know, hexadecimal is a base system like decimal. Contrary to decimal however, it uses 16 (hence the name) digits instead of 10. Here are the first few numbers while counting up in hexadecimal to maybe give you a feel of things, although you should proba...
Use any programming language to generate two random digits between 1 and 9 (including both). Then your program should display: in the first line: the first random digit, in the second line: the second random digit, in the third line: a number whose tens and units digits are the first and second random digits res...
Given an array of integers a which contains n integers, and a single integer x; remove the fewest amount of elements from a to make the sum of a equal to x. If no combinations of a can form x, return a falsy value. As pointed out in a comment this is the maximum set with a sum of x, excuse my lesser math brain. I forg...
Problem A3 from the 2008 Putnam competition says: Start with a finite sequence \$a_1, a_2, \dots, a_n\$ of positive integers. If possible, choose two indices \$j < k\$ such that \$a_j\$ does not divide \$a_k\$, and replace \$a_j\$ and \$a_k\$ by \$\gcd(a_j, a_k)\$ and \$\text{lcm}(a_j, a_k)\$, respectively. Prove that...
Cyclically self-describing lists A list \$L\$ of positive integers is cyclically self-describing, if the following conditions hold. \$L\$ is nonempty. The first and last elements of \$L\$ are different. If you split \$L\$ into runs of equal elements, the element of each run equals the length of the next run, and the e...
Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The Fibonacci sequence is almost one example of this type of sequence for F(0) = 0, F(1) = 1, but it's excluded because of the positive integer requirement. Any two initial values will yield a different sequence. For example F(0) = 3...
Introduction My car speedometer was hacked! Instead of showing me how fast i'm driving, it just shows: "Vroooom!" Please help me know how fast i'm going. Challenge Take a string as input, and check if it matches the regex /^[Vv]ro*m!$/m. In English that means any line of the string must start with a capital or lowercas...
It turns out that my toaster is a tad broken. It lost WiFi (You know, it's one of those newfangled smart toasters), and its been going bonkers! Since it no longer works, I've been having to hack into my breakfast's source code and run Plate.bread.toastAs(3); every morning. Will you help? My toaster takes one input: the...
Background A number n can be described as B-rough if all of the prime factors of n strictly exceed B. The Challenge Given two positive integers B and k, output the first k B-rough numbers. Examples Let f(B, k) be a function which returns the set containing the first k B-rough numbers. > f(1, 10) 1, 2, 3, 4, 5, 6, 7, 8,...
Coming from this sandbox post This is inspired from an 8th graders math test Intro We have a cube with following corners A(0, 0, 0) B(1, 0, 0) C(1, 1, 0) D(0, 1, 0) E(0, 0, 1) F(1, 0, 1) G(1, 1, 1) H(0, 1, 1) This cube clearly has 8 corners, 12 edges and 6 faces. If we now cut off corner G, such that our cut plane goe...
Calculate the maximum number of circles of radius r that can fit in a rectangle with width x and height y. Write a function that take r, x and y as input and returns the number of circles that fit in the rectangle.
S. Ryley proved following theorem in 1825: Every rational number can be expressed as a sum of three rational cubes. Challenge Given some rational number \$r \in \mathbb Q \$ find three rational numbers \$a,b,c \in \mathbb Q\$ such that $$r= a^3+b^3+c^3.$$ Details Your submission should be able to compute a solution f...
In the absurdist play Rosencrantz and Guildenstern are Dead, the two main characters Rosencrantz and Guildenstern(or are they?) are always mixing up which of them is who—or sometimes which of their own body parts is which—because of a perceived lack of individual identity. Wouldn't it be absurd if they even shuffled ar...
Input is a single integer in ascending digit order. The only valid inputs are: 12 123 1234 12345 123456 1234567 12345678 123456789 The only valid output is an array (set; list) of length equal to the factorial of input: Input - Factorial of input - Output array length 12 -> 1*2 -> 2 123 -> 1*2*3 -> 6 1234 -> 1*2*3*4 ->...
Captchas aren't meant to be machine-readable, and that's terrible. It is time to end this obvious bout of unfounded hatred for machines just trying to let you know about great deals on ṗḧ@ṛḿ4ćëüẗ1ċäḷṡ ƻđȺɏ. Note: All captchas were made by using a library that has been modified so that it mostly generates images much ea...
The sum of the squares of the first ten natural numbers is, \$1^2 + 2^2 + \dots + 10^2 = 385\$ The square of the sum of the first ten natural numbers is, \$(1 + 2 + ... + 10)^2 = 55^2 = 3025\$ Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is \$3025 − 385...
I think the Collatz Conjecture is already well-known. But what if we invert the rules? Start with an integer n >= 1. Repeat the following steps: If n is even, multiply it by 3 and add 1. If n is odd, subtract 1 and divide it by 2. Stop when it reaches 0 Print the iterated numbers. Test cases: 1 => 1, 0 2 ...
As a big fan of the Lost TV series, I always got intrigued by the sequence of numbers that repetitively appears on the episodes. These numbers are: \$ 4, 8, 15, 16, 23, 42\$ (A104101) Using any programming language, write a code that outputs these numbers. Scoring: Shortest answer wins The output must not contain any ...
Imagine we get a slice of some mountainous region, this would result in a shape similar to this: 4 _ 3 _ _ __/ \ 2 / \__/ \ _/ \_ / 1 / \ / \_/ 0 \/ 12322223210012233343221112 As we can see, we can represent this (to a certain degree) with a sequence o...
Given a positive integer \$N >= 4\$, output an RSA key pair (both the private and the public key) whose key length is \$N\$ bits. The RSA key generation algorithm is as follows: Choose an \$N\$-bit semiprime \$n\$. Let the prime factors of \$n\$ be \$p\$ and \$q\$. Compute \$\lambda(n) = LCM(p-1, q-1)\$. Choose an int...
For functions \$f, g: \{0,1\}^n \rightarrow \{0,1\} \$, we say \$f \sim g\$ if there's a permutation of \$1,2,3,...,n\$ called \$i_1,i_2,i_3,...,i_n\$ so that \$f(x_1,x_2,x_3,...,x_n) = g(x_{i_1},x_{i_2},x_{i_3},...,x_{i_n})\$. Therefore, all such functions are divided in several sets such that, for any two functions \...
The robber's thread is here The cops task is to write a function or program that, when given an input of itself, outputs a finite deterministic string. If the program is given a different input, it should return a different output. Rules: Submissions consist of Language name If any flags are used, they should be r...
The cop's thread is here The robber's task is to find a program of size equal to or less than the cop's program, which, when given an itself as input, produces the same output as the cop's program. Additionally, even if a cop's answer is provisionally marked Safe and has been revealed, you can still crack it by finding...
A simplistic version of English numeral calculator Task Write a program that takes a string as input and outputs the result of the expression. Rules The input string will be worded and not numeral. There will be no parentheses. Order of calculation will be divide,multiply,subtract then add. For same operations, the cal...
Challenge Taken from here and also here An n parentheses sequence consists of n (s and n )s. A valid parentheses sequence is defined as the following: You can find a way to repeat erasing adjacent pair of parentheses "()" until it becomes empty. For example, (()) is a valid parentheses, you can erase the pair on the 2...
This challenge is about finding the smallest disk that contains some given points. This is made somewhat trickier, however, by the fact that in this challenge, the disk's coordinates and radius must both be integers. Your input will be a list of points with integer coordinates x and y. You can take this as a list of tu...
Given an input integer n > 1, output an ASCII-art octagon with side lengths composed of n characters. See examples below: n=2 ## # # # # ## n=3 ### # # # # # # # # # # ### n=4 #### # # # # # # # # # # # # # # # # #### n=5 ##### ...
The 5-card magic trick involves a magician whose assistant gives them 4 shown cards and a hidden one, in this order, and the magician must guess the hidden one. WARNING: Solution below! Leave now or get spoiled with it. The solution The trick here is that the five cards are given in a specific order! \$c_1,...,c_5\$ a...
This is a follow up to Count arrays that make unique sets . The significant difference is the definition of uniqueness. Consider an array A of length n. The array contains only positive integers. For example A = (1,1,2,2). Let us define f(A) as the set of sums of all the non-empty contiguous subarrays of A. In this c...
https://www.youtube.com/watch?v=6vAhPeqlODg Ok—jig's up—this one's only related to smash in name, but it'll give you something to burn your time with while you wait 'til December 7th Given a color string s of form #rgb(in hex, so #000000 to #ffffff, dont worry about the three digit ones: #123) you must average the rgb ...
Given two integers, output the two integers, and then the range between them (excluding both). The order of the range must be the same as the input. Examples: Input Output 0, 5 -> [0, 5, 1, 2, 3, 4] -3, 8 -> [-3, 8, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7] 4, 4 -> [4, 4] 4, 5 -> [4, 5] 8, 2 ->...
Sandbox The major scale (or Ionian scale) is one of the most commonly used musical scales, especially in Western music. It is one of the diatonic scales. Like many musical scales, it is made up of seven notes: the eighth duplicates the first at double its frequency so that it is called a higher octave of the same note....
Consider an array A of length n. The array contains only integers in the range 1 to s. For example take s = 6, n = 5 and A = (2, 5, 6, 3, 1). Let us define g(A) as the collection of sums of all the non-empty contiguous subarrays of A. In this case g(A) = [2,5,6,3,1,7,11,9,4,13,14,10,16,15,17]. The steps to produce g(A...
This is similar to this question. However, I have a different goal in mind: Reduce the wordlist to words that could appear. The easy part is to delete hyphens and similar. The hard part, however: Remove words containing more than seven letters. So, the problem: Given a set of words containing only lowercase (or upperca...
For more MtG-goodness: Magic: The Gathering Combat with Abilities Premise: In Magic: the Gathering, you cast spells by paying their mana cost by tapping lands for the required amount. These lands can produce one of the five colors which are: White (W) Blue (U) Black (B) Red (R) Green (G) The cost is made up of two...
Scratch is a visual programming language. For the sake of counting bytes, Scratch is usually written in scratchblocks2 syntax. Post tips that specifically apply to Scratch or scratchblocks2.
Dart is an object oriented programming language borrowing from both Java and Javascript. What general tips do you have for golfing in Dart? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Dart (e.g. "remove comments" is not an answer). Please post one ti...
Introduction: In general we usually speak of four dimensions: three space dimensions for x, y, and z; and one time dimension. For the sake of this challenge however, we'll split the time dimension into three as well: past, present, and future. Input: Two input-lists. One containing integer x,y,z coordinates, and one co...
The below pattern will form the basis of this challenge. /\ \/ /\ / \ / \ /\/ \/\ \/\ /\/ \ / \ / \/ /\ \/ Given an input width and height, each >=1, output the above ASCII art pattern repeated that many times, joining (and overlapping) at the small diamond...
Dina loves most numbers. In fact, she loves every number that is not a multiple of n (she really hates the number n). For her friends’ birthdays this year, Dina has decided to draw each of them a sequence of n−1 flowers. Each of the flowers will contain between 1 and n−1 flower petals (inclusive). Because of her hatred...
Use any programming language to display numbers between 1 and 99 (including both) in such a way, so that: the numbers are separated by single space, if a number is divisible by 3, it should be in parentheses, if a number is divisible by 4, it should be in square brackets, if a number is divisible by both 3 and 4, it s...
Note: This is an attempt at recycling guest271314's permutation question(s) There's an interesting pattern that forms when you find the differences between lexographically sorted permutations of base 10 numbers with ascending unique digits. For example, 123 has permutations: 123 132 213 231 312 321 When you find the d...
For the purposes of the current challenge to "outline" a word means to surround it successively with its own letters, starting with the last one, and finally to replace the original word in the center with spaces: oooooo onnnno on -> on no onnnno oooooo Task: Given a list of words, con...
Challenge Take an input string \$s\$, and split it into words \$w_1, w_2, ..., w_n\$. If the amount of words is odd, then return \$s\$. Otherwise, for each word: Take the second last letter, and swap it with the first letter keeping capitalization positions. So GolF becomes LogF. Now check if the amount of words is a m...
Given a positive integer, write it as the sum of numbers, where each of them is in \$\{kt|k\in{1,9,81},t\in{1,2,3,...,64}\}\$. How many numbers at least are used? Shortest code win. Samples: Input Output Method 1 1 1 2 1 2 64 1 64 65 2 64+1 72 1 72 343 2 342+1 576...
Matlab has a useful command for visualizing data: plot. It draws data points using "markers" in 2-D space, connecting them with lines; however, for this challenge, let's ignore the lines and use only markers. In fact, only one marker. Input: one of Matlab's marker symbols: . o x + * s d v ^ < > p h Output: correspondin...
Given a non-empty rectangular array of integers from 0 to 9, output the amount of cells that are 8 and do not have a neighbour that is 8. Neighbouring is here understood in the Moore sense, that is, including diagonals. So each cell has 8 neighbours, except for cells at the edges of the array. For example, given the in...
Introduction In Android Studio and other IDEs there are code completions to assist efficient code insertion (especially when the names of the classes or methods are so verbose), like the one in the image below. There are slightly different logics used between IDEs to determine what classes, methods and variables to su...
I have just tried a game called Couch 2048. (Note: You should have a look to better understand this question.) Since it wasn't very exciting for me, I've been asking myself 'How much more till 2048!?' That inspired me to post a challenge, because calculating this in not as easy as I thought. Your goal: Given a list of ...
CHALLENGE STATUS: OPEN Comment, open a PR, or otherwise yell at me if I'm missing your bot. Prisoner's dilemma ... with three choices. Crazy, huh? Here's our payoff matrix. Player A on the left, B on the top A,B| C | N | D ---|---|---|--- C |3,3|4,1|0,5 N |1,4|2,2|3,2 D |5,0|2,3|1,1 The payoff matrix is engineered...
Let \$A\$ be a positive integer consisting of \$n\$ decimal digits \$d_1,d_2,...,d_n\$. Let \$B\$ be another positive integer. For the purpose of this challenge, we call \$A\$ a copycat of \$B\$ if there exists at least one list of positive integers \$p_1,p_2,...,p_n\$ such that: $$\sum_{i=1}^{n}{{d_i}^{p_i}}=B$$ \$A\$...
Task Given is a square matrix of any dimension and any integer n. Output all possible matrices(without duplicates) by removing columns and rows from the input matrix such that the determinant of these new matrices is n. Rules Output should include original if determinant of original is n. Output should be all the chopp...
Introduction The EKG sequence begins with 1 and 2, then the rule is that the next term is the smallest positive integer not already in the sequence and whose common factor with the last term is greater than 1 (they are not coprimes). The first terms are: 1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, ... It's called EKG because...
Unfortunately one of the greatest comic book writers passed away yesterday afternoon. Lots of Hollywood stars, musicians, actors, and many other people are paying tribute to this awesome writer, so we must do something as well. Challenge Print The Avengers Logo Note: You may use any other character in place of # othe...
Do you know Icy Tower ? Here is a gameplay example of what i'm talking about The game concept is simple : you play as Harold the Homeboy, and your goal is to jump from floors to floors to go as high as possible without falling and getting off-screen ( the camera goes higher following you or at a speed that gets faster ...
FreeChat Online It is 1985, and you are a humble Russian potato farmer. Sadly, your glorious homeland is going through a time of crisis and it needs your help! The KGB, with the "assistance" of your wife and children, has convinced you to build their up-and-coming government FreeChat Online service for high ranking sov...
This is similar to the alignment used in word. Task 3 inputs: A 1 line string, a positive integer k, and direction (left or middle or right) Your job is to insert new lines(\n) and spaces in the string such that every line has k characters in it and aligned to the direction given. Rules The words must not be split(unle...
May this challenge serve as (another) tribute to Stan Lee, who passed away aged 95. Stan Lee has left us an invaluable legacy and a peculiar catch word: Excelsior. So here's a small challenge based on what he said it was its meaning: Finally, what does “Excelsior” mean? “Upward and onward to greater glory!” That’s wh...
Shorter version of Skyscrapers Challenge Task Given an array of building heights and a positive integer k, find all the permutations(without duplicates) of the heights such that exactly k buildings are visible. Any building will hide all shorter or equal height buildings behind it. Any format for input and output is va...
Challenge: Given a list of integer, sort descending by their single largest digit(s). The order for numbers with the same largest digit are then sorted by second largest digit, etc. We ignore duplicated digits in numbers. And if all digits in a number are the same, the order of those numbers in the list can be in any w...
Task Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them. Rules Input,Output can be in any convenient format. The array may have at most 1 decimal number. Examples input:[22,33,44,55.55,33] output:4433332255.55,55.5522333344 input:[34,900,3,11,9] o...
Challenge Calculate the strange sum of two natural numbers (also known as lunar addition): Given \$A=...a_2 a_1 a_0\$ and \$B=... b_2 b_1 b_0\$ two natural numbers written in the decimal base, the strange sum is defined, based on the maximum operation, as: \$A+B=... \max(a_2,b_2) \max(a_1,b_1) \max(a_0,b_0)\$ ... ...
This challenge is for the largest finite number you can get BrainFuck programs of given lengths to contain in memory. We must use one of the BF versions that uses big integers for the cells rather than byte values as not to be capped at 255. Do not use negative positions and values in memory. Do not use the BF instruct...
Introduction Busy Beavers are programs (specifically Turing Machine programs) that aim to output the most ones as possible, while having the least states as possible and halting. Challenge Your challenge is to make a busy beaver, which outputs as many ones as possible, but also outputs a second busy beaver. That secon...
If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total. Output how many letters would be used if all the numbers from 1 to 1000 (one thousand) inclusive were written out in words. NOTE: Do not count spaces or hyphens. For example, 342 (th...
Background Quaternion is a number system that extends complex numbers. A quaternion has the following form $$ a + bi + cj + dk $$ where \$ a,b,c,d \$ are real numbers and \$ i,j,k \$ are three fundamental quaternion units. The units have the following properties: $$ i^2 = j^2 = k^2 = -1 $$ $$ ij = k, jk = i, ki = j $$ ...