instruction
stringlengths
34
53.1k
When babies open their mouths, they're not just spewing gibberish. They're actually talking in a highly advanced, adult-proof cipher... The Baby-talk Cipher When a baby talks, it could look something like gogooa gagooook aagaaoooy Each single-space separated section represents a character (so the example above represen...
The challenge Your task is to animate Adve the Adventurer moving through a creepy (i.e. Halloween) maze. Adve is a •; he's character fluid, though, so he does not mind being represented by a different character. To animate Adve, you print out each frame; a frame is the map with his current location in it. Adve moves on...
Introduction I defined the class of antsy permutations in an earlier challenge. As a reminder, a permutation p of the numbers from 0 to r-1 is antsy, if for every entry p[i] except the first, there is some earlier entry p[i-k] such that p[i] == p[i-k] ± 1. As a fun fact, I also stated that for r ≥ 1, there are exactly ...
A string is pairable if it can be split into subtrings, each of which is a string repeated twice consecutively. For example, aabaaababbbaba is pairable as: aaba aaba b b ba ba Given a non-empty string of a's and b's, output a Truthy value if it's pairable and a Falsey value if it isn't. Pairable: aa abaaba bbababbb aa...
Given a sequence of 625 32-bit unsigned integers (that is, in the range [0, 2**32)), output which of the following pseudorandom number generators generated the sequence: Linear Congruential Generator Xorshift Mersenne Twister Specifically, the C implementations of these three generators used for this challenge are as...
Seems like an impossible task right? Well, it's actually not that hard. If we write the word Infinity as 8-bit binary ASCII code, we'll get: 01001001 01101110 01100110 01101001 01101110 01101001 01110100 01111001 This can be concatenated, and converted to the decimal value 5291279215216915577. Now that's a number we c...
Review First, let's review the Simple Substitution Cipher. To encode a string in the Simple Substitution Cipher, replace each letter in your string with another letter. A letter may not be used to replace more than one existing letter. For example, if I was encoding the text Hello world, my name is Oliver! I like code...
Background Back in the late 90's / first 00's when Flash Web Design was so much cool that noone could live without having a full Flash website, or at least an animated widget, I was hired to develop a "horse races viewer" in Flash/Actionscript, in the shape of an 80's videogame style animation, so the site's visitors c...
Given a number as input, determine how many significant figures it has. This number will should be taken as a string because you have to do some special formatting. You'll see what I mean soon (I think). A digit is a sig-fig if at least one of the following apply: Non-zero digits are always significant. Any zeros bet...
Given a positive integer n, output the 2^n binary sequences of length n sorted in the following precise ordering. Test cases: 0: 0 or 1 (defining this is a matter of debate) 1: 0 1 2: 00 01 10 11 3: 000 001 010 100 011 101 110 111 4: 0000 0001 0010 0100 1000 0011 0101 1001 0110 1010 1100 0111 1011 1101 1110 1111 e...
Your task is to palindromize a string as follows: Take the string. abcde Reverse it. edcba Remove the first letter. dcba Glue it onto the original string. abcdedcba But here's the catch: since this challenge is about palindromes, your code itself also has to be a palindrome. Remember, this is code-golf, so the code...
Given a palindrome generated according to this challenge, depalindromize it. Test cases abcdedcba -> abcde johncenanecnhoj -> johncena ppapapp -> ppap codegolflogedoc -> codegolf As this is about depalindromizing, your code cannot be a palindrome. Remember, this is code-golf, so the code with the fewest bytes wins.
Background When I was in elementary school, we used to play a game in math class that goes as follows. All kids sit in a big circle and take turns counting, starting from 1. However, the following numbers must be skipped while counting: Numbers that are multiples of 3. Numbers that have a 3 in its decimal representat...
inspired by Count down from infinity Given a non-negative integer N, output the number of repetitions of the following steps it takes to reach 0: Convert N to binary (4812390 -> 10010010110111001100110) Flip each bit (10010010110111001100110 -> 01101101001000110011001) Trim leading zeroes (01101101001000110011001 -> 1...
Note: this is heavily inspired by this question. Task: Your task is to generate the nth prime, when each character of your program is repeated n times in place. Let's say your program is: Derp Every character in there is repeated once, so it should output 2. When every character is duplicated in place, like so: DDeerr...
Given a string, first square it as follows: First, write the string. abcde Next, write the string rotated one left. abcde bcdea Keep doing this until you have written len(string) lines. abcde bcdea cdeab deabc eabcd Now, read from the string like this: ----+ +--+| |+>|| |+-+| +---+ Which gives: abcdeabcdcbaedcbcdea...
Your task is to determine the palindromic degree of a given non-empty string. To do this, loop until one of the following conditions are met: The string is not a palindrome. You encounter a string that has already been encountered. And do the following: If it is a palindrome, add one to the degree. Depalindromize. ...
Introduction: Like Twitter and Instagram and others, I wanted to display numbers like 1.2K and 3.8 M instead of 1,222 or 3,823,456. But that's not all! As we all know, there might be some human beings which undoubtely won't like these abbreviations and will try to reverse them. So, 1.2k will become 1,200 and 3.8 M will...
The program should take input the number, the start of the range and the end of the range, and output how many integers the number appears between the start and end of the range, inclusive. Both programs and functions are allowed. Example Inputs For example: //Input example 1 3,1,100 //Input example 2 3 1 100 //Input e...
Given N (2 <= N), print N lines of the letter Fibonacci series like this (i.e. N = 5) First, start with a and b: a b Next, add the two lines. a b ab Keep adding the last two lines. a b ab bab Keep going... a b ab bab abbab And we're done. Remember, this is code-golf, so the code with the fewest bytes wins.
This is my first code golf exercise for you: Your input is two integers n and k. You can assume n >= 1 and k >= 1 You have to output all numbers from 1 to n (inclusively) and replace every element that is a multiple of k or that contains k with "Shaggy". you can take the input in any convenient form and output it in a ...
Write a program or function that draws a mountain range, where each subsequent larger mountain peak is "behind" the ones in front, and alternates which side is visible. This is a mountain range of size 1 /\ This is a mountain range of size 2 /\ /\ \ This is a mountain range of size 3 /\ / /\ / /\ \ This is a mou...
Today you will be doing another palindrome challenge! So, your task today is to take a string, and determine the minimum amount of letters required to insert to turn it into a palindrome. For example, let's take the string fishes. In this, case the best way would be to add h if, so the result would be 3. fishe s h...
You can create a list of all rationals 0 < r ≤ 1 by listing them ordered first by denominator and then by numerator: 1 1 1 2 1 3 1 2 3 4 1 5 1 2 3 4 5 - - - - - - - - - - - - - - - - - 1 2 3 3 4 4 5 5 5 5 6 6 7 7 7 7 7 Note that we skip any rational number that already o...
A binary convolution is described by a number M, and is applied to a number N. For each bit in the binary representation of M, if the bit is set (1), the corresponding bit in the output is given by XORing the two bits adjacent to the corresponding bit in N (wrapping around when necessary). If the bit is not set (0), th...
Write a program that takes two numbers as its input. The first one is the number of dimensions - 0 for a dot, 1 for a straight line, 2 for a circle, 3 for a sphere. The second number is the radius of the object, or, if it's 1-dimensional, the number itself. Output 0 for 0 dimensions. The output is the length/area/volum...
Given the following Python 3 script: def greet(): print("Hello, world!") greet() Prepend some lines to this text file so that it can be both executed as a Python program as well as compiled and run as a C++ program producing the same output Hello, world! (including the newline at the end): $ python3 bilingual.py....
I often forget what I wanted to say when the teacher calls on me to speak. Can you make me a tool to solve this? Requirements: The program must loop as follows: First, take in input If the input is empty, print the last stored question. Otherwise, store the input as a question. Notes: The input will never be empt...
Given a sequences of events with probabilities between 0.0 and 1.0, generate and derive the probability of each combination occurring. You may presume that a sequence of numbers is provided in whatever construct your chosen language provides. Here's an example; you may presume that the length of the sequence's combinat...
...will you help me immortalize it? I've had this pillow a few years now, and apparently it's time to get rid of it. Can you please write a function or program, that I can bring with me and use to recreate this pillow whenever I want to reminisce a bit. It must work with no input arguments. The output should look exa...
A Primenary (binary-prime) string is one which, when written as a binary grid, every row and column has a prime total. That's quite a vague explanation, so let's break it down with a worked example... For this example we'll use the string bunny: First, find the ASCII code point of each character and its binary repre...
Inspired by, and in memory of, my dear friend and colleague, Dan Baronet, 1956 – 2016. R.I.P. He found the shortest possible APL solution to this task: Task Given a Boolean list, count the number of trailing truth values. Example cases {} → 0 {0} → 0 {1} → 1 {0, 1, 1, 0, 0} → 0 {1, 1, 1, 0, 1} → 1 {1, 1, 0, 1, 1} → 2 ...
Your task is to write a program that runs in two different languages, and does the following: In one language, it palindromizes a given string. Take the string. abcde Reverse the string. edcba Remove the first character. dcba Glue it onto the original string. abcdedcba In another language, it depalindromizes a give...
Your task is simple: Write a program (or function) that takes no input and outputs something like this: ## *name*, *length* bytes *code* Where *name* is the name of the language you are using, *length* is the number of bytes in your code, and *code* is your program's source code. If *code* contains multiple lines,...
Introduction to Numerical Mathematics This is the "Hello, World!" of PDEs (Partial Differential Equations). The Laplace or Diffusion Equation appears often in Physics, for example Heat Equation, Deforming, Fluid Dynamics, etc... As real life is 3D but we want to say "Hello, World!" and not sing "99 bottles of beer,..."...
Given a string of text that contains lowercase letters, encode it as follows: (I will be using abcdef) First, encode the alphabet cipher, but this time, 0-indexed. 000102030405 Reverse it. 504030201000 Loop through the string. If the next two digits together are 25 or smaller, encode those two numbers. 5 04 03 02 01...
Find X I was inspired by math questions in which one is asked to "Find X" for a given shape. Originally, I was just going to have the challenge be to print the x and y location of the character 'x' in a String. But I supposed that would be too simple. So I considered the context they were normally in, and decided findi...
Problem Description Imagine you're a turtle on a grid. You're given two numbers f and b, and you're facing east. You perform a march across the grid, counting each of the cells you encounter, according to the following rules: By default, you write the count to the cell you're in, then walk forward. If the count is di...
I got this challenge from Codingame and am curious about better solutions than mine: Given a width via standard input draw a hollow square of '#' in given width and length. Example: 5 results in ##### # # # # # # ##### I used python to solve this so i am particulary interested in other python code. But please fe...
Challenge Given an ASCII operator from the list below and a number n, draw an ASCII representation of the operator using that operator as the character with the line segments of the operator having length n. Input An ASCII character from the list = + - x / and an integer n where n >= 1. (I'm using x instead of * and /...
Cubes can be made of six squares as sides. But you could also fold three 2x1 rectangles in half and glue them together to form a cube. Now in this challenge you get a set of pieces which are each made from squares, and you have to determine whether you can choose pieces to form a unit cube. Not all of the pieces have t...
In my time on PPCG, I've noticed that quine problems and polyglot problems are quite popular. Also, meta-solutions to problems, that is, scripts which generate a program which is the solution to a problem, tend to get a lot of positive feedback from the community. Therefore, I have created this challenge, which impleme...
This problem is about separating a string representing a product identifier into three components. The first part consists of upper and lower letters of arbitrary length which represents the warehouse. The second part is digits which represents the product number. This part is also of arbitrary length. The last par...
Today is November 8th, 2016, Election Day in the United States of America. If you are a U.S. citizen eligible to vote, then go out and vote if you haven't already before answering this challenge. Do not discuss who you voted for. It only matters that you voted. If you are not a U.S. citizen or not eligible to vote, the...
I want a blanket that looks like this. Each strip goes over, under, over, under. Can you print it? \\\\////\\\\////\\\\////\\\\////\\\\////\\\\//// \\//// \\//// \\//// \\//// \\//// \\//// //// //// //// //// //// //// ////\\ ////\\ ////\\ ////\\ ////\\ ////\\ ////\\\\////\\\\////\\\\/...
Challenge I need help building a brick wall! Throw together some code for me using no input and produce the following output wall shown below: _|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___| ___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|__ _|___|___|___|___|___|___|___|___|...
It is only Tuesday, ugh. I deserve a treat. Golf me a Castle. The Least amount of bytes wins! Taken no input and output this image exactly: /\ /\ / \ / \ ---- ---- | |^^^^^^^^^| | ----------------- | _ | | | | | | | | | | | Edit Build me a brick wall! 36 votes...
Your program must take in a string like: test string And must output each character adding one at a time like this: t te tes test test test s test st test str test stri test strin test string notice how spaces count! Good luck! Least Bytes win. ~N
In the alternating Fibonacci sequence, you first start with 1 and 1 as usual. However, instead of always adding the last two values to get the next number, you alternate starting with adding, and every other time you subtract instead. The sequence starts like this: 1 1 2 # 1 + 1 -1 # 1 - 2 1 # 2 + -1 -2 # -1 ...
Let's define a simple 2D language, which we'll give the incredibly original name befinge. Befinge has 5 instructions: <>^v, as in most 2D esolangs, redirect the instruction pointer in their respective directions. . is a no-op. The instruction pointer starts out at the top-left corner going right. If the instruction ...
Given an xxd hexdump such as this one: 00000000: 1f8b 0808 4920 2258 0003 7069 6c6c 6f77 ....I "X..pillow 00000010: 2e74 7874 00d3 d707 8218 10d0 2799 c545 .txt........'..E 00000020: ba96 41a1 994c 7d60 d650 d53c 44a3 8a22 ..A..L}`.P.<D.." 00000030: cd43 34aa 28d2 3c44 a38a 22cd 4334 aa28 .C4.(.<D..".C4.( 00000040:...
As you all know, today is election day! Your task today is to print out a ballot, given an input. If the input is Hillary Clinton, print: Hillary Clinton ===-----===> Donald Trump === ===> ____________ === ===> However, if the input is Donald Trump, print: Hillary Clinton === ===> Donald Trum...
Introduction The perimeter density matrix is an infinite binary matrix M defined as follows. Consider a (1-based) index (x, y), and denote by M[x, y] the rectangular sub-matrix spanned by the corner (1, 1) and (x, y). Suppose that all values of M[x, y] except Mx, y, the value at index (x, y), have already been determin...
Consider a date formatted in YYYY-MM-DD. You can use the joker * at the end of the date string. E.g. 2016-07-2* describes all the dates from 2016-07-20 to 2016-07-29. Now, consider a period represented by a start date and an end date. The algorithm must find the smallest possible list of dates representing the period....
This challenge has two threads. This is the cops' thread. The robbers' thread is located here. Your challenge is to choose an OEIS sequence and write two full programs in two different languages that produces that nth item in the sequence when given an n via STDIN, or an other forms of standard input, where n is any p...
This is the robbers' thread of this challenge The cops will choose an OEIS sequence and write two full programs in two different languages that produces that nth item in the sequence when given an n via STDIN. The two programs must be anagrams of each other, meaning each can be rearranged from the other's letters. The...
An emirp is a non-palindromic prime which, when reversed, is also prime. The list of base 10 emirps can be found on OEIS. The first six are: 13, 17, 31, 37, 71, 73 However, due to the reversal rule, emirps are different in each base. For example, the first six binary emirps are: Bin | 1011, 1101, 10111, 11101, 1010...
A cruise control has 3 different options to move the handle to set the speed you want to drive with. Towards you: Adds 1 speed. Upwards: Increases speed to the next multiple of 10 (e.g. 20-->30, 32-->40) Downwards: Decreases speed to the next multiple of 10 (e.g. 20-->10, 32-->30) Input 2 integers: the first is the ...
An orthogonal matrix is a square matrix with real entries whose columns and rows are orthogonal unit vectors (i.e., orthonormal vectors). This means that M^T M = I, where I is the identity matrix and ^T signifies matrix transposition. Note that this is orthogonal not "special orthogonal" so the determinant of M can be...
Solve a Tron Game Tron is a great game, and if you haven't played it the internet has MANY online versions available. A fun challenge is to try to write an AI that plays Tron, which is normally much better than any human, thanks to their frame perfect dodging. Even with their perfect dodging of walls, they still get th...
I apologize if this isn't fit for this site but it is a puzzle, not all that practical, so I thought it would fit. Take this code: string s = ""; Console.WriteLine(ReferenceEquals(s, string.Empty)); This will print out true because "" is interned by the JITter at some early point and literals are reused from the inter...
Let's define the "unwrapped size" function u of a nested list l (containing only lists) by the following rules: If l is empty, then u(l) is 1. If l is non-empty, u(l) is equal to the sum of the unwrapped sizes of every element in l, plus one. Your task is to write a program (or function) that takes a list as input an...
Given the equation of a polynomial and an x-coordinate find the rate of change of the point at that x-coord on the curve. A polynomial is in the form: axn + axn-1 + ... + ax1 + a, where a ϵ Q and n ϵ W. For this challenge, n can also be 0 if you don't want to have to deal with special cases (constants) where there is n...
Let's define a 2-quine as a program that prints its source code two times. For example, if the program ABC printed ABCABC, it would be a 2-quine. Let's define a 3-quine as a program that prints its source code three times. For example, if the program ABC printed ABCABCABC, it would be a 3-quine. Let's define a n-quine...
Introduction Consider two arrays of the same length, say A = [0,1,0,2] and B = [-1,1,2,2]. Suppose we know that their contents are equivalent in some sense, item by item: 0 is equivalent to -1, 1 is equivalent to 1, 0 is equivalent to 2, and 2 is equivalent to 2. Equivalence is transitive: -1 and 0 are equivalent, an...
Are you feeling jealousy towards Mathematica, Matlab et al. for their intricate plotting capabilities? If you answered yes, this challenge is for you! Challenge Given, via parameters or standard input, a list of numbers list and a positive integer h for the height of the plot, write a program/function/snippet that prin...
The Challenge I was looking into small code examples for a specific language as a small tutorial and came accross a simplified Blackjack that should be implemented. In this Challenge you will have to implement a full Blackjack game, with 5 Decks. The Game You are playing against a Dealer and he has 5 Decks of Poker pla...
This challenge is based upon three sequences, below are their formulae: Recamán's sequence: a1 = 0; for n > 0, an = an-1 - n if positive and not already in the sequence, otherwise an = an-1 + n Fibonacci sequence: an = (Φn – (–Φ)–n) / √5 where Φ denotes the golden ratio, and a1 = 0 Triangular numbers s...
Today, November 11th, is known as Remembrance Day, Armistice Day, or Veterans Day (depending upon the country), and is a day of reflection and gratitude for members of the military and their service, specifically started to reflect the end of European hostilities in the first World War. Let us reflect on that with a si...
This is the cops' thread. For the robbers' thread, click here. Cops' Task First, write a quine in a language of your choosing. Next, scramble the quine. Make sure to do this well as the robbers will be trying to unscramble it and find the original source code! Note that the scrambled code does not need to work. Post a...
This is the robbers' thread. For the cops' thread, click here. Cops' Task For the cops' thread, click here. Robbers' Task Find an uncracked submission on the cops' thread. (A submission may only be cracked once.) Unscramble the code to find a working quine. Post an answer on the robbers' thread. Include the language, ...
Challenge: Write a lossless encoder/decoder that is able to compress its own source code. Usage: progname encode Encodes data provided on the standard input, writes the encoded representation of the data to the standard output. progname decode Decodes data produced by progname encode. Reads the encoded data from the s...
You are a taxicab driver in San Francisco. As is typical of taxicab drivers, you are navigating a grid where the only valid directions you can move are the left, right, up, and down. However, San Fransisco is very hilly so the distance between two adjacent intersections is not necessarily the same. More specifically, t...
Identify whether an IP address is internal, global, link-local, or reserved. Input should be an IPv4 address in decimal octets separated by periods. Output should be 0 for link-local (RFC 3927), 1 for internal (RFC 1918), 2 for global IPs (Internet), and 3 for otherwise reserved addresses. All these address types are d...
Balancing Act A see-saw (supposedly from the French 'ci-ça', meaning 'this-that') forms a third of the holy trinity of playground equipment, along with the similarly ubiquitous slide and swing. A see-saw is in perfect balance if, and only if, the sum of the moments on each side are equivalent. A see-saw can therefore b...
Note: This challenge is finished. Submissions are still welcome but can not win. This is the cops' thread. The robbers' thread goes here. Write a code that outputs the integer 1. If you add, remove or substitute a single character (of your choosing), the code should output the integer 2. Change one more character (th...
This is the robbers' thread. The cops' thread goes here. Write a code that has the same number of bytes as the cop post and where the revealed characters are identical. The code must produce 1 in its initial state, and produce the numbers 2, 3 .. when single alterations are made. The winner will be the robber that crac...
Steganographic Squares Your job is to take in a string, and generate an NxN image that represents this string. You must also write the algorithm that takes in the image and turns it back into a string as well. The scoring will be will include the byte count of both algorithms: "Encryption" Algorithm + "Decryption" Algo...
A sestina is a format of poem that follows an interesting pattern that we can generate. It has six stanzas of six lines each, where the last words of each line in the first stanza make up the line endings in each successive stanza, rotated in a set pattern. (There's also a three-line stanza at the end, but we won't wor...
Why don't you grow up? In the past week a meme involving the young actor Aaron Bailey became trending in most Brazilian social networks. Entitled "why don't you grow up" it consists in repeating a sentence replacing its vowels with is (it's a bit more complicated than that, I'll explain below). As I want to be a cool g...
Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C. Program B, when run in language B produces Program A, and running program B in language A produces program C. Program C, when run in language A or language B, prints "Wrong language!". Prog...
The challenge Simply write a program that outputs its own source code. Nothing more than a regular quine. The problem We don't have a computer so we have to run the program on a programmable logic device (such as an FPGA, a CPLD, a gate array ...). The rules Any device available on the market (such as a printer connec...
Given an input of a list of words, output the words with their letters arranged diagonally: p r o p g u r z a a z m n l m d e i c s n o g d g e o l f (The above should be the output for the input programming puzzles and code golf.) To be precise, each word starts on the first co...
Introduction In mathematics, a polygonal number is a number represented as dots or pebbles arranged in the shape of a regular polygon. The dots are thought of as alphas (units). These are one type of 2-dimensional figurate numbers. The number 10, for example, can be arranged as a triangle: * ** *** **** But 10 cannot...
My Downgoat avatar has several distinct features These features can however also apply to any other animal. Specification Given an image of an animal (technically can be anything), you must apply the Downgoat properties to it. Border pixels are the outer most pixels of the image. The background color is defined as th...
Out Steganograph Me As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them. The Challenge Your goal is to write a function or program that when given a string as an input, outputs an image. Then, in a seprate program/function, accept that same image...
The challenge here is to accurately depict the flower of life (which is a sacred geometrical figure according to some) in the language of your choice. The design consists an arrangement of circles and partial circles of radius 1 as shown whose centres arranged on a triangular grid of pitch 1, plus one larger circle of...
Hearts is a trick-taking card game for 4 players. Each trick is taken by the player who played the highest card of the leading suit. At the end of each hand, the players incur a penalty score depending on the penalty cards they have taken; the task is to determine the scores under Microsoft Hearts rules. Input Input is...
Briefing You are a bot, in a 2D grid that extends infinitely in all four directions, north, south, east and west. When given a number, you must move the bot so that you get to the target number. Here's how the grid works: You can move in 4 directions: north, south, east or west. Once you move off a cell, you are not al...
It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words! Walking words Walking words are words which will respond to certain characters. For the purpose of this challenge the trigger characters are [u, d, r, l] from up down right left. Whenever you encounter su...
In this challenge, you are going to create a Fellowship with the goal of defeating all other fellowships in battle. A fellowship (team) consists of 3 characters. Each character moves independently of the rest of their team, but they will need to work together when fighting your enemy. Teams will face each other head t...
The Art of Word Shaping Given a binary matrix and a string of letters, replace all 1's in the matrix, moving from top to bottom and from left to right within each row, with the letters of the string. Once the letters have been formed into the shape of the matrix, print the matrix, replacing 0's with spaces. It's probab...
A monotonic subsequence is a sequence of numbers \$a_1, a_2, ..., a_n\$ such that $$a_1 \le a_2 \le ... \le a_n \\ \text{or} \\ a_1 \ge a_2 \ge ... \ge a_n$$ [1, 3, 3, 7, 9, 13, 13, 100] is a monotonic (non-decreasing) subsequence, as well as [9, 4, 4, 3, 0, -10, -12] (this one is non-increasing), but [1, 3, 6, 9, 8] i...
Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly. For example, let's check the number 100. 1003 is 1000000. The set of digits in 100 is {0, 1}. The set of digits in 1000000 is {0, 1}. Therefore, 100 should give a truthy value. Test case...
Input: Firstly An array of three cards representing the cards played by each player formatted like [JD][TH][9S] Representing Jack of Diamonds, 10 of Hearts, and Nine of Spades. As you always sit across from your team-mate in Euchre, the second element represents your team mate's play. Here, the TH. Secondly A Single ...
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places. In traditional compass notation, a string is made up of only 2 of these characters (like NNW or ESE). Here you must also accept strings that contain all 4 (like WNNNSE). Using only 2 symbols allows hu...
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that they must be from the following list: AAA BBBB CCCC DDDD EEEEE FFFFF GGG H H A A ...
There is a helicopter flying 500 meters from the ground. It can fly up 100 meters, which takes 1.0 secs. Or if it doesn't fly up it will fall 200 meters, which also takes 1.0 secs - This means if the instruction is anything other than "Fly" the helicopter falls. Build a program that takes input of a list of instruction...
(randomly inspired by this question) Let's make a drawing from some pipes | and hyphens -. Choosing a subset, if chosen carefully, you can form a rectangular box or block shape (meaning that the corners are formed by |- or -|). For this challenge, we're concerned only with identifying the corners -- the vertical and ho...
Poker hands are ranked from best to worst as follows: Straight flush - five cards of sequential rank, all of the same suit Four of a kind - four cards of the same rank and one card of another rank Full house - three cards of one rank and two cards of another rank Flush - five cards all of the same suit Straight - five...