instruction stringlengths 34 53.1k |
|---|
I thought it'd be interesting to turn AoC day 3 puzzle into a Golfing Challenge, so here it is.
Task
Find the number of # you'd encounter in an 11x11 grid (consisting of # and .) that repeats itself (to the right side), starting at the top left corner, which is always a .. You will need to check the position that is \$... |
Halley's Comet is the only comet that may appear (i.e. become visible to the naked eye on Earth) twice in a human lifetime. The orbital period of Halley's Comet is not constant: it has varied between 75 to 79 Earth years since the first definite apparition was recorded in 240 BCE. This variability is mainly driven by g... |
Related: Ellipse circumference
Introduction
An ellipsoid (Wikipedia / MathWorld) is a 3D object analogous to an ellipse on 2D. Its shape is defined by three principal semi-axes \$a,b,c\$:
$$ \frac{x^2}{a^2} + \frac{y^2}{b^2} + \frac{z^2}{c^2} = 1 $$
Just like an ellipse, the volume of an ellipsoid is easy, but its surf... |
Given a binary sequence of finite length, find the starting position where this sequence first appears in the binary digits of π (after the decimal). You can assume that an answer exists for any input sequence.
The binary digits of π start with
11.001001000011111101101010100010001000010110100011...
and digits will be ... |
Interval notation is a way to write complicated range bounds more conveniently and concisely than writing an inequality. The challenge, should you choose to accept it, is to write a program or function that interprets a subset of interval notation. In this subset, intervals are a comma-separated pair of integers delimi... |
Inspired by a recent challenge involving Fibonacci numbers in which OEIS was mentioned, I would like to present a challenge of creating a function that generates a wide array of different linear integer sequences, depending on user input.
Specifically, the user should provide three inputs:
the kernel (a representation... |
Stack Exchange doesn't know how to transpose tables. Let's help.
Given a markdown table, transpose it.
Input assumptions:
There will be at least two rows (including header) and two columns
Either all cells have no leading space or all cells have exactly one leading space (you must handle both)
If the cells have a lead... |
Given a positive integer \$n\$ output an ASCII hexagon with diagonal side length \$n\$, as pictured (note there are \$2n\$ _ characters on the top edge)
Examples:
\$n = 1\$
__
/ \
\__/
\$n = 2\$
____
/ \
/ \
\ /
\____/
\$n = 5\$
__________
/ \
/ \
/ \
... |
Challenge
The goal of this challenge is to make a function that takes an input string, a start keyword and a end keyword. The output extracted result is from (but excluded) the given start keyword to (but excluded) end keyword. The output sub-string follows the rules as below.
In all cases, the leading/trailing spaces... |
Your program should take two lists, where each entry (a positive integer) represents the number of members of some group, as input. These lists will have the same sum but may have different lengths.
Your mission, should you choose to accept it, will be to pair up members of the first list with members of the second, ou... |
Do you know the game Battleship? Well, I want to play with my little brother, but before we can begin we need to set up our ships on the board. This is your input.
Now, we need to check that the ships that we set up are valid. This is where you come in to help. Your task is to write a program or function which checks w... |
This problem will have you analyzing circles drawn on the grid, with the gridlines drawn at integer values of \$x\$ and \$y\$.
Let \$\varepsilon\$ be a very small number (think, \$\varepsilon = 0.0001\$). If we paint a filled-in circle of radius \$\varepsilon\$ centered at the origin, it will require paint to be in \$4... |
Win a K vs KQ endgame
Summary
The goal of this challenge is to create a program or function which will win a Chess game with a King and Queen against a lone King. The user will specify three squares, representing the locations of the computer's King, the computer's Queen, and the user's King. The computer will then a o... |
Input
Your program will take in the integer coefficients of the equation \$ax^3+bx^2+cx+d=0\$ as inputs (a, b, c, and d).
Output
All real solutions of the input equation, with an accuracy of at least the thousandths place, sorted from smallest to largest.
Rules
Built-in equation solver are not allowed
Native math ... |
Write a program or function which takes three positive integers \$a, b, c\$ and returns/outputs one value if there is, and a different value if there isn't, a triangle on the square lattice, whose sides' lengths are \$\sqrt{a}, \sqrt{b}, \sqrt{c}\$. By "on the square lattice" I mean that its vertices are in the \$xy\$ ... |
JavaScript has no direct support for keyword arguments, but it supports argument object destructuring. It is standard to use a destructed final argument for keyword arguments. Here is an example:
function f(x, { a = 7, b = 2}){
return [x, a, b];
}
You would then call this function like:
f(9, {}); // ==> [9, 7, 2]
... |
I'm not sure if this kind of golf is allowed, but here it is.
Your objective is to create an image containing one pixel of every possible RGB color. The image with the smallest file size wins.
Rules:
The image must be a PNG.
The image must contain exactly one of every possible RGB color.
Acceptable image dimensions ar... |
Let S be a set of sets, for example S = {{A},{B},{A,B}}. A maximal subset, Max, is an element of S such that no other set in S strictly includes Max. So in this example, {A,B} is a maximal subset as none of the other sets strictly contain {A,B}.
A minimal subset, Min, is an element of S such that no other set in S is s... |
Related: Landau's function (OEIS A000793)
Background
Landau's function \$g(n)\$ is defined as the largest order of permutation of \$n\$ elements, which is equal to \$\max(\operatorname{lcm}(a_1,a_2,\cdots,a_i))\$ where \$a_1,a_2,\cdots,a_i\$ is an integer partition of \$n\$.
We can extend this to define "iterations" of... |
Here’s the picture of the first published picture of the Mandelbrot set.
Use the fewest bytes possible to write a program or function that outputs the following.
A trailing new line is permitted. Character * cannot be replaced by any other character.
Useful information: Center is \$(-0.75, 0)\$, \$\Delta x = 0.035\$, ... |
Robber Thread here
The Challenge
Choose any numeric* formula, algorithm, or code challenge. Implement it in such a way that the math is correct, but at least one answer is wildly** wrong due to some defect in how computers/programs operate, e.g. floating point errors, uninitialized/corrupted memory, environment bugs, c... |
Challenge
The cops created code challenges which result in certain wildly incorrect answers despite correct math. Choose an uncracked, not safe formula from the cop thread.
Your task is to find an incorrect answer and describe its underlying cause. The challenge author has the responsibility to confirm whether the expl... |
Your task: Print or return a conversion table with every byte from 00 to ff's value as an unsigned integer, to its value as a signed one (using two's complement).
For example:
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
1... |
From the subreddit r/SpeedOfLobsters:
Edit the text of an image to create a new phrase
This meme format/style is pretty self-explanatory. Simply have a browse through the subreddit if you need more examples. However, when coming up with ideas, it can be quite difficult to decide exactly which letters to keep and whic... |
EDIT (Jan 19, 2022, 18:00 UTC): This challenge is now over. The winner is Citty with this Pyth answer. Congratulations!
This is an answer-chaining challenge where each answer must take an integer \$N\$ as input and return the 1-indexed ID of the answer which was written by the user whose ID is \$N\$.
You may want to s... |
The goal is to raise the error message with the most bytes! The error message may not be generated by the program itself, such as Python's raise. errors that do not terminate the program are not allowed unless they do not show an error message.
Here is an example in python that raises 243041 bytes of error code:
def a(... |
Background
A little while ago, someone posted an interesting puzzle on Math.SE:
What is the smallest digraph (directed graph) G where the following eight graphs are all distinct:
G, the original graph
Reflexive closure of G
Symmetric closure of G
Transitive closure of G
Reflexive symmetric closure of G
Symmetric tran... |
Challenge
The goal of this challenge is to make a function that takes two paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy (but a single copy of the part of overlapped lines should be kept to avoid information loss). Each input paragraph is with the follows spe... |
When one performs a search query using Google, one of the first things you see is an approximation of how many results were found. Today, you'll be simulating this in as few bytes as possible.
Input
A short string of length at most 10 with characters from a-z.
Output
The approx count that Google reports for the number ... |
Write a program or a function to print the following cube (if you allow me to call it so) in different sizes:
^L^L^L^L^L^L^L^L^L^L^L
//^L^L^L^L^L^L^L^L^L^L^L
////^L^L^L^L^L^L^L^L^L^L^L
//////^L^L^L^L^L^L^L^L^L^L^L
////////^L^L^L^L^L^L^L^L^L^L^L
//////////^L^L^L^L^L^L^L^L^L^L... |
Edit (Jan 24/2021): The original specification for the challenge had a few problems. Underneath the original text, I have added alternate conditions that were suggested by @caird-coinheringaahing (thanks for the tips).
There is a gameshow in the UK called "Countdown", and a parody called "8 out of 10 Cats does Countdow... |
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... |
In this challenge, bots (consisting of JS functions) move around an infinite factory (playing field), collecting characters. These characters can be used to build worker bots, or dropped for other bots to pick up.
This challenge is a modified redo of Bot Factory KoTH, which was broken by a mistake in the spec.
Results
... |
zipwith is a functional construct that takes three arguments: one binary function and two lists of the same length, and returns a single list where each element is constructed by applying the binary function to each pair of elements from the two lists:
zipwith (a+b) [1,2,3] [4,5,6] = [5,7,9]
You are to take a black-bo... |
Input:
Ten unique integer coordinates, between (0,0) and (100,100).
Output:
The coordinates arranged in the order/an order such that a path drawn between the coordinates in that order is the shortest path possible.
This is code golf so the shortest code wins!
|
Background
An L-shape is defined as a polyomino which can be made by extending two rectangular legs in orthogonal directions from a full square (called a pivot). The size of the square should be at least 1, and the lengths of the two legs should also be at least 1.
These are some examples of L-shapes:
Pivot size 1, two... |
Here is the problem, for which I can only think of an iterative solution and have not found a closed formula:
You need to paint a house with R rooms.
For each room there are four walls and one ceiling, which all have the same dimensions and need C coats of paint.
You can't paint the next coat until the previous one ha... |
Peano numbers represent nonnegative integers as zero or successors of other Peano numbers. For example, 1 would be represented as Succ(Zero) and 3 would be Succ(Succ(Succ(Zero))).
Task
Implement the following operations on Peano numbers, at compile time:
Addition
Subtraction - You will never be required to subtract a ... |
Heavily based on this closed challenge.
Codidact post, Sandbox
Description
A Sumac sequence starts with two non-zero integers \$t_1\$ and \$t_2.\$
The next term, \$t_3 = t_1 - t_2\$
More generally, \$t_n = t_{n-2} - t_{n-1}\$
The sequence ends when \$t_n ≤ 0\$. All values in the sequence must be positive.
Challenge
Gi... |
You are to write a program which generates random integers between \$0\$ and \$99\$ inclusive, outputting each integer in turn, until \$0\$ is generated. You may choose which single-order random distribution (uniform, binomial, Poisson etc.) you use so long as each integer has a non-zero chance of being generated and i... |
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... |
Sandbox, Codidact
A rewrite of this question with a simpler input format and guidelines.
Challenge
Deadfish uses a single accumulator, on which all commands are to be performed.
It has the following commands:
Command
Description
i
increment the accumulator
d
decrement the accumulator
s
square the value of t... |
Challenge
The goal is to output Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo.
Context. (Maybe another interesting challenge could be printing all of the other examples? This would probably use similar logic but involve either a function or just a for loop.)
Rule(s)
You cannot output anything other t... |
My stovetop has 10 (0 through 9) different settings of heat and a very odd way of cycling through them.
It always starts at 0
When I hit plus it increments the number, unless the number is 9 in which case it becomes 0, or the number is 0 in which case it becomes 9.
When I hit minus it decrements the number, unless t... |
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... |
I made this because, although we have a bunch of other questions involving smiley faces, there is nothing for just printing an ASCII smiley face with as little code as possible.
Anyway, print this exactly (Trailing spaces allowed):
**********
******************
**********************
******* ****** ***... |
Challenge:
Given a list of non-negative integers, determine by how much you should increase each item to create the closest binary box with the resulting integer-list.
What is a binary box?
A binary box is where the first and last rows consists of 1-bits; the first and last columns consist of 1-bits; and everything els... |
Background
Fibonacci trees \$T_n\$ are a sequence of rooted binary trees of height \$n-1\$. They are defined as follows:
\$T_0\$ has no nodes.
\$T_1\$ has a single node (the root).
The root node of \$T_{n+2}\$ has \$T_{n+1}\$ as its left subtree and \$T_n\$ as its right subtree.
T0 T1 T2 T3 T4
O ... |
Given a rod of length n inches and a list of prices that contains prices of all pieces of size smaller than n. Determine the maximum value obtainable by cutting up the rod and selling the pieces. For example, if length of the rod is 8 and the values of different pieces are given as following, then the maximum obtainabl... |
Challenge
The challenge is to implement the bottom encoding (only encoding, not decoding). There is a wide variety of existing implementations in the bottom-software-foundation org.
Bottom is a text encoding where each character is separated into multiple emoji.
Unicode escape(s)
Character
Value
U+1FAC2
200
... |
What is Permutation Coefficient
Permutation refers to the process of arranging all the members of a given set to form a sequence. The number of permutations on a set of n elements is given by n! , where “!” represents factorial.
The Permutation Coefficient represented by P(n, k) is used to represent the number of ways ... |
Originally sandboxed by @xnor
Left-or-right is a very simple language @xnor made up. Its expressions are made of arrows < (left), > (right), and parentheses. The goal is to evaluate an expression to either < or >.
An expression A<B picks the left item A, while A>B picks the right one B. Think of < and > as arrows point... |
Challenge
Create a function or program that, when given an integer size, behaves the following way:
If size is equal to 1, output
┌┐
└┘
If size is greater than 1, apply the following substitutions :
Source
Target
┌
┌┐└┌
┐
┌┐┐┘
└
┌└└┘
┘
┘┐└┘
Note: this is basically a Unicode box-drawing version of the... |
Given a BF program consisting of only the characters +-[]<>., with the property that there's an equal number of < and > between every matching pair of [].
You have to find the shortest program that can be achieved with the optimal memory layout (by rearranging the cells on the tape).
If there are multiple such programs... |
Given an array of integers, find "the next to the middle".
The next to the middle is the smallest integer greater than the smallest among mean, median and mode of the given numbers, that is neither the mean, median or mode and is also contained in the array.
For example, in the following array
[ 7, 5, 2, 8, 0, 2, 9, ... |
Output this 1364-digit base-10 number:
10346063175382775954983214965288942351853612536382034663905935101461222060548195774084941504127779027795484711048746289269095513027910438498906751225648197766590064457965461314130149942152545074712074006545797623075756579902190433531325851645586375231773037880535184421903026638874... |
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... |
Introduction
git diff is a great way to export patches of the source code, and its outputs are colorized if you don't pass extra arguments to it.
However, when you want to review the exported file with colored output, it would be pretty hard. colordiff is an option, but it acts like the diff program itself, also, it is... |
One thing that is constantly frustrating when golfing ARM Thumb-2 code is generating constants.
Since Thumb only has 16-bit and 32-bit instructions, it is impossible to encode every immediate 32-bit value into a single instruction.
Additionally, since it is a variable length instruction set, some methods of generating ... |
Repost and improvement of this challenge from 2011
A vampire number is a positive integer \$v\$ with an even number of digits that can be split into 2 smaller integers \$x, y\$ consisting of the digits of \$v\$ such that \$v = xy\$. For example:
$$1260 = 21 \times 60$$
so \$1260\$ is a vampire number. Note that the dig... |
When I was posting answers for the Husk Language of The Month thread, I realized it took more time to enter them in the thread than it took to actually write the answers. So, why not automate it?
Write a program/function which inputs a language name, and displays all answers in that language during the current month so... |
In the MMORPG Final Fantasy XIV, the Ninja class has the ability to use combinations of up to three handsigns (Ten, Chi and Jin) to perform a variety of ninjutsu skills.
The skill you cast depends on the last sign used, and using two or more of the same sign makes the ninjutsu skill fail and puts a little bunny on your... |
An unrooted binary tree is an unrooted tree (a graph that has single connected component and contains no cycles) where each vertex has exactly one or three neighbors. It is used in bioinformatics to show evolutionary relationships between species.
If such a tree has \$n\$ internal nodes, it necessarily has \$n+2\$ leav... |
In my previous bioinformatics challenge, I asked you to mutate a DNA sequence. This time, I'd like you to evaluate how likely a mutation, or a series of mutations, is.
The two types of substitutions are transitions and transversions, and due to the chemical structure of DNA bases, transitions are more likely to occur t... |
The challenge: compute the day of the week from a MM-DD representation of a day in this year (2021).
However, you have to write your program in the following subset of Python: (I chose Python because it's popular and easy to understand even to the people who doesn't know the language. Obviously you can use another prog... |
Given two strings a and b, count how many times b occurs as a substring in a, but only when it overlaps with another instance of b.
(This means that 1 will never be a valid output, because in order for the substring to be strictly overlapping, there must be at least one other instance for it to overlap with.)
Test case... |
Given the following Python "reference implementation" of non-terminating FizzBuzz:
i=1
while True:
if i%15 == 0:
print("FizzBuzz")
elif i%3 == 0:
print("Fizz")
elif i%5 == 0:
print("Buzz")
else:
print(i)
i += 1
We can represent its output as an infinite array of char... |
Given a 2-dimensional jagged array and a fill value, pad the array in both dimensions with the fill value to ensure that it is square and not jagged (i.e., all rows are the same length, and that length is the same as the number of rows).
The fill values should always be added to the "edges", which may be the start or t... |
You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.
Rules
You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
Standard... |
You will need to evaluate the definite integral (bounded by \$a\$ and \$b\$) of a certain polynomial function that takes the form of:
$$\int_a^b \left( k_n x^n + k_{n-1} x^{n-1} + \cdots + k_2x^2 + k_1x + k_0 \: \right) dx$$
Normally, this can be done using the fundamental theorem of calculus and power rules. For examp... |
Background
Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits.
Given a positive integer \$N\$, the encoding algorithm is as follows:
Start with a single zero in the output.
If \$N=1\$, stop.
Prepend the binary digits of \$N\$ to the current output.
Let \$N\$ be ... |
The program should start out with 2 separate files, here named "a" and "b". "a" and "b" should be what I am calling inverse quines: "a", when run, should output "b"'s source code, and "b", when run, should output "a"'s source code, for example:
./a
#source code of b, optionally followed by newlines
./b
#source code of ... |
Left in sandbox for at least 3 days.
I want to verify if this inequality is true:
for \$n\geq4\$, if \$a_1,a_2,a_3,\dots,a_n\in R_+\cup\{0\}\$ and \$\sum_{i=1}^na_i=1\$, then \$a_1a_2+a_2a_3+a_3a_4+\dots+a_{n-1}a_n+a_na_1\leq\frac{1}{4}\$.
Challenge
Write a piece of program which takes an integer n as input. It does th... |
Background
This is loosely based on the now closed Kaomoji question asked a few hours ago.
Kaomojis are sequences of characters designed to express a given emotion. In this code-challenge, you'll be writing a program that takes a Kaomoji as input, and must output the emotion expressed by the Kaomoji.
Input
A Kaomoji. I... |
You have to print out your username, by only using the characters in your username.
Standard loopholes are forbidden
This is not code-golf, so shortest does not win
Don't modify your username please
And each language be used one time
|
Introduction
Book cipher
A Book cipher is a very unique method of a encipher. Here's how's it done:
You have a book / a document or a article (something full of text, the more pages of text the better).
You have a message to convey (a secret, of some sort)
You simply-put read trough the text and the secret message (ma... |
Challenge
I've checked that there is a question Compute the Discrete Cosine Transform which is a competition for implementing a shortest solution to compute the one dimensional discrete cosine transform.
The goal of this challenge is to implement a program to calculate three dimensional discrete cosine transform which ... |
Looking at the following hackerrank problem:
https://www.hackerrank.com/challenges/flatland-space-stations
You are given a number n where cities can be at indices 0 to n-1 and also given an unsorted list of indices of cities where there are stations. The goal is to find the maximum distance from a city to a station. Fo... |
Challenge
In this simple challenge, you have to print the public IP address of google.com.
Rules
You have to output either the IPv6 or IPv4 address, and do it by somehow using internet.
Output does not strictly need to be the IP address, your answer will be valid if the correct IP address is somewhere in the output, ... |
Inspired from Is this site down or is it just me?
Challenge
You have to print if a website server is online or not, for you.
Input
The domain name, like codegolf.stackexchange.com
Output
1/True if online
0/False if offline
Rules
Any kind of web access is allowed
URL shorteners allowed
Except 2 no. Rule, all standa... |
!!!Batch is another derivative of the Windows Batch programming language, its wiki is here
Your challenge is to create an compiler/translator that reads a !!!Batch program and returns a Windows Batch program.
In !!!Batch each token braced in two question marks like ?!!!? is converted to another ASCII character, like '?... |
Given two inputs, a number n and a dimension d, generate the nth d-dimensional pyramid number.
That was confusing, let me try again.
For d = 1, the numbers start 1,2,3,4,5 and is the number of points in a line n points long.
For d = 2, the numbers start 1,3,6,10,15 and is the number of points in a triangle with side le... |
Background
Character classes are a standard way to indicate a set of characters to match in regular expressions. For example, the class [ab] matches a or b, [a-z] matches any lower case letter, and [^a] matches everything but a. For the purpose of this question, classes can contain:
a sequence of characters to match, ... |
While at work I spotted a nice and simple challenge.
The job was to stock products in cargo units with a certain capability.
Since an order can have various batches, coming in sequence from the production, we usually make a list of the pieces of those batches distributed in each cargo to make sure nothing is lost durin... |
A binary relation on a set \$X\$ is simply a subset \$S \subseteq X \times X\$; in other words, a relation is a collection of pairs \$(x,y)\$ such that both \$x\$ and \$y\$ are in \$X\$. The number of different relations grows quickly with the size of the set: if \$X\$ contains \$n\$ elements, there are \$2^{n^2}\$ bin... |
Introduction
This challenge was originally the "Among Us" challenge in the "Misc" category of YASCON CTF 2020. (The link includes an answer to that challenge. Click at your own risk.)
You're given a lot of files, 1 of which is different from every other files. Your job is to find that 1 different file.
Challenge
Input... |
Related: Elias omega coding: encoding
Background
Elias omega coding is a universal code which can encode positive integers of any size into a stream of bits.
Given a stream of bits \$S\$, the decoding algorithm is as follows:
If \$S\$ is empty, stop. Otherwise, let \$N=1\$.
Read the next bit \$b\$ of \$S\$.
If \$b=0\$... |
Your task is to make a script with the shortest byte count, that reverses a word then replaces each letter with the next letter next in the alphabet.
Examples:
input: hi
output: ji
input: hello
output: pmmfi
input: test
output: utfu
A few notes:
Should the letter's value be 27 (z+1), assume it is an a.
Symbols, num... |
I like anagrams. I like programs that reference their own source code. So this challenge combines them!
Input.
The input to the program could be anything, including letters, numbers, symbols, you name it.
Output.
A truthy value if the input's characters can be rearranged to give the source code, and a falsy value if th... |
Adapted from tips for restricted-source in Python
Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the zsh language. While we already have a place to collect all these tips for code-golf, those for restricted-source remain transmitted by word of mouth or hidden deep within the ... |
When I was a kid, there was a "really cool" shortcut to count to 100:
1, 2, miss a few, 99, 100
Output the exact string above, in the fewest characters possible, without using these characters: 0, 1, 2, 9
|
It's the end of the year, you and your friends have just received your grades and ranks for the GOLF101 class. On a chat group, everyone sends their grade and rank to see who's got the best one.
Problem: someone is lying.
Here is an excerpt from the chat:
<A> I'm ranked 1 with a grade of 85.
<B> Ranked 3, got 50.
<C> R... |
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... |
Challenge
In this challenge, all numbers are in \$\mathbb{N}_0\$.
Create a function or program that, when given a number \$N\$ and a tuple of \$k\$ numbers \$(n_i)\$ (all ≤ \$N\$), returns the number of ways \$N\$ can be written as a sum of \$k\$ integers (\$x_1 + x_2 + ... + x_k\$) such that \$n_i \le x_i \le N\$.
The... |
Print integers 0 to 100 (inclusive) without using characters 123456789 in your code.
Separator of numbers can be comma or white space (by default <blank>, <horizontal tabulator>, <newline>, <carriage return>, <form feed> or <vertical tabulator>).
Shortest code wins.
|
Given an array \$A\$ of positive integers between \$1\$ and \$9\$ inclusive and a positive integer \$n\$, remove all integers in \$A\$ which appear more than \$n\$ times.
For example:
[1,2,3,2,3,2,4,1,2], n = 2
Occurrence: 1 1 1 2 2 3 1 2 4
Keep? 1 1 1 1 1 0 1 1 0
Kept values: [1,2,3,2,3, 4,1 ]... |
Background:
For this challenge, a polynomial looks like this:
$$P(x)=a_nx^n+a_{n-1}x^{n-1}+\dots+a_2x^2+a_1x+a_0$$
The degree, \$n\$, is the highest power \$x\$ is raised to. An example of a degree 7 polynomial would be:
$$P(x)=4x^7+2x^6-7x^4+x^2-6x+17$$
All powers are integers \$n\ge0\$. This means \$x\$, \$-2\$, and ... |
Oh, No!
the sentences are out of balance.
Quick! balance them.
A word is defined as follows:
A sequence of letters [A-Za-z] separated by any non-letter character ([0-9] ~+- etc.)
A word is BaLanCeD if its capitalization is the same forwards as it is backwards.
Given a sentence with words, balance each word by capita... |
Your challenge: The code must print "Hello, World!" and nothing else.
Your restrictions: Your program must satisfy these requirements:
The program must be a pangram.
It must use every character in printable ASCII, or, if you chose a particularly strange language, characters which are stored as one byte.
You are allow... |
A "qruine" if you will :)
Design a QR code that legibly spells with its pixels (or the space between them) the text that it scans to.
For example, this QR code scans to the letter A, and also spells out A in white:
There are 4 categories, one for each mode of QR code: numeric, alphanumeric, byte, and kanji. Please sta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.