instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
Write two programs, each taking a string s and a number n ≥ 0, such that: The first program prints s n times, separated by newlines. The second program prints each character of s n times, with repeated characters separated by newlines. Every character at column x, line y in one program equals the character at column y...
stackexchange_codegolf
Given an integer n as input, write a function that dynamically allocates n bytes and returns their address. Rules The allocator must be able to dynamically allocate memory at runtime. It doesn't matter where the memory is allocated to or in what form, as long as it's allocated in a valid location which can be read fro...
stackexchange_codegolf
You place a standard die at the origin of a 2D grid that stretches infinitely in every direction. You place the die such that the 1 is facing upwards, the 2 is facing in the negative y direction, and the 3 is facing in the positive x direction, as shown in the figure below: You then proceed to execute a series of move...
stackexchange_codegolf
Arturo is a bytecode-compiled/interpreted, garbage-collected general-purpose language filling a role similar to JavaScript, Python and Ruby. It is centered around the concept of blocks, which hold code just as easily as data. It uses fixed-arity prefix syntax and emphasizes the procedural and functional paradigms. What...
stackexchange_codegolf
This is a somewhat proof-golf-like cops-and-robbers challenge. This is the cops' thread; the robbers' thread is here. Cops Your task is to define an abstract rewriting system in which the reachability of one word from another is difficult to determine. You will prepare the following things: A set of symbols, called th...
stackexchange_codegolf
!!!Batch is another derivative of the Windows Batch programming language, its wiki is here Your challenge is to create an compiler/translator that reads a !!!Batch program and returns a Windows Batch program. In !!!Batch each token braced in two question marks like ?!!!? is converted to another ASCII character, like '?...
stackexchange_codegolf
Inspired by this challenge, as well as a problem I've been working on Problem: Given a non-empty set of points in 3D space, find the diameter of the smallest sphere that encloses them all. The problem is trivial if the number of points is three or fewer so, for the sake of this challenge, the number of points shall be ...
stackexchange_codegolf
Good Afternoon, Your goal is to, in the least amount of source code bytes, recreate any of Piet Mondrian's 'Composition' paintings (for instance, Composition #10). The recreation can either use the actual colors, or replace it with the appropriate colours from the Windows Default 16 Color Palette. Your recreation can b...
stackexchange_codegolf
Since 2009, Android's version code names have been confectionery-themed. Android 1.5 is Cupcake, Android 1.6 is Donut, Android 2.0 is Eclair, etc.. In fact, the version names are alphabetical! C -> Cupcake D -> Donut E -> Eclair F -> Froyo G -> Gingerbread H -> Honeycomb I -> Ice Cream Sandwich J -> Jellybean K -> Kitk...
stackexchange_codegolf
Your task is to determine whether some arbitrary programming language has zero-indexed or one-indexed arrays based on sample inputs and outputs Inputs An array of integers with at least 2 elements A positive integer index The value of the array at that index Output One of four distinct values representing: One-index...
stackexchange_codegolf
Your task is to generate a random digit following these steps: First, generate 10 random digits to make a binary number, 50% 0, and 50% 1: 010011001 If it is all zeros, generate a new one. Convert this to decimal: 153 For each digit, write that amount of alternating 0s and 1s (first digit = 1s, second digit = 0s, thi...
stackexchange_codegolf
Backstory, skip if you like Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars effortlessly rise above the primitive notion of linearly passing time and add an exhilarating sense of unpredictability to the...
stackexchange_codegolf
This is the exact same question I asked earlier, but without the annoying Cyrillic factor which many found superfluous. I hope this is a better puzzle! The quaint hamlet of North Codetown in the Scottish far north has a problem: their population is low (below 52), and no new people have arrived for years. Moreover, af...
stackexchange_codegolf
Find the original challenge here Challenge Given an integer, Z in the range -2^31 < Z < 2^31, output the number of digits in that number (in base 10). Rules You must not use any string functions (in the case of overloading, you must not pass a string into functions which act as both string and integer functions). You a...
stackexchange_codegolf
Background You have again, again been given the task of calculating the number of landmines in a field. But this time, the field is foggy. You must calculate the landmine score given a list/string of numbers, the landmine number, and the land distance (all are numbers). The landmine number tells you where landmines are...
stackexchange_codegolf
Negadecimal, also known as base -10, is a non-standard positional numeral system. Take the number \$1337_{10}\$. In decimal, this has the value one thousand three hundred thirty seven, and can be expanded to: $$1\cdot10^3+3\cdot10^2+3\cdot10^1+7\cdot10^0$$ $$(1000)+(300)+(30)+(7)$$ In negadecimal, instead of \$10^n\$, ...
stackexchange_codegolf
The following problem is taken from the real world — but indubitably code-golf! In this puzzle, the programming language is fixed, and your job is to write the most efficient program in this fixed language. The language has no loops; a program is a straight-line sequence of instructions. Each instruction consists of ex...
stackexchange_codegolf
Optimize the following function for number of tokens: int length(int x) { switch (x) { case 1: return 1; case 3: return 2; case 7: return 3; case 15: return 4; case 31: return 5; case 63: return 6; case 127: return 7; case 255: return 8; case 511: return 9; case 1023: ret...
stackexchange_codegolf
Background and Motivation: IOC Country Codes are three letter abbreviations that are commonly used when broadcasting the Olympic Games. The last two letters of some codes overlap with the first two letters of other codes (RUS -> USA, JPN -> PNG), etc. Clearly, you can transform the first country code into the second by...
stackexchange_codegolf
Can you imagine solving the New York Times crossword puzzle without any clues? Maybe not with all of the creativity and new words and phrases appearing in modern crosswords, but with a fixed word list there's some hope. In this challenge, you create a crossword puzzle grid in which this is theoretically possible. The...
stackexchange_codegolf
Here's the phonetic alphabet: Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu In the fewest bytes possible: Input will be these words in a random order, with the first letters removed. Your goal is to...
stackexchange_codegolf
Lost is a 2-Dimensional programming language where the instruction pointer starts at a random location, moving in a random direction. A description of the language can be found at the bottom of the post for completeness' sake and a tutorial for the language can be found in the above link. The task here is simple to de...
stackexchange_codegolf
Let us assume that we have number X. Let us assume that we have positive integer "components" (C) of this X number. We can add these components together like C1+C2+...+Cn = X. We have N as limit of number of components. We have B as limit of biggest component Distribution: if we have [8;8;5] then avg of components is ...
stackexchange_codegolf
Write a program to take a graph (from either standard input or a file, your choice) and find a shortest path in the graph. Graphs are specified using the following format: A---S F--T | / \ | | / 5 0 |/ \| D----3--E A-Z: nodes in the graph -|/\: edges in the graph 0-9: weights on the edges <space>:...
stackexchange_codegolf
The famous constructed language Esperanto uses the Latin alphabet (mostly, see the linked wikipedia page for details). However, there are some characters with accents: ĉ, ĝ, ĥ, ĵ, ŝ, and ŭ. (C-circumflex, g-circumflex, h-circumflex, j-circumflex, s-circumflex, and u-breve.) Naturally, these characters are very hard to ...
stackexchange_codegolf
Challenge description A Smith number is a composite number whose sum of digits is equal to the sum of sums of digits of its prime factors. Given an integer N, determine if it's a Smith number or not. The first few Smith numbers are 4, 22, 27, 58, 85, 94, 121, 166, 202, 265, 274, 319, 346, 355, 378, 382, 391, 438 (seque...
stackexchange_codegolf
Given a string of printable ASCII text (including newlines and spaces) that contains at least one character that is neither a newline nor a space, output a truthy value if the string is rectangular, and a falsey value otherwise. Additionally, the source code for your solution must be rectangular. A string is rectangula...
stackexchange_codegolf
Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a visually appealing explanation. How do I do that? The current iteration index starts at 0. If the iteration index is even,...
stackexchange_codegolf
Overview The sharpness of a word is the sum of the sharpness of each of its letters, using the following rules: Sharp letters A, and V each have a sharpness of 1 N and Z each have a sharpness of 2 M and W each have a sharpness of 3 Dull letters C and U each have a sharpness of -1 S has a sharpness of -2 O has a shar...
stackexchange_codegolf
Given a positive integer, determine if it can be represented as a concatenation of two square numbers. Concatenated numbers may not begin with 0 (except for 0). Any leading zeros in input should be ignored. Examples 11 -> true // because 1 and 1 are squares 90 -> true // because 9 and 0 are squares 1001 -> true // ...
stackexchange_codegolf
Introduction A function that adds months to a date (without overflowing ends of months) is implemented in many languages/packages. In Teradata SQL it's ADD_MONTHS, here are some examples: ADD_MONTHS('2021-01-31', 1) => 2021-02-28 ADD_MONTHS('2021-01-30', 1) => 2021-02-28 ADD_MONTHS('2021-02-28', 1) => 2021-03-28 ...
stackexchange_codegolf
Well the title says it all. Standard loopholes apply Nothing to read from stdin, and output goes to stdout 1-byte-long programs are... nonsense. They don't qualify A program with a single byte repeated is also a nonsense (like aaa) Please mark it out if your program is a palindrome Sample: A program with source code...
stackexchange_codegolf
Task: With the minimum amount of bytes, determine today's Zodiac sign using the programming language of your choice. Rules: This is code golf, the answer with the fewest characters wins. The initialization of getting the current date into a variable (e.g. var now = new Date();) does not add to the count. Leap years mu...
stackexchange_codegolf
Problem Starting with a set of 10 coins at the start where all coins are tails up, and given n number of integers \$x_1, x_2, x_3... x_n\$ representing n rounds of coin flipping. At each round, we randomly flip \$x_i\$ number of coins at random. i.e Coins that were heads become tails, and vice versa. Within each round,...
stackexchange_codegolf
Originally posted (and deleted) by @Tlink, which was most likely inspired from this StackOverflow question. Since it was a shame it got deleted, because it seemed like a good challenge in general, I figured I'd repost it with proper formatting and rules. (I've tried contacting @Tlink and get his/her permission to post ...
stackexchange_codegolf
This is an exact inverse of the question Convert to Spoken Binary. This introduction is copied from there. Introduction In the video the best way to count, binary is proposed as the best system of counting numbers. Along with this argument is a proposal on how to say numbers in this system. First, we give names to eac...
stackexchange_codegolf
Inspiration: Heavily inspired by Smallest chess board compression I decided to make a similar but distinctly different competition. tl;dr Take the file Chess_Games.txt and compress it as much as you can so that you can expand it to the original file. Objective: Write an algorithm to encode and decode an entire chess da...
stackexchange_codegolf
Introduction A recursive acronym is an acronym that contains or refers to itself, for example: Fish could be a recursive acronym for Fish is shiny hero, notice how that also contains the acronym itself. Another example is Hi -> Hi igloo. Or even ppcg paints -> ppcg paints cool galaxies pouring acid into night time star...
stackexchange_codegolf
A parity bit, is one of the simplest forms of a checksum. First, you have to pick the parity, even or odd. Let's say we pick even. Now, we need a message to transmit. Let's say our message is "Foo". This is written in binary as: 01000110 01101111 01101111 Now, we count the total number of 1's in there, which is 15. Si...
stackexchange_codegolf
Logic gates are functions which perform basic logic operations. In this problem, we will account for the following 6 logic gates: AND, OR, XOR, NAND, NOR, and XNOR. Each of these takes two boolean inputs \$ a \$ and \$ b \$, and outputs a boolean. Below are the truth tables which show the output of each gate given two ...
stackexchange_codegolf
I am a big fan of the game Creeper World, and especially the sequel. You don't need to know how this game works to answer the question, I just wanted to mention where my question originated from. In the game, your objective is to destroy the Emitters that are spawning Creeper, using a weapon known as a nullifier. Nulli...
stackexchange_codegolf
Today is November 11th, which for many regions is Remembrance Day. If you don't know anything about the history or context of Remembrance Day, you can read about it in the wiki page, but it's not relevant for this challenge. In Flanders Fields is a poem that is pretty well-known relating to this day. It opens like so: ...
stackexchange_codegolf
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...
stackexchange_codegolf
This geometric spiral looks complicated, but it's fairly simple to draw; take the following box: Draw a straight line between the corner of the box and some set distance above the next corner counter-clockwise. Continue this pattern inward, always staying that set distance away from the corner of the next line. Here...
stackexchange_codegolf
Backstory Meet my friend Jimmy: /o\ Jimmy is a little character who likes to stand on platforms. Here's Jimmy safely standing on a platform: /o\ ------------- Now, Jimmy has a good sense of balance, so he can safely stand with one leg off of the platform, like so: /o\ ------------------- Although i...
stackexchange_codegolf
The Triforce is a fictional artifact in The Legend of Zelda, made of three identical-looking equilateral triangles representing power, wisdom and courage. Several games in the saga include an animation when the three parts finally join together. The purpose of this challenge is to draw a single 2D frame of such a simpl...
stackexchange_codegolf
You've just been hired by a German car manufacturing company. Your first task, as an engineer, is to write a program that computes the ecological footprint of ASCII strings. The ecological footprint of character is computed as follows: Write the character's ASCII code in binary, and count the number of 1's. For examp...
stackexchange_codegolf
Given a ASCII string containing control characters, compute what it should look like when printed to a terminal. Imagining the behaviour of a cursor, this is how to treat each character in the input: 0x08 backspace (\b): go left one (if already at the start of a line, do not go up) 0x09 horizontal tab (\t): go right o...
stackexchange_codegolf
Knight is the Language of the Month for August 2022, and I noticed that it didn't have a tips page, so here it is! I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Knight (e.g. "remove comments" is not an answer). Please post only one tip per answer.
stackexchange_codegolf
Andrew is a chemist, interested in the acidity of solutions and in agriculture. After months of research (Google is not his friend), he came up with the following table* regarding the human-readable level of acidity in terms of the pH (potential of Hydrogen): Denomination | pH range ...
stackexchange_codegolf
This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a lot easier than this one here This Challenge Given a bunch of rectangles, figure out whether or not they fill a rectang...
stackexchange_codegolf
Write an irreducible proper quine, i.e. a program that prints its own source code, which can't be reduced by removing characters to a shorter program with the same constraints. Eg. the python quine: var='var=%r;print(var%%var)';print(var%var) can be reduced to the quine v='v=%r;print(v%%v)';print(v%v) thus it is no...
stackexchange_codegolf
The autokey cipher is closely related to the Vigenère cipher (both were invented by Blaise de Vigenère). Decryption involves the encrypted message and the key. For simplicity, let us assume all characters in the message and key are lowercase letters (no spaces, numbers or symbols etc.). How to decrypt the cipher Conve...
stackexchange_codegolf
You are sick of all of the codegolf challenges. Hence you decide to write a program that will automatically golf some Python code for you. There are 3 test cases: print quickSort([0,7,3,-1,8,10,57,2]) def quickSort(arr): less = [] pivotList = [] more = [] if len(arr) <= 1: return arr else:...
stackexchange_codegolf
A number is a Mersenne Prime if it is both prime and can be written in the form 2m-1, where m is a positive integer. For example: 7 is a Mersenne Prime because it is 23-1 11 is not a Mersenne Prime because it cannot be written as 2m-1 15 is not a Mersenne Prime because it is not prime The first few Mersenne primes:...
stackexchange_codegolf
Task Your task is to take a character in: AÁÀÃÂBCÇDEÉÊFGHIÍJKLMNOÕÓÔPQRSTUÚVWXYZaáàãâbcçdeéêfghiíjklmnoõóôpqrstuúvwxyz and turn it into a characters in: AAAAABCCDEEEFGHIIJKLMNOOOOPQRSTUUVWXYZaaaaabccdeeefghiijklmnoooopqrstuuvwxyz by the obvious operation: dropping the accents in the letters. Input A character in any se...
stackexchange_codegolf
Your challenge today is to output a given term of a sequence enumerating all of the integers. The sequence is as follows: If we have a 0-indexed function generating the sequence f(n) and ceil(x) is the ceiling function, then f(0) = 0; abs(f(n)) = ceil(n/2); sign(f(n)) is positive when n and ceil(n/2) are either both ev...
stackexchange_codegolf
A brace string is defined as a string consisting of the characters *()[] in which braces match correctly: [brace-string] ::= [unit] || [unit] [brace-string] [unit] ::= "" || "*" || "(" [brace-string] ")" || "[" [brace-string] "]" This is a valid brace-string: ((())***[]**)****[(())*]* But these are not: )( **...
stackexchange_codegolf
Preamble A common pain-point when working with rational numbers and decimals is how infrequently one can represent their rational number as a clean, non-repeating decimal. Let's solve this by writing a program to decimalize (not to be confused with decimate) them for us! The Challenge Given a fraction, check if it can ...
stackexchange_codegolf
Starting with 1, output the sequence of integers which cannot be represented as the sum of powers of earlier terms. Each previous term can be used at most once, and the exponents must be non-negative integers. This sequence starts: 1, 2, 6, 12, 25, 85, 194, 590, 1695, 4879, 19077, 83994, 167988 For example, after 1 an...
stackexchange_codegolf
With the given text below, there are some words in the text that repeats several times in the text. Use any programming language to write a short code that compresses the text to display it. Or in other words, use the smallest number of bytes to display the text. The Text is: Peter Piper picked a peck of pickled peppe...
stackexchange_codegolf
Write the shortest program that prints the sound my alarm clock makes, and stops after an inputted number of beeps. For reference, here is the sound my alarm makes: beep beep beep beep beep beepbeep beepbeep beepbeep beepbeep beepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeep beepbeepbeepbeep bee...
stackexchange_codegolf
Task You are playing Hangman, and your opponent uses a simple but effective strategy: Each turn, from the remaining letters, they guess the letter that appears most frequently across all possible words. When multiple letters appear with the same maximum frequency, your opponent selects randomly among them. That is, yo...
stackexchange_codegolf
Background I am currently in an AP Comp Sci A: Java class, and I want to start some of my friends on code golfing. I have a challenge from the course, and I would like to see how many bytes the community can do this challenge in. Challenge details: Given two input strings, the main string and the pivot string, do the ...
stackexchange_codegolf
A great Python golfing tip is to omit needless spaces. But if you are like me, you don't always have the time to search for which spaces to remove. If only there was a way to speed up the process... Task Given a single line of Python, as input, return/output a new line which omits all needless spaces. The table below s...
stackexchange_codegolf
The brainiacs at New Scientist tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again to make ABLEST." (https://twitter.com/newscientist/status/1379751396271124480) This is of course correct. It is not, however,...
stackexchange_codegolf
James Bond is about to start a new mission and you are his computer scientist friend. As Tic Tac Toe is becoming more and more popular you decide that nothing would be more underhanded than a Tic Tac Toe encoder/decoder™. For each line the decoder will follow the following steps: Convert from 'O','X' and ' ' [space] ...
stackexchange_codegolf
I personally love quines, but they all seem to be so... static. So why not create a quine that can do more. Challenge The challenge here is to create a quine that without any sort of input is a normal quine. Then if it receives a different input, it outputs a different quine in a different language. (basically like a p...
stackexchange_codegolf
Chess pieces (kings, queens, rooks, bishops, and knights) and pawns are on a board, but not on the a1 or h8 square. Your task is to travel from the empty a1 to the empty h8 squares, passing through only empty squares. The rules of movement are as follows: You can proceed from any empty square to any empty square next ...
stackexchange_codegolf
Giving a challenge involving a Star Trek reference just after May the 4th may be frowned upon, but here goes. You, Luke, Anakin, Palpatine, Yoda and Han Solo are involved in an insane tournament of Rock, Paper, Scissor, Lizard, Spock. The catch here is that you are only allowed to use a fixed order of moves. If your or...
stackexchange_codegolf
Task: I know we can all add two numbers the short way, using +. Your task is to create the longest code you can to add two input numbers. Rules: All of the code must be on topic (don't fill it with non-addition code to add length) The count is in characters, but do not count tabs, spaces, or newlines. Do not use extra...
stackexchange_codegolf
Cops' challenge This cops-and-robbers challenge challenges the Cop to write a non-empty program that, when run, produces some non-empty output in language A, and, when reversed, produces some non-empty output in language B. The program may produce any output to STDERR when run in either language, but may not take input...
stackexchange_codegolf
So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code... Here's a (short) example output: + + + + + + + ...
stackexchange_codegolf
I am trying to write a solution to the following problem using as few characters as possible (to meme my friend and introduce him to golfing). Can any improvements be done to my code? So the problem requires us to write a function called navigate in Python 3.6 (language of the judge, sorry, no walruses) that takes two ...
stackexchange_codegolf
I'm surprised that this challenge isn't already here, as it's so obvious. (Or I'm surprised I couldn't find it and anybody will mark it as a duplicate.) Task Given a non-negative integer \$n\$, calculate the sum of the first \$n\$ primes and output it. Example #1 For \$n = 5\$, the first five primes are: 2 3 5 7 11 ...
stackexchange_codegolf
Remove every pair of newline characters, that means every two newline characters appearing together are elided, whereas unaccompanied newline characters remain present. Example: echo -ne 'a\n\nb\nc\n\n\n\nd\n\n\n' | your-command should output the same as echo -ne 'ab\ncd\n' Watch out, some POSIX tools have implementa...
stackexchange_codegolf
I am a robot. I bought this keyboard because of its easy rectangular layout: ~` !1 @2 #3 $4 %5 ^6 &7 *8 (9 )0 _- += tab Qq Ww Ee Rr Tt Yy Uu Ii Oo Pp {[ }] \| Aa Ss Dd Ff Gg Hh Jj Kk Ll :; "' [-enter-] Zz Xx Cc Vv Bb Nn M...
stackexchange_codegolf
The problem with the Caesar cipher is the resulting words are often unpronounceable. The problem with Pig Latin is that it is easy to decode. Why not combine them? Input A word consisting of the 26 english letters. Output First, change every consonant in the word to the next consonant in the alphabet. So, b goe...
stackexchange_codegolf
Given a word list, find all sets of five words of five letters each, such that the words of each set have 25 distinct letters in total. This challenge was inspired by this video by Matt Parker. Testcases Use this file if you want to test your code against the English vocabulary. Sample output sets: ["fjord", "vibex", ...
stackexchange_codegolf
Probably a simple code-golf challenge. Given 2 positive integers m and n, make a list of n values that are positive integers whose sum is equal to the number m. Either all values in the output are the same value or the difference is exactly 1. Examples For example m=6 and n=3 would become 2, 2, 2 m=7 and n=3 would bec...
stackexchange_codegolf
Your challenge today is to output a given term of a sequence enumerating all of the integers. The sequence is as follows: If we have a 0-indexed function generating the sequence f(n) and ceil(x) is the ceiling function, then f(0) = 0; abs(f(n)) = ceil(n/2); sign(f(n)) is positive when n and ceil(n/2) are either both ev...
stackexchange_codegolf
Introduction: In my recent Strikethrough the Word Search List challenge I mentioned the following: When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one. In some cases I do them in reversed order as a change of pace, although that doesn't matter too much r...
stackexchange_codegolf
Definition Given some number, x calculate the smallest number i such that 2i≥x. This is not a duplicate of this question. It is slightly different in that an input of 16 should yield an output of 4 whereas 16 returns 5 in the linked question. Input Input will be an unsigned 32-bit integer. Output Output will be an unsi...
stackexchange_codegolf
Consider the following alphabetically sorted list of words: balderdash ballet balloonfish balloonist ballot brooding broom All of the words start with b, and the first 5 start with bal. If we just look at the first 2 words: balderdash ballet we could write instead: balderdash +let where the ' ' is used where a wor...
stackexchange_codegolf
This challenge is not code golf. Please read the scoring before you attempt to submit an answer. You will be given a multi-line string as input. You should output the size of the largest contiguous chunk of non-space characters. Contiguous just means that the chunk is a single piece rather than multiple disconnect...
stackexchange_codegolf
Description Output the rhyme scheme for a very long Terza Rima. Input None. Output ABA BCB CDC DED EFE FGF GHG HIH IJI JKJ KLK LML MNM NON OPO PQP QRQ RSR STS TUT UVU VWV WXW XYX YZY Rules You can pick between separating stanzas with whitespace or newlines, so either: ABA BCB... OR ABA BCB ... A single trailing whit...
stackexchange_codegolf
Is there any javascript-like language? Something that can be interpreted by browsers?
stackexchange_codegolf
I'm not really sure if this is the right place to ask this. Now, I know I can convert a float to an int with int, but is there some shorter way?
stackexchange_codegolf
MATL is a golfing language created by Luis Mendo. MATL has proven to be highly competitive, often beating submissions in other golfing languages such as Pyth, CJam and Jelly. What are some useful tips for golfing in MATL? (As always, one tip per answer, please!) For the record, MATL can be tested online here. Documen...
stackexchange_codegolf
Make a program that takes a length and list of intervals and outputs a ruler of that length with longer ticks for each interval using the line drawing characters ┌ ┬ ┐ │ ╵ The first row of the output should begin with the tick for 0 with ┌ and end with a tick for the length with ┐, with a ┬ being used for every charac...
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
Task You will be given a positive integer and you must output a "self-complementary graph" with that many nodes. If you don't know what a self-complementary graph is the wikipedia article wont help you much so below are two explanations, a technical and a non-technical one. Non-Technical A graph is a set of nodes that...
stackexchange_codegolf
Related but different. Part II Taken from the book: Marvin Minsky 1967 – Computation: Finite and Infinite Machines, chapter 14. Background As the Gödel proved, it is possible to encode with a unique positive integer not just any string but any list structure, with any level of nesting. Procedure of encoding \$G(x)\$ i...
stackexchange_codegolf
Challenge I've checked that there is a question Compute the Discrete Cosine Transform which is a competition for implementing a shortest solution to compute the one dimensional discrete cosine transform. The goal of this challenge is to implement a program to calculate three dimensional discrete cosine transform which ...
stackexchange_codegolf
Information Given a non-negative odd integer (let's call it \$n\$), find the number of all possible paths which covers all squares and get from the start to end on a grid. The grid is of size \$n\$×\$n\$. The start of the path is the top left corner and the end is the bottom right corner. You have to count the number ...
stackexchange_codegolf
In most programming languages, arithmetic is written with infix notation -- i.e. the operator is put in between the operands -- e.g. 1+2. In contrast, with Polish notation (a.k.a prefix notation), the operator comes before the operands -- e.g. +1 2. As long as the number of operands for each operator is fixed, this mea...
stackexchange_codegolf
J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966): If \$A\$ is any positive integer having \$m\$ digits, there exists a positive integer \$N\$ such that the first \$m\$ digits of \$N!\$ constitute the integer \$A\$. Challenge Your challenge is given some \$A \geqslant 1\$ find a corresponding \$N \ge...
stackexchange_codegolf
Your task is to translate a 103-smooth number into an English word, using the method described below. How? Generate the list of prime factors (with repetition) of the input number. Sort the list: If 2 is not one of the prime factors, sort the list in ascending order. If 2 is one of the prime factors, remove it from ...
stackexchange_codegolf
A marquee is a low-tech board that allows customizable letters. For example, here is a marquee: SALE ON SNEAKERS However, someone might come along and vandalize it by removing letters to send a different message: S N AKE Given two non-empty string inputs, an original message and a new message, determine whethe...
stackexchange_codegolf
In my time on PPCG, I've noticed that quine problems and polyglot problems are quite popular. Also, meta-solutions to problems, that is, scripts which generate a program which is the solution to a problem, tend to get a lot of positive feedback from the community. Therefore, I have created this challenge, which impleme...
stackexchange_codegolf