instruction
stringlengths
34
53.1k
Print the dates of all the Sundays in 2017 in the following format : dd.mm.yyyy. Expected Output: 01.01.2017 08.01.2017 15.01.2017 22.01.2017 29.01.2017 05.02.2017 12.02.2017 19.02.2017 26.02.2017 05.03.2017 12.03.2017 19.03.2017 26.03.2017 02.04.2017 09.04.2017 16.04.2017 23.04.2017 30.04.2017 07.05.2017 14.05.2017 21...
Everyone loves The Big Bang Theory, right? And everyone loves polyglots, right? So let's combine them! Task Your task in each language is quite basic. You must output the name of the one of the 5 main characters of The Big Bang Theory: Sheldon Lee Cooper, Leonard Leakey Hofstadter, Howard Joel Wolowitz, Rajesh Ramayan ...
The rundown Create a program that generates an array of random length with random numbers, then apply a series of rules that alter the array. After the rules have been applied, print the sum of the array unless specified otherwise Array setup The array must be a random length between 5 and 10 inclusive, with random int...
Task Basically you have an array of random integers e.g. I() = [1, 4, 3, 2, 5, 3, 2, 1] and you have to create another array of the same length with the numbers 1 to the size of the array in place of the smallest to largest numbers respectively, e.g. O() = [1, 7, 5, 3, 8, 6, 4, 2] For duplicates, the first occurrence...
Challenge Given an input of an integer, \$n\$ (where \$0<n<50\$), output the graph of \$y=\mathrm{Re}((-n)^x)\$ from \$x = -3\$ to \$x = 3\$ inclusive. Where \$\mathrm{Re}(p)\$ is the real part of the complex number \$p\$. Note that \$\mathrm{Re}((-n)^x) = n^x \cos{(\pi x)}\$ Output The output may be in any form you wi...
In this challenge, you will be given a square matrix A, a vector v, and a scalar λ. You will be required to determine if (λ, v) is an eigenpair corresponding to A; that is, whether or not Av = λv. Dot Product The dot product of two vectors is the sum of element-wise multiplication. For example, the dot product of the f...
The bus driver picks up the children from their homes every morning for school. All the homes are positioned around a circular street and the bus driver has to stop at every home exactly once. One monday morning the bus driver decided to only pick up every second child he encountered along his way. However, he still ha...
I heard somewhere that one thing that technology cannot do yet is fold towels1. So it is now your job to prove that statement false! Given a string as input, made up of rectangles (towels), like the following, fold each towel in half twice. For example: +------+ +------+ +--+ | | | | | | ...
Your challenge is to write a program, function, etc. that calculates if the passed string is "in order". That means that the characters of the string have character codes that are in order from smallest to largest. The smallest char code must be the first. By that I mean lowest unicode codepoints to highest. It doesn'...
No, not the ^^vv<><>BA kind of Easter eggs, real Easter eggs that we paint. Here is an (awfully drawn) egg. __ / \ / \ | | \____/ In easter, we paint them with patterns. Like these: __ /--\ /----\ |----| \____/ __ /%%\ /%%%%\ |%%%%| \____/ __ /~~\ /~~~~\ |~~~~| \____/ The challenge Given a chara...
Given a string that is one of the directions on a 16-point compass rose output the two directions that are immediately adjacent to the input direction, in clockwise order. Specifically, you need to handle these (and only these) input/output pairs: Input Output N NNW NNE NNE N NE NE NNE ENE ENE NE E E ...
Your program / function, etc. will take 2 inputs. The first will be a list of who came to my party and when. Example: Kevin 13:02 Ruby 5 Sam 3 Lisa 6 Bob 12 What does that mean? It means that Kevin got to my party first (at 13:02, 24-hour time), then Ruby 5 minutes later, then Sam 3 minutes later, then Lisa ...
This is a fewest-operations challenge where the objective is to sort a vector into ascending order using the fewest reversals. Your algorithm can only sort the vector using "sub-vector reversals"1, but it can use other operations for arithmetic operations, loops, checking if it's sorted etc. The number of sub-vector re...
Your task is to write a program which, given a number and a string, splits the string into chunks of that size and reverses them. Rules Your program will receive a positive integer n, as well as a string s with length at least one consisting of only printable ASCII (not including whitespace). The string should then be ...
Recently, I have found my reputation changing time to time. I would like to know my reputation changing real-time. The job Given an id of a user on PPCG (ex.64499), Print the user's reputation every 10 seconds. You may ignore the daily quota. Examples 64499 3808 40695 Possible output format 12345 12,345
Given an audio file, determine whether it is encoded in a lossy format or a lossless format. For the purposes of this challenge, only the following formats need to be classified: Lossy AC3 AMR AAC MP2 MP3 Ogg Vorbis WMA Lossless AIFF FLAC TTA WAV Rules If input is taken in the form of a filename, no assumption...
Challenge Given three numbers \$a\$, \$b\$, and \$n\$, you must expand \$(a + bx)^n\$ in ascending powers of \$x\$ up to \$x^3\$. Binomial Expansion Note that this method is an approximation The binomial expansion works like so: (a + bx)^n = a^n(1 + bx/a)^n = a^n(1 + n(bx/a) + n(n -1)(bx/a)^2/2! + n(n-1)(n-1...
Many different types of train set exist, ranging from wooden tracks like Brio, to fully digital control perfect tiny metal replicas of real trains, but they all require a track to be designed, ideally using as many of your pieces as possible. So, your task is to determine whether, given input of the available pieces, i...
Your task: given an integer n, output an embedded triangle to the nth depth. Standard methods of input and output, input in any convenient format, output should be as a string. Examples are 0-indexed, you can use 1-indexed if you want. Standard loopholes apply The left and right sides of each figure is 2^n, when 0 inde...
Gödel's β function takes three natural numbers as arguments. It is defined as β(x,y,z) = rem(x, 1 + (z + 1) · y) = rem(x, (z · y + y + 1) ) where rem(a, b) denotes the remainder after integer division of a by b. The β Lemma now states that: For any sequence of natural numbers (k_0, k_1, … , k_n), there are natural nu...
Problem adapted from the book Fortran 77 by Donald M. Monro Introduction Digital plotting machines are widely used to produce various forms of drawings, graphs and other pictorial results. Most such machines can move their pens only in certain directions, usually as single steps in the X and Y direction or both. A typi...
Titin is a protein found in muscle tissue. It is a pretty big protein, and its full chemical name is giant as well. Comprising 189819 characters, the full name of titin would take about 3.5 hours to pronounce. Your task is to output this entire name! Details The full name can be found here: Gist (this file does not inc...
Instructions Your goal is to write code that makes a "string" from a string in the least amount of bytes possible, as per the rules of code-golf. Standard loophole rules apply. To make a string, you have to assume the string contains only alphabetical characters and basic punctuation such as the period, comma, colons a...
First, a few definitions: Given n and k, consider the sorted list of multisets, where for each multiset we choose k numbers from {0, 1, ..., n-1} with repetitions. For example, for n=5 and k=3, we have: [(0, 0, 0), (0, 0, 1), (0, 0, 2), (0, 0, 3), (0, 0, 4), (0, 1, 1), (0, 1, 2), (0, 1, 3), (0, 1, 4), (0, 2, 2), (0,...
I have an issue with my keyboard (more likely an issue with my browser). Some times when I click on a new text field and begin typing all my text comes out backwards. After a very short amount of time (for the purpose of the challenge we will say it is 10 milliseconds) it resumes typing forwards again. It seems that ...
We'd like to factorize a semiprime \$N\$. The goal of this challenge is to find two small integers \$u\$ and \$v\$ such that \$uvN\$ can be trivially factorized with Fermat's method, thus allowing to easily deduct the factors of \$N\$. The task Given a semiprime \$N\$ and a positive integer \$k\$, we define \$x\$ and \...
My boss just told me to write a cosine function. Being a good math geek, my mind immediately conjured the appropriate Taylor Series. $$\cos(x) = \frac 1 {0!} - \frac {x^2} {2!} + \frac {x^4} {4!} - \frac {x^6} {6!} + \cdots + \frac{(-1)^k \times x^{2k}} {(2k)!} + \cdots$$ However, my boss is very picky. He would like t...
Using our familiar mathematical symbols: +, x, parenthesis, and any rational number, it's easy to create expressions that evaluates to some desired number. For example: 1+(2x3)=7, (1+2)+(3x6.5)=22.5 and so on. Boring enough. In this challenge, we'll use a new operator: ±. The use of ± in an expression means you need to...
Some of you may say that I am wasting my time, but this task does not give me peace for more than 500 days. It is required to write a program in Python 3.x that takes two numbers as input and displays their sum. The numbers are given in the following format: a b Some example test cases: 100 500 -> 600 3 4 -> 7 Th...
Make me a s'more! I tell you the width, the amount of graham cracker, the amount of chocolate, and the amount of marshmallow. An example: Input: Width: 10 Graham: 3 Chocolate: 2 Marshmallow: 1. Output: GGGGGGGGGG GGGGGGGGGG GGGGGGGGGG CCCCCCCCCC CCCCCCCCCC MMMMMMMMMM GGGGGGGGGG GGGGGGGGGG GGGGGGGGGG Is it that easy? U...
Given two strings, find the translation table (substitution cipher) between the two, if the translation is not possible, output false. The answer must be minimized and created from left-to-right. The first character to be translated between words must be the first in the translation table. In addition to this, any lett...
This task is rather simple, and makes use of three distinct "operator" characters. Your task is, given a simple sequence of letters, perform the following task to encode it using <,>,*. You may choose to use either upper or lowercase letters, you do not have to handle both. Cipher Explanation The cipher is simple, you...
Your challenge is to make a program or function that outputs the GCD of its inputs in one language and the LCM of its inputs in another. Builtins for GCD or LCM (I'm looking at you, Mathematica) are allowed but not encouraged. There will be 2 inputs, which will always be positive integers, never greater than 1000. Test...
The Rundown Given any input x and y, perform a complex operation, and print a corresponding result. How your program should work Given an input x and y in the form z = x+yi, find zi-z If the absolute real value of zi-z is larger than the absolute imaginary part, print the real part; vice versa for the other way around...
Your mission today is to create a vortex given a single parameter. This parameter determines the length of each arm in characters. Each "layer" of each arm contains one more character than the last. Here's how the vortex will look, given the arm length: 0: # 1: # ### # 2: # # # ### # # # 3: ## # ...
Well, everyone loves Polyglots. You will be given two integers, in any standard form of input (no hardcoding). Your task is to write a polyglot which finds the minimum value in a language and the maximum value between the two numbers in the other language, and performs the following operations: The code which finds th...
Your submission must take a list of numbers (in whatever list format your language supports, or using multiple function / command-line parameters) or a string of numbers separated by any character that is not 0123456789. In one language, it must add all of them and output the sum. In another language, it must output th...
Definition A dollar word is a word where when each of its letters is given a cent value, from a = 1 to z = 26, and the letters are summed, the result is 100. Here is an example on CodeReview, and here is a list of dollar words I found online. Input Input will be alphabetical from a-z, in your one language's text dataty...
Challenge Given a user's name (not ID, we have that challenge already), output their current reputation and their ID. Input Input will be a single string which is the user's username. You may assume that this user exists. Output Output will be two integers to either STDOUT or STDERR which will be the user's reputation ...
The challenge is simple Write a script that, when given a string input, will hash the string using the MD2 hashing algorithm, and then return either a positive integer or negative integer output based on which character set below is more common in the resulting hash as a hexadecimal string: 01234567 - (positive) 89abcd...
Sometimes a long absolute path, in e.g. a command-line parameter to a linux tool, can be shortened, using current working directory as reference: $ pwd /home/heh $ cat /home/heh/mydir/myfile my stuff $ cat mydir/myfile my stuff In this challenge, you should make a function or a program that receives two parameters: ...
The following puzzle was asked in puzzling SE. This puzzle is quite hard to solve by hand because every answer depends on another answer. So, for example, a solution with all answers being A does not work because then the question 7 would contradict question 8, for example. One of the answers there at puzzling SE sugge...
Write a function, f, that takes in a positive integer and returns a function. The new function returned should be identical to f. However, when the "termination call" happens, f should instead return the sum of all integers passed. For example, g=f(4) (if f is the first function) should set g to another function. h=g(...
Challenge Create a program that, when run, changes the contents of the source file. This means that you can delete/add/change characters in the source file, but you can't delete the (source) file itself (deletion is when the source file does not exist after the program is run). In the case of pre-compiled languages suc...
I was messing around on my 'ol TI-84 CE and made a program that produced this output (it was actually bigger but that is not the point): * * * * * * * * * * * * * * * * * ... I evolved it to take input text and make the triangle waves out of that. The final step was to also take a number to specify th...
As you may very well know python has lists. As you might not know these lists can contain themselves. a = [] a.append(a) Python 2 Python 3 These are cool and there are lots of interesting things you can do with them, however you cannot compare them. a = [] a.append(a) b = [] b.append(b) a == b Python 2 Python 3 Task...
Challenge Given a number x, output the first x powers of two, starting with 2¹ (2). Example 2 2 4 3 2 4 8 1 2 6 2 4 8 16 32 64 You may output numbers separated by non-numerical characters. You may not just output them mashed together like 248163264128. Rules In your code, you may only use the number 2. You m...
Given a non-empty set of strings and a list of strings, find out how many times the set occurs in the list, i.e. how many times you could create the set with items from the list. Every element from the list can only be used once. Hint: a set is an unordered list of unique items. Default input/output rules apply. No e...
Introduction One day, you were showing your kid how to draw on a computer. You type mspaint.exe in the run bar. To your horror, it says "No items match your search". You must create a simple version of paint so your kid can draw! Challenge You must create a simple drawing program. To do this, open a white display windo...
Challenge: To take two points on the plane and figure out the position of the point that's a) on the line that connects them, and b) equally distant from each of the original points. Example: (0,0), (3,3) -> (1.5,1.5) (-1,-1), (1,1) -> (0,0) (-7,3), (2,-2) -> (-2.5,0.5) (3, 1), (-5,9) -> (-1,5) Rules: The input an...
Introduction Connect Four is a game where you attempt to get four in a row: horizontally, vertically, or diagonally. In this code golf, we will be trying to find who won, given a game board. There will always be one winner, and only one winner. Task Given a Connect Four board, figure out who the winner is: X or Y. ...
Every palindrome with an even number of digits is divisible by 11, so 11 is the only [palindromic prime] with an even number of digits. - David Wasserman, OEIS I learned this today the manual way, before I did my research, when my program skipped numbers with an even number of digits (except 11) when calculating pali...
And no, This is not a dupe of Translate ASCII text to braille. There are 28=256 Braille patterns in Unicode. (By 'Braille' I mean 8-cell ones) W, wait. How many ASCII characters were there? 27 = 128? Well then, Let's turn ASCII into Braille, 'cause there is absolutely no reason not to! The way from ASCII, to Braille...
Everyone is likely familiar with the following song, which is a musical round: Background Fewer people might recall trying to sing the 4-person version of this with a few friends and failing. Offsetting the lyrics of a song with different harmonious pitches is known as singing a "round" and that's what we're here to s...
The ECMAScript 6 standard added many new features to the JavaScript language, including a new arrow function notation. Your task is to write a basic ES6-to-ES5 transpiler. Given only an ES6 arrow function as input, output its ES5-compatible counterpart. It's code-golf! May the shortest program in bytes win! The Basics...
This is a good beginner challenge and a good time killer. I only said a -natural- log because the title was too short, this has nothing to do with logarithms. Given 2 variables: The number of ants n. The width of the log w. Output a log of width w with n ants (Example shown w=3, n=6) | | | \O/ \O/ \O/ | ...
Charcoal is a language created by ASCII-only and DLosc that specialises in ASCII art challenges. What tips do you have for golfing in Charcoal? Obviously I am looking for tips related specifically to Charcoal, not those which can be applied to most - if not all - languages.
Spring has recently arrived, and it is almost the time when flowers start to sprout. So I want you to help them grow. Your task: Given two numbers, m, and n, output m flowers randomly placed on an n*n grid. A single flower looks like this: & | A flower's position is defined by where its & is. When randomly placing two...
Challenge Given a SE user's ID, output the sum of their reputation from across all of the Stack Exchange networks​ the user has signed up to. Rules If a user has 101 or less reputation on a site, count it as zero in the sum. You should not count Area 51 rep or hidden communities!! URL shorteners are disallowed. Example...
For robbers' post, Cheapo Enigma machine (Robbers) A cop's submission will consist of a program/function that accepts a single byte of data and return a single byte of data. Every possible input must produce a unique output. (In the other words, your function must be bijective) Robbers will attempt to create the invers...
For cops' post, Cheapo Enigma machine (Cops) A robber's submission consists of a program/function that accepts the output of a cop's code and returns the input for all the outputs provided by that cop's code. (In other words, you must write the inverse function) You cannot use built-ins that have the sole purpose of ha...
Background: Okay, i dropped my android smartphone and damaged the touchscreen The lower half (yeah, exact half!) is spider-webbed and does not work (potrait-mode) Fortunately for me, the display itself is working My phone is already rooted and adb enabled, so i have managed to enable 360 degree display rotation Using t...
You know how you get a voicemail message and the person's connection wasn't great, and you're trying to figure out how to call them back, but you're not sure if that was a "5" or an "8" they said? That's this challenge. The good news is that the caller read off their number twice, but it's garbled in both places. Your ...
From Wikipedia: Chopsticks is a hand game for two players, in which players extend a number of fingers from each hand and transfer those scores by taking turns to tap one hand against another. In this challenge "splits" can only be 4->2+2 or 2->1+1. Challenge Your challenge is to make a bot (think the AI and framewor...
Introduction You started to write a "Hello, World!" program, but after you wrote the part to print the hello, you forgot what your program should actually print. So now, you somehow managed it to write a program which can check if the entered word is what you search. The task Your task is to write a program or function...
Your task: make a hexagonal triangle with side length n, where n is a positive whole number or 0. First, let me define a hexagon: / \ | | \ / (Amazing ASCII art, right?) Hexagons can be linked together by sharing sides: / \ / \ | | | \ / \ / / \ | | / \ / | | \ / A hexagonal triangle is the fo...
I saw a cool gif of the twin dragon curve made from a square, and wondered what would happen if we started from another base image. So I wrote a program to do this.                                         It's so cool that I thought it would be fun to do it as a challenge. Task You will take in a square image with an ...
Your task is to create a program which, given an input string, will output the first Google autocomplete result for that search. The format of input/output is up to you. Rules Your program must take 1 input, a string, and output the top Google autocomplete/auto-fill suggestions result. The format of input/output is up...
Do you have any code-golf tips for writing in SOGL, a golfing language created by dzaima? Your tips should be at least somewhat specific to SOGL. Please post one tip per answer.
Intro Reverse and add is as simple as it sounds, take n and add it to its digits in reverse order. (e.g. 234 + 432 = 666). If you apply this process repeatedly some numbers will eventually hit a prime number, and some will never reach a prime. Example I currently have 11431 rep. 11431 is not prime 11431 + 13411 = 2484...
Challenge Given two question IDs, try to figure out how similar they are by looking at the answers. Details You will be given two question IDs for codegolf.stackexchange.com; you may assume that there exist questions for both IDs that are not deleted, but are not necessarily open. You must run through all of the answer...
You must make a polyglot that outputs its source code in one language and its source code backward in another. Unlike the normal rules, you are allowed to read the current file or use a builtin to get the source code of your submission and reverse that in one language. Your source code cannot be a palindrome. For examp...
In: a string without line breaks* Allow the user to edit and submit the line Out: the modified string (optionally with a trailing linebreak) The line editor must at minimum allow the user to: move a visible cursor left and right insert and/or overwrite characters at the cursor position remove characters at the curso...
Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1. To determine the perfectness of a string, you see how many sections you can split it into where each section is a palindrome. If there are ambiguities, such as with a...
Task: Your task is, when given three inputs: a numerator n a denominator d another integer, x Create a program/function that finds the xth digit of the number after the decimal place. Specs: The range of n and d is between 1 and 2^31 - 1, inclusive. The range of x is between 1 and 10,000,000, inclusive. You may ch...
There was a discussion going on in TNB once about the best temperature scale, and we agreed on something: Take the average of all four main temperature scales! That is, Celsius, Kelvin, Fahrenheit, and Rankine (Sorry Réaumur). So, now the issue is, most people don't use this system. So, I need a program to convert back...
If you're going to invent some fake news, you'll want to fabricate some data to back it up. You must already have some preconceived conclusions and you want some statistics to strengthen the argument of your faulty logic. This challenge should help you! Given three input numbers: N - number of data points μ - mean o...
This challenge was inspired by @HelkaHomba's excellent challenge Red vs. Blue - Pixel Team Battlebots. That challenge was probably the best one I've seen on this site. Ever. My challenge is still a lot different, but @HelkaHomba deserves credit for the inspiration. Overview This is a team king-of-the-hill where your t...
I read this question and thought it would make a nice challenge. Task Give an input 0<n<10 generate a random number with exactly n digits the first not a 0 so f(n)>10**(n-1)-1 distinct digits Winning criteria This is code-golf so shortest code wins. Random I mean evenly distributed random. So from the view of the ...
Circa 1976. With the success of the Tiny BASIC Design Note, a variety of Tiny BASIC IL implementations now span a range of microcomputers. The time has come to expand the Tiny BASIC standard. Grammar revisions: (LET) var = expression INPUT (string ,) var-list PRINT expr-list (;) IF expression relop expression (THEN) st...
I was watching the world snooker championship and it got me wondering.. Snooker scoring In the game of snooker there are certain rules that you must adhere too: When there are red balls on the table, during your turn you must first pot a red ball After potting each red ball, you must pot a colored (not red) ball (the ...
As you may know it, the factorial of a positive integer n is the product of all the positive integers which are equal or smaller to n. For instance : 6! = 6*5*4*3*2*1 = 720 0! = 1 We will now define a special operation with an irrelevant name like sumFac: Given a positive integer n, sumFac(n) is the sum of the factori...
Definitions You can skip this part if you already know the definitions of groups, finite groups, and subgroups. Groups In abstract algebra, a group is a tuple (G, ∗), where G is a set and ∗ is a function G × G → G such that the following holds: Closure: for all x, y in G, x ∗ y is also in G (implied by the fact that ∗...
In preparation for the AP Computer Science AP Test (Java), our teacher has been giving us FRQs from previous years for practice. My friend and I were golfing this during class today and got it as short as we could, but I'd like to see if there are any shorter solutions any of you can come up with. Rules: You must use ...
Given a number n and an upper limit l list the numbers that can be created by multiplying two or more numbers consisting of only sevens of length n or less that are less than l. A161145 is close to this challenge, however, you will NOT be including the 7, 77, 777, 7777, 77777, etc.. Examples n=anything, l<49 would resu...
Consider a connected undirected graph. A matching set of edges on this graph is defined as a set of edges such that no two edges in the set share a common vertex. For example, the left figure denotes a matching set in green, while the right figure denotes a non-matching set in red. A matching set is said to be maximal...
Ah, yet another of my selfish uses of this Stack. Being a Chromebook owner, I'm a frequent user of the Ace IDE, the editor used by Cloud9. It has lots of tools for dealing with excess whitespace, but it notably lacks one: clearing empty lines. Your mission today is, given an input from a place I can copy-paste to [;)],...
What I want: Quite simply, I want a text based display, that asks for an input, n, then shows that value on the display! But there's a catch. Each of the 'true' 'pixels' (the ones filled in) has to be represented by that number n.. Example : You are given an input n. You can assume n will be a single digit Input: 0 O...
This question is the first of several Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday! You can find more information about Brain-Flak's Birthday here Last summer we had the Brain-flak Integer Metagolf, and the answers it generated have been very useful to the Brain-Flak community sinc...
Dennis puts in a huge amount of effort for this community, including as moderator, language designer, and provider of TIO. Unfortunately, his four-year-old daughter has caught a cold, so let us all help him keep track of her recovery (may it be speedy) by providing him with a thermometer: .-----------. | | | ...
The French spell out numbers in a peculiar way. 1-16 are "normal" 17-19 are spelled out 10+7. 10+8, 10+9. 20-69 are "normal" (OK, OK! Not really, but they are in this challenge) 70-79 are 60+10, 60+11 ... 60+10+7, 60+10+8, 60+10+9. 80-99 are 4*20, 4*20+1, 4*20+2 ... 4*20+16, 4*20+10+7, 4*20+10+8, 4*20+10+9 Challen...
Inspired by a question over at Stack Overflow. The title here is entirely my fault. The challenge Given a list of positive integers containing at least two entries, replace each number by the minimum of all entries excluding itself. Test cases [4 3 2 5] -> [2 2 3 2] [4 2 2 5] -> [2 2 2 2] [6 3 5 5 8] -> [3 5...
Given a positive integer < 100 (from 1 to 99, including 1 and 99), output that many lockers. A locker is defined as the following: +----+ | | | | | | | nn | +----+ where nn is the locker number, in base 10. If there is 1-digit number, it is expressed with a 0 in front of it. For example, locker number 2 displ...
Backstory You wake up dizzy in a chemistry laboratory, and you realize you have been kidnapped by a old mad chemist. Since he cannot see very well because of his age, he wants you to work for him and only then, you can escape the laboratory. Task It is your task to return the structural formulae of the molecules whose ...
Your task is to translate a 103-smooth number into an English word, using the method described below. How? Generate the list of prime factors (with repetition) of the input number. Sort the list: If 2 is not one of the prime factors, sort the list in ascending order. If 2 is one of the prime factors, remove it from ...
...or is there? Your challenge is to parse my lunch bill, which contains the base price, tips, discounts, coupons, and extras and find out if my lunch was $0 or less. If this is the input: 12.34 15 tip 25 discount 1.5 extra 2 coupon Then the output might be false. Here's how it works: 12.34 is the base price. 15 tip m...
This question is the second of several Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday! You can find more information about Brain-Flak's Birthday here Challenge For this challenge you'll be generating all fully matched strings from a list of brackets. To borrow DJMcMayhem's definition...
Recently, I've seen Hare Krishna people with their mantra on the emblem and I've found it may be quite interesting to code golf. The challenge Write the Hare Krishna mantra, i.e.: Hare Krishna Hare Krishna Krishna Krishna Hare Hare Hare Rama Hare Rama Rama Rama Hare Hare Winning criteria This is code-golf, so shortest...
Given a string s and an array/list l, determine whether or not s can be made with parts from l. For example, if the string is "Hello, world!" and the list is [' world!', 'Hello,'], then the program/function should return a truthy value, because you can arrange the list to form the string. The following list would also ...
Say you list the positive integers in a triangle, then flip it left-to-right. Given a number, output the number it's sent to. This is a self-inverse mapping. 1 1 2 3 3 2 4 5 6 <---> 6 5 4 7 8 9 10 10 9 ...