instruction
stringlengths
34
53.1k
The goal of this challenge is to write a program or function that returns the least amount of strikes needed to complete a given course. Input The layout of the course can be passed in any suitable way and format you prefer. (read from the console, passed as an input parameter, read from a file or any other, multilin...
The Challenge Given an input string (or array) consisting of < and >, output a sequence (array or string) of integers such that: the operators are all correct when applied in order between consecutive numbers in the output all integers are positive (1 or greater) the sum of the integers is as small as is mathematicall...
Challenge: The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing bytes. BUT WAIT..... there is one restriction: Your source code can not include any of the digits from your byte count So if your score is 186 bytes, you...
A piggy bank is a container used to collect coins in. For this challenge use the four US coins: quarter, dime, nickel, and penny. Challenge Your challenge is to create an electronic piggy bank. Write a program (or function) that when run (or called), outputs (or returns) the count of each coin you have, as well as the ...
Inspired by The Great API Easter Egg Hunt! Summary Your task is to search for a predetermined integer in the "Collatz space" (to be explained later) using the fewest step possible. Introduction This challenge is based on the famous Collatz conjecture that hopefully everyone here at least heard of. Here is a recap taken...
Introduction For as long as programmers have been programming and as long as English teachers have been teaching, there's a controversy over the datasets called Arrays and Lists (or hashes). Arrays have almost always had their first index at 0. Which, for the programmer, is understandable because of math. But along the...
The task in this challenge is to put elements of an array into time bins. The input will be a non-decreasing array of positive integers representing the time of events, and an integer which represents the size of each bin. Let us start with an example. We call the input array A and the output array O. `A = [1,1,1,2,7,...
Challenge You need to generate a program or function that takes in a positive integer N, calculates the first N terms of the Fibonacci sequence in binary, concatenates it into a single binary number, converts that number back to decimal, and then outputs the decimal as an integer. For example 1 -> [0] -> 0 to decimal o...
A well known song by the Irish rock band U2 starts with the singer Bono saying "1, 2, 3, 14" in Spanish ("uno, dos, tres, catorce"). There are various theories as to the significance of those numbers. Apparently the official explanation is "we drank too much that night". But there's a more interesting hypothesis: Bono ...
Introduction I have some ASCII cars that have velocity and direction. Their velocity is represented by their number. If a car is <> then it has stopped. For example: <> 1> 2> 3> After one second, I get <> 1> 2> 3> After two, I get <> 1> 2> 3> If two cars are too close, they crash. 1> <1 1> <2 Afte...
Background IEEE 754 Double-precision floating-point format is a way to represent real numbers with 64 bits. It looks like the following: A real number n is converted to a double in the following manner: The sign bit s is 0 if the number is positive, 1 otherwise. The absolute value of n is represented in the form 2**y...
Introduction I have a lot of ASCII rocks. They are built with dashes, pipes, Vs, carets, angle brackets, slashes and spaces. Example: /--\ | | | | \--/ I want to erode them, like this: /\ / \ \ / \/ All of the corners have become rounder. A more complicated example: /----\ | \------\ | | | ...
Introduction Some months are completely symmetric, meaning they have central symmetry as well as reflection symmetry, like February of 2010: February 2010 ┌──┬──┬──┬──┬──┬──┬──┐ │ │ │ │ │ │ │ │ ├──┼──┼──┼──┼──┼──┼──┤ │ │ │ │ │ │ │ │ ├──┼──┼──┼──┼──┼──┼──┤ │ │ │ │ │ │ │ │ ├──┼──┼──┼──┼──┼...
Given the spiral of size S and the step N, output the "square" S*S spiral having N asterisks, built from the outer to inner radius clockwise. Test cases (examples) below. Input: 4 3 Output: *** Input: 4 6 Output: **** * * Input: 4 11 Output: **** * * * **** Input: 6 18 Output: ****** * * * * ...
Given a positive integer N ("virality"), your program should create an ASCII-art drawing of a tree with two branches of length N extending downwards and/or rightwards from the top-left corner. The direction taken by each branch after the first asterisk can be either rightwards or downwards, and this choice should be ma...
This challenge was posted as part of the April 2018 LotM challenge, as well as for Brain-flak's 2nd birthday I was thinking about what the most efficient way to encode brain-flak programs would be. The obvious thing to do, since there are only 8 valid characters, is to map each character to a 3-bit sequence. This is c...
Roguelike pathfinding Your task will be, given a two-dimensional array of the elements described below, which represents a dungeon, to output or return a single number representing the amount of gold pieces the rogue can collect without waking up any monsters. The elements of the array are as follows: Empty spaces are...
For the purposes of this challenge, we define a postfix regex dialect with alphabet {1, 0} and the following operations: 1 and 0 match themselves literally. _ matches the empty string. ! always fails (i.e. it does not match anything). ab; matches a, followed by b. ab| matches both a and b. a+ matches one or more insta...
Write a program or function that given n ≥ 1 returns the number of solutions to ±1 ± 2 ± 3 ± ... ± n = 0. For n = 6 there are no solutions, so the answer is 0. For n = 4 there are two solutions, so the answer is 2 (the two solutions are 1 - 2 - 3 + 4 = -1 + 2 + 3 - 4 = 0). This is OEIS sequence A063865. Some example in...
Challenge : \$\pi\$ is supposed to be infinite. That means every number is contained inside the decimal part of \$\pi\$. Your task will be to take a positive integer on input and return the position of this number in \$\pi\$ digits on output. For example, if the input is 59, we'll return 4 Here is why : we will look fo...
Inspired by Digits in their lanes Input: An ASCII-art of width ≤ 11, consisting of spaces and #. (You can choose any two distinct characters instead.) Example: # ### # # # # # # # # # ### # # ### # ########### # # # # # ### # # ...
Well I think it is about time we have another proof-golf question. This time we are going to prove the well known logical truth \$(A \rightarrow B) \rightarrow (\neg B \rightarrow \neg A)\$ To do this we will use Łukasiewicz's third Axiom Schema, an incredibly elegant set of three axioms that are complete over proposit...
I have recently thought of a wonderful relatively old mobile game, called Tower Bloxx. Alhough I'm not really old myself, but it reminded me of childhood and school :) So this my challenge is a kind of a reference to that good game! I have (hopefully) looked into any tower question on PPCG and this won't be a dupe. ...
Background: Pi (π) is a transcendental number, and therefore it has a non-terminating decimal representation. Similar, the representation doesn't terminate if written in any other integer base. But what if we wrote it in base π? Digits in decimal represent powers of 10, so: π = 3.14… = (3 * 10^0) + (1 * 10^-1) + (4 * 1...
As of ECMAScript 2015, JavaScript has 33 reserved keywords, such as break, const and new, as well as 10 future reserved keywords, such as let and await. Your task is to chain together the largest number of consecutive1 distinct reserved keywords2 while writing functional JavaScript code3. Consecutive reserved keywor...
Given an integer, output five perfect cubes whose sum is that integer. Note that cubes can be positive, negative, or zero. For example, -10 == -64 - 64 + 64 + 27 + 27 so for input -10 you could output [-64, -64, 64, 27, 27], though other solutions are possible. Note that you should output the cubes, not the numbers be...
Challenge: Input: Two integer parameters a and b (where a<b and the difference is at least 2) Output: Output or return this text, where a and b are filled in: (a,b) = ]a,b[ = {a<x<b} = {a<x&&x<b} = a+1..b-1 [a,b) = [a,b[ = {a<=x<b} = {a<=x&&x<b} = a..b-1 (a,b] = ]a,b] = {a<x<=b} = {a<x&&x<=b} = a+1..b [a,b] = [...
In some nations there are recommendations or laws on how to form emergency corridors on streets that have multiple lanes per direction. (In the following we only consider the lanes going in the direction we are travelling.) These are the rules that hold in Germany: If there is only one lane, everyone should drive to t...
So, here's a map of, let's say, a dungeon... ########## # ##### # ##### ########## ########## ########## ########## #### ## #### ## ########## Let's say that the hero is in Room A (at the top left) and their goal (a prince in distress?) is in Room B (to the bottom right). Our map does not allow the hero to...
Input A non-empty array of positive integers. Task Convert each integer to either binary, octal, decimal or hexadecimal in such a way that each digit (0 to F) is used at most once. Output The list of bases that were used to solve the puzzle. Detailed example The expected output for [ 16, 17 ] is [ octal, decimal ]. Her...
The following problem is a common interview question, thus dull answers are discouraged. Go short or creative, best if both: Create the following pattern ########### ## ## # # # # # # # # # # # # # # # # # # # # # # # # # # # ## ## ########### In case you cry "dupe", I see y...
For an integer n that satisfies n > 0, write its value as a right-descending path based on its binary representation. Rules The first (most significant) set bit is always in the top-left corner. When the next bit is set (a 1), draw a character ("filled") on the next line in the same column as the previous character dr...
Trigonometry has LOTS of identities. So many that you can expand most functions into sines and cosines of a few values. The task here is to do that in the fewest bytes possible. Identity list Well, the ones we're using here. sin(-x)=-sin(x) sin(π)=0 cos(-x)=cos(x) cos(π)=-1 sin(a+b)=sin(a)*cos(b)+sin(b)*cos(a) cos(a+b)...
A number theory expression contains: There exists at least one non-negative integer (written as E, existential quantifier) All non-negative integers (written as A, universal quantifier) + (addition) * (multiplication) = (equality) >, < (comparison operators) &(and), |(or), !(not) (, ) (for grouping) variable names(all ...
Input The board: A 2D container (matrix, list of lists, etc.) of letters like: ["B", "C", "C", "C", "C", "B", "B", "C", "A", "A"], ["B", "A", "C", "B", "B", "A", "B", "B", "A", "A"], ["B", "C", "B", "C", "A", "A", "A", "B", "C", "B"], ["B", "B", "B", "A", "C", "B", "A", "C", "B", "A"], ["A", "A", "A", "C", "A...
So your task is to take a 3x3 block where -'s mean blank spaces, and *'s mean filled spaces, for example: -** -*- *-* and rearrange the block so that the *'s form an X, like this: *-* -*- *-* Input: 3x3 squares like above, they can be 3 lines, an array, or however you want. Output: The shortest amount of moves to rea...
Given an integer N perform the following steps: (using 9 as an example). Receive input N. (9) Convert N from base10 to base2. (1001) Increase every bit by 1. (2112) Treat the result as base3 and convert it back to base10. (68) Return/Output the result. Input May be received in any reasonable number format. You only ...
What if we have a corridor comprised of two parallel mirrors? | | | | | | | | | | | | | | | | | | | | Now, we shine a laser down it... | \ | | \ | | \ | | \ | | \ | | \ | | \ | | ...
Recreational languages win at code golf too much. This challenge is simple, when using higher level functions. The task is as follows: Given any valid url, which is guaranteed to result in a valid HTML document (for example https://en.wikipedia.org/wiki/Ruby_on_Rails, which has 9 images), count the number of images di...
Given a list of two or more spelled-out serial numbers of equal length greater than two, e.g. [[ "three" , "one" , "four" ], [ "one" , "five" , "nine" ], [ "two" , "six" , "five" ], [ "three" , "five" , "eight" ]] sort the list by the numbers that the words represent: [[ "one" , "five" , "nine" ], [ "t...
In the context of quines, an intron (or payload) is a part of a quine that serves no purpose in producing output, but is still included in the data section. For example: function quine() { const data = "function quine() {\n const data=\"@\";\n // Arr! This be an intron!\n return data.replace(\"@\", JSON.s...
Using your language of choice, write a function that takes a variable number of arguments and returns the number of arguments it was called with. Specifics: Your language needs to support variadic argument functions: something callable that takes an arbitrary number of arguments and returns a value. Parameters must be...
A certain well-known cable company has a somewhat clumsy 'Search for Program' feature that works through the remote. It takes muchly much button pushing; so, being an admirer of economy of motion, I thought I'd seek out a programmer's help to minimize the number of finger movements I have to make. The Craptastic Search...
This is an answer-chaining challenge in which each answer builds on the previous answer. Taking no input, you are to output the most recent submission to this thread. I would HIGHLY suggest sorting by oldest and skipping to the last page to find the most recent answer. Scoring The winner will be chosen based on a point...
Input: A 2D array containing two distinct (optional) values. I'll use 0 and 1 when explaining the rules. The input format is of course flexible. Challenge: Zeros are water, and ones are islands. In order to ensure loneliness, your task is to surround all islands with water by inserting rows and columns of zeros. You d...
Premise So recently I was about half an hour early to an appointment, and decided to wait outside. I also determined that it would look strange if I just stood motionlessly in front of the house. Therefore, I decided to go on a quick walk, within a limited area. I also concluded that if I started walking in circles tha...
Given latitude/longitude of two points on the Moon (lat1, lon1) and (lat2, lon2), compute the distance between the two points in kilometers, by using any formula that gives the same result as the haversine formula. Input Four integer values lat1, lon1, lat2, lon2 in degree (angle) or four decimal values ϕ1, λ1, ϕ2, λ2...
I have a series of binary switches, which I can represent as a bit string. The last person who used my switches left them in some arbitrary state without cleaning up, and it bugs me. I always keep the switches in one of four possible "tidy" configurations: All 1: e.g., 111111111 All 0: e.g., 000000000 Alternating 1 an...
Not sure if this is the correct community to post this is. But as I see this problem as an interesting puzzle to solve, I'd thought to give it a shot... Problem Statement: Let`s say we have: N collections of parts: A, B,C,D,...etc Each collection consists of n parts: 1,2,3,4,5 ... All these parts are randomly present...
Input: A list of integers (which will never contain a zero) Output: A list of the same size with counts based on the following: If the current item is negative: Look at all items before this item, and count how many times the digits occurred in those other numbers If the current item is positive instead: Look at all i...
Challenge Predict the distance between the Sun and the nth planet when using any formula that gives the same result as the Titius–Bode law: d=(3*2^n+4)/10. BUT WAIT... there is one restriction: Your source code can not include any of the Titius–Bode law's digits So, your program can not contain the characters 0, 1, 2,...
Given an input sentence consisting of one or more words [a-z]+ and zero or more spaces , output an ASCII-art histogram (bar graph) of the letter distribution of the input sentence. The histogram must be laid out horizontally, i.e. with the letter key along the bottom in alphabetical order from left to right, with a Y-a...
So what might be the shortest language for this simple task? Task: You are given an input of type String - the string is a valid hexadecimal number ([0-9A-F]). Convert it to a decimal number and print it to the console. Tests: HEX -> DEC 1 -> 1 98 -> 152 539 -> 1337 1337 -> 4919 A5F9 > 42489 F -> 15 Win Condition: Th...
Write a program that, when run in different languages, outputs a different byte permutation of the code in each language. The exact source code is counted as one permutation. Here "different language" can be different version(Py 2 and Py 3) or different standard flags. It's different output that forces different versio...
So, there's a famous children's rhyme... This is the house that Jack built. This is the malt That lay in the house that Jack built. This is the rat That ate the malt That lay in the house that Jack built. This is the cat That killed the rat That ate the malt That lay in the house that Jack built. This is the do...
Description : You are given a string of numbers (positive and negative but not decimals) along with the number of entries like so. Like so 8 '1 2 5 0 7 -9 12 -8' Task : Your job is to return the number closest to zero be it +ve or -ve. Your input will be separated by spaces only. You are free to return the answer in a...
Given an arbitrary sequence consisting of 1 and A split this sequence up so that A is at the beginning of each sub sequence. Sequences without a leading A and Sequences without 1 before the next A will be self contained. Example Input 111A11A1111111A1A1AA should result in 111 A11 A1111111 A1 A1 A A Above already cont...
Description : Given an array of strings representing a grid of cells With the key : 0 = 'dead cell' 1 = 'live cell' write a function that returns the next iteration following the rules of Conway's Game of Life . Rules Any live cell with fewer than two live neighbours dies, as if caused by underpopulation. Any live ...
Assignment is simple to explain: write the shortest code you need to determine whether an executable binary program supplied as parameter is 32 or 64 bits. If there is a different kind of bitness, you can also do for it, but is not mandatory. What I really don't want is telling me you support other bitnesses and after ...
A lot of PPCG users helped with the creation of this challenge, both in chat and the Sandbox, specifically Martin Ender, AdmBorkBork, Emigna and user202729 Our community has found it necessary to create a set of languages designed specifically for golfing, "golfing languages" as we call them. Such languages have evolve...
Input: Integer n which is >=0 or >=1 (f(0) is optional) Output: The n'th number in the sequence below, OR the sequence up to and including the n'th number. Sequence: (0),1,-1,-3,0,5,-1,-7,0,9,-1,-11,0,13,-1,-15,0,17,-1,-19,0,21,-1,-23,0,25,-1,-27,0,29,-1,-31,0,33,-1,-35,0,37,-1,-39,0,41,-1,-43,0,45,-1,-47,0,49,-1,-51,0...
Description : Given a string of space separated binary digits or space separated booleans or an array of binary digits or array of booleans . Your job is to find the xor of each until you end up with one answer either 0 or 1. The inputs will always be valid and will only be either 0 or 1. Example : 1 0 0 1 0 --> 0 1 0 ...
(Inspired by last week's Riddler on FiveThirtyEight.com. Sandbox post.) Given a year between 2001 and 2099, calculate and return the number of days during that calendar year where mm * dd = yy (where yy is the 2-digit year). 2018, for example, has 5: January 18th (1 * 18 = 18) February 9th (2 * 9 = 18) March 6th (3 *...
Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. Wikipedia for more information For example you can be given a max weight of 15 and objects with ...
Due to technical limitations of Stack Exchange, the title is rendered incorrectly. The correct title for this challenge is Make a Word Icicle! Word Icicle Word cicle ord cicle ord icle ord i le or i le or i l or l or r Today's challenge is to make icicles out of t...
Description : Given an input (a string , array , integer) , Your job is to append one of the following to it. st , nd , rd , th . Examples : 1 ---> 1st 2 ---> 2nd 3 ---> 3rd 4 ---> 4th 11 ---> 11th 12 ---> 12th 13 ---> 13th 14 ---> 14th and so on and so forth This is code golf so shortest code will win in each langua...
Having a function f that takes arguments x1, x2, …, xn                                                – ie.  f : X1 × X2 × … × Xn → Y – currying redefines f as a function taking a single argument a1 which maps to yet another function. This technique is useful for partial application, for example with a curried pow func...
This is a code golf puzzle: shortest byte count wins. The program should do the following (standard loopholes obviously forbidden): Input a hexadecimal number Convert to octal Then interpret the digits as if in decimal (765 octal -> 765 decimal) Divide the number by two Convert to hexadecimal Example: Input: 4a3d Out...
Description : Given a string as input, check if it is a valid ordinal number in English or not. If it is valid return truthy value otherwise return falsy value. (Suggested by @Arnauld. Thanks . Also by @JoKing) For users who want to know about ordinal numbers go here : https://www.mathsisfun.com/numbers/cardinal-ordina...
In this task you are given an odd number of white balls and the same number of black balls. The task is to count all the ways of putting the balls into bins so that in each bin there is an odd number of each color. For example, say we have 3 white balls. The different ways are: (wwwbbb) (wb)(wb)(wb) for the two differ...
A Walsh matrix is a special kind of square matrix with applications in quantum computing (and probably elsewhere, but I only care about quantum computing). Properties of Walsh matrices The dimensions are the same power of 2. Therefore, we can refer to these matrices by two's exponent here, calling themW(0), W(1), W(2)....
This is a cops-and-robbers challenge based around defining languages and proving they are Turing complete. This is the cops' thread. The robbers' thread is here. Cops As a cop, you will prepare two things: A formal specification of a programming language, or other computational system. (Computational systems are defin...
This is a cops-and-robbers challenge based around defining languages and proving they are Turing complete. This is the robbers' thread. The cops' thread is here. Robbers The cops will post definitions of Turing-complete languages. Your task is to crack them by proving that they are indeed Turing complete. See the cops'...
This challenge is inspired by the meme Men of Culture. The meme involves blanking out parts of the original caption, Ah, I see you're a man of culture as well. to make it appear as if the character is saying something else. Your challenge is to write a program that, given an input, show how the original sentence can ...
Input is in this format: image fontwidth fontheight rowwidth xoffset yoffset xgap ygap non-existent charstart thetextitself thetextitself: The text that should be rendered from the image. image: The image filename. Implementation may vary; it could be either the filename from your computer, an image URL, or something ...
Introduction A sequence of numbers is passed in as the input. The program has to generate the lowest degree polynomial possible. This was my first programming project in college and it would be interesting to see how much smaller the solution could have been. Challenge The input is a list of integers separated by a com...
Description : Given x and y positions of two circles along with their radii, output the area of intersection of the two circle. Input : You will be given following input : array 1 = x and y positions of circle a array 2 = x and y positions of circle b radius = radii of the two congruent circles Input method : ([12 ,...
You're given the map of a cinema theatre as a boolean matrix: 0 represents a free seat, 1 - occupied. Each Finn who walks in chooses the seat farthest away (Euclidean distance) from the nearest occupied one, or if several such exist - the first among them in row-major order. Output a matrix showing the order seats will...
Your challenge is simple: write as long of a pristine program as possible in the language of your choice using only unique bytes. (The full definition of a pristine program, copied from that link, is at the bottom of this question.) That's right, no strings attached. Your code doesn't have to do anything at all, just r...
For a computer language, a reserved word is a word that cannot be used as an identifier, such as the name of a variable, function, or label. For other computer languages, keywords can be considered as the set of the language instructions. Challenge Using your language of choice, write a code in the chosen language that...
Recursively define a "valid arithmetic expression": Any natural number is a valid arithmetic expression. If s is a valid arithmetic expression, then so is (-s). If p and q are valid arithmetic expressions, then so is (p+q). In the above, a "natural number" is recursively defined as follows: 0 1 2 3 4 5 6 7 8 9 are n...
look! It's an ASCII maze! Soo coolzors, amazeballs and stuff. +-+-----+---+ | | | | | | ++ | | | | ++ +-+ | | | | +-------+ | | | | | +---------+-+ But, but, but... it's a pain to work out which direction all the parts of the maze are going. I just want to draw the layout and the maze make it...
This sentence employs two a’s, two c’s, two d’s, twenty-eight e’s, five f’s, three g’s, eight h’s, eleven i’s, three l’s, two m’s, thirteen n’s, nine o’s, two p’s, five r’s, twenty-five s’s, twenty-three t’s, six v’s, ten w’s, two x’s, five y’s, and one z. Such sentences are called autograms. Your task is to write a p...
Given an input integer n >= 10, output the average of all deduplicated rotations of the integer. For example, for input 123, the rotations are 123 (no rotation), 231 (one rotation) and 312 (two rotations). The average of those is (123 + 231 + 312) / 3 or 222. As another example, take 4928. The rotations are 4928, 9284,...
This is a CC-BY-SA challenge from the CCSC Mid-South Programming Contest 2018. Author(s): Brent Yorgey Source: Consortium for Computing Sciences in Colleges Mid-South Programming contest 2018 https://ccsc18.kattis.com/problems/ccsc18.mountainrange Good news: you have been hired to do all the special effects for a fil...
Your mission is to build an algorithm (program or function) that can optimize packing fruit from a conveyor belt into bags to be sent off to retailers, optimizing for a largest number of bags. Each bag has to weight at least a certain amount, but any excess is lost profit since that weight could be used to fill another...
Back in the day, telephone autodialers used punched cards with one column for each digit of the number to be dialed. Columns had seven rows. The first three rows represented the numbers (1,2,3), (4,5,6), and (7,8,9) respectively. The last three rows rotated this arrangement by 90°: (1,4,7), (2,5,8), and (3,6,9). The mi...
Challenge : Your job is to find the given number N. Input : You will be given a string in the following form: dN ± Y = X Where: d, N, X, Y are all numbers with d , X , Y being integers (not decimals). Output : Solve the equation and output the value of N rounded. Round up if decimal is greater than or equal to 0.5...
Given string S representing a dollar amount, make change for that amount of money use the least number of coins to make the change and record the amount of each coin in a list. Here are the coins available to use and their value. Coin : Value Dollar Coins : $1.00 Quarters: $0.25 Dimes: $0.10 Nickels: $0.05 Pennies: $0....
Interleaved sequences represent an arbitrary merging of some number of sequences. An interleaved sequence can be made by appending elements to a list one by one from some number of lists, choosing the next element from some list each time. Therefore, an interleaved sequence will contain exactly the same elements of all...
Given a polynomial in one variable with rational coefficients, output an equivalent expression containing only 1, variables, and definite integrals. For example, -x2 can be expressed as ∫x∫111dtxdu. E := 1 | var | ∫EEEdvar Any reasonable input/output method is allowed. Examples: Your score will be the your code length...
This is a KOTH challenge for the dollar bill auction game in game theory. In it, a dollar is being sold to the highest bidder. Bids go up in increments of 5¢, and the loser also pays their bid. The idea is that both players escalate the bidding war far beyond the value of a dollar in order to cut their losses. Let's ho...
Description You are given the results of a range function where every element has been rounded down to the nearest whole number. Your goal is to recover the original list. For example, the following function (in Python3) will produce an input for your program: from numpy import arange, floor def floored_range(A, B, C):...
Take the numbers 0, 1, 2, 3, 4, ... and arrange them in a clockwise spiral, starting downward, writing each digit in its own separate square. Then, given one of four distinct and consistent ASCII characters (your choice) representing an axis, and an input integer n, output the first n terms of the sequence described by...
Challenge : Given a word, check whether or not it is an isogram. What : An isogram is a word consisting only of letters with no duplicates (case insensitive). The empty string is an isogram. Examples : "Dermatoglyphics" ---> true "ab" ---> true "aba" ---> false "moOse" ...
Challenge: Take a string of upper or lower case letters as input (optional), and calculate the score that string would get in a game of Scrabble in English. Rules: The score of each letter is as follows (use this even if there are other versions of the game): 1 point: E, A, I, O, N, R, T, L, S, U 2 points: D, G 3 point...
The Seidel Triangle is a mathematical construction similar to Pascal's Triangle, and is known for it's connection to the Bernoulli numbers. The first few rows are: 1 1 1 2 2 1 2 4 5 5 16 16 14 10 5 16 32 46 56 61 61 Each row is generated as follows: If the row number is even (1-indexed): Bring...
Challenge A simple challenge: given two or more strings, output all of the substrings that are in each string. Rules Input is always a comma separated list of strings Strings should be outputted from longest to shortest length without duplicates Strings should preserve whitespace Examples Input: aaa,aa Output: aa a ...
99 Varieties of Dosa is a popular chain of roadside dosa stalls across South India. This is inspired by a combination of this chain and the classic CodeGolf challenge "99 Bottles of Beer". Recreate the variant of the menu of the popular '99 Varieties of Dosa' listed below. (Note: Despite the name, the list contains 10...
Given integers N , P > 1 , find the largest integer M such that P ^ M ≤ N. I/O: Input is given as 2 integers N and P. The output will be the integer M. Examples: 4, 5 -> 0 33, 5 -> 2 40, 20 -> 1 242, 3 -> 4 243, 3 -> 5 400, 2 -> 8 1000, 10 -> 3 Notes: The input will always be valid, i.e. it will always be integers g...