instruction
stringlengths
34
53.1k
Introduction Rules of the puzzle: The puzzle Binary (also known as Takuzu or Subiku) is very simple to understand, and has only a few rules: Since the name of the game is binary it's pretty obvious, but you can only fill in zeros and ones. No more than two of the same digit can be vertically or horizontally adjacent t...
This challenge is very simple: Given an angle measure in degrees or radians (your choice), output the angle between 0 and 2π non-inclusive [0º, 360º) that is coterminal with it. Input A positive or negative angle measure. You can pick if you want to take it in degrees or in radians. Output The angle on [0, 2π) that ...
Your task is to write a program that outputs its own source code in reverse. However, when the reversed code is run, it should output the source code, facing the correct direction. Example Say your program is abc. When run, it should output cba. cba, when run, should output abc. Rules Your program should follow all the...
Given a dictionary of 4-letter words that have no repeated characters (from this list of words), you must choose ONE of those words, and output that specific word using the following dictionary of block letters: .----------------. .----------------. .----------------. .----------------. | .--------------. || .----...
Make a program (or a function) that copies the exact text "Hello, World!" to the clipboard, and terminates.
Make a Quine. Seems easy right? Well this quine must output itself plus its first character, which then outputs itself plus its second character, and so on. This way the quine should in several generations output two copies. Example: Lets your code be x. Running it should output x + x[:1]. Running the resulting program...
Given a list of (key, value) pairs, determine whether it represents a function, meaning that each key maps to a consistent value. In other words, whenever two entries have equal keys, they must also have equal values. Repeated entries are OK. For example: # Not a function: 3 maps to both 1 and 6 [(3,1), (2,5), (3,6)] ...
Explanation of the challenge Given an input, return what shapes it could be. There are only a couple options. Square Triangle Square A square is in the following format: XXXX XXXX XXXX XXXX So, in this example, the input would be: 16 And the output would be: 1 or "Square" Triangle We are only checking for equila...
Given a positive integer n write some code to take its prime factorization and replace all of its factors of 2 with 3. For example 12 = 2 * 2 * 3 -> 3 * 3 * 3 = 27 This is code-golf so the goal is to minimize the byte count of your answer. Test cases 1 -> 1 2 -> 3 3 -> 3 4 -> 9 5 -> 5 6 -> 9 7 -> 7 8 -> 27 9 -> 9 10 -...
A collection of N dimensional coordinates are provided. An example is below: {2,3,4} This can be thought of as a 3 dimensional array with 2x's, 3y's and 4z's; there may be any number of dimensions. In the example, there are 24 total nodes. Each node can be indexed using {x,y,z}. To access the 5th node, the provided in...
No, not this. And not this either. This question is nothing like those Write the shortest code to print/return the following output: /\ /\ /\ / \ / \ / \ / /\ \ / /\ \ / /\ \ / / \ \/ / \ \/ / \ \ \ \ / /\ \ / /\ \ / / \ \/ / \ \/ / \ \/ / \ / /\ \ / /\ \ / \/ / \ \/ / \ \/...
Note that this is similar to my other challenge, but it is widened to be similar to most challenges (input -> truthy/falsey), instead of asking you all to brute force something. If this makes it a dupe, let me know, but I posted it on Sandbox and asked on chat, and didn't get any negative responses. Input Input will be...
Jill lives in the (magnetic) north pole. One day, Jill decided to go for a walk, travelling in the four directions (north, east, west, south) for some lengths, with the help of a compass. Your task is to find whether Jill ended up where Jill lives, i.e. the magnetic north pole. Only south is defined at the north pole. ...
Challenge Given a the ID for a PPCG user who has existed for at least a month, output the average amount of reputation they gain per month. You can do this by dividing their reputation by the time since their account was created (which you can find on the profile). This should be returned floored; that is, truncate all...
Your task is to write a function that takes an even-digit integer and compares the 2 halves of the integer. If the sum of the digits in the first half is greater than the sum of the digits in the second half, output a truthy value, otherwise, output falsey. For example: 12345678 1234 5678 (1+2+3+4)>(5+6+7+8) 10>26 Out...
Oh no! I'm trapped in a big forest (Okay, not really, but just assume it) and I don't know where I am! Thankfully, I brought my laptop. But when I searched 'Maps', It said 'No results', and I'm asking this as a last resort. Please make a program which outputs my location's longitude and latitude in any two number forma...
What is the shortest way of generating a random string with a given length and with only alphanumeric characters allowed? example of a random string: with N = 9 output would be aZua7I0Lk the given length N can be assumed to be always greater than 0 if necessary you can assume 256 as a maximum value for N, but solution...
Briefing Given a Fully Qualified Java Class/ Package name, you must shorten it as such: Each part of the dot separated package will be shortened to its first letter, apart from the last section and the class (if it exists). package names will be all lower case, and the class (if it exists) will start with a capital let...
I used to play a game while I was in the car, it consisted in taking the n-1 first numbers of another car plate and use operators and roots on them to get the nth number of the plate. I could use the following operators and roots : addition (ex: 1 + 1 = 2) subtraction (ex: 2 - 4 = -2) division (ex: 10 / 2 = 5) (Note ...
I am making a customizable password generator. But I (for some reason) thought it'd be better to let you guys do it. Umm.. then? You only get one integer. That will include all the information about the customization. The first 4 bits (1,2,4,8) will be used for choosing which charsets will be used. Each bit correspond...
A magic square is an n-by-n square grid, filled with distinct positive integers in the range 1,2,...n^2, such that each cell contains a different integer and the sum of the integers in each row, column and diagonal is equal. Your task is to take an n-by-n matrix consisting of positive numbers, and a placeholder charact...
Yes is a stack-based language that has a few space-separated instructions: yes: Push 1 to the stack no: Push 0 to the stack what: Push the input to the stack (input is taken at the start of program execution and is the same for the whole execution) sure: Increment the last item in the stack nah: Decrement the last item...
You may know the mathematician von Koch by his famous snowflake. However he has more interesting computer science problems up his sleeves. Indeed, let's take a look at this conjecture: Given a tree with n nodes (thus n-1 edges). Find a way to enumerate the nodes from 1 to n and, accordingly, the edges from 1 to n-1 in ...
Given a non-empty string of lowercase ASCII letters a-z, output that string with each consecutive “run” of the same letter lengthened by one more copy of that letter. For example, dddogg (3 d’s, 1 o, 2 g’s) turns into ddddooggg (4 d’s, 2 o’s, 3 g’s). This is code-golf: the shortest answer in bytes wins. Test cases aab...
Wise is a simple bitwise language I designed a while back. It is based around Python's bitwise operations. It has several operations most of these are the same or very similar to the equivalent symbol in Python. : Duplicate the top of the stack ? Rotate the top of the stack to the bottom ! Rotate the bottom of the s...
Write a program or function that, given a string, will strip it of zalgo, if any exists. Zalgo For this post, zalgo is defined as any character from the following Unicode ranges: Combining Diacritical Marks (0300–036F) Combining Diacritical Marks Extended (1AB0–1AFF) Combining Diacritical Marks Supplement (1DC0–1DFF) ...
The goal of this challenge is to use Euler's method to approximate the solution of a differential equation of the form f(n)(x) = c.† The input will be a list of integers in which the nth value represents the value of f(n)(0). The first integer is f(0), the second is f'(0), and so on. The last integer in this list is th...
Background While a program is running on a computer, the computer needs to keep track of that program somehow, typically by either copying or mapping the compiled form of the program into memory. (Even interpreted languages do this; a few primitive languages work with source code directly, but in most interpreted langu...
Generate the following soccer team ASCII art with the least number of bytes possible. |.| |.| |.| |.| |.| |.| |.| |.| ]^[ ]^[ ]^[ ]^[ ]^[ ]^[ ]^[ ]^[ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ /~`-'~\ {<| 8 |>}{<| 6...
My father who was a really good APLer and taught me all the basics of APL (and much more), passed away on this day, five years ago. In preparation for 50 Years of APL, I found this patent letter (translated for the convenience of those who do not read Danish) for a handwritten logo. It explains a major reason for APL n...
This challenge was greatly inspired by this Stack Overflow post. Challenge Given a bunch of clients in terms of when they enter a room and when they exit it, determine the period(s) of time when the room has a maximum number of people. The time resolution should be to the minute. For example, if there are three clients...
I'm currently cooking us some cup noodles, but we're really sleepy at the moment. They'll be finished in 50 seconds from now, can you wake me up then? Problem: Write a program or function that waits 50 seconds of busy waiting (so that you too doesn't sleep) and then outputs at least 1 visible character to wake me up. B...
For any positive integer \$k\$, let \$d(k)\$ denote the number of divisors of \$k\$. For example, \$d(6)\$ is \$4\$, because \$6\$ has \$4\$ divisors (namely \$1, 2, 3, 6\$). Given a positive integer \$N\$, display a "skyline" in ASCII art using a fixed character, such that the height of the "building" located at horiz...
Given multiple sets, e.g. s1={2,3,7}, s2={1,2,4,7,8} and s3={4,7}, a Venn diagram visualizes each set by a closed curve and set elements which are either inside or outside the curve's perimeter, depending on whether they are element of the set or not. Because all set elements appear only once in the Venn digram, the cu...
Based on this, but I was asked[​1​],[​2​] to do a graphical edition. Task Generate a circular display of the text EASIER COMMUNICATION MEANS FASTER CODING MEANS FEWER CODERS MEANS . Any uppercase font goes. The letter tops must face out of the circle. Either the space before FEWER must be at the bottom (6 o'clock) or ...
Intro Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic code-golf edition of this year's eighth problem. I have explicit permission to post this challenge here from the original author of the competition. Feel free to verify by following the ...
Make a program which can fill a 2D space with "pursuit polygons". The following picture will help you understand better what I mean. You can also look up "pursuit curves" or mice problem. You can use any convex n-polygon you like here are some examples Triangle: Square: Pentagon notice that for every polygon you ca...
Today I installed MonoGame and ran the test application, which creates a basic colored window. I was surprised to see that the process was using 32.2 MiB of memory, and I thought it could be improved. Your challenge is to write a program that creates a 640 by 480 window displaying only black pixels. Whatever program u...
A Quine is a program which outputs its source when run. In this challenge, You should make a Fibonacci-quine, a variant of the quine. What is a Fibonacci-quine? A Fibonacci-quine is a program, which outputs a modification of the source by the following rule: The initial source should be ...2.... In other words, the so...
Challenge Given an integer, \$s\$, as input where \$s\geq 1\$ output the value of \$\zeta(s)\$ (Where \$\zeta(x)\$ represents the Riemann Zeta Function). Further information \$\zeta(s)\$ is defined as: $$\zeta(s) = \sum\limits^\infty_{n=1}\frac{1}{n^s}$$ You should output your answer to 5 decimal places (no more, no le...
Write a program which calculates if an inputted monetary value, as an integer, can be represented by a unique combination of coins and/or notes, that meaning the same coin/note cannot be used more than once. Your program should take a value as input, and can take a list of coin/note values either via input or via your ...
Your challenge is to print the input, wait any amount of time, print the input, wait twice the time you initially waited, print the input again, and so on. The initial delay must be less than 1 hour, and you must have an accuracy of +/- 5% in the subsequent delays. Other than that, there is no restriction on the delay ...
In the standard loopholes, the following is forbidden: Claiming that your answer is written in "MyOwnLanguage", where the command x means "read a sequence of numbers, split them into groups of three, and print the last numbers of those groups where the second number is less than the first" Here, we are going to do th...
Task Given two positive integers: Draw the rectangle with dimensions specified by the two integers. Repeat Step 3 until there is no more space. Draw and fill the largest square touching three sides of the (remaining) rectangle. Output the resulting rectangle. Example For example, our input is 6 and 10. We draw the ho...
My dog is called Rex. Every time I scold him, he seems not very impressed and the only times I see him react is when I pronounce his name. If I say Rex, I told you not to do this! You're making me angry Rex! all he hears is Rex, * **** *** *** ** ** ****! ***'** ****** ** ***** Rex! The challenge : given an input str...
Disclaimer: No, this is not a joke challenge to reverse a string. Task There is only one operation to support: subtraction (-). You also only have two atoms to support: zero (0) and one (1). Here, the prefix notation -AB is equivalent to the postfix notation AB-, where A and B are expressions. Your task is to (recursiv...
Meta discussion: Is "(The other day) I met a bear" a duplicate? Your challenge is to output this text: The other day, The other day, I met a bear, I met a bear, A great big bear, A great big bear, Oh way out there. Oh way out there. The other day, I met a bear, A great big bear, Oh way out there. He looked at me, H...
Your task is to, given a map as input, zoom it out or in, depending on the scale. Note that the scale given is the scale by which to zoom out, so a scale between 0 and 1 will actually zoom in. For example, given the following (badly made) map: ..____.... ../OOO\... ..\OO/\... .......... And a scale factor of 2, you sh...
Raffaele Cecco is a programmer who produced some of the best video games for the ZX Spectrum computer in the late eighties. Among others, he developed the highly acclaimed Cybernoid and Exolon. Raffaele is turning 50 on May 10, 2017. This challenge is a small tribute to him, for the happy hours that many of us spent p...
K-Means Clustering (Wikipedia) The task here is rather simple, perform a single iteration of a k-means clustering algorithm on a binary matrix. This is essentially the setup task for the main k-means algorithm, I felt the setup might be easier and entice golfing languages to give it a shot as well. The matrix passed to...
Task Write some code that can be rearranged into n different programs in n different languages each outputting a distinct number from 1 to n. No two languages should be the same however different versions of "the same language" will be considered distinct languages, as long as they have different major version numbers....
The task Write a program or function whose input is a list/array X of integers, and whose output is a list of sets of integers Y, such that for each element e in each set Y[i], X[e] = i, and such that the total number of elements in the sets in Y equals the number of elements in X. (This is basically the same operation...
Task - The title pretty much sums it up: raise an integer x to power x, where 0<x. Restrictions: Use of exponentiation, exp(), ln(), and any other powers-related language built-ins, like pow(), x^x, x**x is forbidden. You can assume that the given integer fits the limits of the programming language of your choice. Te...
This is much more advanced than How to randomize letters in a word and Cambridge Transposition because of the rule about which letters may be swapped with which. A simple regex will not suffice here. It is well known that a text can still be read while the innards of its words have been scrambled, as long as their fir...
According to legend, almost everyone is outgolfed by Dennis. If not, they will be. Now I'm curious if I'm one of those 'almost everyone'. You will be given a link to an answer in the format of https://codegolf.stackexchange.com/questions/[QUESTION ID]/[QUESTION NAME]/#[ANSWER ID]. Find the length of the code, which we ...
I know there have been a lot of challenges about "the two best code-golfers in the world", but this one is a bit more unique, being Round 1 in a series of (future) challenges involving the two of them. Your task is to write a program or function that returns two different non-whitespace ASCII strings, corresponding to...
Introduction Yes, it's as simple as that. Download any file from the internet! Rules You must use your language's API. You must output the file you downloaded to STDOUT, the console, a file, etc. Input should be empty, or the URL you wish to download, but the url must count to byte count.. Good luck!
Your challenge is to query the SE API and find out whose rep on PPCG is tied, and output it. If these were all the users on PPCG: Martin Ender: 10000 rep Dennis: 10000 rep xnor: 5000 rep sp3000: 3000 rep You should output Martin Ender, Dennis. If these were the only users: Jon Skeet: 1000000 rep Martin Ender: 10000 re...
For those of you who are unfamiliar, Kirkman's Schoolgirl Problem goes as follows: Fifteen young ladies in a school walk out three abreast for seven days in succession: it is required to arrange them daily so that no two shall walk twice abreast. We could look at this like a nested 3 by 5 list (or matrix): [[a,b,c] ...
Given a string or list, calculate the effects of gravity on that string/list. The string will be made of 5 characters: N has a weight of 2 L has a weight of 1 S has a weight of -2 D has a weight of -1 (the 5th character is whatever you want, it means empty space. I use (space) in my examples) Items with negative we...
A void list is a list that at no level contains any non-list objects. Or if you prefer a recursive definition The empty list is void A list containing only other void lists is void All void lists have a finite depth. Here are some examples of void lists (using python syntax): [] [[]] [[],[]] [[[]]] [[[]],[]] [[],[[]...
Doing code review, I stumbled upon the following code, that tests the status of a checkbox: if (!isNotUnchecked()) { ... } I had to brainstorm for 30 minutes to find out what actual checkbox status the code was expecting. Please write me a program that can simplify these silly expressions! The program should accept a...
Task Given one non-whitespace printable character, make a 3x3 square representation of that input. For example, if the input is #, then the output is: ### # # ### Rules The output format is strict, although a trailing newline is allowed. It means that the space in the middle is required, and also that the two newline...
Challenge Given a list of integers, show how gravity sort would be done. Gravity Sort In gravity sort, imagine the numbers as rows of asterisks. Then, everything falls, and the new rows will be obviously sorted. Let's look at an example: [2, 7, 4, 6]: ** ******* **** ****** ------- ** **** ******* ****** ------- ** ...
Definitions A perfect square is an integer which can be expressed as the square of another integer. For example, 36 is a perfect square because 6^2 = 36. A squarefree number is an integer which is not divisible by any perfect square, except by 1. For example, 10 is a squarefree number. However, 12 is not a squarefree ...
Take a flag, like this one: ----------------------------- | | | | | | |=============+=============| | | | | | | ----------------------------- And a number input: the "wave length" Say the wave length was 5. Then, every 5 ch...
Given two lists that contain no duplicate elements a and b, find the crossover between the two lists and output an ASCII-Art Venn Diagram. The Venn Diagram will use a squarified version of the traditional circles for simplicity. Example Given: a = [1, 11, 'Fox', 'Bear', 333, 'Bee'] b = ['1', 333, 'Bee', 'SchwiftyFive'...
This dear StackExchange site has so many challenges, and so many good answers. But what about the challenges that were never answered? Task Write a program or a function that will print a pseudo-random open unanswered (as in, a question with exactly zero answers) challenge from PPCG. All possible challenges should be p...
Take a matrix of positive integers as input, and output the individual sums of the elements on the diagonal lines through the matrix. You shall only count the lines that goes diagonally down and to the right. You must start with the diagonal that contains only the bottom-left element, then the length-two diagonal abov...
In graph-theory a Prüfer code is a unique sequence of integers that denotes a specific tree. You can find the Prüfer code of a tree with the following algorithm taken from Wikipedia: Consider a labeled tree T with vertices {1, 2, ..., n}. At step i, remove the leaf with the smallest label and set the ith element of th...
Given an array of numbers, find out how many iterations of averaging* it takes for the average of every element to be no more than 1 higher or lower than the first element (absolute difference between the array's average and the first element is less than or equal to 1). *Array averaging To "average" a number in our ar...
Definitions Two numbers are co-prime if their only positive common divisor is 1. A list of numbers is mutually co-prime if every pair of numbers within that list are co-prime with each other. A factorization of number n is a list of numbers whose product is n. Task Given a positive number n, output the mutually co-pr...
Make a Windows style Loading bar by the following instructions. (notice that this is different than Loading... Forever) Your output should start by [.... ]. Every tick, you should wait 100 ms, then move each dots by one character right. if the dot is on the tenth character, move it to the first. Notice that you s...
Create a progress bar indicating year progress Your code has to output the percentage of the year already passed form 1st of January of the current year. You have to display a progress bar and the figure. Input You may use builtins to get the current date, if your language doesen't have it you can get date as input but...
TL;DR: Solve this particular challenge, a robot simulation, by stepping on all of the white pads, and avoiding the gray pads. You can step on a white pad any number of times, as long as you step on each white pad at least once. Solutions in languages like Befunge with a 2D instruction pointer would also be accepted, bu...
Challenge Write a program that outputs the lyrics to 99 Bottles of Beer, but instead of "beer", output "fizz" if the number of bottles on the wall is a multiple of 3, "buzz" if it is a multiple of 5, and "fizzbuzz" if it is a multiple of 3 and a multiple of 5. If the number of bottles on the wall is not a multiple of 3...
Given a linear equation mx+n, return n and m. However, the equation may be in any of the following formats: 5x+2 -> 5 2 5x-2 -> 5 -2 5x -> 5 0 -2 -> 0 -2 x -> 1 0 Here are the formats, where each ? stands for a positive integer written without leading zeroes ?x+? ?x-? -?x+? -?x-? x+? x-? ? -? ?x -?x x All of t...
What general tips do you have for golfing in ///? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to /// (e.g. "remove unnecessary whitespace" is not an answer). Tips for itflabtijtslwi and Lines are on-topic and valid here as well. Please post one tip per ...
Implement the Discrete Cosine Transform (DCT). This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. Your program must be able to handle sequences of any length (assuming a hypothetical version of your language which has no limits on things l...
Challenge Given a valid goo.gl shortened link, output the original URL. Example goo.gl/qIwi3N would give something like https://codegolf.stackexchange.com/. For input, you can choose to have the https?:// at the beginning, you can choose to have www. before the goo.gl, and you can also choose to get rid of the goo.gl i...
Take an array which consists of positive integers or arrays, output if it only contains 2s. Output should be a truthy or falsey value (Sorry if this destroys answers) Truthy Test Cases [2] [2,2] [[2],[2,2],2] [] [[],[]] Falsey Test Cases [1] [22] [2,2,2,1] [[1,2],2] Standard Loopholes Are forbidden. Default IO rules ...
Given a string s and a non-negative number n less than the length of s, output the character at the n-th position of s. 0-indexing and 1-indexing are allowed. For 1-indexing, n will be positive and less than or equal to the length of s. s will consist of printable characters only. Any reasonable input/output is permitt...
For those who didn't know, Sigma is a Greek letter which is heavily used in mathematics as the summation sign. Given a string representing an expression depending on \$k\$ that we will denote \$E(k)\$, compute the sum of the results for \$E(k)\$, for each \$k\in\{1,2,3,4,5\}\$. Concisely, you should find \$S\$ such th...
The Task In this challenge, your task is to write a program or function which takes in a String and outputs a truthy or falsey value based on whether the first character and the last character of the input String are equal. Input You may take input in any way reasonable way. However, assuming that the input is present...
About the Series First off, you may treat this like any other code golf challenge, and answer it without worrying about the series at all. However, there is a leaderboard across all challenges. You can find the leaderboard along with some more information about the series in the first post. Hole 8: Shuffle an infinite ...
Given a positive integer N, your task is to return the number of steps required by the following algorithm to reach N: Find the smallest triangular number Ti such that Ti ≥ N. Build the corresponding list L = [ 1, 2, ..., i ]. While the sum of the terms of L is greater than N, remove the first term from the list. If t...
Suppose we start with the infinite list of prime numbers: [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, ... Then, we take the absolute differences between each pair of numbers, repeatedly: [1, 2, 2, 4, 2, 4, 2, 4, 6, 2, 6, 4, 2, 4, 6, 6, 2, 6, 4, ... [1, 0, 2, 2, 2, 2, 2, 2, 4, 4, 2, 2, ...
Challenge Given a quark composition of a particle as input, output the corresponding hadron's name. Quarks will be represented by a capital letter and antiquarks by a lowercase letter. The quarks may be in any order, not necessarily the order given below. Built-in functions the access data about particles and/or quarks...
Given a nonzero polynomial with integer coefficients and roots that are on the imaginary and on the real line such that if a is a root then so is -a, return another polynomial with the roots rotated by 90 degrees. Details The polynomial can be given in any reasonable format, e.g. as a list of coefficients. The symmetry...
In graph theory, a Cactus is a connected graph such that any distinct two simple cycles in the graph share at most one vertex. Here is a Cactus with 3 simple cycles outlined with dashed lines. The following graph is similar to the one pictured above but is not a Cactus because the two vertices labeled in red are share...
Take a string, s containing printable ASCII-characters as input, and output its "binary split sum". Need an explanation? How do you get the binary split sum? We'll use the string A4 as an example in the following explanation. Convert the characters to binary, treating each letters as a 7-bit ASCII character A -> ASCII...
Definitions An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of 2 is algebraic, because it is a zero of x^2 - 2. A transcendental number is a real number which is not algebraic. Task You are to choose a transcendental number. Then, write a...
Intro More complex than A square of text since this requires padding and input has unknown data type. Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic code-golf edition of this year's tenth problem. I have explicit permission to post this ch...
Given a non-empty 2D array consisting of 0 and 1, find the number of squares whose 4 corners are all 1. The squares do not need to be "upright". All the rows are guaranteed to have the same length. Reasonable input/output methods are allowed. Testcases: 0001000 1000000 0000000 0000100 0100000 This returns 1. 10101 000...
I'll start off by saying I checked and checked again that this question should be on topic. I will also clearly state that this is a tips question about further golfing a certain set of code not a challenge. I recently answered the following challenge: Scramble words while preserving their outlines: It is well know...
Introduction For my 5th KOTH, I present to you a challenge based on the well-known game Battleship with a few twists. You'll only command one ship, whose type you'll be able to select between the 5 "traditionnal" classes, but you'll be able to undertake multiple actions each turn, including moving! This is played as a ...
A lawn is defined as a rectangular field with of one character surrounded by two layers of visible whitespace. This means two lines above and twos lines below, and a two space padding on the left (the right has visible whitespace, so you do not need to include it).     ||||| ||||| |||||     A mowed lawn is...
Results (May 22 2017 21:40:37 UTC) Master won 18 rounds, lost 2 rounds, and tied 0 rounds Save One won 15 rounds, lost 3 rounds, and tied 2 rounds Machine Gun won 14 rounds, lost 3 rounds, and tied 3 rounds Monte Bot won 14 rounds, lost 3 rounds, and tied 3 rounds Amb Bot won 12 rounds, lost 8 rounds, and tied 0 rounds...
Definitions An algebraic number is a number that is a zero of a non-zero polynomial with integer coefficients. For example, the square root of 2 is algebraic, because it is a zero of x^2 - 2. The corresponding polynomial is called the minimal polynomial of the algebraic number, provided that the polynomial is irreduci...
Challenge Given a plot with broken paths, return the plot with all paths connected in the minimum number of changes. Explanation This problem deals with graphs on the Cartesian plane. Every node has 8 possible edges, extending vertically, horizontally, or diagonally. Each direction is represented by a number 0-7 as fol...