instruction_seed
stringlengths
34
53.1k
_source
stringclasses
1 value
The TV series "Breaking Bad" replaced the letters Br and Ba with a periodic-table like representation, printing [Br35]eaking [Ba56]d. Create a program that takes a string input, does a replacement and prints an output. The replacement shall subsidize any substring that matches an element symbol with the notation demons...
stackexchange_codegolf
A string is dot-heavy when its morse representation contains more dots than dashes. For example, the letter E is a single dot, which means it is Dot-heavy. Input The input string will only contain characters in the range of [a-z] or [A-Z]. You can decide if they should all be upper case, or all lower case. AAA is fine...
stackexchange_codegolf
There's never really been a definitive ASCII-cards challenge AFAIK. So, using the following deck of ASCII cards: .------..------..------..------..------..------..------..------..------..------..------..------..------. |2.--. ||3.--. ||4.--. ||5.--. ||6.--. ||7.--. ||8.--. ||9.--. ||T.--. ||J.--. ||Q.--. ||K.--. ||A.--....
stackexchange_codegolf
In North America, most electrical outlets/receptacles follow standards set by NEMA. For this challenge, you'll be given a few properties of a device you need to plug in, and your program (or function) should return all of the outlets that would be compatible. For this challenge, an outlet has three properties: voltage,...
stackexchange_codegolf
Lambda calculus is a system of computation based on single-argument functions; everything in it is such a function. Due to this functional nature, juxtaposition is commonly used to denote function application, grouped from left to right. For example, \$(f g) h=f g h\$ denotes what would conventionally be written \$(f(g...
stackexchange_codegolf
If we take a positive integer \$n\$ and write out its factors. Someone can determine \$n\$ just from this list alone. In fact it is trivial to do this since the number is its own largest factor. However if we take \$n\$ and write only the first half of its factors (factors that are smaller than or equal to \$\sqrt{n}...
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
(Just open 50 tabs in Google Chrome :D (just kidding, no you can't)) Shortest code for infinite disk I/O any language, C# example: using System.IO; namespace FileApp { static class Program { public static void Main() { do { File.WriteAllText("a", "a"); File.Delet...
stackexchange_codegolf
A positive integer \$x\$ is an \$n\$-perfect number if \$\sigma(x) = nx\$, where \$\sigma(x)\$ is the divisor sum function. For example, \$120\$ is a \$3\$-perfect number because its divisors sum to \$360\$: $$360 = 3\times120 = 1+2+3+4+5+6+8+10+12+15+20+24+30+40+60+120$$ and $$926073336514623897600 = 6\times1543455560...
stackexchange_codegolf
Cops' Challenge Robbers' challenge here. It has now been four days since the challenge was posted so all new answers should be marked as non-competing in the title. These answers can still be cracked by robbers but will not go towards their total, and cannot win this challenge. In this cops-and-robbers challenge, you...
stackexchange_codegolf
Given an integer n ≥ 0 , output it in a non-positional base-3 notation, using digits 139ABCDE… and a 1-character separator. Every digit is a consecutive power of 3 and the digits on the left side of the separator are negated, e.g. A931|B → 81−(1+3+9+27) → 41. A digit may appear only once. Rigorously, let ...
stackexchange_codegolf
Write a program that is capable of randomly generating itself. It must do this based on the tokens used in its source code. If your program's source code is composed of 50 unique tokens and is 60 tokens long, then the program should output 60 tokens where each token is randomly chosen from one of the 50 unique tokens. ...
stackexchange_codegolf
Your task is to, given an array of signed 32 bit integers, recompile it with its inverse deltas. For example, the list 1 3 4 2 8 holds the deltas: 2 1 -2 6 which are then negated, yielding: -2 -1 2 -6 and recompiled, yielding: 1 -1 -2 0 -6 as the final result. Input/Output You will be given a list/array/...
stackexchange_codegolf
This is a pretty simple challenge, but (I hope) a fun one. Task If right now either the month is 4 and the day is 20, the hour (on a 12 hour clock) is 4 and the minute is 20, or the minute is 4 and the second is 20, print this ascii art: . .:. :|: ...
stackexchange_codegolf
Given an integer \$ n \ge 2 \$, you need to calculate \$ \lfloor n \log_2(n) \rfloor \$, assuming all integers in your language are unbounded. However, you may not ignore floating-point errors - for example, in python lambda n:int(n*math.log2(n)) is an invalid solution, because for example for n=10**15, int(n*math.log2...
stackexchange_codegolf
Introduction A "lobster number", by my own designation, is a number that contains within itself all of its prime factors. The "lobster" description was inspired by the recent question "Speed of Lobsters". The basic idea is that each prime factor can be made by lobsters munching away digits of the number until you are...
stackexchange_codegolf
I was annoyed the other day when I got a point off in math class because I didn't distribute the factors of my function. That is, I put (x+2)(x-3) when I should have put x^2 - x - 6. Your job is to write a program that takes a string with the expression and convert it to the expanded form so I don't miss future points...
stackexchange_codegolf
Adam West passed away, and I'd like to honor his memory here on PPCG, though I doubt he knew of our existence. While there are many, many different things that this man is known for, none are more prominent than his role as the original batman. I'll always remember my step-father still watching the old-school Batman an...
stackexchange_codegolf
In this code-golf challenge, you must output an ascii-art of a random die roll. like this: ________ /\ \ / \ 6 \ { 4 }-------} \ / 5 / \/_______/ Please note that: ________ /\ \ / \ 3 \ { 4 }-------} \ / 5 / \/_______/ is invalid output, because that is not a possib...
stackexchange_codegolf
(Note: This is my first ever code golf question, but as far as I can tell, nobody else has done exactly this, so I should be good.) Your task is to make a program or function that takes in a string s and an integer n, and returns or outputs that text wrapped into multiple lines. Each word must be wholly on a line; i.e....
stackexchange_codegolf
Challenge You must, in the least bytes possible, implement the Binary Heap data structure and each of the following methods that operate on it: A function which takes no arguments and returns an empty Heap A function which takes a list of arguments with an arbitrary length and returns a Heap containing the elements A ...
stackexchange_codegolf
This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter: XYZABC VW DE U F T G S H RQ JI PONMLK Write a program that takes in a single letter character, A-Z, and...
stackexchange_codegolf
Introduction: Apparently I keep coming up with word search related challenges lately. :) When I do the word search in the Dutch news paper, some words are very easy to find because they contain letters that aren't too common in Dutch words, like x or q. So although I usually look for the first letter or prefix of a wor...
stackexchange_codegolf
You work at a virtual, old-fashioned printing press. To help you arrange your monospace letters faster, you decide to make the shortest program possible to help you. Given a string of text and a page size, generate and output each page of the text. Examples For example, with a page width of 14, height 7, and some text,...
stackexchange_codegolf
Whispers is February 2021's Language of the Month, so what tips do you have for golfing in it? Tips do not have to be specific to code-golf, so long as they apply to other types of challenges on the site. Tips should be at least somewhat specific to Whispers (e.g. "remove ignored code" is not an answer). Please post on...
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
Given a dictionary file (a text file containing a word or phrase on each line, with possible punctuation but no numbers; lines are alphabetized), you must output each combination of words where one letter can be removed from a word to make another; the removed letter should be encased in parentheses. For example, the i...
stackexchange_codegolf
Given a string of printable ASCII, output the frequency of each character in that string. The Challenge Input is given as a string of printable ASCII characters (decimal [32-126] inclusive). Output the frequency of each character, in ASCII order. The output must have a format similar to [character][separator][count]. ...
stackexchange_codegolf
Three positive integers A, B, C are ABC-triple if they are coprime, with A < B and satisfying the relation : A + B = C Examples : 1, 8, 9 is an ABC-triple since they are coprime, 1 < 8 and 1 + 8 = 9 6, 8, 14 is not because they are not coprime 7, 5, 12 is not because 7 > 5 You can see this Frits Beukers 2005 presenta...
stackexchange_codegolf
Based on the "Pretty Ugly" poem. Input consists of a number of stanzas (positive integer), and four arrays/lists of strings, called the "negatives", "negations", "positives", and "filler" sentences. You must output a "pretty ugly" poem with the specified number of stanzas. A stanza consists of a negative, negation, pos...
stackexchange_codegolf
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...
stackexchange_codegolf
The way points are assigned on a dice follows a regular pattern, the center dot is present if and only if the number is odd. To represent the even numbers, pairs of dots on opposite sides of the center are added, which will stay present for all successive numbers. 1: O 2: 3: 4: 5: 6: O O O O O O ...
stackexchange_codegolf
Note: There was not a vanilla challenge to actually flip a coin, even though there were mentions about flipping coins a lot of places. Even though there is a challenge to generate a random number from 1 to N, I suspect this is not a dupe. These questions ask for random numbers from 1 to N, while this ask for just trut...
stackexchange_codegolf
In this challenge, submissions will be programs or function which, when given an emoticon such as :-), :(, or :D, will rate their happiness from 0 to 3. An emoticon will be one of the following: :(: 0 :|: 1 :): 2 :D: 3 Emoticons may also have noses (a - after the :). Test cases: :( -> 0 :-| -> 1 :D -> 3 :-) -> 2 :|...
stackexchange_codegolf
Given two positive integer fractions \$x\$ and \$y\$ such that \$x < y\$, give the fraction \$z\$ with the smallest positive integer denominator such that it is between \$x\$ and \$y\$. For example \$x=2/5\$, \$y=4/5\$, the answer is \$1/2\$. Other fractions such as \$3/5\$ are also in between the two, but \$1/2\$ has...
stackexchange_codegolf
In this challenge, given a CSV file as a string, you'll return the data contained as a 2d array of strings. Spec: The input consists of one or more records, delimited with \r\n (CRLF), \n (line feed), or some other reasonable newline sequence of your choice A record consists of one or more fields, delimited with , (co...
stackexchange_codegolf
Almost every language has a built-in function that can split a string at a given position. However, as soon as you have html tags in the string, the built-in function will not work properly. Your task is to write a program or function which splits a string at the nth character but does not count characters of html tags...
stackexchange_codegolf
Objective You have two knights on a standard chessboard labelled 1-8 and A-H, one knight is located at 1C and the other at 2G. You have to write a program in the language of your choosing that accepts a set of coordinates from stdin, like 2C, and then calculates which of the two knights you have to move in order to cap...
stackexchange_codegolf
For our purposes, a trend is a contiguous subsequence of an array that falls into one of three categories: increasing, e.g. [1,2,3,10,239] decreasing, e.g. [8,5,0,-3,-50] stable, e.g. [7,7,7,7] Note that [1,1,2,3] is not a valid trend. It can be broken up into a stable trend [1,1] and an increasing trend [1,2,3]. In ...
stackexchange_codegolf
A polyiamond of size \$n\$ is a contiguous shape formed by joining \$n\$ equilateral triangles side by side. Your output should consist of two distinct characters, plus whitespace as necessary (▲ and ▼ work great!). Trailing whitespace is acceptable. You may use any other characters - but you may count ▲▼ as 1 byte e...
stackexchange_codegolf
Given a multidimensional, rectangular array of nonnegative integers, sort it at every depth (lexicographically), starting from the innermost. For example, with this array: [ [ [5, 1, 4], [10, 7, 21] ], [ [9, 20, 2], [4, 2, 19] ] ] You'd sort at the deepest first: [ [ [1, 4, 5], [7, 10, 21] ], [ [2,...
stackexchange_codegolf
Task The task is to convert a string to a number. It must accept the string via stdin and output the number via stdout. You convert a string to a number by replacing each letter of the string by its index (mind that you don't need to replace it with the index, that's just an example. You are allowed to replace it with ...
stackexchange_codegolf
How many ways can one place (unlabelled) dominoes on a square chequerboard such that the number placed horizontally is equal to the number placed vertically? The dominoes must align with, and may not protrude, the chequerboard and may not overlap. This is OEIS sequence A330658, 1, 1, 1, 23, 1608, 371500, 328956227, 112...
stackexchange_codegolf
Intro Given a whole number \$< 100,\$ extend/shorten the english representation of the number to have as many characters as it's value. Sandbox Rules Take the number \$n\$, and get it in words from this dictionary. You may take this dictionary in any way you prefer. (a list, read from link, command line arg, STDIN, va...
stackexchange_codegolf
Cyclically self-describing lists A list \$L\$ of positive integers is cyclically self-describing, if the following conditions hold. \$L\$ is nonempty. The first and last elements of \$L\$ are different. If you split \$L\$ into runs of equal elements, the element of each run equals the length of the next run, and the e...
stackexchange_codegolf
A string of characters repeats if it contains two consecutive substrings that are equivalent. For example, 2034384538452 repeats as it contains 3845 twice, consecutively. Therefore, your challenge is to decide whether a string contains a repeating substring. You may take the input as a string or an array of characters....
stackexchange_codegolf
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...
stackexchange_codegolf
Write a program which accepts a sentence into stdin, and writes that sentence to stdout in pig latin. Here are some test cases which your program should handle: Input: Read your script Output: ead-Ray our-yay ipt-scray Hyphenation is mandatory. Note that multiple consonants at the start of the word must all be...
stackexchange_codegolf
You are the captain of a world-famous wrestling team. An Olympic-grade match is coming up, and you are determined not to let your team down. You also happen to be a competent programmer, so you are going to write a program to help your team win! You have access to the strength ratings for each of your own team wrestler...
stackexchange_codegolf
Given the equation of a non-parabolic conic section, output its characteristics. Spec Some info on conic sections: for more info visit Wikipedia From an equation of the form \$ax^2+bx+cy^2+dy+E=0\$, it is possible to derive the type of conic section using a combination of square completion and simple arithmetic. For t...
stackexchange_codegolf
Wow, time really flies! It's already been one year since the debut of the Code Golf Stack Exchange site design. Let's celebrate this milestone with a code golf challenge... to imitate the site logo! Golf a program that outputs a graphic of a medal enclosed in curly braces {}, along with two lines of text containing COD...
stackexchange_codegolf
A casino uses the following deck of cards. (* is one of the card suits D, S, C or H.) _________ _________ _________ _________ _________ | | | | | | | | | | | | | | | * | | * * | | * * | | | | * | | | | ...
stackexchange_codegolf
You are given a string of terrain, with molehills and mountains: /\ / \ _/\__ / \ ___/ \_/ \_ ____/\___/ \___ Your job is to replace every molehill in the string with an equivalent mountain centered in the same col...
stackexchange_codegolf
Let's define fn(k) as the sum of the first k terms of the natural numbers [1, ∞) where each number is repeated n times. k | 0 1 2 3 4 5 6 7 8 9 --------+------------------------------------------------- f_1(k) | 0 1 3 6 10 15 21 28 36 45 deltas | +1 +2 +3 ...
stackexchange_codegolf
This challenge is inspired by my earlier challenge "Create a program that prints the amount of characters it has, in words". This challenge's rules are simple: make a program that prints its character count, in words, which works in as many languages as possible. Each programming language the program works in must make...
stackexchange_codegolf
A near-repdigit number is a positive integer where all the digits are the same, except one. For example 101 and 227 are near-repdigits. A near-repdigit prime is a near-repdigit that is also prime. For example: 101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, ...
stackexchange_codegolf
Background This challenge is about the game of Go. Go is a game played on a board with a square grid N x N. You don't have to know how to play the game to do this challenge, but if you are interested, google "Tromp-Taylor rules" for a minimal and precise set of rules to play a full game. Let's use a 4 x 4 board. As the...
stackexchange_codegolf
Inspired by this blog post. Write a program that outputs 99 distinct programs (in the same language) that output the string I love you. How the programs are separated from one another in the output will be defined by you. However, Each byte of output can only belong to at most 1 of the 99 programs. Constraints for Out...
stackexchange_codegolf
This challenge is related to a project I did last year (in Ruby). To make it more fun I decided to do it in as few bytes as possible. I didn't know about code golf back then so now that I found out about it and found this community I was wondering if anybody can beat me :) The program should return the current time if ...
stackexchange_codegolf
Introduction In the prisoner's dilemma, two partners in crime are being interrogated, and have the choice to either betray their partner or stay silent. If both prisoners betray each other, they both get 2 years in prison. If neither betrays (both stay silent), they both get 1 year in prison. If only one betrays and t...
stackexchange_codegolf
Modern British number plates (a.k.a. registration marks or license plates) use the format AANNXXX where AA is a "DVLA memory tag" (basically a location code), NN is the age identifier, and XXX is three random letters. Your task is to, given a date, generate a random valid number plate with a date code matching the supp...
stackexchange_codegolf
Traditionally when you compare two strings you use lexicographical comparison. That can be described by the recursive algorithm: $$ f(x, y)= \left\{\begin{array}[rr] \\ \mathrm{EQ} & \mathrm{if}\,\mid x\mid=0\,\mathrm{and}\,\mid y\mid=0 \\ \mathrm{GT} & \mathrm{if}\,\mid x\mid>0\,\mathrm{and}\,\mid y\mid=0 \\ \mathrm{L...
stackexchange_codegolf
Consider an \$n \times n\$ grid of integers. The task is to draw a straight line across the grid so that the part that includes the top left corner sums to the largest number possible. Here is a picture of an optimal solution with score 45: We include a square in the part that is to be summed if its middle is above o...
stackexchange_codegolf
You have to take 2 string inputs and output the sum of these two strings without converting them to int or using any numeric data type. ex. string one = "123"; string two = "456"; string sum = "579"; Assume the strings won't be larger than 10 digits. This is code golf and shortest answer in characters wins. An ed...
stackexchange_codegolf
Since today marks the occasion of the 26th leap second ever to occur, your challenge will be to output the date and time of every leap second in GMT or UTC that has occurred so far, as well as the one to occur today. Input There is no input. Output 1972-06-30 23:59:60 1972-12-31 23:59:60 1973-12-31 23:59:60 1974-12-31 ...
stackexchange_codegolf
Background Inspired by a now deleted question by John Burger from which I quote: Now obviously no human made this mistake. It's a mis-decode of something - perhaps the ISBN? My question is: does anyone know of an existing algorithm that was so messed up it would invent an entirely new calendar? TFeld ingeniously com...
stackexchange_codegolf
Given a non-empty list of integers, output every possible partitioning of the list where each partition is a non-empty sublist. So for the list [1, 2, 3, 4] the result is: [[1, 2, 3, 4]] [[1, 2, 3], [4]] [[1, 2], [3, 4]] [[1, 2], [3], [4]] [[1], [2, 3, 4]] [[1], [2, 3], [4]] [[1], [2], [3, 4]] [[1], [2], [3], [4]] The...
stackexchange_codegolf
Given an expression matching the regex /^[-~]*x$/, evaluate it in terms of x and output a string matching the regex /^-?x[+-]\d+$/. For example, the string -~x evaluates to x+1, while the string -~-x evaluates to -x+1, and the string -~-~--x evaluates to x+2. We start from x and evaluate the string right to left. - neg...
stackexchange_codegolf
Validate a codice fiscale Every Italian resident/citizen is given a 16-character alphanumeric codice fiscale Challenge The final letter is a check code, which is calculated as follows : Characters of the code are split up into even and odd character according to their positions (check letter excluded) Both sets are re...
stackexchange_codegolf
Let us consider the following representation of the periodic table. __________________________________________________________________________ | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |--------------------------------------------------------------------------| |1| 1...
stackexchange_codegolf
Write a program or function that takes input and outputs/returns a full program (in the same language) that outputs said input. Note that the input may contain any printable ASCII character or newline (AKA 0x20-0x7f and 0x0a). However, the input will not have trailing whitespace nor preceding whitespace, nor will it be...
stackexchange_codegolf
So, there's a famous children's rhyme... This is the house that Jack built. This is the malt That lay in the house that Jack built. This is the rat That ate the malt That lay in the house that Jack built. This is the cat That killed the rat That ate the malt That lay in the house that Jack built. This is the do...
stackexchange_codegolf
Challenge: The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing bytes. BUT WAIT..... there is one restriction: Your source code can not include any of the digits from your byte count So if your score is 186 bytes, you...
stackexchange_codegolf
Challenge Create a function or program that, when given an integer size, does the following: If size is equal to 1, output H H HHH H H If size is greater than 1, output X X XXX X X where X is the output of the program/function for size - 1 (If you prefer, you may have the base case correspond to 0, so long as you spe...
stackexchange_codegolf
Introduction: In Dutch, the words leading and suffering, being 'leiden' and 'lijden' respectively, are pronounced the same way. One is written with a "short ei", and one with a "long ij", as we Dutchman would say, but both 'ei' and 'ij' are pronounced [ɛi]. Challenge: Given a list of numbers, determine which (if any) a...
stackexchange_codegolf
Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1. To determine the perfectness of a string, you see how many sections you can split it into where each section is a palindrome. If there are ambiguities, such as with a...
stackexchange_codegolf
Objective Write a routine that accepts a string of printable ASCII characters, s, and returns a string containing the same characters as s, reordered so that no two-character substring appears more than once. The program must process all benchmark strings (see below) in under one minute each on a modern computer. I wi...
stackexchange_codegolf
The input for the continuous knapsack problem is as follows. For each item 1...n we are given a positive weight and profit. Overall we are also given a positive capacity which is the maximum weight we can carry. The goal is to pick items so that the profit is maximized without exceeding the capacity. This is hard if ...
stackexchange_codegolf
\$ 1089 \$ is a very special number. To prove why, select any 3-digit number whose first and last digits differ by at least 2. Then, reverse the digits, and take the difference of these two numbers. Reverse the digits once more, and add these two numbers together. You will get \$ 1089 \$. The magic is left as an exerci...
stackexchange_codegolf
Your task is to output all possible ways to end a game with a tie (all rows, columns, and diagonals are completely filled and do not have 3 X's or 3 O's, and there are exactly 5 X's and 4 O's in total) in Tic-Tac-Toe (assuming X goes first): OXO XXO XOX OXX XOX OOX XOX XOO XOX XXO OXO OXX XOX XOX OXX XXO O...
stackexchange_codegolf
Write the shortest program that takes one input (n) from STDIN (or equivalent) and outputs a simple incrementing function with one argument (x) that returns x + n but the function must be in a different language. Pretty simple! This is code-golf, normal rules apply, shortest program wins. Example: ><> to Python (Ungolf...
stackexchange_codegolf
Your friend isn't too good with computers so as a practical joke someone scrambled the letters (a-z) on his keyboard. When he sit down and tried to type his name looking at the keyboard he realized that the letters are scrambled and asked your help. You are smart so you know that if he types his name and then repeatedl...
stackexchange_codegolf
Note: this is my first post here. The Challenge The challenge is to count the number of chocolate chips in a cookie. A cookie in this case is a circle with dots (the chips) in it. Given any square cartoon image of this cookie, you are to write a bot that counts and outputs the number of chocolate chips. Rules Has to t...
stackexchange_codegolf
Recently I've been playing a game called Alcazar. It is a board puzzle game where your goal is to enter from one door, pass through all squares, and exit through another door. The only rules are: Enter once, leave once; Pass through all squares; Do not pass through a square more than once The image below shows an exa...
stackexchange_codegolf
Background Gödel numbers are a way of encoding any string with a unique positive integer, using prime factorisations: First, each symbol in the alphabet is assigned a predetermined integer code. Then, to encode a string \$ x_1 x_2 x_3 \ldots x_n \$, where each \$ x_i \$ represents an symbol's integer code, the resultan...
stackexchange_codegolf
Background Sometimes, people think you didn't work at your git project. But - you can prove yourself with git shortlog -n. Now, the problem is you are a programmer and programmers are lazy. So you want to write a program which shows the person who committed at most. Rules You may not do the following things: use git s...
stackexchange_codegolf
You may remember in first or second grade using expanded form to learn about place value of numbers. It's easier to explain with an example, so consider the number 123. In expanded form it is represented as 100 + 20 + 3, which helps a young mind visualize place value. It is reminiscent of how you say it: one hundred (p...
stackexchange_codegolf
Your task is to print the following: I have a pen I have an apple Uh! Apple pen! I have a pen I have pineapple Uh! Pineapple pen! Apple pen... Pineapple pen... Uh! Pen Pineapple Apple Pen! Remember, this is code-golf, so the code with the smallest number of bytes wins. Leaderboards Here is a Stack Snippet to generat...
stackexchange_codegolf
I love sardines, I can't get enough of them, and so does my computer, the Omnilang 5000, which is language agnostic. To give my computer the joy of experiencing sardines, I've decided to feed him a number of programs that are capable of displaying on the screen tins of sardines in various orientations, and showing up t...
stackexchange_codegolf
No, not the ^^vv<><>BA kind of Easter eggs, real Easter eggs that we paint. Here is an (awfully drawn) egg. __ / \ / \ | | \____/ In easter, we paint them with patterns. Like these: __ /--\ /----\ |----| \____/ __ /%%\ /%%%%\ |%%%%| \____/ __ /~~\ /~~~~\ |~~~~| \____/ The challenge Given a chara...
stackexchange_codegolf
Though there is a prime factorization challenge and it's here, this, I feel, will be a bit more interesting than that one. To understand this, let's have an example; I will use 5,184 for this. \$5184 = 2^6 \times 3^4\$. However, for this challenge, such a factorization is insufficient - the reason is that 6 and 4 are c...
stackexchange_codegolf
You must write a program that takes an encrypted string and decrypt it according to specific rules and then print it out. Decryption will occur by performing two operations. Sample Input Argument 1 (the encrypted string) HGJILKBADCFE Operation 1: Swap the first half of the string with the second half, which should lea...
stackexchange_codegolf
This is a pretty run of the mill question. I will define a sequence and you golf some code to output a entry given a index. The first item in the sequence is 2. The nth item in the sequence is the smallest positive integer other than n and 1 sharing at least one factor with n (other than 1) that has not already appea...
stackexchange_codegolf
Introduction Long story short: a few days ago I accidentally started knitting a sock and the pretty logical structure of the plain stitches lead me to the idea: Why don't we just ASCII-knit a sock? Input The input is an even integer N in the range [2,30]. Output The output is a sock, obviously. Structure Because we wil...
stackexchange_codegolf
Your goal is to write a program that takes no input and outputs the following text: ca e na ŋa va o sa; þa ša ra la ła. ma a pa fa ga ta ča; în ja i da ða. ar ħo ên ôn ân uħo; carþ taŋ neŋ es nem. elo cenvos. But there's a catch: for each letter (any character whose general category in Unicode starts with L) in your s...
stackexchange_codegolf
The Rules Each submission must be a full program. The program must take input as two comma-separated dates in the form YYYY-MM-DD, and print the number of days that has passed since the second date to STDOUT as if today was the first date (if the second date would be in the future, output a negative number) plus an o...
stackexchange_codegolf
With a window similar to the one pictured below, you are given a list of strings, which you want to put in alphabetical order. As shown, you have five operations: Move up [U] - moves the selected string up one place Move down [D] - moves the selected string down one place Move first [F] - moves the selected string t...
stackexchange_codegolf
Introduction The \$n\$-ellipse is a generalization of the ellipse with possibly more than two foci. Specifically, given \$n\$ points on the plane, called foci, the \$n\$-ellipse is the set of points of the plane whose sum of distances to the \$n\$ foci is equal to a constant \$t\$. This challenge is about plotting the ...
stackexchange_codegolf
I know it's 1.5 weeks after Christmas but trying to print an isosceles triangle in a monospaced font makes it look weird. Challenge Print the alphabet from A to Z so that it forms a filled triangle in the output. For each line in the output, starting from "A", add the next letter. No inputs, only outputs. Pad the leadi...
stackexchange_codegolf
The main purpose of the RGB (Red Green Blue) color model is for the sensing, representation and display of images in electronic systems, such as televisions and computers HSL (Hue Saturation Lightness) is an alternative color model, designed in the 1970s by computer graphics researchers to more closely align with the ...
stackexchange_codegolf