instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Your task is to sort an array containing the strings "quarter", "dime", "nickel", and "penny" any number of times in no specific order and sort them so that they are in this order: quarter dime nickel penny (in other words, greatest to least monetary value).
Rules
Your program must take an array as input containing... | stackexchange_codegolf |
This idea is not mine, though I don't know where it originated. I once met it in a programming contest very long ago (1998, if I remember correctly). The task is to write a program in your favorite language that outputs 2012 and only 2012. The catch is that the program must still output 2012 after any one of its charac... | stackexchange_codegolf |
Tomorrow, November 23rd, is Thanksgiving Day in the United States. To prepare, you need to cook up some ASCII turkeys. However, since you're late in planning, you need a program (or function) to help you with how many birds you need to prepare.
.---. _
.' './ )
/ _ _/ /\
=(_____) (__/_/==
======... | stackexchange_codegolf |
Your task, if you wish to accept it, is to write a program that outputs a positive integer (higher than 0). The tricky part is that if I duplicate your source code, the output must be double the original integer.
Rules
You must build a full program. That is, your output has to be printed to STDOUT.
The initial source... | stackexchange_codegolf |
The title pretty much describes it all. Given as input a \$n \times m\$ matrix and an integer \$i\$ create a complete function/program that returns the matrix \$i\$ times clockwise rotated by \$90^\circ\$.
Rules:
as matrix you can use any convenient representation you like e.g. a list of lists etc...
matrix values can... | stackexchange_codegolf |
Imagine that there are \$n\$ different types of objects \$O_1,O_2,O_3,\ldots,O_n\$ and they each have a conversion factor \$k_1,k_2,k_3,\ldots,k_n\$. You can, for any \$1\le i\le n\$, convert \$k_i\$ amount of \$O_i\$ into \$1\$ of any other type of object.
Task
Your objective is to output all the possible ending confi... | stackexchange_codegolf |
Pyramid Scheme is a language being developed by @ConorO'Brien. In Pyramid Scheme, the code that you write looks like this:
^ ^
/ \ /3\
/ \ ---
/ + \
^-------^
/9\ /3\
/123\ ---
-----
Now, that code has two obvious qualities: It's difficult to parse, and it's difficult... | stackexchange_codegolf |
A staircase number is a positive integer x such that its nth digit (one indexed starting with the least significant digit) is equal to x % (n + 1). Thats a bit of a mouthful so lets look at an example. Take 7211311, if we take the modular residues of 7211311 on the range 2-8 we get the following:
7211311 % 2 = 1
7211... | stackexchange_codegolf |
Given a positive input \$n\$, output a random pair of primes whose difference is \$n\$. It's fine if there's another prime between them.
Every pair should possibly appear and the program should have zero possibility to fall into infinite loop.
It's promised that such pair exist, but not always infinite, so beware. You ... | stackexchange_codegolf |
Challenge
I think everyone of us heard of URL encoding mechanism - it's basically everywhere.
Given an URLEncoded string on stdin, decode it, and output the decoded form to stdout.
The encoding is very simple, + or %20 is representing space. Every percent followed by two hex digits (uppercase or lowercase) has to be re... | stackexchange_codegolf |
Introduction:
Beckett Grading Service (aka BGS), is a company which encapusulates and grades Trading Card Game (TCG) cards (i.e. sport cards, Magic The Gathering, Pokémon, Yu-Gi-Oh, etc. etc.). The TCG cards that come in for grading will be checked on four categories (which we will later refer to as subgrades): centeri... | stackexchange_codegolf |
Related: Read a crossword
Task
Given a completed Crossword puzzle, extract the words in it with their respective clue numbers, with "across" (horizontal) and "down" (vertical) words grouped and ordered like a real crossword puzzle.
The words are numbered in the row-major order of their first letters. If an "across" wor... | stackexchange_codegolf |
Intro
So I've been wasting my time again researching suffix sorting algorithms, evaluating new ideas by hand and in code. But I always struggle to remember the type of my suffixes! Can you tell me which type my suffixes are?
Left-most what?
A lot of suffix sorting algorithms (SAIS, KA, my own daware) group suffixes int... | stackexchange_codegolf |
Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible.
Wikipedia for more information
For example you can be given a max weight of 15 and objects with ... | stackexchange_codegolf |
Introduction
The Hausdorff distance measures the difference between two subsets of a metric space.
Intuitively, a metric space is just some set with a built-in distance function; in this challenge, we will use natural numbers with the ordinary distance d(a, b) := abs(a - b).
The Hausdorff distance between two non-empty... | stackexchange_codegolf |
Intro
The Tetris Guidelines specify what RNG is needed for the piece selection to be called a Tetris game, called the Random Generator.
Yes, that's the actual name ("Random Generator").
In essence, it acts like a bag without replacement: You can draw pieces out of the bag, but you cannot draw the same piece from the ba... | stackexchange_codegolf |
Program A outputs program B's code when run, and B outputs A's source.
Requirements:
Only one language across both programs
Programs are different. One program that outputs itself does not qualify.
Both programs are non-empty, or at least 1 byte in length. Trailing newlines in both source and output are ignored
st... | stackexchange_codegolf |
There are programs that will output its source code to standard output and do nothing else. They also access no external output. This type of program is known as a quine, and is a common code challenge.
There are poems that have the rhyme scheme a-b-a-b, c-d-c-d, e-f-e-f, g-g. They have 14 lines. They are usually recit... | stackexchange_codegolf |
Your challenge is simple: write as long of a pristine program as possible in the language of your choice using only unique bytes. (The full definition of a pristine program, copied from that link, is at the bottom of this question.)
That's right, no strings attached. Your code doesn't have to do anything at all, just r... | stackexchange_codegolf |
We've already got a meta-regex-golf problem as inspired by the xkcd comic
But, this regex golf looks fun, too! I want to distinguish between the states of the US and the regions of Italy. Why? I'm a citizen of both countries, and I always have trouble with this*.
The regions of Italy are
Abruzzo, Valle d'Aosta, Pug... | stackexchange_codegolf |
Piet is an interesting programming language for a number of reasons. Today we will focus on one reason: the roll command. The roll command was originally from PostScript and is a powerful way to manipulate the stack.
The roll command pops the top two elements of the stack and uses them as parameters. We'll call the fir... | stackexchange_codegolf |
Background
Complex floor is a domain extension of the mathematical floor function for complex numbers. This is used in some APL languages to implement floor ⌊, ceiling ⌈, residue |, GCD ∨, and LCM ∧ on complex numbers.
For the rest of this challenge, an integer refers to a Gaussian integer, i.e. a complex number whose ... | stackexchange_codegolf |
Challenge:
Create a program that takes input of a positive non-zero integer and outputs the 4 next numbers in the sequence described below.
Note: Checking if the input is actually a positive non-zero integer is not necessary
Sequence:
Every number in this sequence (apart from the first, which is the input) shall be com... | stackexchange_codegolf |
I noticed that it seems nobody has posted a non-ASCII (related) USA flag challenge yet, so what better time than the 4th of July?
The Challenge
Draw the current (as of 2022) flag of the United States of America.
Here is the flag:
Specifications
Hoist (height) of the flag: A = 1.0
Fly (width) of the flag: B = 1.9
Hoi... | stackexchange_codegolf |
Inspired by this Stack Overflow question.
The challenge
Input
An array of square matrices containing non-negative integers.
Output
A square matrix built from the input matrices as follows.
Let \$N \times N\$ be the size of each input matrix, and \$P\$ the number of input matrices.
For clarity, consider the following ex... | 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 |
The purpose of this challenge is to solve the original first Project Euler problem, but as the title suggests in constant time (with respect to the size of the interval).
Find the sum of all the multiples from a list of numbers in some defined range, in such a way that the running time of your program runs in constant... | 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 |
We do seem to have a fastest square root challenge, but it's very restrictive. In this challenge, your program (or function) will be given an arbitrarily sized nonnegative integer, which is the square of an integer.
Input
You may take input in any normally allowed way, including (but not limited to) an arbitrary sized ... | stackexchange_codegolf |
Sandbox
Inspired by a Codingame challenge I tried (and failed at) about a month ago.
Given a binary tree of words, say:
HELLO
/ \
WORLD EATING
/ / \
ARCH IDAHO GUARD
/
DOOZY
/
... | stackexchange_codegolf |
In this challenge, your past self comes back to help or hurt someone else!
The task is simple: write a full program, not a function, that prints the first code submission on this site submitted by the previous user, in the language of your first answer. (In the case that your first answer was purely prose, for example ... | stackexchange_codegolf |
Powerful numbers are positive integers such that, when expressed as a prime factorisation:
$$a = p_1^{e_1} \times p_2^{e_2} \times p_3^{e_3} \cdots \times p_k^{e_k}$$
all exponents \$e_1, e_2, ...\$ are greater than or equal to \$2\$. Note that the exponents do not include zero exponents, as exampled by \$200 = 2^3 \ti... | stackexchange_codegolf |
The 3Blue1Brown Youtube channel released a video a year ago called "Why do colliding blocks compute pi?" which describes a model where a block A of mass \$a\$ slides into a block B of mass \$b\$, which then pushes block B into a wall, causing it to bounce off the wall and then collide again with block A.
The miracle of... | stackexchange_codegolf |
Risky is a new language of mine, which features an interesting form of tacit programming. In this challenge, you'll take a Risky program as input, and visualize the parsing.
No knowledge of Risky is needed for this challenge, but it's a pretty interesting language so I'd recommend trying it :p.
Task
Risky's parsing is ... | stackexchange_codegolf |
Given a square string, produce all the output for the string at every stage of unfurling.
The string must unfurl in a clockwise direction one quarter turn at a time.
Examples
Input:
A
Output:
A
Note: I'll also accept the input duplicated for this particular test case only if this helps reduce your byte count.
Input:
... | stackexchange_codegolf |
Input
A single positive integer \$ 10 \geq n \geq 2\$
Output
A list of strings, each of length \$2n\$, satisfying the following properties.
Each string will contain each of the first \$n\$ lowercase letters of the alphabet exactly twice.
No letter can occur twice consecutively. That is abbcac is not allowed.
No two st... | stackexchange_codegolf |
Older cellphones have 3 or 4 characters mapped to each number from 2-9 and that number must be pressed a certain number of times to get the required character. Let's assume our cellphone has this map:
1:1
2:abcABC2
3:defDEF3
4:ghiGHI4
5:jklJKL5
6:mnoMNO6
7:pqrsPQRS7
8:tuvTUV8
9:wxyzWXYZ9
0:<space><newline>0
If you wan... | stackexchange_codegolf |
The Challenge
Create an terminating expression in SKI Combinator Calculus in less than 200 combinators (S, K, I) that reduces to the expression with the most combinators.
There will be no limit on how many parenthesis/applications can be used.
SKI
SKI expressions are created using S, K, I and parenthesis. They are redu... | 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 |
Introduction
Sometimes, my boxes are too small to fit anything in it. I need you to make a box expander! So, what makes a box a box in this challenge.
OOOO
O O
O O
O O
OOOO
The corners of the box are always spaces. The box itself can be made out of the same character. That character can be any printable ASC... | stackexchange_codegolf |
In preparation for the AP Computer Science AP Test (Java), our teacher has been giving us FRQs from previous years for practice.
My friend and I were golfing this during class today and got it as short as we could, but I'd like to see if there are any shorter solutions any of you can come up with.
Rules:
You must use ... | stackexchange_codegolf |
Paul is one of your Belgian acquaintances, and he would like you to create a program that outputs at least one of the following five strings:
12496=>14288=>15472=>14536=>14264
14264=>12496=>14288=>15472=>14536
14536=>14264=>12496=>14288=>15472
15472=>14536=>14264=>12496=>14288
14288=>15472=>14536=>14264=>12496
It ... | stackexchange_codegolf |
We know that not all fractions have a terminating binary representation. However every fraction can be written as a leading portion followed by a repeating portion. For example \$1/3\$ starts with \$0.\$ and then just repeats \$01\$ endlessly. This corresponds to the bar notation taught in primary school. For examp... | stackexchange_codegolf |
Introduction:
Every workday I read the newspaper in the morning while eating breakfast, and also do some of the puzzles at the back. When I do the word-search puzzles, I (almost) always go over the words in order, and strike them through one by one. The word-searches in the newspaper have two columns of words, and afte... | 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 |
Background
Match Land is a mobile game that falls into the Match-3 genre (think Bejeweled or Candy Crush Saga series): swap two orthogonally adjacent pieces to make a 3-in-a-row or longer. However, Match Land has an additional rule that makes the game much more interesting.
Once you make a valid match-3 move, the match... | stackexchange_codegolf |
Challenge
Given a valid goo.gl shortened link, output the original URL.
Example
goo.gl/qIwi3N would give something like https://codegolf.stackexchange.com/. For input, you can choose to have the https?:// at the beginning, you can choose to have www. before the goo.gl, and you can also choose to get rid of the goo.gl i... | stackexchange_codegolf |
Anyone remember these things?
Your challenge today is to make the shortest program that involves your pet growing into 1 of at least 7 different creatures.
Your creature will grow into different forms depending on a random percentage from an RNG and the name you give it (from STDIN or equivalent for your language) a... | stackexchange_codegolf |
Introduction
In this challenge your task is to generate the ISBN-10 code for books given its ISBN-13 code, assuming that such a code exists. Such an ISBN-13 code consists of several parts separated by -:
978-GG-PPPP-TTT-C
The letters G (group), P (publisher), T (title) and C (checksum) all stand for one digit. For the... | stackexchange_codegolf |
Here is a simple challenge for you: You must produce this ASCII representation of a chess board. White is represented by uppercase characters, and black is represented by lowercase. Empty tiles are represented by a .. Here is the full board:
rnbqkbnr
pppppppp
........
........
........
........
PPPPPPPP
RNBQKBNR
Since... | stackexchange_codegolf |
Robbers' Challenge
Read the cops' challenge first.
In this cops-and-robbers challenge, you (the robbers) must find the correct string of characters, which, when added into the cop's code, will make it produce the correct (case-sensitive) output (except that there may also be an extra trailing newline at the end).
The n... | stackexchange_codegolf |
Here is a fairly simple ASCII depiction of an open book:
|\
| \
| \
| \
| \__________
| || |
| || Lorem i |
\ || psum do |
\ || lor sit |
\ || amet, |
\ || consect |
\||_________|
Notice that the text portion is only on the right page and is 7 characters wide by 5 tall. Also notic... | stackexchange_codegolf |
Description
a typeracer is an apps where user could type and evaluate their typing speed and accuracy.
Criteria
User could type "A quick brown fox jumps over the lazy dog."
A visual indicator of each wrong character typed.
A visual indicator of what characters to type.
A visual indicator of what has been typed
A visua... | stackexchange_codegolf |
Introduction
Congratulations! You've been selected to do research a a newly discovered animal called a fuzzy, a docile, simple creature that strongly resembles a cotton ball. Fuzzies love to be near other fuzzies, but not all fuzzies want to be near each other.
There are 6 types of fuzzies, 1a, 1b, 2a, 2b, 3a, and 3b. ... | stackexchange_codegolf |
Just because the reverse and palindrome were not too challenging individually :)
Write a program (full program or function) that satisfies the following: given a string input,
the program as-is outputs the input string unchanged.
the program reversed outputs the input string reversed.
the program palindromized outputs... | stackexchange_codegolf |
In this challenge, you will write an interpreter for 2Ω (transcribed as TwoMega), a language based loosely on brainfuck with an infinite-dimensional storage space.
The Language
2Ω contains three pieces of state:
The Tape, which is an infinite list of bits, all initialized to 0. It has a leftmost element, but no rightm... | stackexchange_codegolf |
Github
You have probably played, and may even have written a program to play, a simple number guessing game. If so, this probably looks familiar:
Try to guess my number (1 to 100)!
Please enter a guess: 50
Too small, guess again!
Please enter a guess: 75
Too big, guess again!
Please enter a guess: 63
Correct!
(Obvious... | stackexchange_codegolf |
Write a function or program that accepts a date (as a string in YYYY-MM-DD format) as input and returns a truthy value if that date is "alphabetical," and a falsey value if it isn't.
An alphabetical date is a date whose month, day and year are in alphabetical order when expressed as a string (and when considered speci... | stackexchange_codegolf |
Jarl Olaf lives in a beautiful village, Stackholm. In every year he is thinking about raiding a place to get some golden jewelery, food and programmers woman slaves.
He is a good person but not the brightest one, so you need to help him decide the next target. He has three targets in his mind: Jarl Burg, England and Pa... | stackexchange_codegolf |
Background
Peter's Father, the Teacher of a dance-club, asks Peter a question:
Given are two natural numbers (\$\mathbb{N}\$ \$x\$ and \$y\$).
\$x\$ is the number of the garment types (e.g. shorts, shirts\$\dots\$) we have
\$y\$ is number of colors (e.g. green, blue, \$\dots\$) of each garment we have.
In the dance cla... | stackexchange_codegolf |
You are an explorer, mapping an unknown world. Your ship is carried on the wind. Where it goes, who knows?
Each day, in your spyglass, you see features to the north, south, east and west. You always see four such features, corresponding to the cardinal directions. Your spyglass reports ASCII symbols like this:
~~.*, ~... | stackexchange_codegolf |
Related: Sort these bond ratings
Credit rating agencies assign ratings to bonds according to the credit-worthiness of the issuer.
The rating business is mostly controlled by "Big Three" credit rating agencies (i.e. Fitch Ratings, Moody's, and Standard & Poor's (S&P)), which use a similar tiered rating system.
Task
For ... | stackexchange_codegolf |
Although there was a prime factors challenge posted ten years ago, it has tedious I/O and restricted time. In this challenge, your task is to write a program or function which takes an integer \$n \ge 2\$ as input, and returns its prime factors.
Task:
Input will consist of an integer, \$n \ge 2\$. Your program should t... | stackexchange_codegolf |
Challenge:
Given a 2D array (8x8) of characters, is the enemy king in check?
The program should return true if and only if the king is currently in check.
Standard chess rules apply.
Specifications:
The game is provided using a 2D array,
where blank space means there is not a piece on that square.
You may assume that t... | stackexchange_codegolf |
Welcome to your first day at PPCG Inc. As our newest junior assistant document sorter, you are responsible for making sure all documents we sent down to you are archived in alphabetical order. It's so easy a monkey can do it. Well, metaphorically speaking, as we did hire a monkey to do it. Guess what? Turns out monkeys... | stackexchange_codegolf |
Background
The Sidi polynomial of degree \$n\$ – or the \$(n + 1)\$th Sidi polynomial – is defined as follows.
$$S_n(x) = \sum^n_{k=0}s_{n;k}x^n \text{ where } s_{n;k} = (-1)^k\binom n k (k+1)^n$$
The Sidi polynomials have several interesting properties, but so do their coefficients. The latter form OEIS sequence A0755... | stackexchange_codegolf |
Your program should take as input a number n that is greater than 0 and output a bar composed of n // 8 ▉ characters (U+2588), as well as a final character which should be one of ▉ ▊ ▋ ▌ ▍ ▎▏(U+2589 to U+258F) representing n % 8. If n % 8 is 0, your program should not output any additional characters. This is difficult... | stackexchange_codegolf |
Convert a classical directory structure like this:
config.yml
drafts
begin-with-the-crazy-ideas.textile
on-simplicity-in-technology.markdown
includes
footer.html
header.html
Into this
.
├── config.yml
├── drafts
| ├── begin-with-the-crazy-ideas.textile
| └── on-simplicity-in-technology.markdown
└──... | stackexchange_codegolf |
Introduction
Write a solver for integer linear programming.
Challenge
Your task is write a solver for integer linear programming (ILP). In ILP, linear inequalities of a set of unknowns (all of which are integers) are given, and the goal is to find the minimum or maximum of a linear function.
For example, for the inequa... | stackexchange_codegolf |
Your task is to write a piece of code that zeros the current cell in the Brainfuck variant that, each cell can contain a signed integer of arbitrarily large magnitude, instead of the normal 0 to 255.
You may assume there are l cells to the left and r cells to the right of the current cell that are initially zero. You p... | stackexchange_codegolf |
You want to find the length shortest path between two points, on an 2d ASCII "map". The roads are made up of + characters, and the two endpoints are represented by #s (not counted in the length). This road can be arranged in any way, and any other characters can be ignored. You can assume the endpoints will always conn... | stackexchange_codegolf |
In the tabletop RPG named Pathfinder, there is a feat that characters can take called Sacred Geometry, which allows a character who has it to buff their spells in exchange for doing some math: to use it, the character rolls a number of six-sided dice equal to their ranks in a particular skill, consults a table based on... | stackexchange_codegolf |
As in this challenge, the task is to generate the vertices of a polyhedron. The polyhedron here is the one obtained by dividing a regular icosahedron's triangular faces into smaller triangles so that each edge is divided into \$b\$ segments (denoted \$\{3,5+\}_{b,0}\$ here) and projecting onto the unit sphere. Your pro... | stackexchange_codegolf |
The specification of the "estimated" sign used by the European Union Directive (U+212e in Unicode, which you may not simply print for this challenge) is quite precise.
To copy some restrictions from this question: Render the symbol to file or screen using vector or raster graphics. If your output is rasterised, your i... | stackexchange_codegolf |
The SAS programming language is a clunky, archaic language dating back to 1966 that's still in use today. The original compiler was written in PL/I, and indeed much of the syntax derives from PL/I. SAS also has a preprocessor macro language which derives from that of PL/I as well. In this challenge, you'll be interpret... | stackexchange_codegolf |
Introduction
In Tennis, the server alternates serving on the left side or the right side of the court every point, starting on the right. It is possible to figure out which side to serve on for that point just based on the score; if there have been an even number of points you serve on the right, and after an odd numbe... | stackexchange_codegolf |
The Penrose triangle, also known as the Penrose tribar, or the impossible tribar, is an impossible object.
The goal in this challenge is to display a Penrose triangle in the fewest bytes possible.
Source: Wikipedia
Rules:
You must display the Penrose Triangle digitally after generating it.
They must look the same as ... | stackexchange_codegolf |
Your program must print out this exact sequence:
1
2
4
10
24
54
116
242
496
1006
2028
4074
8168
16358
32740
65506
131040
262110
NOPE!
As usual, shortest program wins. Standard code golf rules apply.
| stackexchange_codegolf |
Inspired by this code review question, I am curious to see what happens if we turn that into a code-golf challenge!
The description is easy, the input is an array or any similar data structure with only unsigned integers, the output is a boolean if the number of odd numbers is equal to the number of even numbers inside... | stackexchange_codegolf |
Introduction
A quine is a program that outputs its own source code. For example, a well-known Python quine is _='_=%r;print(end=_%%_)';print(end=_%_). Running it outputs _='_=%r;print(end=_%%_)';print(end=_%_), therefore it is a valid quine. An error quine is similar to a regular quine, however it must output to STDERR... | stackexchange_codegolf |
Your task is to implement a Tetris strategy balanced in terms of score vs code size.
In this version of the game tetrominoes are rotated and dropped from above into a grid of 20 rows and 10 columns. While falling, they cannot be rotated or moved horizontally. As usual, a dropped piece stops when it reaches the bottom o... | stackexchange_codegolf |
Your task is to write a program/function to scale up an image (list of strings) by a factor of n.
Specs
You will receive two inputs: an image, and a positive integer.
The image will only contain ASCII printable characters (U+0020-U+007F).
Scoring
This is code-golf. Shortest solution in bytes wins.
Testcases
Testcase ... | stackexchange_codegolf |
IUPAC in their insufferable wisdom have created a systematic element name for any newly created element. This is the temporary name of an element until they finally make up their minds about an actual name. It works like so: each digit of an element number is assigned a prefix based on its value. The prefixes are conca... | 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 |
So, like the title says, today you are going to guess my password (sort of). You need to make a big long list of every possible password I might be using on my 4 digit online vault.
Specifications:
It could contain any 26 letters of the alphabet in UPPER CASE.
It could contain any numbers 0-9.
So, basically, each di... | stackexchange_codegolf |
Drunkard's Journey Home
In this challenge you are to write a program which simulates a drunkard stumbling his way home from the bar.
Input:
The input will be an adjacency matrix (representing a directed graph) which represents paths the drunkard can take. At each location, the drunkard will choose one path at random (E... | stackexchange_codegolf |
Write a program with the following properties:
When run as-is, the program produces no output (i.e. 0 bytes of output).
There is a location within the program (of your choice: it could be at the start, end, or somewhere in the middle) with the following property: modifying the program via placing any string there will... | stackexchange_codegolf |
Challenge (Easy)
Write a function which takes an argument and returns the number of non-alphanumeric characters found.
Challenge (Hard)
Write a function which takes an argument and returns the number of bytes used to store the number of non-alphanumeric characters found. (ie: include calculation for multi-byte char... | stackexchange_codegolf |
Note: This challenge has nothing to do with actual assembly language.
As the head of Code-Golf Factory Inc., you must create an assembly line to generate a specific piece of code. Today, the foreman has asked you to produce quines.
Specification:
In this challenge, the goal is to write a quine such that a proper subse... | stackexchange_codegolf |
This challenge has been divided into parts.
Your goal is to convert a sentence into a form of 'short-hand'
For Part 1 these are the rules
Take in 1 word
Remove all vowels(a,e,i,o,u), except the ones at the beginning and the end
If a letter is repeated more than once consecutively, reduce it to only one (e.g. Hello -> ... | stackexchange_codegolf |
Introduction
Eisenstein integers are complex numbers of the form
a+bω
Where a,b are integers, and
ω = e^(2πi/3)
The Eisenstein integers form a triangular lattice in the complex plane:
We say that an Eisenstein integer z=a+bω is prime if it cannot be written as the product of two non-unit (not 1,-1,ω,-ω,ω^2, or -ω^2) ... | stackexchange_codegolf |
You're sick of other players smugly announcing "BINGO" and walking triumphantly past you to claim their prize. This time it will be different. You bribed the caller to give you the BINGO calls ahead of time, in the order they will be called. Now you just need to create a BINGO board that will win as early as possible f... | stackexchange_codegolf |
Given a sorted list of unique positive floats (none of which are integers) such as:
[0.1, 0.2, 1.4, 2.3, 2.4, 2.5, 3.2]
Evenly spread out the values that fall between two consecutive integers. So in this case you would get:
[0.333, 0.666, 1.5, 2.25, 2.5, 2.75, 3.5]
(I have truncated the values 1/3 and 2/3 for ease of... | stackexchange_codegolf |
Task
Given a square array of 0s and 1s, determine whether or not there exists a path of 1s connecting the leftmost and rightmost columns. A path can take steps of one unit up, down, left or right, but not diagonally. Every symbol on the path must be a 1, and it must start somewhere in the first column and end somewhe... | stackexchange_codegolf |
Challenge
Write code that outputs TeX (LaTeX) math-equation code (given below) that will typeset Sierpinski Triangle Fractal of 5 levels. Shortest code wins.
Details
TeX (and friends like LaTeX, etc.) is a sophisticated typesetting system. It can render arbitrary nested complex expressions for mathematical formulas. Co... | stackexchange_codegolf |
I'm surprised this hasn't been posted before!
The Consistent Overhead Byte Stuffing (COBS) algorithm is used to delimit byte streams.
We choose a frame marker (we'll use 0x00) and wherever 0x00 occurs in the stream it is replaced with the number of bytes until the next 0x00 occurs (we'll call this a milestone). This re... | stackexchange_codegolf |
Given an \$n \times n\$ matrix of integers, The task is to find the optimal dividing line that maximizes the sum of the integers on the same side as the top left corner. The dividing line should be connected and made up of only vertical and horizontal lines. For an example with a non-optimal dividing line:
[[ 3, 0,... | stackexchange_codegolf |
Ouput the following banner:
_____ _ _____ _ __
/ ____| | | / ____| | |/ _|
| | ___ __| | ___ | | __ ___ | | |_
| | / _ \ / _` |/ _ \ | | |_ |/ _ \| | _|
| |___| (_) | (_| | __/ | |__| | (_) | | |
\_____\___/ \__,_|\___| \_____|\___/|_|_|
The code ... | stackexchange_codegolf |
You may have heard of the "Hacker Logo", also called the "Hacker Emblem". It looks like this:
This is a pattern from a mathematical simulation called the Game of Life. The glider is the simplest Life pattern that moves, and the most instantly recognizable of all Life patterns.
The challenge
The challenge is pretty sim... | stackexchange_codegolf |
The Challenge
Convert a phrase of two words to reverse style: candy bar -> bar le candy.
Specifications
There will be one word (only a-zA-Z0-9 + -), a space (), and then another word.
For equal length, score is used to determine winner.
Test cases:
candy bar -> bar le candy
code golf -> golf le code
programming puz... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.