instruction stringlengths 34 53.1k |
|---|
As a little kid, I liked to play with these toys a lot:
They probably intended for these to be used for art, but I always used them for math! Fractals, patterns, etc. One time, I was given this challenge:
Build a triangle without using any of the green triangle tiles.
This challenge stumped me for the longest time, ... |
Every number can be represented using an infinitely long remainder sequence. For example, if we take the number 7, and perform 7mod2, then 7mod3, then 7mod4, and so on, we get 1,1,3,2,1,0,7,7,7,7,.....
However, we need the shortest possible remainder subsequence that can still be used to distinguish it from all lower ... |
My Python 3 function golf(...) should take a list of lists of lists of strings representing a solid cube and return whether there are any places in which two equal strings are directly next to each other on the x, y or z axis (not diagonally).
If there are no adjacent duplicates, True shall be returned, else False.
T... |
I'd like to start a series of challenges for http://box-256.com/ starting with the first challenge, “BIG SQUARE II”. After this one I'll add another for "CHECKERBOARD" and so on.
Rules:
Complete the BIG SQAURE II challenge in the Box-256 emulator (either on the website or download the program if you run Windows)
Post... |
In-between fractions
The challenge:
You will need to create code that takes atleast 3 inputs; 2 integers and "a fraction representation" - whichever type suits your language for representing the fraction increments) ie. If you choose string the input would be "1/4" or you could choose 2 extra integer inputs or a tuple ... |
The Challenge
It's quite simple really, sort a list of numbers.
Details
You must sort a list of numbers in ascending order, without using any built-in sorting functions/libraries/etc (i.e. list.sort() in Python).
Input/output can be done in any method you choose, as long as it is human readable.
Standard loopholes ar... |
In the C programming language, arrays are defined like this:
int foo[] = {4, 8, 15, 16, 23, 42}; //Foo implicitly has a size of 6
The size of the array is inferred from the initializing elements, which in this case is 6. You can also write a C array this way, explicitly sizing it then defining each element in ord... |
Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise.
0, 1, and 8 have rotational symmetry. 6 becomes 9 and vice versa.
Sequence of numbers producing truthy results: OEIS A000787
0, 1, 8, 11, 69, 88, 96, 101, 111, 181, 609, 619, 689, 808, 818, 888, 906, 916, 98... |
A substitution cipher is an encoding method where each letter in the alphabet is replaced with a fixed, different one; for example, given the following substitution map:
abcdefghijklmnopqrstuvwxyz
||
qwertyuiopasdfghjklzxcvbnm
The phrase "we all love cryptography" would be encoded as "vt qss sgct eknhzgukq... |
Given consecutive side lengths s1, s2, s3... s_n of an n-gon inscribed in a circle, find its area. You may assume that the polygon exists. In addition, the polygon will be convex and not self-intersecting, which is enough to guarantee uniqueness. Built-ins that specifically solve this challenge, as well as built-in fun... |
Explanation
Befunge is a two-dimensional program that uses stacks.
That means, to do 5 + 6, you write 56+, meaning:
56+
5 push 5 into stack
6 push 6 into stack
+ pop the first two items in the stack and add them up, and push the result into stack
(to those of you who do not know stacks, "push" just means add ... |
Your task is to convert a given positive integer from Arabic numeral to Roman numeral.
Things get difficult when you count to 4000.
The romans did this by adding a line above a symbol to multiply that symbol by 1 000. However, overlines aren't exactly displayable in ASCII. Also, there are double overlines to multiply a... |
Given the input tilesX and tilesY create a method that would make a rectangular ring from the tiles.
The function must order the tiles in a ring like this:
tilesX and tilesY are always positive integer values, cannot be 0
tilesX and tilesY are not always equal, expect values like: 2x5, 6x3 etc.
Checking for invalid i... |
I recently got a really weird irregular chess board. It's squares are all over the place and not even all connected. At least they're still laid out on a regular grid. I want to adapt the chess rules to be able to play on the board, but to start with, I need a piece that can actually go anywhere on the board, and it se... |
For the non-zero digits on a standard numpad
789
456
123
consider placing a chess knight at any digit and moving it around with any number of normal L-shaped jumps, tracing out a positive decimal integer. What positive integers can be expressed in such a way?
One of them is 38, since the knight could start on the 3 an... |
Tangentially inspired by the opening to the What-If book.
The input is a rectangle of spaces as a string, list of string, etc., with objects made of #'s inside:
########
# #
########
### ####
### ####
###
The objects will always be non-intersectin... |
There is fairly strong support on meta for challenge-writing questions to be on topic on main, provided these questions are specific and answerable. However, we don't have any such questions yet, so I figured I'd test the waters. This question is probably entering good subjective, bad subjective territory, but I think... |
Today is Tax Day!
Oops.
Well, today is tax day if you are a resident of Maine or Massachusetts.
So you're probably still completing your return and need a calculator for when you get to Line 44.
Given an input of taxable income (US$, accurate to 2 decimal places) and a string representing filing status, output the amou... |
Given a set of vectors all of the same positive finite dimension, output a falsey value if they are linearly dependent and a truthy value if they are linearly independent. A set of vectors v1, v2, ... is linearly dependent if for some scalars a1, a2, ... not all equal to 0, a1v1 + a2v2 + ... = 0. (0 is the zero vector... |
Pre-Note
Because of popular demand, and to avoid disqualifying certain languages, the dictionary can now be provided as input parameter.
Intro
Given a dictionary of words, you should write an autocomplete program or function.
Autocompletion
"Autocomplete, or word completion, is a feature in which an application predict... |
For the last day of the semester, I decided to have some fun with my students and I showed them Code Golf... poor guys, they're addicted now.
The goal was to compete against the other students to solve those problems with what would be very usual rules for you. They had to use C# (because it's the language they are lea... |
Mancala is the name of a family of board games that usually involve a series of cups filled with beads that the players manipulate. This challenge will use a specific rule set for a solitaire variant of the game.
The board consists of a "basket" at one end, followed by an infinite number of cups, numbered starting from... |
Write a program or function to output the sum of the odd square numbers (OEIS #A016754) less than an input n.
The first 44 numbers in the sequence are:
1, 9, 25, 49, 81, 121, 169, 225, 289, 361, 441, 529, 625, 729, 841, 961, 1089,
1225, 1369, 1521, 1681, 1849, 2025, 2209, 2401, 2601, 2809, 3025, 3249, 3481,
3721, 396... |
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... |
EDIT It is not clear how answers to the question of compressing a long text, without cumulative properties are relevant to golfing a short cumulative strong, any more than general Lempel Ziv techniques are relevant to code-golfing. Take note that the complexity of 99 bottles of beer is not O(Sqrt(n))
Knuth suggested t... |
Driftsort is a simple way to "sort" an array. It works by "sliding" or "rotating" the elements over in the array until the array is sorted, or until the array fails to be sorted.
Let's walk through two examples. First, consider the array [10, 2, 3, 4, 7]. Since the array is not sorted, we rotate it once. (This can happ... |
PARI/GP is a free computer algebra system. It is designed for (algebraic) number theory, not golfing, but that's part of the attraction. Unsurprisingly, it fares best at mathematical tasks; its support for string manipulation is primitive. (Having said that, advice for golfing non-mathematical tasks is also welcome.)
A... |
Write a regex which matches any valid sudoku solution and doesn't match any invalid sudoku solution. The input is an unrolled version of the sudoku, i.e. there are no line delimiters. E.g. the following board:
7 2 5 8 9 3 4 6 1
8 4 1 6 5 7 3 9 2
3 9 6 1 4 2 7 5 8
4 7 3 5 1 6 8 2 9
1 6 8 4 2 9 5 3 7
9 5 2 3 7 8 1 4 6
2 ... |
Introduction
You must create a function to convert Arabic numerals into Greek numerals. The input will be an integer less than 1000 and more than 0.
Algorithm
Split number into digits (e.g. 123 -> 1, 2, 3)
Take each digit, and change to character found in table below, for letter symbol or letter name, (e.g. 123 -> 1,... |
Gravity Guy is a game where the only user input is a single key that flips the direction of gravity. Given an ASCII art level, determine if it is possible for Gravity Guy to reach the end.
Rules
The initial direction of gravity is down.
The first column of the input will always contain only one #, which Gravity Guy s... |
Write a function to convert CamelCased text to snake_case: FunctionForHTMLManipulation becomes function_for_html_manipulation
The input text will be a single suitable identifier in many languages. It must start with an English letter, then be followed by any number of English letters or digits. No other characters (spa... |
A person has to complete N units of work; the nature of work is the same.
In order to get the hang of the work, he completes only one unit of work in the first day.
He wishes to celebrate the completion of work, so he decides to complete one unit of work in the last day.
He is only allowed to complete x, x+1 or x-1 uni... |
Introduction
You must create a function to convert Greek numerals into Arabic numerals. The input will be a Greek numeral less than 1000 and more than 0. This is the reverse of my previous challenge.
Algorithm
Split input into letters (e.g. ΡΚΓ -> Ρ, Κ, Γ)
Take each letter, and change to character found in table below... |
There is an N x N square of numbers.
All columns increase strictly monotonically from top to down
All rows increase strictly monotonically from left to right
There is exactly one valid answer for each input.
You are given 2N-1 rows of N numbers representing rows or columns in this square. The task is to find the row ... |
In mountaineering terminology, a "14er" is any mountain with an elevation of 14 000 feet or more. However, there is another distinction. For a peak to count as a 14er, it must also have a "geographic prominence" of 300 or more feet. This means that to move from one 14er to another, you must first descend at least 300 f... |
Programming Puzzles and Code Golf has graduated from beta. Soon we will get a custom site design, and with that the reputation boundaries for privileges will go up. A lot of users will lose privileges on the site. So your task is to write a program that tells us how much extra reputation we'll need to keep our privileg... |
Introduction
You are sitting with your coworker, having lunch, and bragging to him/her about the latest and supposedly greatest project you've been working on. Getting sick and tired of your constant showcase of egoism, he/she gives you a challenge just so you'll shut up. Being the egoistic and happy-go-lucky person yo... |
In chess, Forsyth-Edwards Notation, more commonly called "FEN", is a textual way of transcribing boards. It describes each of the board's eight rows (called "ranks" in chess) from top to bottom from White's perspective. The pieces are written as K (king), Q (queen), R (rook), B (bishop), N (knight), and P (pawn). Black... |
Given two polynomials f,g of arbitrary degree over the integers, your program/function should evaluate the first polynomial in the second polynomial. f(g(x)) (a.k.a. the composition (fog)(x) of the two polynomials)
Details
Builtins are allowed. You can assume any reasonable formatting as input/output, but the input and... |
While the binomial coefficient are the coefficients of \$(1+x)^n\$, m-nomial coefficients are the coefficients of \$(1+x+x^2+...+x^{m-1})^n\$.
For example, \$m(3,5,6)\$ is the coefficient of \$x^6\$ in the expansion of \$(1+x+x^2)^5\$.
Write a program/function that takes 3 numbers as input and outputs the corresponding... |
Continuation of this challenge because the author is gone and the question is closed.
What you need to do is create a Boolean parser.
Boolean expressions, in case you haven't heard of them yet, have two inputs and one output.
There are four "gates" in boolean arithmetic, namely:
OR (represented by |) (binary operato... |
Given a list of integers, output the number of permutations of the integers, with indistinguishable permutations counted once. If there are n integers, and each group of indistinguishable numbers has length n_i, this is n! / (n_1! * n_2! * ...)
Rules
Input will be some form of list as arguments to a function or the pr... |
Problem
Create a function that can determine whether or not an arbitrary DNA string is a Watson-Crick palindrome. The function will take a DNA string and output a true value if the string is a Watson-Crick palindrome and a false value if it is not. (True and False can also be represented as 1 and 0, respectively.)
The... |
Taylor series are a very useful tool in calculating values of analytic functions that cannot be expressed in terms of elementary functions, using only information about that function at a single point.
In this challenge, you won't be actually doing any math with them, but merely making string representations of taylor ... |
Introduction
It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive.
This is not the same thing. That one is a (closed) not well-explained challenge.
This is not the same thing. That one is about counting up indefinitely.
Challenge
Write a program or function that prints every intege... |
Jolf is a procedural golfing language made by @CᴏɴᴏʀO'Bʀɪᴇɴ.
What tips do you have for golfing in Jolf?
Please post one tip per answer.
These tips should be at least somewhat specific to Jolf, e.g. remove comments is an answer, but not a very good one.
|
Write a program or function that estimates the Shannon entropy of a given string.
If a string has n characters, d distinct characters, xi is the i th distinct character, and P(xi) is the probability of that character occuring in the string, then our Shannon entropy estimate for that string is given by:
For the estimat... |
Input
Your input is a list of single-digit numbers in any reasonable format, including a string of digits.
The input will not be empty.
Output
Your output shall be the input list, but with each maximal run of nonzero digits being reversed.
Example
Consider the input
95883007414830
<---> <---->
where the nonzero runs ... |
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... |
Write a single line program two or more characters long that contains no line terminators and takes no input. For example, your program might be:
MyProgram
When your program is arranged into the shapes a clock's hands make at 12, 3, 6, and 9 o'clock, it needs to output the corresponding hour number. No other times nee... |
It is well-known that there are one-to-one correspondences between pairs of integers and the positive integers. Your task is to write code defining such a correspondence (by defining a pair of functions/programs that are inverses of each other) in your programming language of choice, plus a correctness check (see below... |
In the examples below, A and B will be 2-by-2 matrices, and the matrices are one-indexed.
A Kronecker product has the following properties:
A⊗B = A(1,1)*B A(1,2)*B
A(2,1)*B A(2,2)*B
= A(1,1)*B(1,1) A(1,1)*B(1,2) A(1,2)*B(1,1) A(1,2)*B(1,2)
A(1,1)*B(2,1) A(1,1)*B(2,2) A(1,2)*B(2,1)... |
Write a program or function where a matrix A (maximum value of dimensions of the matrix is 100) is transformed to a new matrix B. Each element of the new matrix B is the sum of the positive neighbors of the corresponding element of the matrix A.
Only neighbors in the four orthogonal directions are considered, and the e... |
We already have a base conversion question, but not one with negative bases (nope, this doesn't count).
(Corresponding wiki article.)
You will receive a number (may be negative) and a base (must be negative), and your task is to convert the number into the base.
The base will only be from -10 to -2.
Specs
You may rece... |
Your challenge, should you choose to accept it, is simple:
Implement RFC 862, also known as the Echo Protocol:
The Echo protocol
An echo service simply sends back to the originating source any data it receives.
TCP Based Echo Service
One echo service is defined as a connection based application on TCP. A server listens... |
Introduction
Let's observe the string abc. The substrings that can be made from this are:
a, ab, abc, b, bc, c
We now need to align them under the initial string, like this:
abc
a
b
c
ab
bc
abc
The order of the string doesn't matter, so this is also perfectly valid:
abc
a
ab
abc
b
bc
c
So, the substring is p... |
A string whose length is a positive triangular number (1, 3, 6, 10, 15...) can be arranged into an "equilateral text triangle" by adding some spaces and newlines (and keeping it in the same reading order).
For example, the length 10 string ABCDEFGHIJ becomes:
A
B C
D E F
G H I J
Write a program or function that ... |
Challenge
Create a quine, that instead of outputting it's source, output's it's source QWERTY-sorted.
What is QWERTY sorting?
QWERTY sorting is sorting code by the QWERTY keyboard. Anything higher or more left is greater (q > Q, \ > /) with presedence on higher. To check, find the locations of the two characters to com... |
Introduction
Consider two strings A and B of the same length L, and an integer K ≥ 0.
For the purposes of this challenge, we say that the strings are K-compatible, if there exists a string C of length K such that A is a contiguous substring of the concatenation BCB.
Note that A is a substring of BAB, so A and B are alw... |
Imagine a path made up of < and > and ending in a @, e.g.
><>@
A walker starts on the left-most cell. He will traverse the path as follows:
If the walker is on a @ cell, he's reached the goal and is done.
If the walker is on a > cell, the entire path shifts one step to the right, cyclically, taking the walker with it... |
Problem
Create a program or function that can calculate the result of a matrix raised to the nth power. Your code will take an arbitrary square matrix A and a non-negative integer n, and return a matrix with the value An.
Restrictions
Built-in functions that compute the matrix power and matrix product are not allowed.
... |
Specification
For this challenge you will:
Take an array of positive integers.
For each overlapping pair in the array, calculate the difference of it's integers. If the difference is a common divisor of the integers (they are both divisible by their difference), swap their positions in the array. The values of the nex... |
Introduction
Gijswijt's sequence (A090822) is famously really, REALLY slow. To illustrate:
The first 3 appears in the 9th term (alright).
The first 4 appears in the 220th term (a long way away, but feasible).
The first 5 appears at (approximately) the 10^(10^23)th term (just no).
No one really even knows where the fir... |
Related, but very different.
In the examples below, \$A\$ and \$B\$ will be \$2\times2\$ matrices, and the matrices are one-indexed.
A Kronecker product has the following properties:
A⊗B = A(1,1)*B A(1,2)*B
A(2,1)*B A(2,2)*B
= A(1,1)*B(1,1) A(1,1)*B(1,2) A(1,2)*B(1,1) A(1,2)*B(1,2)
A(... |
We don't have a single challenge about drawing a real 3 dimensional cube, so here it goes:
Challenge
Your task is to draw a rotated, cube with perspective. It can be in a separate window or as an image.
Input
Your input is 3 separate numbers between 0 and 359.99... These represent the rotation around the x, y and z axi... |
This challenge is simple. Given a number, output a ascii-art representation of the number, using the Mayan Base-20 numeral system.
What is the Mayan system?
The Mayans used base 20 to store numbers, so the first position was the 1s place, the next the 20s place, then the 400s, etc.
So Mayan number 1 is 1 in base 10, b... |
Given (on STDIN, as command line arguments, or as function arguments) two distinct non-empty strings, find and return the shortest substring of the first string which is not a substring of the second. If no such substring exists, you may return the empty string, return any string which isn't a substring of the original... |
We all often hear the idiom "walk through the array" to mean "map the function over the following array". However, I need it done (now!), so I want you to run through the array.
How do I run?
Imagine there's a wild pack of wolves behind you
Running through an array is like walking through one, except you can skip over... |
In this challenge 2 years ago, we found the period of a unit fraction (1/n where n is a natural number).
Now, your task is to write a program/function to find the repetend of a unit fraction.
The repetend is the part of the decimal expansion which repeats infinitely, like:
The decimal representation of 1/6 is 0.16666.... |
Introduction
hackertyper.net is a website that simulates "hacking" (as the media portrays it) by outputting complicated code from the crypto section of the Linux kernel onto the screen as you type at a rate of 3 characters per one inputted.
Challenge
Your program/function should either accept a file as a command-line a... |
Background
Adler-32 is a 32-bit checksum invented by Mark Adler in 1995 which is part of the widely used zlib library (also developed by Adler). Adler-32 is not as reliable as a 32-bit cyclic redundancy check, but – at least in software – it is much faster and easier to implement.
Definition
Let B = [b1, ⋯, bn] be a b... |
Children are very good at classifying objects and counting them. Computers seem to have more trouble. This is a simplified version of this problem. Can you write a small program that can classify and count objects in an image?
The problem: Given an image containing one or more circles and rectangles, return 2 integers
... |
Your goal is to calculate the exponential of a float (e**x) up to 2 decimal places for any float within 1 to 10. The accepted error range is 0.01.
However, you must not use the built-in exponential function or the logarithm function.
In fact, attempts to circumvent this by (2**x)**(1/ln(2)) are prohibited, even if you ... |
Challenge
Your goal is, given two positive integer numbers a and b, to calculate (and output) a ^ b without using either multiplication, division and the power itself (not directly, at least).
And, of course, built-in exponentiation functions.
Scoring
This is code-golf, so the shorter, the better.
Test cases
Input => O... |
The challenge
Given a 2d string representing the bottom of a boat as an input, you must determine whether or not the boat will float. This 2D string can be in whatever format is most convenient. (String with newlines, list of string, list of list of chars, etc.) Print a truthy value if it will float, and a falsey value... |
Credits
This challenge originated from @miles.
Create a function that computes the CRC32 hash of an input string. The input will be an ASCII string of any length. The output will be the CRC32 hash of that input string.
Explanation
The algorithm of CRC32 and other CRC are essentially the same, so only CRC3 will be demo... |
Your task is to decompose a number using the format below.
This is similar to base conversion, except that instead of listing the digits in the base, you list the values, such that the list adds up to the input.
If the given base is \$n\$, then each number in the list must be in the form of \$k\times n^m\$, where \$0\l... |
Your task is to create a program/function to replicate this word generator.
Details
Your program/function take two input. One input is the categories. The other input is the syllable types.
Categories
categories will consist of classes of letters.
For example, V=aeiou means that the letters a, e, i, o, and u will be cl... |
It is well known, in the field of Mathematics studying infinity, that the Cartesian product of any finite amount of countable sets is also countable.
Your task is to write two programs to implement this, one to map from list to integer, one to map from integer to list.
Your function must be bijective and deterministic,... |
Definition
A number is positive if it is greater than zero.
A number (A) is the divisor of another number (B) if A can divide B with no remainder.
For example, 2 is a divisor of 6 because 2 can divide 6 with no remainder.
Goal
Your task is to write a program/function that takes a positive number and then find all of it... |
A perfect power is a number of the form \$a^b\$, where \$a>0\$ and \$b>1\$.
For example, \$125\$ is a perfect power because it can be expressed as \$5^3\$.
Goal
Your task is to write a program/function that finds the \$n\$-th perfect power, given a positive integer \$n\$.
Specs
The first perfect power is \$1\$ (which... |
This challenge is a harder version of this one.
A variable number of trits is an array of 0 or more trits (a trit is a ternary digit). So [0, 2, 2, 1] is a variable number of trits, but so is [].
Write a function or program that, given an non-negative integer returns a variable number of trits such that every integer h... |
For example, if n is 5 and r is 2, it would mean the number of lists below:
[1,1,1,1,1]
[1,1,1,2,2]
[1,1,2,2,2]
[2,2,1,1,1]
[2,2,2,1,1]
[2,2,2,2,2]
which is 6.
If n is 4 and r is 3:
[1,1,1,1]
[1,1,2,2]
[1,1,3,3]
[2,2,1,1]
...
[3,3,3,3]
which is 9.
where each item has a neighbour whose value is the same.
For example, ... |
Mary has given John two sticks of lengths a and b respectively, where a and b are positive integers.
John is very curious.
He would like to know how many triangles with integer perimeter can be formed, by having one additional side.
Please help him find it out.
(This is my first time composing this kind of stupid stori... |
A polygonal number is the number of dots in a k-gon of size n.
You will be given n and k, and your task is to write a program/function that outputs/prints the corresponding number.
Scoring
This is code-golf. Shortest solution in bytes wins.
Example
The 3rd hexagon number (k=6, n=3) is 28 because there are 28 dots abov... |
This question got me nostalgic: Build a word generator!
In the '80s I wrote a simple word generator in under 42kB (code and working memory) that would take a collection of strings and use them to create new words and phrases.
Your task is to recreate this program in as few bytes as possible, with a few minor updates.
Y... |
You are trying to guess my emotion.
I will give you an adjective, as the input to the function/program.
Your task is to output my emotion, either :) for happy, or :( for sad.
Details
For these adjectives, you must output the happy face :)
contented
delighted
merry
overjoyed
pleased
blessed
chipper
content
convivial
gle... |
Automatic house building nanobots have been fabricated, and it's your job to code them.
Here is the house created by input 7 4 2
/-----/|
/ / |
|-----| |
| | |
| | /
|_____|/
The input is a string containing the house's dimensions.
7 is the width.
|_____|
---7---
4 is the height.
|
|
|
|
2 is the d... |
Introduction
Let's observe the following array:
[1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1]
A group consists of the same digits next to each other. In the above array, there are 5 different groups:
[1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1]
1, 1, 1
2, 2
1, 1, 1, 1
... |
You are trying to guess my emotion.
I will give you an adjective, as the input to the function/program.
Your task is to output the state of my eyes, either O_O for open, or ._. for closed.
Details
For these adjectives, you must output open eyes O_O
animated
breezy
brisk
driving
enterprising
fresh
indefatigable
industri... |
Congratulations!
You have just been hired by a Fortune 499 company specializing in oil drilling.
Your job is to write a program to determine the optimum placement of OilRUs' drill (represented by a single alphabetical character of your choice, I use a capital "O" in the examples), given a length of piping, and a two-di... |
Clarification: Basically, you need to make this
Euler's totient function has the name phi.
Let's try to calculate phi(8)
First, list all numbers 8 and under backwards, not including 0 or under
8
7
6
5
4
3
2
1
Now find which numbers don't share a factor with 8 (1 doesn't count), and place a # in their place.
8
#
6
#
4
... |
In information theory, a "prefix code" is a dictionary where none of the keys are a prefix of another. In other words, this means that none of the strings starts with any of the other.
For example, {"9", "55"} is a prefix code, but {"5", "9", "55"} is not.
The biggest advantage of this, is that the encoded text can be... |
In this challenge about prefix code, we learnt that prefix codes are uniquely concatenable.
That means, they can be joined together without separator, and without ambiguity.
For example, since [1,2,45] is a prefix code, I can join them together without separator as such: 1245245112145, and there will be no ambiguity.
H... |
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 ... |
Final results available
Introduction
After my previous KOTH with heavy themes (fantasy war, worldwide pandemic...), I'm back with a new lighthearted game. This time, you are facing off in a "board game-like" situation. A pile of upside down coins is placed at the center of a really big table, and you are determined to ... |
Encrypting Challenge
Your encrypting program must be able to do following things:
Input password
Generate random key
Encrypt random key with set key
Then, the decrypting program must be able to these things:
Input encrypted password
Input encrypted random key
Decrypt random key
Decrypt password with decrypted random ... |
Note: This challenge is not the same.
Challenge
Believe it or not, we haven't got ONE challenge for reversing one-dimensional arrays (although we've got one for n-dimensional ones)! This should operate only on the 1st dimension, not on all dimensions of an array.
Rules
Standard loopholes are denied
[[1, 2], [3, 4]] be... |
Text to DNA golf
Challenge
Convert input into a DNA output.
Algorithm
Convert text into ASCII code points (e.g. codegolf -> [99, 111, 100, 101, 103, 111, 108, 102])
String the ASCII codes together (e.g. 99111100101103111108102)
Convert to binary (e.g. 1010011111100110100101101000100001100110101101111000011001011111101... |
This challenge is about gradually shifting hues in an image to make pretty pictures like this:
(original)
Challenge
Write a program or function that takes in two non-negative integers and an image in any common image file format of your choosing (you can take a path to the image or the raw image data).
We'll call the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.