instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Related, related Introduction The ruler sequence is the sequence of the largest possible numbers \$a_n\$ such that \$2^{a_n}\mid n\$. It is so-called because its pin plot looks similar to a ruler's markings: However, with a slight modification, we can also get a similar sequence. This sequence is \$\{a_1,a_2,a_3,…\}\$...
stackexchange_codegolf
source: Dilbert, September 8, 1992 I'm hoping to add a new twist on the classic "Hello World!" program. Code a program that outputs Hello World! without: String/Character literals Numbers (any base) Pre-built functions that return "Hello World!" RegEx literals With the exceptions of "O"† and 0. †"O" is capitalize...
stackexchange_codegolf
Not a new one: Input N, being n, 0 ≤ n ≤ 5. Output N times "Hello World." Example: Input 3 Output Hello World. Hello World. Hello World. These 2 are my best solutions: First public class Out { public static void main(String[] a) throws Exception { java.io.OutputStream o = System.out; ...
stackexchange_codegolf
In the board game Pandemic, an outbreak occurs when a city contains more than 3 disease cubes. When the outbreak occurs, any disease cubes in the city in excess of 3 are removed, and each city connected to it gains one disease cube. This means that chain reactions can, and will occur. Important note: Each city may onl...
stackexchange_codegolf
Many people consider RPS to be a game of chance. If both players play unpredictably, the best strategy is to play randomly. However, let's introduce a bit of predictability to it. Each bot will have a chance to tell the other bot what it's going to play simultaneously. Then there is a pause in which each bot will know...
stackexchange_codegolf
What is elementary cellular automata? Since I'm not sure I'll be able to explain this so that somebody who has never heard of this is able to understand, I'm giving an explanation from https://mathworld.wolfram.com/ElementaryCellularAutomaton.html Elementary cellular automata have two possible values for each cell (0 ...
stackexchange_codegolf
Let's have string multiplication to take a string and a positive number and concatenate that string that many times. In Haskell: 0 * s = "" n * s = s ++ ((n - 1) * s) Your task is to write a program that outputs a number \$n > 0\$. When you double your program (with the described procedure) the new program should ou...
stackexchange_codegolf
This is a cops-and-robbers challenge, the robbers' thread is here You can change the word code into golf by changing a letter at a time in four steps: CODE COLE COLD GOLD GOLF Today, we’ll be doing the same thing with programs. Your challenge is to: choose a programming language write two programs / functions, one th...
stackexchange_codegolf
A first order separable ordinary differential equation is (arguably) the easiest type of differential equation to solve, and takes the form of $$N(y)\frac{dy}{dx} = M(x) \\ y(x_0) = y_0$$ For two given functions \$N(y)\$ and \$M(x)\$ and an initial condition \$y(x_0) = y_0\$. Your task is to take \$N(y)\$, \$M(x)\$, \...
stackexchange_codegolf
Your task is to create a plain hunt (a bell ringing pattern) with n bells. An example with 6 bells: 123456 214365 241635 426153 462513 645231 654321 563412 536142 351624 315264 132546 123456 Each number "bounces" off the side of the grid. From Wikipedia: Each bell moves one position at each succeeding change, unless ...
stackexchange_codegolf
The task: Output a value for x, where a mod x = b for two given values a,b. Assumption a and b will always be positive integers There won't always be a solution for x If multiple solutions exist, output at least one of them. If there aren't any solutions, output nothing or some indication that no solutions exist. Buil...
stackexchange_codegolf
Surprised that we don't have a symmetric difference challenge yet. Given two lists only containing positive integers, return all items among these two lists that aren't contained in both of the lists. Rules From the set definition: A set is a collection of definite distinct items. So you can assume the items in the ...
stackexchange_codegolf
I cannot believe that this hasn't been done before but I may be wrong. If so, just close as dupe. This challenge is very similar to Is it truthy or falsy? but, IMO, isn't close enough to be a dupe. That has predefined "falsy" variables that all languages must use, some of which aren't even falsy; this uses your own fal...
stackexchange_codegolf
Context So the Dutch "Ministerie van Binnenlandse Zaken en Koninkrijksrelaties" (NL) - "Ministry of the Interior and Kingdom Relations" (EN) recently released the source code of their digid-app. They have some goofy code in there, which led to mockery and memes on reddit Source code of the offending method can be found...
stackexchange_codegolf
Your task is to create the shortest program (A) that outputs another program (B) with the most unique bytes, which in turn outputs the original program (A). Essentially, you are golfing one half of a pair of ouroboros programs (a.k.a. periodic iterating quine) and bowling the other half. A and B may be in different lan...
stackexchange_codegolf
This ascii-art challenge is about walking around a string like a snake. s-n-a-k .---. e d <-' a n-u-o-r You will be given a string \$ S \$ of length \$ l \$ and a positive integer \$ n \$ where \$ n ^ 2 \ge l + 1 \$. The string rotates 90° after writing \$ n \$ characters of \$ S \$, or when it hits itself. When \$ S ...
stackexchange_codegolf
Background Many esoteric programming languages don't have numbers built in at literals, so you have to calculate them at runtime; and in many of these cases, the number representation can be quite interesting. We've already had a challenge about representing numbers for Underload. This challenge is about representing n...
stackexchange_codegolf
Background You have again x4 been given the task of calculating the number of landmines in a field. But this time, the field is not a number field... it's a field of letters. Our landmine letter operator is sick and requires you to cover for them. They left you the following note: Things work a little differently with...
stackexchange_codegolf
Write a program which takes an input (which may or may not be prime), and lists the immediate prime following and preceding it. Example input: 1259 Example output: 1249 1277 Shortest program wins. Must execute within 10 seconds on a modern desktop PC. Inputs will be limited to 10,000 maximum.
stackexchange_codegolf
This is cops-and-robbers. This is the Robbers thread. For the cops thread, go here. I've noticed a number of OEIS challenges since I joined the site. It seems only fair that we have a cops-and-robbers challenge that determines who is the master of online integer sequences, once and for all. Cops Write a program or func...
stackexchange_codegolf
Write a program or function that takes in a nonempty list of mathematical inequalities that use the less than operator (<). Each line in the list will have the form [variable] < [variable] where a [variable] may be any nonempty string of lowercase a-z characters. As in normal math and programming, variables with the s...
stackexchange_codegolf
You have been given the charge to calculate the current balance as of the day that you perform the calculation for 330,000 individuals who worked for an average of 30 years spanning 300 years where the initial principal was 1 with an addition of 1 per day and interest rate set at 3%. You initially tried to use online ...
stackexchange_codegolf
This is a rather simple challenge, but I couldn't find any question that was really similar to it. The challenge is to take a frequency in using STDIN or an equivalent, and then output a tone that matches that frequency, in Hz, for 5 seconds. For example Input: 400 Output: (a tone of 400 Hz with a duration of 5 seconds...
stackexchange_codegolf
While the binomial coefficient are the coefficients of \$(1+x)^n\$, m-nomial coefficients are the coefficients of \$(1+x+x^2+...+x^{m-1})^n\$. For example, \$m(3,5,6)\$ is the coefficient of \$x^6\$ in the expansion of \$(1+x+x^2)^5\$. Write a program/function that takes 3 numbers as input and outputs the corresponding...
stackexchange_codegolf
Very related You're given a piece of ASCII art representing a piece of land, like so: /‾\ __/ ‾\_ \_/‾\ \ Since an overline (‾) is not ASCII, you can use a ~ or - instead. Your challenge is to determine if it is connected by the lines of the characters. For example, the above can be traced ...
stackexchange_codegolf
Write a regex that works in at least 2 regex flavors (or versions), and match a different string in each flavor (or version) it is running in. The strings to be matched in this challenge are the first words of the Ubuntu code names, which are listed below. Your regex has to match from the top of the list. That is, if y...
stackexchange_codegolf
Today's problem is easy. You're given two strings A and B of equal length consisting of only the characters ( and ). Check whether after any number of operations you can make both strings balanced or not. The only operation allowed is swapping A[i] and B[i], where i is an arbitrary index. Here is the definition of a ba...
stackexchange_codegolf
It's a well-known fact that Fermat's Last Theorem is true. More specifically, that for any integer \$n \gt 2\$, there are no three integers \$a, b, c\$ such that $$a^n + b^n = c^n$$ However, there are a number of near misses. For example, $$6^3 + 8^3 = 9^3 - 1$$ We'll call a triple of integers \$(a, b, c)\$ a "Fermat n...
stackexchange_codegolf
...or "snakes but not too long". Inspired by this challenge and this comment. Task Write a program or a function that takes no input and outputs its own source code formatted as a snake according to the rules below: If your code has any whitespace, it will not be output; it will just be skipped. There will be one char...
stackexchange_codegolf
Note: SmokeDetector is a bot that detects spam and offensive posts on the network and posts alerts to chat. What to implement Smokey's !!/alive command uniformly at random picks one of these messages: Yup You doubt me? Of course ... did I miss something? plz send teh coffee Watching this endless list of new question...
stackexchange_codegolf
Note: The survey for community favorite will be released soon In this KoTH, the aim is to be the last bot alive. Coins will be placed in random areas, and your bot must get the coins first. If a bot runs into another bot, the bot with more coins wins, and the other bot dies. More details below. Coin types There will ...
stackexchange_codegolf
A struggling manufacturer named Tennessee Instrumental is desperate to get into the calculator business. Problem is, they don't have any software engineers on payroll, and the deadline is coming up fast. It's your job to help TI configure a basic calculus-ready calculator that can simplify expressions input as strings...
stackexchange_codegolf
cat goes "Meow" We are all familiar with the concept of a cat program. The user types something in, it is echoed back to the user. Easy. But all cat programs I've seen so far have missed one fact: a cat goes "Meow". So your task is to write a program that copies all STDIN to STDOUT UNLESS the input is cat, in which ca...
stackexchange_codegolf
Note: Bot Factory KoTH (2.0) is now posted; you're probably looking for that one instead! In this challenge, bots (consisting of JS functions) move around an infinite factory (playing field), collecting characters (UTF-16). These characters can be used to build worker bots, or droppedfor other bots to pick up. Results ...
stackexchange_codegolf
Background At the time of writing this, the P vs NP problem is still unsolved, but you might have heard of Norbert Blum's new paper claiming proof that P != NP, which is already suspected to be erroneous (but we will see). The problem discussed in this paper is the clique problem. At least that's what I read in a newsp...
stackexchange_codegolf
Write a program that, for the numbers 1 through 255, prints out BF code that will produce the given number in some byte of the array, plus a newline. For example, the first four lines of the output could (and most likely will) be: + ++ +++ ++++ The winner will be the smallest: source code + output (in bytes). Clarific...
stackexchange_codegolf
Here is my ungolfed Ruby code for a function I want to try and golf: Iter =-> k { str = "" (0..k).map{|m| str += "-> f#{m} {"} str += "f#{k}.times{f1 = f0[f1]};f1" (2..k).map{|m| str += "[f#{m}]"} eval(str + "}" * (k+1)) } The best I can do to golf this is essentially shortening variable names, rem...
stackexchange_codegolf
As the majority of nations using the Euro have the , as the decimal separator, you must use it also. The task is to output all the values of the Euro coins and notes in ascending order. You must also put the trailing ,00 on the integer values. 0,01 0,02 0,05 0,10 0,20 0,50 1,00 2,00 5,00 10,00 20,00 50,00 100,00 200,0...
stackexchange_codegolf
Background With the success of Simple Boolean Algebra Calculator, I present a more difficult problem. Boolean Algebra concerns representing values with letters and simplifying expressions. The following is a chart for the standard notation used: Above is what actual boolean algebra looks like. For the purposes of this...
stackexchange_codegolf
We're graduating to a full site soon, and there's only one thing left to do before graduation: pull a senior prank! I think we should do a variation on the classic "fill a hallway with cups of water" gag. Challenge Your program will read in text and output that text, covered in upside-down cups of water. An upside-down...
stackexchange_codegolf
Intro Cookie Clicker is a popular browser game in which the player has to click a cookie to gain... Cookies! The player can buy upgrades which will automatically farm cookies for you. Sometimes a golden cookie will enter the screen, which will provide a bonus upon clicking it. Challenge This challenge will not be about...
stackexchange_codegolf
So in 1st grade math, you learn the names of polygons. Three sides is a triangle, 4 is a square, and 5 is a pentagon. However, in 1st grade honors, you go a bit further. Your challenge There is a naming system for polygons above a few sides, so arbitrarily large polygons have a name. Your task is to write a program or ...
stackexchange_codegolf
It is Halloween and Jimmy (/o\) has gone into a mysterious neighborhood for trick-or-treating (ask himself why). Now some evil ghosts are chasing him. Can Jimmy escape the ghosts? Challenge: Input: A board showing position of Jimmy, ghosts, solid objects and empty spaces. An example 10x5 board, o is Jimmy (we needed a ...
stackexchange_codegolf
Write a program/function/script that takes a natural number i from 1 to 10 as input and outputs the URL of the Question with the i th hottest question on the Code Golf Portal The ordering should be like in https://codegolf.stackexchange.com/?tab=hot. For example: input 1 output https://codegolf.stackexchange.com/quest...
stackexchange_codegolf
(This challenge exists to extend sequence A276272 in the On-Line Encyclopedia of Integer Sequences, and perhaps create a new OEIS sequence1.) This is a code-challenge, which will have you write code to compute as many terms of this sequence as possible. Background A polytet is a kind of polyform which is construct...
stackexchange_codegolf
Given an integer n, your task is to determine whether it is a perfect square that when reversed, is still a perfect square. You may assume n is always positive. When numbers such as 100 (10x10) are reversed the result may have leading zeros (001) In this case, ignore the leading zeros and treat it as 1 (1x1). Test case...
stackexchange_codegolf
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 ...
stackexchange_codegolf
Everyone knows the old minesweeper game that shipped with Windows XP. It's a simple grid with a 9x9 matrix of cells containing either a number (indicating how many mines are adjacent to it) or a mine. The challenge is to generate a random 9x9 grid with 10 bombs given any integer seed (up to whatever your machine/langu...
stackexchange_codegolf
Drunk Uncle (sorry M.E. and AUS for region lock) is a fictional character from Saturday Night Live. He often confuses words for others that sound like them. For this challenge you need to convert normal speech into drunkspeak. Algorithm Translating to drunkspeak requires swapping the order of words in the text. Swappin...
stackexchange_codegolf
You know nothing The things I do for "Chaos is a ladder" is a memorable line from the television series Game of Thrones. The purpose of this challenge is to build a ladder from chaos, in ASCII art. The challenge Input Ladder width, W >= 3 (integer) Step height, H >= 2 (integer) Number of rungs, N >= 2 (integer). Outp...
stackexchange_codegolf
You are given a very special gun with a full magazine. Let n be the initial number of bullets in the magazine and i the number of bullets left. That gun is really unreliable, hence each time you shoot, you have a i/n chance to successfully shoot. The fewer bullets you have left, the more tries it requires to shoot. The...
stackexchange_codegolf
The Rockstar programming language has "poetic number literals", allowing you to assign nonnegative, finite (at least one Rockstar interpreter supports infinity) numbers to variables without typing a single digit: just type words with length equal to each digit, modulo 10. For example, This is a challenge sets the vari...
stackexchange_codegolf
Room Number Locator I have come across an interesting problem solving technique at my job when given the wrong room number from a colleague for a meeting. Every now and then, while on the way to a meeting, a member on my team will send me the wrong room number, typically because they are in a rush at their desk and fat...
stackexchange_codegolf
Introduction Given an undirected graph G, we can construct a graph L(G) (called the line graph or conjugate graph) that represents the connections between edges in G. This is done by creating a new vertex in L(G) for every edge in G and connecting these vertices if the edges they represent have a vertex in common. Here...
stackexchange_codegolf
There are \$a\$ honest man(always tell the truth), \$b\$ dishonest man(always tell lie), and \$c\$ random man(tell random Y/N). How many times at least should you ask one of them a yes/no question about who they are, to guarantee you get knowledge of who they are? You may assume that it's possible. Test cases: (a,b,c) ...
stackexchange_codegolf
History There's a room on StackOverflow in Russian where you can see such an interesting discussion: Just because there are not enough real discussing in that room, @Grundy "plays ping-pong" to keep it unfrozen. Task Implement a bot for StackExchange that posts "ping!" to the 115624 room if the previous message was ...
stackexchange_codegolf
What does "jelly" mean in the title?. Cop's thread Robbers, you are to choose an uncracked Cop answer, and attempt to find a Jelly program which is: shorter than the Cop's answer solves the linked challenge, according to the rules of the challenge So long as these two bullet points are met, your answer cracks the Cop...
stackexchange_codegolf
How many petals around the rose How many petals around the rose is a dice game you can play with your friends. Similar to "can I join the music box", there is a person that knows how the game works and the others have to discover the rule. In this game, someone rolls some dice (usually two or more) and then people have...
stackexchange_codegolf
Background LISP programmers have taken over the world! Parentheses have been declared as sacred characters, and from now on, they can only be used in LISP programs. It has been decided that parentheses in literary works shall be replaced by footnotes, and it's your job to automate this for simplified Markdown text. Inp...
stackexchange_codegolf
There's something wrong with your keyboard. The Shift key has a mind of its own. Every time you type a character you have no idea whether it will come out shifted or not (though it is 50-50). Besides the standard character keys, nothing on the keyboard is functional. There is no mouse or other means of input. Somehow y...
stackexchange_codegolf
There have already been challenges about computing the exponential of a matrix , as well as computing the natural logarithm of a number. This challenge is about finding the (natural) logarithm of matrix. You task is to write a program of function that takes an invertible \$n \times n\$ matrix \$A\$ as input and returns...
stackexchange_codegolf
Task: Output the Swiss flag. Happy Swiss National Day / Schweizer Bundesfeiertag / Fête nationale suisse / Festa nazionale svizzera / Fiasta naziunala svizra! Details: The flag consists of a white (#FFFFFF) cross on a red (#FF0000) background. The cross consists of a 6x6 square with arms of size 6x7 glued to each sid...
stackexchange_codegolf
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...
stackexchange_codegolf
Consider a finite, one-dimensional grid where each cell is marked with one of two symbols (I will use the symbols < and >, but you can use other symbols). When a pinball is placed on one of the cells, it moves according to the following rules: If the pinball is on a cell that is marked with <, the pinball moves one ce...
stackexchange_codegolf
This challenged is highly inspired by what @Mego created with his Holy and Holier numbers, lots of thanks to him and his puns. Holy numbers are numbers composed of only the digits with holes, which are: 04689 Numbers with at least one unholy digit are considered unholy. Unholy digits are evil by definition, but being ...
stackexchange_codegolf
Frequently while I'm code-golfing, I'll want to know what the ASCII value of a certain character is. One of my favorite resources for quickly looking up all of the printable ASCII characters is ASCIItable.com. This has a really nice image that not only shows the printable ASCII characters and their values, but also the...
stackexchange_codegolf
Given a natural numbers n>1, find the smallest narcissistic number of n digit. A narcissistic number is a number which is the sum of its own digits, each raised to the power of the number of digits. For example, for n=3 (3 digits) the out put should be 153: 1^3 + 5^3 + 3^3 = 1 + 125 + 27 = 153 For n=4 (4 digits) the ou...
stackexchange_codegolf
Given a BF program consisting of only the characters +-[]<>., with the property that there's an equal number of < and > between every matching pair of []. You have to find the shortest program that can be achieved with the optimal memory layout (by rearranging the cells on the tape). If there are multiple such programs...
stackexchange_codegolf
tl;dr? See bottom for The Competition Integer literals While programming, the 64-bit hexadecimal literal 0x123456789abcdefL is difficult to gauge the size of. I find myself mentally grouping digits from the right by fours to see that it's 15 digits' worth. Python PEP 515 allows you to express the above literal, insid...
stackexchange_codegolf
I was answering one challenge here and this task was part of the challenge. I've got a 73 bytes solution in javascript. But I think it is too much for a simple thing. Challenge Given as input two integers: N the length of the expected array R the interval's range starting in one: 1..R, not 0..R-1 Output in each run o...
stackexchange_codegolf
Given a rectangular grid of text, line up the diagonals that go from the upper-left to the bottom-right into columns such that the lowest-rightmost characters of all diagonals are on a level. Use spaces for indentation. For example, if the input grid of text is abcd 1234 WXYZ then you'd line up the diagonals W, 1X, a2...
stackexchange_codegolf
Inspired by Find the largest fragile prime A recurring prime (or whatever you choose to call it) is a prime that, when removing leading digits, always remain prime regardless of how many digits are removed. for example 6317 is a recurring prime because... 317 is a recurring prime because... 17 is a recurring prime beca...
stackexchange_codegolf
We say two positive integers are anagrams of each other if the digits in one of them (in decimal representation) can be rearranged to form the other. Leading zeros don't count. For example, 110020222 is an anagram of 212102020, but not of 221100011; neither is 22002211 even though it can be written as 022002211. Intere...
stackexchange_codegolf
This is a cops-and-robbers challenge. The robbers' thread is here. An interesting question to think about is the following: If I have a sequence of numbers how many of them do I have to provide before it is clear what sequence I am talking about? For example if I want to talk about the positive integers in order star...
stackexchange_codegolf
The Dutch system for naming one's ancestors is a lot more interesting than the English version. For English, the sequence goes "parent", "grandparent", "great-grandparent", "great-great-grandparent", "great-great-great-grandparent"; and in Dutch those terms are "ouder", "grootouder", "overgrootouder", "betovergrootoude...
stackexchange_codegolf
Background Based on a game my four-year-old got from his rabbi. The "goal" is to "find" the letters in a given order, e.g. aecdb. You are given a stack of letter cards, e.g. daceb. You can only search through the stack in the order given, albeit cyclically. When you meet a letter you need, you take that out of the stac...
stackexchange_codegolf
This is an alternate version of this earlier challenge with a twist that adds a significant bit of difficulty. Like last time, you are going to be given a string containing some alphabetic characters along with [ and ]. Your task is to split into sections that are enclosed in a "group" created by [...] and those that ...
stackexchange_codegolf
Your program must accept as input six numbers, which describe a triangle - for example, the inputs 80, 23, 45, 1, 76, -2 describe a triangle with vertices (80, 23), (45, 1), and (76, -2). The input must be given as six plain real numbers or as a list of six real numbers, in the order given in the example. Your task is ...
stackexchange_codegolf
Introduction Write a program or function that, given the coordinates of where a dart lands on a dartboard, return the score of that dart. Dart coordinates are given as two integers, x,y measured from the center of the dartboard, with millimeter precision. How to score a dart Darts is a game played by throwing a dart at...
stackexchange_codegolf
In this challenge, your task is to take an anion and a cation, and output the chemical formula of the compound. Input rules Take in 2 strings (in any order) representing the anion and cation, e.g. F, NH_4, or Al. To take in the charge of each ion, you can either have it as part of the string separated by a caret (e.g...
stackexchange_codegolf
There is a Sioux village. It has a totem: __ ___| |___ \/ \ / \/ /\ ``| |`` /\ /^^\ | | /^^\ / /\ \ | | / /\ \ '''''''''''''''''''''''''''' The totem lets the Sioux mastering the weather for helping in their different tasks. Help the villagers p...
stackexchange_codegolf
The program must print the following block of text of LED numbers exactly. +-----------------------------------------------------------------+ | | | 000 1 222 333 4 4 555 666 777 888 999 AAA B CCC D EEE FFF | | 0 0 1 2 3 4 4 5 6 7 8 8 9 9...
stackexchange_codegolf
Infix notation is a method of printing mathematical expressions where each operator sits between its two arguments, such as \$ \left(5 \cdot 4\right) + 3 \$. Prefix notation is a method of printing expressions where operators sit before their arguments. The equivalent of the above is +*543. It's a bit harder to underst...
stackexchange_codegolf
The challenge In the least number of source code characters, in a language of your choosing, devise a function which raises base a to power b, modulo m, using purely integer arithmetic, where a, b, and m are all unsigned 64-bit values or larger. You may use signed arithmetic if your language does not have unsigned arit...
stackexchange_codegolf
Break two numbers up into their powers of 2, if they share any, return a falsey value. Otherwise, return a truthy value. If one input is 0, the answer will always be truthy. if one input is 255, the answer will be falsey if the other is not 0. Example Given 5 and 3 5 = 2⁰ + 2² 3 = 2⁰ + 2¹ Both share 2⁰, return falsey....
stackexchange_codegolf
Input A non-empty shuffled string consisting of ASCII characters in the range \$[32..126]\$. Output The output is obtained by applying successive rotations to the input string. For each letter ([a-zA-Z]) in the input string, going from left to right: if the letter is in upper case, rotate all characters before it by o...
stackexchange_codegolf
The challenge Given point and a path of points, say whether or not the point is in the polygon that is created by the path. Also return true if the point is on an edge of the polygon. Input A list of pairs of integers. The first 2 integers represent the point. The remaining pairs (3rd and 4th, 5th and 6th etc.) represe...
stackexchange_codegolf
A musical string is any string that can be played on a piano keyboard. For those of us who weren't forced to learn the piano as kids, here is what the keyboard looks like. So the string feed a dead cabbage is a musical string because every single letter corresponds to one of these nots. Your challenge is to write a pr...
stackexchange_codegolf
About the Series This is a guest entry for the Random Golf of the Day 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 abo...
stackexchange_codegolf
I am quite proficient in C++ and Java and want to learn competitive programming to participate in contests like Google codejam and other online contests held on sites like CodeChef and Codeforces. I would like to get information about any free resources including websites and courses to learn the "sport". Book suggesti...
stackexchange_codegolf
Below Python code generates memory leak. Challenge: Fix the memory leak with minimal changes to the code as measured by Levenshtein distance to the original code. You may only change the code before t is initialised. When the del t line is removed the modified program should print I'm still alive! every second. PS: I ...
stackexchange_codegolf
You can decompose a number greater than 0 as a unique sum of positive Fibonacci numbers. In this question we do this by repeatedly subtracting the largest possible positive Fibonacci number. E.g.: 1 = 1 2 = 2 3 = 3 4 = 3 + 1 12 = 8 + 3 + 1 13 = 13 100 = 89 + 8 + 3 Now, I call a Fibonacci product the same lists as abov...
stackexchange_codegolf
The wizard is determined to pose the most challenging challenge yet for which he believes the previous solution techniques will not work. He decides to go multidimensional. If there is a number line with \$x = 10\$ then your task is to prove this. If you do so you win. In this situation, for your code to be correct, ...
stackexchange_codegolf
Input: A positive integer N. Challenge: Suppose you have a list of integers n = 1, 2 ... N. Output a list of integers, where each number is the maximum power of 2, m, such that 2^m divides each number of n. Test cases: 1 0 15 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 100 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, ...
stackexchange_codegolf
Here is the (quite scary) Five little ducks song(it is not long): Five little ducks went out one day, over the hills and up away. Mother Duck said, "Quack Quack Quack Quack", but only four little ducks came back. Four little ducks went out one day, over the hills and up away. Mother Duck said, "Quack Quack Quack Quack...
stackexchange_codegolf
Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (A______). Easy enough right? Well here's the catch, your code must also output a second separate sequence when the name of the sequence in the code is changed to the name of the second sequence. Input Out...
stackexchange_codegolf
Develop a program which takes two arrays of decimal numbers, and compare the sum of whole numbers only and the decimal part. If the sums of the whole numbers are the same, and the decimal parts of Array a are a subset of the decimal parts of Array b, return True. Otherwise, return False. Example-1 :- Array a ={2.5,3.0,...
stackexchange_codegolf
Background / Description Note: as @HelkaHomba points out, the actual GitHub identicons are not actually random but based on the hash of a username The default GitHub avatar is a 5x5-pixel image. A color is picked randomly, and then random pixels are filled in on one side (right or left, 2x5 size) using that color. Then...
stackexchange_codegolf
Some two-dimensional esolangs, such as Forked, and some non-esolangs, such as Python, can sometimes require spaces before lines of code. This isn't very golfy. Also, I'm lazy and writing a 2d lang that needs lots of spaces before code. Your task is to write a tool that makes these languages golfier. Of course, this wil...
stackexchange_codegolf
(Related) Given an integer n > 1, 1) Construct the range of numbers n, n-1, n-2, ... 3, 2, 1 and calculate the sum 2) Take the individual digits of that number and calculate the product 3) Take the individual digits of that number and calculate the sum 4) Repeat steps 2 and 3 until you reach a single digit. That digit ...
stackexchange_codegolf