instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
My first code golf post, apologies for any mistakes...
Context
In rock climbing (bouldering specifically), the V/Vermin (USA) climbing grades start at 'VB' (the easiest grade), and then go 'V0', 'V0+', 'V1', 'V2', 'V3', 'V4', 'V5' etc. up to 'V17' (the hardest grade).
Task
You will take as input a list/array of climbin... | stackexchange_codegolf |
Background
Hamiltonian circuit problem is a decision problem which asks whether a given graph has a Hamiltonian circuit, i.e. a cycle that visits every vertex exactly once. This problem is one of the well-known NP-complete problems.
It is also known that it remains so when restricted to grid graphs. Here, a grid graph ... | stackexchange_codegolf |
S. Ryley proved following theorem in 1825:
Every rational number can be expressed as a sum of three rational cubes.
Challenge
Given some rational number \$r \in \mathbb Q \$ find three rational numbers \$a,b,c \in \mathbb Q\$ such that $$r= a^3+b^3+c^3.$$
Details
Your submission should be able to compute a solution f... | stackexchange_codegolf |
A barcode of EAN-13 symbology consists of 13 digits (0-9). The last digit of this barcode is its check digit. It is calculated by the following means (the barcode 8923642469559 is used as an example):
Starting from the second digit, sum up all alternating digits and multiply the sum by 3:
8 9 2 3 6 4 2 4 6 9 5 5 9
|... | stackexchange_codegolf |
There are 10 types of people in the world, those who understand binary and those who do not.
Where are you? Let's see!
Challenge
Your task is to convert a decimal integer to binary, only using a set of arithmetic operators (+, -, *, / and %). You can use conditional statements, loops and variables. (No bitwise operator... | stackexchange_codegolf |
Write code that when given a positive number \$x\$ as input, outputs the largest positive divisor of \$x\$ less than or equal to the square root of \$x\$.
In other words find the largest \$n > 0\$ such that
\$\exists m\geq n:m\cdot n=x\$
(Exists \$m\$ greater than or equal to \$n\$ such that \$m\$ times \$n\$ is \$x\$)... | stackexchange_codegolf |
Print the following text and nothing else:
<html>
<body>
<p>HTML is kinda annoying</p>
</body>
</html>
I'm happy I'm not a web developer.
The catch? Your code must fit the template: print(<?>), where ? can be any group of characters. You can paste your completed code (with the print(<>) part) into this Scast... | stackexchange_codegolf |
Introduction
You're making a robot that can navigate a set of books of varying heights. It can climb books and jump off books, but if the distance is too big it will stop to prevent damage. To figure out the ideal design, you're writing a simulator.
Your program will take as input a list of numbers, representing the he... | stackexchange_codegolf |
For this challenge, you will be required to write 3 programs:
The first program should be a quine, i.e, it should print it's own source code.
The second program should read the input and print all of it.
The third program should simply print the string "Hello, Permutations!", with or without quotes.
In addition to th... | stackexchange_codegolf |
RPS 25 is a version of Rock Paper Scissors which has 25 hand symbols instead of just 3. Each symbol defeats 12 symbols, and is defeated by 12 others.
Here's a link to a chart showing which symbols defeat which.
The challenge here is simple: your program should take in two strings representing the symbols thrown by each... | stackexchange_codegolf |
Introduction
The middle-square method is used for the generation of pseudorandom numbers. However, this is not a good method in practice, since its period is usually very short and has some severe weaknesses. How does this work? Let's take an example:
For the seed, we pick 123456:
Seed 123456
The seed squared (see... | stackexchange_codegolf |
Very heavily inspired by this challenge Code Golf: Your own pet ASCII snake - I thought making it horizontal would add an extra layer of complexity.
An example horizontal snake:
0 0
0 0 0 000
00 0 00 000 0 0
000 0 0 0 00
0 ... | stackexchange_codegolf |
Your challenge is to create the longest run of characters with incrementing Unicode codepoints in a pristine program as you can. To keep things simple, I'll abridge the definition for this challenge to be "any program which produces no errors but will error if any one character is removed".
Let's define a codepoint run... | stackexchange_codegolf |
Write a program to calculate the first 500 digits of the mathematical constant e, meeting the rules below:
It cannot include "e", "math.e" or similar e constants, nor may it call a library function to calculate e.
It must execute in a reasonable time (under 1 minute) on a modern computer.
The digits are to include the... | stackexchange_codegolf |
In this challenge we learned a way to encode every positive integer using factor trees.
Here is how it works:
The empty string has value of 1.
(S) where S is any expression with a value of S evaluates to the Sth prime.
AB where A and B are arbirary expressions with values of A and B respectively has value A*B.
For ex... | stackexchange_codegolf |
We've all heard of the ol' Fizz Buzz problem, but what happens when you try to apply it with more factors? Fizz Buzz Crackle Pop!
The Challenge
Write a full program that takes an integer input n, then n tuples containing an integer and a string, then another integer (>1) k, as such:
n int1 str1 int2 str2 (...) intn st... | stackexchange_codegolf |
Input a datetime, format the datetime in YYYY-MM-DD HH:mm:ss format using 30-hour clock time.
The 30-hour clock time works as:
After 6 a.m., it is same as 24-hour clock time
Before 6 a.m., it use date for previous day, and plus Hours by 24.
For more examples, you may checkout the testcases.
Rules
To simplify the que... | stackexchange_codegolf |
Given a long multi-sentence string, the goal is the count the occurrences of the following words: park, lake, Santa Fe.
The words can appear as substrings of other words, i.e, parked counts as an instance of park.
Santa Fe counts as one word (so the space matters). Both Santa and Fe appearing alone or out of order does... | stackexchange_codegolf |
Introduction
This challenge is inspired by Grime, my 2D pattern matching language.
Basically, you are given a "grammar" that describes two-dimensional grids of characters, and your job is to generate a grid according to the grammar.
In addition, the grid should be as small as possible in a certain weak sense.
Input
You... | stackexchange_codegolf |
This is a two-player card game which resembles a vastly simplified game of Texas Hold'em,
combined with RPS (rock-paper-scissors) and the most basic mechanic of commercial turn-based card games.
The deck
A single full deck consists of 30 unique cards, where each card has one symbol out of RPS and one number between 0 a... | stackexchange_codegolf |
Problem statement
Pólya is playing about with his urn again and he wants you to help him calculate some probabilities.
In this urn experiment Pólya has an urn which initially contains 1 red and 1 blue bead.
For every iteration, he reaches in and retrieves a bead, then inspects the colour and places the bead back in the... | stackexchange_codegolf |
So you are given a POSITIVE base 10 (decimal) number. Your job is to reverse the binary digits and return that base 10 number.
Examples:
1 => 1 (1 => 1)
2 => 1 (10 => 01)
3 => 3 (11 => 11)
4 => 1 (100 => 001)
5 => 5 (101 => 101)
6 => 3 (110 => 011)
7 => 7 (111 => 111)
8 => 1 (1000 => 0001)
9 => 9 (1001 => 1001)
10 => ... | stackexchange_codegolf |
Sociable numbers are a generalisation of both perfect and amicable numbers. They are numbers whose proper divisor sums form cycles beginning and ending at the same number. A number is \$n\$-sociable if the cycle it forms has \$n\$ unique elements. For example, perfect numbers are \$1\$-sociable (\$6\to6\to\cdots\$) and... | stackexchange_codegolf |
Your toy in this challenge is a special abacus of 4 rows and 8 positions per row. There's one bead on the first row, 2 beads on the 2nd row, 3 beads on the 3rd row and 4 beads on the 4th row. Beads on a same row are glued together, which means that they can only be moved as a block.
Below is a valid configuration of th... | stackexchange_codegolf |
This challenge requires integration with C, so you can stop reading if you're not interested.
Matrix multiplication is a simple operation, but the performance depends a lot on how efficiently the code is written.
Let's compute m = x * y. The following code is the implementation of the textbook algorithm.
for (int i = 0... | stackexchange_codegolf |
Vyxal is a stack-based language, meaning that everything operates by popping and pushing values onto a stack. It has a bunch of useful flags, one of which is r.
Running a Vyxal program with the r flag causes functions to take their elements in reverse order.
For example, the program 5 3 - means: Push 5 to stack, push ... | stackexchange_codegolf |
There have been a couple of challenges involving doubling source code: here and here. The task we have here is a bit harder, but should be doable in almost every language.
In this challenge, you will take in an arbitrary positive integer. Your program must output that integer doubled.
When your source code is doubled, ... | stackexchange_codegolf |
Everyone is likely familiar with the following song, which is a musical round:
Background
Fewer people might recall trying to sing the 4-person version of this with a few friends and failing. Offsetting the lyrics of a song with different harmonious pitches is known as singing a "round" and that's what we're here to s... | stackexchange_codegolf |
Given a string containing only letters, output the length of the longest run of consecutive alphabetical letters the word contains, where order does not matter. An example algorithm may sort the word, remove duplicates, and then output the length of the longest run.
Test Cases
watch -> 1
stars -> 3
antidisestablishment... | stackexchange_codegolf |
In some nations there are recommendations or laws on how to form emergency corridors on streets that have multiple lanes per direction. (In the following we only consider the lanes going in the direction we are travelling.) These are the rules that hold in Germany:
If there is only one lane, everyone should drive to t... | stackexchange_codegolf |
The Problem:
This challenge comes from a real problem I was having. I have a dual monitor setup at work, and I wanted to use the following image as my wallpaper:
However, my monitors have quite significant bezels, and when I set my background, it looks something like this, where the pier appears (appiers?) to be broke... | stackexchange_codegolf |
"Digital sum" refers to the sum of all the digits in a number.
For example, the digital sum of 1324 is 10, because 1+3+2+4 = 10.
The challenge is to write a program/function to calculate the smallest number bigger than the input whose digital sum is the input.
Example with walkthrough
As an example, take the number 9 a... | stackexchange_codegolf |
In this challenge you will receive a list of pairs of non-negative integers representing a mushroom forest. Each pair represents a mushroom whose center is at that horizontal coordinate. The only part of the mushroom we care about is the cap (the flat bit at the top).
The first integer in each pair represents which ro... | stackexchange_codegolf |
Intro
This is based on an actual problem I recently faced while making a computer game and I thought it would make for a nice round of code-golf.
There are seven main spectral classes of star which put out varying amounts of heat. The geology of planets around a star are greatly influenced by the amount of heat receive... | stackexchange_codegolf |
Task
Given an input n, calculate the n-th decimal digit of pi
Rules
Answer can be a full program or a function.
Input must be taken from stdin or from function arguments.
Output must be either sent to stdout, the return value of a function, or written to a file.
all n values between 0 and 20000 must be supported (can ... | stackexchange_codegolf |
There's a lot of questions about Conway's Game of Life, but nothing about customization (Related: 2-Player Life). Given an input, determine the result on a 100x100 grid after some iterations. The input is given as a string. For example:
Using the character #, follow the following rules:
If there are 2 or 3 neighboring ... | stackexchange_codegolf |
Challenge: Create a program that prints out the size of its own source code file.
For example, a 35 bytes size of program must print out 35. Pre-calculation is not valid. What I mean by pre-calculation is:
// test.js -> its size is 15 byte
console.log(15)
It must dynamically calculate the size of own source code fi... | stackexchange_codegolf |
Yes, I know there is a similar question, but this one specifically concerns any possible words, even with letters left over, while the linked one restricts to a permutation of the input
Objective
Have you ever had those moments in a Scrabble game where you're staring at your letters, trying to find a good word, and y... | stackexchange_codegolf |
Given n points, choose a point in the given list such that the sum of distances to this point is minimum ,compared to all others.
Distance is measured in the following manner.
For a point (x,y) all 8 adjacent points have distance 1.
(x+1,y)(x+1,y+1),(x+1,y-1),(x,y+1),(x,y-1),(x-1,y)(x-1,y+1),(x-1,y-1)
EDIT
More cleare... | stackexchange_codegolf |
Did you know that a small number can borrow bits from a larger number? Here's an example. Let's say our two numbers 5 and 14. First, write them out in binary:
5 14
000101 001110
First we take the smallest on bit away from the larger number, and we give it to the smallest off bit on the other number. So
This bit... | stackexchange_codegolf |
Given a string s, return the smallest contiguous substring you can remove to create a palindrome.
Examples:
800233008 -> 2
racecarFOOL -> FOOL
abcdedcba -> (empty string)
ngryL Myrgn -> "L " (or " M")
123456789 -> 12345678 (or 23456789)
aabcdbaa -> c (or d)
[[]] -> [[ (or ]])
a -> (empty stri... | stackexchange_codegolf |
You must make a regex that matches everything except itself. For example, PPCG must not match PPCG, but must match everything else, like something, PPC, and PPCG!.
Surrounding slashes are not considered part of the regex in flavors where they are usually part of the syntax. The same is true of all delimiters.
The rege... | stackexchange_codegolf |
Given a list of N lists, each containing M positive integers, and a separate list of M positive integers (target values), return a list of N scalars (integers with a value of 0 or more) that correspond to each list in the lists of lists, such that when each value in a list is multiplied by it's scalar, and the values a... | stackexchange_codegolf |
Introduction
Suppose you have a list of lists of integers (or any objects really, but let's stick to integers for simplicity).
The lists may be of different lengths, and some of them may be empty.
Let's write the lists in a tabular format:
[[ 1, 2, 3, 4, 5],
[ 6, 7],
[ 8, 9, 10, 11],
[],
[12, 13, 14... | stackexchange_codegolf |
Challenge
Write a program that applies an injective function which takes an ordered pair of strings as input and one string as output. In other words, each input must map to a unique output.
Specifics
The input may be any two strings of arbitrary length, but will consist only of printable ASCII characters (codes \$[32... | stackexchange_codegolf |
Consider a triangle where the Nth row (1-indexed) is the array of the first N positive integer powers of N. Here are the first few rows:
N | Triangle
1 | 1
2 | 2 4
3 | 3 9 27
4 | 4 16 64 256
5 | 5 25 125 625 3125
...
Now if we concatenate those powers into a single sequence, we get OEIS A075363:
1, 2, 4, 3, 9, 27, 4... | stackexchange_codegolf |
Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1.
To determine the perfectness of a string, you see how many sections you can split it into where each section is a palindrome. If there are ambiguities, such as with a... | stackexchange_codegolf |
This challenge is about printing the abacaba sequence of a specific depth.
Here is a diagram of the first 5 sequences (a(N) is the abacaba sequence of depth N, upper/lowercase is just to show the pattern, this is not needed in the output of your program):
a(0) = A
a(1) = aBa
a(2) = abaCaba
a(3) = abacabaDabacaba
a(4) =... | stackexchange_codegolf |
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places.
In traditional compass notation, a string is made up of only 2 of these characters (like NNW or ESE). Here you must also accept strings that contain all 4 (like WNNNSE). Using only 2 symbols allows hu... | stackexchange_codegolf |
Introduction
What you have to do is, given an an ASCII diagram of a chemical, output the chemical formula.
Rules
Your code must not access the internet and may not use a stored library of molecules. You may have a library of elements.
You must verify all of the elements included in the formula are real, with all elemen... | stackexchange_codegolf |
The skip-pure numbers are defined with this rule:
A(0) = 1
A(1) = 1
A(n) = the smallest positive number not in the sequence such that A(x) + A(x-2) for any x never appears
For example, the term A(2) is 2, because 1 has already appeared. The term A(3) is 4, as A(2) + A(0) = 3 and 3 is disallowed by the third line of th... | stackexchange_codegolf |
Challenge is to write a function/program which outputs a truthy or falsey value alternately each time you call it. No input.
It can start with either true or false.
| stackexchange_codegolf |
Slope fields or direction fields, are a graphical representation of the solutions to a first-order differential equation of a scalar function. A slope field shows the slope of a differential equation at certain vertical and horizontal intervals on the cartesian plane, and can be used to determine the approximate tangen... | stackexchange_codegolf |
The code has a lot of names, but is very simple:
1 2 3 4 5
1 A B C D E
2 F G H I J
3 L M N O P
4 Q R S T U
5 V W X Y Z
A letter is coded by its coordinates, with the row first, then the column. Ex:
M = 3, 2
V
1 2 3 4 5
1 A B C D E
2 F G H I J
>3 L M N O P
4 Q R S T U
5 V W X Y Z
Note the letter 'K' i... | stackexchange_codegolf |
The Prisoner's Dilemma, but with 3 choices, and the payoffs are random!
Each round, your bot recieves a 3x3 grid and chooses a row to play. The grid might be this:
4 5 7
3 1 9
9 9 0
Each number in the grid is between 0 and 10 (inclusive). Your score for the round is grid[your_play][their_play], and your oppone... | stackexchange_codegolf |
Write two code fragments, which we will call s_zero and s_one.
Program (l, n) consists of l copies of s_zero and s_one corresponding with the digits of n in binary, padded with s_zero on the left.
For example, if s_zero = foo and s_one = bar then
Program (4, 0) = foofoofoofoo
Program (4, 1) = foofoofoobar
Program (4, 2... | stackexchange_codegolf |
Given a word list, find all sets of five words of five letters each, such that the words of each set have 25 distinct letters in total.
This challenge was inspired by this video by Matt Parker.
Testcases
Use this file if you want to test your code against the English vocabulary. Sample output sets:
["fjord", "vibex", ... | stackexchange_codegolf |
I'm surprised this hasn't been done yet, but here we go.
Create a program which prints some number of 1s (ideally as large as possible) before halting.
The rules are simple:
Your program is bounded to 50 bytes in size.
Your output must only be a continuous row of 1s (plus trailing newline if it has to be added), withou... | stackexchange_codegolf |
Most square numbers have at least 1 different square number with which their Levenshtein distance is exactly 1. For a given square \$x\$, each square that meets this condition is called a Levenshtein neighbour of \$x\$. For example, \$36\$ is a Levenshtein neighbour of \$16\$, as only 1 edit (\$1 \to 3\$) is required. ... | stackexchange_codegolf |
Given an positive integer as input determine if it is a magnanimous number.
A magnanimous number is a number such that any insertion of a + sign between any two digits in base 10 results in an expression of a prime integer.
For example 40427 is magnanimous because
4+0427 = 431 is prime
40+427 = 467 is prime
404+27 ... | stackexchange_codegolf |
The task
Your program will be given the following inputs: a number n, and an array of n positive integers. Your program only has to work when n=1000.
The program must do the following:
If the input array is a permutation of the range [1, 2, …, n], output Huh!?
Otherwise, return a three-element array [i, j, n], where i... | stackexchange_codegolf |
Thunno 2 is a stack-based golfing language with around 400 commands (achieved through overloads) created by me, The Thonnu.
It seems like a good idea to share some tips for golfing in Thunno 2.
Please, one tip per answer, and no tips like “remove comments and whitespace”.
Links:
Tutorial
List of commands
Attempt This... | stackexchange_codegolf |
Your task is to take \$n \ge 2\$ points in 3D space, represented as 3 floating point values, and output the Euclidean distance between the two closest points. For example
$$A = (0, 0, 0) \\ B = (1, 1, 1) \\ C = (4, 0, 2)$$
would output \$\sqrt3 = 1.7320508075688772...\$, the distance between \$A\$ and \$B\$.
The Euclid... | stackexchange_codegolf |
Construct a full program which outputs Hello, World!. The score of your submission will be equal to the sum of all of the ASCII values of the distinct characters. The lowest score wins!
Rules
It must be a full program which takes no input
It must only print to STDOUT, nothing else
It must be strictly less than 1000 by... | stackexchange_codegolf |
Codegolf the hamming code (with distance equals 3)!
The sequence looks like this: 0, 7, 25, 30, 42, 45, 51, 52, 75, 76, 82, 85, 97, 102, 120, 127, 385, 390, 408, 415, 427, 428, 434, 437, 458, 461, 467, 468, 480, 487, 505, 510, 642, 645, 667, 668, 680...
Task
Given n output the first n items in OEIS sequence A075926. Y... | stackexchange_codegolf |
There have of course been challenges to render ASCII art fonts here and there. This challenge doesn't add anything to those. In contrary, it subtracts from them for a good reason. If you allow all characters,
it's a lot of boring work
the task is mainly about clever compression of the font and short extraction
This o... | stackexchange_codegolf |
The goal of this challenge is to create a program that takes in a matrix and outputs its reduced row-echelon form.
A matrix is in reduced row-echelon form if it meets all of the
following conditions:
If there is a row where every entry is zero,
then this row lies below any other row that contains a nonzero entry... | stackexchange_codegolf |
We have X Girls and Y Boys in a class. If more girls sit together they will not behave. Similarly if more boys sit together they will not behave.
Write a program/algorithm to get maximum same gender that will be seated if seating is done to efficiently to get them behave.
Example 1: 5 girls and 1 boy
Expected Output: ... | stackexchange_codegolf |
Index sum and strip my matrix
Given a matrix/2d array in your preferable language
Input:
The matrix will always have an odd length
The matrix will always be perfectly square
The matrix values can be any integer in your language (positive or negative)
Example:
1 2 3 4 5 6 7
2 3 4 5 6 7 8
3 4 50 6 7 8 ... | stackexchange_codegolf |
Your program must accept as input six numbers, which describe a triangle - for example, the inputs 80, 23, 45, 1, 76, -2 describe a triangle with vertices (80, 23), (45, 1), and (76, -2). The input must be given as six plain real numbers or as a list of six real numbers, in the order given in the example. Your task is ... | stackexchange_codegolf |
You need to implement immutable dictionaries using only functions without any other data types (custom or built-in).
The dictionary must be indexed by any data type of class Eq and contain values of arbitrary type, but all the values in a dictionary should be of the same type.
Here are some examples of usage:
dict `acc... | stackexchange_codegolf |
Fizz Buzz is a common challenge given during interviews. The challenge goes something like this:
Write a program that prints the numbers from 1 to n. If a number is
divisible by 3, write Fizz instead. If a number is divisible by 5,
write Buzz instead. However, if the number is divisible by both 3 and
5, write FizzBuzz... | stackexchange_codegolf |
Program
Write a program to display repeating terms of a given sentence.
Explanation
The program must output the repeating terms of two or more letters from the given input (input is a sentence separated by spaces without any punctuation except the full-stop indicating the end.) Repeated terms may not span across or in... | stackexchange_codegolf |
2fuck is a simple 2D variation on brainfuck. Like traditional brainfuck, there is an 1D memory tape that extends 30000 bytes to the right from its beginning, consisting of values between 0 and 255.
Arithmetic should wrap around, adding 1 to 255 sets the cell to 0, and moving right from memory cell 29999 should move the... | stackexchange_codegolf |
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... | stackexchange_codegolf |
Given a decimal integer n as input, output the smallest (in terms of absolute value) decimal integer m such that the absolute value of n-m is a binary integer (composed only of 1s and 0s).
n and m can be any integer, positive or negative.
Example
Let n = 702. The closest binary integer is 1000 = |702 - (-298)|, so m = ... | stackexchange_codegolf |
I'm looking for a program such that, given a finite list of strings, can find short regexes to match exactly all of them and nothing else.
Since there are multiple languages that express regexes differently, there can correspondingly be multiple regex generators. Each answer must discuss regex generation in one langaug... | stackexchange_codegolf |
The Kempner series is a series that sums the inverse of all positive integers that don't contain a "9" in their base-10 representations (i.e., \$\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + .. + \frac{1}{8} + \frac{1}{10} + ...\$).
It can be shown that, unlike the Harmonic series, the Kempner series converges (to a value ... | stackexchange_codegolf |
Disclaimer: The story told within this question is entirely fictional, and invented solely for the purpose of providing an intro.
I have a friend who is an architect, and, after explaining the concept of code-golf and this site to him, he said that I should code something actually useful for a change. I asked him ... | stackexchange_codegolf |
This prompt asked you to convert back and forth to factoradic, but is very limited in scope (only decimal integers from 0 to 10!-1). Your task in this challenge is to reach just a bit further and fully implement conversion between factoradic and any other integer base.
The factoradic system is extended to the reals by ... | stackexchange_codegolf |
I am quite proficient in C++ and Java and want to learn competitive programming to participate in contests like Google codejam and other online contests held on sites like CodeChef and Codeforces. I would like to get information about any free resources including websites and courses to learn the "sport". Book suggesti... | stackexchange_codegolf |
Chat room: https://chat.stackexchange.com/rooms/106513/easter-bunny-challenge
Git repo: https://github.com/AJFaraday/easter_bunny_hunt
The garden is a 2-dimensional grid with 49 rows and 49 columns.
The Easter Bunny™️ is in the center of the garden, minding his own business, holding on to 100 Easter eggs. He'll hop awa... | stackexchange_codegolf |
Randomness is fun. Challenges with no point are fun.
Write a function that, given integer input n, will output a set (unordered, unique) of exactly n random integers between 1 and n^2 (inclusive) such that the sum of all integers is equal to n^2.
Randomness does not have to be uniform, provided each valid set has a non... | stackexchange_codegolf |
You work for a social media platform, and are told to create a program in a language of your choice that will automatically flag certain post titles as "spam".
Your program must take the title as a string as input and output a truthy value if the title is spam, and a falsey value if not.
To qualify as non-spam, a title... | stackexchange_codegolf |
Write a program or a function that accepts the list of outputs from a logic function and outputs the LaTeX code for its truth table.
The inputs should be labeled as lowercase letters a-z, and the output should be labelled as F. The length of list of inputs will always be shorter than 2^25, which means that number of in... | stackexchange_codegolf |
For this challenge, you will be given a long string as an input. With this string, you must create a dictionary.
Details:
This dictionary will contain all the words from the string - a word being any sequence of letters surrounded by non-letter characters (ASCII). Letter case of the entries of the dictionary should alw... | stackexchange_codegolf |
For the purposes of this challenge a substring \$B\$ of some string \$A\$ is string such that it can be obtained by removing some number of characters (possibly zero) from the front and back of \$A\$. For example \$face\$ is a substring of \$defaced\$
\$
de\color{red}{face}d
\$
This is also called a contiguous substri... | stackexchange_codegolf |
We often get restricted-source questions here on PPCG that favour submitting solutions using only a subset of characters (sufficiently so that there's a tag printable-ascii that identifies a particular subset of those challenges). Wouldn't it be nice if we could automatically cut languages down to a subset of their nor... | stackexchange_codegolf |
Given a unicode character C (or the first character of a string input), output that character's hex representation. Case does not matter. The output ranges from \u0000 to \u9999.
Test cases
A => 41 (65_10 === 41_16)
ʣ => 2A3 (675_10 === 2A3_16)
Ω => 3A9 (937_10 === 3A9_16)
7 => 37 (55_10 === 37_16)
(null byte) => 0 (... | stackexchange_codegolf |
It's August 10th, 2019, but your task still involves Y2K. Weird, right?
Create a program that prints itself, with a two digit number appended to it. The first time you run it, it should append 00 to its output (its source code, because this is a quine variant). When you run that output, the original program without a t... | stackexchange_codegolf |
Create a program which prints the amount of characters its source has in English words.
If your program is nine letters long it should print "nine".
Capitalization is ignored: in case you're printing "one" (somehow) you can print "one", "oNe", "ONE" or anything else.
Base ten is required.
Proper spacing is also require... | stackexchange_codegolf |
I recently ordered some new and colorful tiles to replace my boring old white tiling for my kitchen. However, when the tiles arrived, they were all in a weird shape! Therefore, I need a program to figure out how to arrange the tiles so that I need to use as few of my old boring white tiling as possible.
Even though t... | stackexchange_codegolf |
Inspired by this.
Background
The evil farmer has decided to burn your wheat field down in order to drive up the prices. To ensure total destruction, he has also soaked your field in gasoline. Even more unfortunately, you happened to be walking on the field when it was lit on fire, and you must get out quickly to surviv... | stackexchange_codegolf |
One reason why ISO8601 is the best date string format, is that you can simply append as much precision as you like. Given 2 integers representing seconds and nanoseconds that have passed since 1970-01-01T00:00:00, return an ISO8601 string as described below.
Output:
The standard output format without timezone looks lik... | stackexchange_codegolf |
Background
The traveling salesman problem (TSP) asks for the shortest circuit that visits a given collection of cities. For the purposes of this question, the cities will be points in the plane and the distances between them will be the usual Euclidean distances (rounded to the nearest integer). The circuit must be "... | stackexchange_codegolf |
Context
If a0 and b0 are two decimal numbers, with a and b representing the decimal expansion of all digits but the least significant one, then we know that
$$\frac{a0}{b0} = \frac{a{\not\mathrel0}}{b{\not\mathrel0}}= \frac{a}{b}$$
Phony fraction
A phony fraction is a fraction where the numerator and denominator share ... | stackexchange_codegolf |
Given two non-negative integers e.g. 27, 96 their multiplication expression would be 27 x 96 = 2592.
If now each digits is replaced with a symbol, such that
two digits are replaced with the same symbol if and only if they are equal
we could get something like AB x CD = AECA or 0Q x 17 = 0Z10 or !> x @^ = !x@!.
(follo... | stackexchange_codegolf |
Introduction
Brainstract, a newly created dialect of Brainfuck adds a bit more elements to the syntax. In addition to the normal Brainfuck syntax, there are macros. To define a macro:
{macro_name ++++}
Then use it:
{macro_name} Adds 4 to the current cell
Challenge
Your challenge is to take a valid Brainstract progra... | stackexchange_codegolf |
I want you to make a gui window like this:
* if you're thinking, the [quit] button closes the window
in any language using minimum "different" characters..
AND remember that the gui window must use native widgets instead of custom icons and buttons
like I have Windows 8, so my GUI window looks like this:
If you didn'... | stackexchange_codegolf |
Write a program or function (hereafter "function") that returns or prints the source code of four new functions: Increment, decrement, undo, and peek.
The initial function contains an internal integer value of 0. Each of the returned functions contains a value based on that value, and each behaves differently:
Increme... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.