instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Your program is given a string consisting entirely of lowercase letters at STDIN (or closest alternative). The program must then output a truthy or falsey value, depending on whether the input is valid romaji.
Rules:
It must be possible to divide the entire string into a sequence of kana without any leftover characte... | stackexchange_codegolf |
So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have fun!
Challenge: write efficiently and securely a program that creates an array of n threads that communicate with each o... | stackexchange_codegolf |
Awhile back I encountered a simple programming puzzle to determine whether a string was a pangram, or a perfect pangram. (Although it's worth noting that this particular challenge gave a different meaning than the standard definition of a "perfect pangram," to mean any sentence where every letter appears n times for so... | stackexchange_codegolf |
Guidelines
Task
Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array (lists in some languages).
Rules
This is code golf so the shortest answer in bytes wins!
You will always get a valid array
There will always be exactly one letter missing
Th... | stackexchange_codegolf |
Challenge
Given a positive integer \$N \ge 3\$, generate an alternating series of \$N\$ random numbers within the range \$[1, N]\$, such that their sum equals \$N\$. Expressed mathematically as
$$N = \sum_{i=1}^{N} (-1)^{i-1} a_i$$ where \$a_i \in [1,N]\$ are random terms.
Input
\$N\$
Output
A string representing the ... | stackexchange_codegolf |
Challenge
An ascii string is made 'dank' when exactly one space is inserted between any two consecutive letters and all capital letters are replaced with lowercase ones. In this challenge I would like you to write a program that takes a string (not necessarily 'dank') as input and outputs a 'dank' version of that strin... | stackexchange_codegolf |
So, this is a task from one very popular educational site in Russia:
https://acmp.ru/index.asp?main=task&id_task=786&ins=1
Mathematically, you need to find the power of two not exceeding the given number, read from the standard input stream, and output their difference in the standard output stream.
My python3 solution... | stackexchange_codegolf |
Well I think it is about time we have another proof-golf question.
This time we are going to prove the well known logical truth
\$(A \rightarrow B) \rightarrow (\neg B \rightarrow \neg A)\$
To do this we will use Łukasiewicz's third Axiom Schema, an incredibly elegant set of three axioms that are complete over proposit... | stackexchange_codegolf |
Write a program that takes a string as input and modifies it by reversing the string in its place by mirroring the position. The first position goes to last, second to second last and so it goes on. In simple words, the string would be mirrored.
"In Place" means the program should use \$O(1)\$ additional memory regardl... | stackexchange_codegolf |
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... | stackexchange_codegolf |
New to code golf and enjoying it. I have a problem that I cannot figure out and am curious if others can solve it.
Start with two dictionaries, y and z:
y = {'a': 1, 'c': 3, 'e': 5, 'g': 7}
z = {'b': 2, 'd': 4, 'f': 6, 'h': 8}
y and z both map length-1 strings to numbers, where each number is between 1 and 26 (inclusi... | stackexchange_codegolf |
Intro
Blur's song Girls & Boys featured the lines
girls who are boys who like boys to be girls
who do boys like they're girls, who do girls like they're boys
in the chorus. These lines have a pretty uniform structure: you have a subject, which is either girls or boys, a relative clause, either who are, who like, or wh... | stackexchange_codegolf |
Logic gates are functions which perform basic logic operations. In this problem, we will account for the following 6 logic gates: AND, OR, XOR, NAND, NOR, and XNOR. Each of these takes two boolean inputs \$ a \$ and \$ b \$, and outputs a boolean. Below are the truth tables which show the output of each gate given two ... | stackexchange_codegolf |
Background
A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be interpreted as "stupid pointless annoying mail".
Challenge
Given a string a, and a word t, capitalise the correct letters of the w... | stackexchange_codegolf |
Introduction
In Tennis, the server alternates serving on the left side or the right side of the court every point, starting on the right. It is possible to figure out which side to serve on for that point just based on the score; if there have been an even number of points you serve on the right, and after an odd numbe... | stackexchange_codegolf |
Input is a single integer in ascending digit order.
The only valid inputs are:
12
123
1234
12345
123456
1234567
12345678
123456789
The only valid output is an array (set; list) of length equal to the factorial of input:
Input - Factorial of input - Output array length
12 -> 1*2 -> 2
123 -> 1*2*3 -> 6
1234 -> 1*2*3*4 ->... | stackexchange_codegolf |
Write a program or function that takes in a nonempty list of mathematical inequalities that use the less than operator (<). Each line in the list will have the form
[variable] < [variable]
where a [variable] may be any nonempty string of lowercase a-z characters. As in normal math and programming, variables with the s... | stackexchange_codegolf |
In light of today's date...
A factorial of a number n, is the product of all the numbers from 1 to n inclusive.
The Challenge
Given an integer n where 0 <= n <= 420, find the sum of the digits of n!. It's that simple :P
Notes: I feel like this challenge isn't too simple, as some languages have a very hard time storing ... | stackexchange_codegolf |
The Challenge:
Just as the title says, your challenge is to use the printable ASCII characters to create a program that prints out a random polygon in the terminal based on the number of sides, n provided by the user, where n is an integer in the range 3 -> 10 including 3 and 10, in as few bytes as possible.
For exampl... | stackexchange_codegolf |
The sequence discussed in this challenge is a variant of the Descending Dungeons sequence family. Specifically, the sequence generation rules:
(A_b = A's base 10 representation read as a base b number, A = A_10)
A(0) = 10
A(n) = 10_(11_(12_(...(n+9)_(n+10))))
Your goal is to make a program which accepts a nonnegative ... | stackexchange_codegolf |
Background
You are planning your trip away from the Diamond City, and must travel through Diamond Road. However, Diamond Road branches away from Diamond City to different locations.
Out of curiosity, you'd like to measure the total distance of unique roads used for all paths.
We define a path as a string that only cont... | stackexchange_codegolf |
Background
We define the two types of chain to be a string that contains only dashes, "-", or only underscores, "_". We link two chains using one equals sign, "=".
Criteria:
The type of chain must change following an equals sign.
You must link the chains, you can do so multiple times, and it does not matter what lengt... | stackexchange_codegolf |
Given a string l, find all palindromic substrings p of l (including duplicates and single character strings). Next, rearrange all sub-strings in p into a valid palindrome (there may be multiple correct answers). If it is not possible to rearrange p into a single palindrome, your program may have undefined behavior (err... | stackexchange_codegolf |
Your challenge is to translate a Cubically cube-dump to the format specified in this challenge.
Input
The input will represent a Rubik's Cube, formatted how Cubically prints its memory cube at the end of every program.
This is a solved cube:
000
000
000
111222333444
111222333444
111222333444
555
555
5... | stackexchange_codegolf |
Rocket Bots
The year is 3024. People have become too scarce a resource to risk in war, so combat has shifted to the robots. Your task is to construct a bot like no other, who's rockets will rain destruction down on your foes and shoot down all incoming threats.
Gameplay
Bots
Gameplay takes place on a 10x15 grid. Your b... | stackexchange_codegolf |
In Elixir, (linked) lists are in the format [head | tail] where head can be anything and tail is a list of the rest of the list, and [] - the empty list - is the only exception to this.
Lists can also be written like [1, 2, 3] which is equivalent to [1 | [2 | [3 | []]]]
Your task is to convert a list as described. The ... | stackexchange_codegolf |
A "triplet bracket" (that I made up for this challenge) is one of the following:
(...+...)
[...:...]
{...|...}
<...-...>
A balanced triplet bracket string (BTBS for short) is either an empty string, two BTBSes concatenated, or one of the above triplet brackets with each ... replaced with a BTBS.
Your task is to write ... | stackexchange_codegolf |
There is a challenge Let's play tennis by Daniel. He proposes to place a court in the North-South direction. My proposal is to create a court to play tennis in the East-West direction too.
You have to print a tennis court, but you have to do it in the fewest bytes possible because of confidential reasons.
Tennis court... | stackexchange_codegolf |
The riddle
In yesterday's newspaper, I found a puzzle in which a Rook should start in the lower-left corner of a 12x12 checkerboard and then, during a round trip, visit each field exactly once except for a selection which must be avoided. The puzzle came with a picture that identified the fields to be avoided as black:... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
Inspired by https://xkcd.com/835
In the midst of his mid-life crisis, Santa has impulsively purchased a Sports Sleigh™ for present delivery this year. The only problem is that this sleigh has a specially designed Infinite Present Trunk... | stackexchange_codegolf |
Balanced binary search trees are essential to guarantee O(log n) lookups (or similar operations). In a dynamic environment where a lot of keys are randomly inserted and/or deleted, trees might degenerate to linked lists which are horrible for lookups. Thus there are various kinds of self-balancing binary trees that cou... | stackexchange_codegolf |
In a challenge of CodingGame, there is a challenge that ask you to decode a string composed by reversed words ('Hello world' > 'olleH dlrow') then each characters converted into ascii value separeted by space:
>>> decode('111 108 108 101 72 32 100 108 114 111 119 32 41 58')
Hello world :)
The challenge is to be the fa... | stackexchange_codegolf |
Background
Here in the UK1, these are the income tax rules:
You get a personal allowance (untaxed) of up to £12,570:
If you earn less than £100,000, you get the full £12,570 as personal allowance
For every £2 over £100,000, your personal allowance goes down by £1
After the personal allowance, the next £37,700 is ta... | stackexchange_codegolf |
In Bgil Midol's question, the score of a sequence of slice is defined as
sumof|startslices|∗2+sumof|endslices|∗2+sumof|stepslices|∗3
Such scoring method makes multiple slices possibly take less score, e.g.
[::25] 75
[::5][::5] 30
Given the length of a string, an upper bound of number of slices1, and the one slice i... | stackexchange_codegolf |
Challenge
Construct n strings, each with three distinct letters, chosen randomly with equal probability.
Print the proportion k/n where k is the number of strings such that all three characters are in ascending order. Print also those k strings.
Input
The only input is n (and thus it must be a positive integer).
Ou... | stackexchange_codegolf |
An easy way to understand the unit n-dimensional hypercube is to consider the region of space in n dimensions that you can get if every coordinate component lies in [0, 1]. So for one dimension it's the line segment from 0 to 1, for two dimensions it's the square with corners (0, 0) and (1, 1), etc.
Write a program or ... | stackexchange_codegolf |
Introduction
A code page maps integer values to a specific character. We can visualize a code page like this:
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+... | stackexchange_codegolf |
Introduction
The Boids Algorithm is a relatively simple demonstration of emergent behavior in a group. It has three main rules, as described by its creator, Craig Reynolds:
The basic flocking model consists of three simple steering behaviors which describe how an individual boid maneuvers based on the positions and ve... | stackexchange_codegolf |
While implementing polynomial multiplication in Itr I found the following interesting operation on strings
To compute the convolution of two strings (for instance Hello and World) first combine all pairs of letters with indices that add up to the same number
(ordered by the index of the first element)
0 -> "HW"
1 -> "... | stackexchange_codegolf |
Similar to the images on allrgb.com, make images where each pixel is a unique color (no color is used twice and no color is missing).
Give a program that generates such an image, along with a screenshot or file of the output (upload as PNG).
Create the image purely algorithmically.
Image must be 256×128 (or grid that ... | stackexchange_codegolf |
Note: this is my first post here.
The Challenge
The challenge is to count the number of chocolate chips in a cookie. A cookie in this case is a circle with dots (the chips) in it. Given any square cartoon image of this cookie, you are to write a bot that counts and outputs the number of chocolate chips.
Rules
Has to t... | stackexchange_codegolf |
A quotation is "the repetition of one expression as part of another one". In American English, a quotation is surrounded by double-quotation marks ("), as in the previous sentence. However, this rule differs when a quote appears inside another quote. In this case, the inner quote is surrounded by single-quotation marks... | stackexchange_codegolf |
The Challenge
I was looking into small code examples for a specific language as a small tutorial and came accross a simplified Blackjack that should be implemented. In this Challenge you will have to implement a full Blackjack game, with 5 Decks.
The Game
You are playing against a Dealer and he has 5 Decks of Poker pla... | stackexchange_codegolf |
Given an array of positive integers, output an array of all the elements that are greater than or equal to the adjacent ones. Most elements will have two adjacent elements; the first and last element are special cases, as they only have one adjacent element.
You may assume that the array contains at least two elements.... | stackexchange_codegolf |
Why a Simulator?
Kids these days don't have the time nor the ambition to actually go and stack boxes on the see-saw or play around with balancing physical objects. This leaves lots of room in the software market for a Lever Simulator which will, according to my models, sell like mad!
Programming Help Wanted
I've filed ... | stackexchange_codegolf |
In this game of cops and robbers, each cop will make a vault: a program that stores a secret, and requires a key to unlock. The robbers should find a way to get the vault to reveal its secret without knowing the key.
Cop rules
Cops will write two short segments of code:
A vault, which takes a key and secret, then allo... | stackexchange_codegolf |
If you place a knight on any square of a chessboard, what is the smallest amount of steps to reach every position?
Rules
It is an 8 by 8 board.
The knight starts at an arbitrary position, taken as input.
The knight moves 2 squares in one direction and 1 square in the other, for example, a knight on the square marked N... | stackexchange_codegolf |
Given a matrix like this:
1 1 3 -2
3 -4 1 -1
1 1 1 0
0 -1 0 0
By taking a 2×2 "sliding sum", where the sum of every 2×2 region of the matrix is one element of the resulting matrix, we get:
1 1 1
1 -1 1
1 1 1
We can do this for sliding windows of any size. For example, a 1×3 sliding sum of the same input ... | stackexchange_codegolf |
In this challenge you will take as input a non-empty list of binary values (these can be booleans or integers on the range 0-1), you should output all the ways to partition the list into non-empty sections such that no two adjacent equal values in the initial list are separated into different sections.
For example if t... | stackexchange_codegolf |
Description
Here's a very superstitious hotel elevator in Shanghai:
It avoids the number 13, because thirteen is unlucky in the Western world, and it avoids the digit 4, because four is unlucky in parts of Asia. What if this hotel was taller?
Read a positive even integer n from STDIN, representing the n... | stackexchange_codegolf |
As in this challenge, the task is to generate the vertices of a polyhedron. The polyhedron here is the one obtained by dividing a regular icosahedron's triangular faces into smaller triangles so that each edge is divided into \$b\$ segments (denoted \$\{3,5+\}_{b,0}\$ here) and projecting onto the unit sphere. Your pro... | stackexchange_codegolf |
Let's parse and process Key-Language! Given the input of a sequence of keyboard keypresses and/or special keys, write a program, function, etc. that outputs the product when all the actions are processed based on the following keyboard:
+-------------------------------------------------------+
| ~ | ! | @ | # | $ | % |... | stackexchange_codegolf |
She said s(he) be(lie)ve(d), he said sbeve.
Input
A non-empty string, s. It's guaranteed that s will have only printable ASCII characters and at least one word (defined as [A-Za-z0-9]+) in parentheses, and all parentheses will be closed respectively.
Output
A string containing all non-whitespace characters (whitespa... | stackexchange_codegolf |
The Typical Way to Make an Acronym Out of a Phrase Is to Take the First Letter of Each Word: TTWMAOPITFLEW. howeveR, sometimEs, you can make an acronym of random leTters In a seNtence such As like this: RETINA. The only condition is that the letters have to be in the correct order. For instance:
LORD can be acronymise... | stackexchange_codegolf |
Objective
Find out how many possible (unique) paths you can take to get from the top left of a NxN grid to the bottom right.
The program will receive either 1 integer (or 2 for -20 points bonus) as input for the gridsize.
Input has to be anywhere in the range of 1..2000.
Output will be a string containing the number of... | stackexchange_codegolf |
Alternate Title: Tally Your Prison Sentence on the Wall
Given a number n, output tallies grouped into the traditional 5-per-group and 50 per row.
Examples
1
|
|
|
|
4
||||
||||
||||
||||
5
|||/
||/|
|/||
/|||
6
|||/ |
||/| |
|/|| |
/||| |
50
|||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/ |||/
||/| ||/| ||/| ||/| ||/... | stackexchange_codegolf |
Robbers' Thread
Your challenge is to find an existing challenge, and implement it in a way such that certain inputs fail. At least one input must not produce the correct output (use the other submissions on the challenge as a reference for this, but be sure to double-check). This must fail consistently, and you must kn... | stackexchange_codegolf |
It is fairly simple to, given a number n, create a range from 0 to n-1. In fact, many languages provide this operation as a builtin.
The following CJam program reads an integer, and then prints out such a range (Try it online!):
ri,
Notice that it prints out numbers without a separator.
The Challenge
Your task is to r... | stackexchange_codegolf |
Write an interactive program or function which allows the user to play The Coinflip Game! The object of the game is to repeatedly flip a coin until you get the same result \$n\$ times in a row.
Specific behavior of the program/function is as follows:
At the start of the game, the user inputs a positive integer \$n>1\$... | stackexchange_codegolf |
Inspiration
Given a positive integer \$1 \le n \le 9\$, output all positive \$n\$-digit integers \$i\$ for which the following is true:
Each digit from \$1\$ to \$n\$ appears exactly once in \$i\$. Therefore, \$i\$'s digits are a permutation of the digits from \$1\$ to \$n\$.
\$i\$ is divisible by \$n\$
Removing the r... | stackexchange_codegolf |
Background
In Scrabble, players take turns placing tiles on a grid so that each contiguous set of (more than one) tiles in every row and column makes a word. In one play, tiles can be placed anywhere in a single row or column as long as there is a contiguous set of tiles that includes all of the ones placed.1 A word is... | stackexchange_codegolf |
Disclaimer: ModTen is a fictional card game which was created for the sole purpose of this challenge.
The rules of ModTen
ModTen is played with a standard 52-card deck. Because the full rules are yet to be invented, we're going to focus on the hand ranking exclusively.
A winning hand in ModTen. Graphics from Wikipedia... | stackexchange_codegolf |
When I was in grade 3, we were taught how to solve a very simple math problem. It was equaling the denominators of two or more fractions.
Let's take two proper fractions:-
$$
\frac{1}{2},\frac{2}{3}
$$
First we will take the Least Common Multiple of the denominators of the two fractions, the LCM of \$2,3\$ are \$6\$. T... | stackexchange_codegolf |
A doubling sequence is an array of numbers where each subsequent number is at least twice the previous number.
Given an ordered list of numbers, determine if the numbers in the list (\$n_{x}\$) have the property that:
\$n_1 \times 2 \le n_2\$
\$n_2 \times 2 \le n_3\ ...\$
and so on until reaching the end of the list.
I... | stackexchange_codegolf |
Task
Write a function/program that, given three positive integers a, b and c, prints a Truthy value if a triangle (any triangle) could have side lengths a, b and c and outputs a Falsy value otherwise.
Input
Three positive integers in any sensible format, for example:
three distinct function arguments, f(2, 3, 5)
a lis... | stackexchange_codegolf |
The objective is to print a graph from an array of numbers, of the design below. Printing the X and Y scale exactly as in the "design", with padding, is part of the challenge. The input array of numbers can be of virtually any range of integers in X and Y, but not 0 and not negative - though I would suggest keeping it ... | stackexchange_codegolf |
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... | 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 |
Inspired by Digits in their lanes
Input:
An ASCII-art of width ≤ 11, consisting of spaces and #. (You can choose any two distinct characters instead.) Example:
#
###
#
#
# #
# #
# #
# ### #
# ### #
###########
# #
# #
# ### #
# ... | stackexchange_codegolf |
Based on a comment by Jo King on my previous question (called 'Inverse-quotes-quine'), I present this new question. The rules are similar, but just, the opposite:
If your program is run normally, all of the code not in the speech marks (" - double quotes) should be printed.
If your program is wrapped in double quotes ... | stackexchange_codegolf |
Two strings are "Caesar equivalent" if the distance (counting up) between the corresponding characters are the same. Yes, I made this term up. Here's an example:
"Abc" and "Cde" are equivalent because
distance from a-c == 2
distance from b-d == 2
distance from c-e == 2
The capitalization doesn't make any difference.
"... | stackexchange_codegolf |
Context
After attempting to program in Grass for the entire morning, you decide to go outside and mow some real grass. The grass can be viewed as a string consisting exclusively of the following characters: wWv. w denotes tall grass which takes \$ 1 \$ unit of energy to mow. W denotes extremely tall grass which takes \... | stackexchange_codegolf |
Unsurprisingly, fibonacci primes are primes that are also Fibonacci numbers. There are currently 34 known Fibonacci primes and an additional 15 probable Fibonacci primes. For the purpose of this challenge, the Fibonacci numbers are the sequence \$F_n\$ defined as \$F_1 = 1\$, \$F_2 = 1\$, and \$F_n = F_{n-1} + F_{n-2}\... | stackexchange_codegolf |
Your challenge is very simple: output the previous answer, in reverse.
However, as with this similarly-titled question, there's a catch: in this case, you can only use characters from the answer before the last. For example:
Let's say the first answer looks like this:
1 - Python
print('hi!')
And the second answer loo... | stackexchange_codegolf |
"Bracket" numerals are a type of 'numerals' I made up once, and thought would be a nice challenge here. Basically, you convert the input number into base 6, and then transliterate the 012345 respectively with ()[]{}†, so every 0 becomes (, every 1 becomes ), etc.
You don't have to use ()[]{} per se. As long as you spec... | stackexchange_codegolf |
Your kindly neighbour, Doctor Tree, just gave you three magical creatures called Codémon. There's a battle tournament in the nearby town of Colorville. Are you the very best, like no one ever was?
Overview
This is a battle tournament. Each player controls a team of three monsters, and the objective is to knock out (k... | stackexchange_codegolf |
Risky is a new language of mine, which features an interesting form of tacit programming. In this challenge, you'll take a Risky program as input, and visualize the parsing.
No knowledge of Risky is needed for this challenge, but it's a pretty interesting language so I'd recommend trying it :p.
Task
Risky's parsing is ... | stackexchange_codegolf |
This is the inverse of "Encode the date in Christmas Eve format."
Write a program that takes as input the string Christmas, possibly followed by Eve between 1 and 365 times, and outputs the date encoded in YYYY-MM-DD format, or any format from which the year, month, and date can be easily obtained. Assume that the "Ch... | stackexchange_codegolf |
It's obviously ellipsisessieses.
Inspired by a chat message.
Your challenge
Given a list or space or comma-separated string of words, ellipsisessiesesify them.
To ellipsisessieses-ify a word:
Start with the word.
Add the first letter of the original word to the end.
Add 2 of the last letter of the original word to the... | stackexchange_codegolf |
I've been a fan of My Little Pony: Friendship Is Magic for a long time, and very early on I created a pony version of myself also called Parcly Taxel (warning: may be too cute to look at). The symbol below is her "cutie mark", which you will be drawing here:
Construction
All key points of the cutie mark lie on a rotat... | stackexchange_codegolf |
It is common to need to make a page selection interface. It typically looks like this:
prev 1 ... 3 4 [5] 6 7 ... 173 next
Which means there are totally 173 pages, and you are on the 5th page currently.
This challenge requires you take the total number of pages and the current page number as input, and output a string... | stackexchange_codegolf |
Robbers post
A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:
Split the string into equal sections.
Reverse the strings, and starting from the start of each string.
Pu... | stackexchange_codegolf |
Input
The input will be a year between 1583 and 2239. We just want to know when Hannukah was or will be in that year. This is information used by millions of people every year and put in calendars across the world. What could be easier?
Output
The Gregorian date of the first evening of Hannukah that year. That is the ... | stackexchange_codegolf |
Consider a zero-sum game with 2 contestants. Each round, each contestant chooses, independently of each other, one of \$n \ge 2\$ different choices. Depending on the two chosen choices, one player is awarded an amount from the other player's pot. For example, the following table shows the gains (positive integers) and ... | stackexchange_codegolf |
Read this yng Nghymraeg
Challenge
Given a word in Welsh, output all of the possible mutated forms of the word.
Mutations
A mutation is a change of the first letter of a word when following certain words or in certain grammatical contexts.
In Welsh, the following are considered "consonants":
b c ch d dd f ff g ng h l ll... | stackexchange_codegolf |
According to MDN, every WebSocket message is sent as one or more frames. Your job is to extract the payload given a (masked) client-to-server text frame. The steps to extract the payload is as follows:
ignore byte 1; read byte 2
if it is 254, skip the next 2 bytes
if it is 255, skip the next 8 bytes,
otherwise, conti... | stackexchange_codegolf |
Challenge
Create the image of a progress pride flag.
Output
Dimensions
Rules
Your program must create the image and not just load it from a website
The colours can be just your language's default if it is very difficult / impossible to load RGB values, else they should be: red: (255,0,0), orange: (255,140,0), yello... | stackexchange_codegolf |
Palindromic prime problems are pretty common, but that's not what this question is about. In this challenge, the number doesn't have to be a palindrome, its prime factors do.
Task
Your code has to take a single positive integer as input. Then check if any of the permutations of the prime factors of that integer are pal... | stackexchange_codegolf |
Inspired by this link I found on Reddit.
A FuzzyFinder is a feature of many text editors. As you start to type a file path S, the FuzzyFinder kicks in and shows you all files in the current directory containing the string you entered, sorted by the position of S in the file.
Your task is to implement a fuzzy finder. It... | stackexchange_codegolf |
Related | Related
Given an ASCII art with |, _, and , check if you can draw the art in one stroke.
Description
Your task is, if the ASCII art is representing lines, then check if you can draw the whole art in one stroke, which means:
without drawing an already drawn line again
without lifting and continuing the stro... | stackexchange_codegolf |
Forth is one of the few non-esoteric stack-based languages. For this challenge, we will use a small subset of Forth, which simply executes a sequence of words in a linear fashion — without any definitions or loops.
In good Forth code, each word definition includes a stack effect comment, which explains the layout of th... | stackexchange_codegolf |
For each integer n, 0 or higher, output the lowest power of 2 that has two identical sub-strings of n digits in decimal, and the two indices where the digit sub-strings start (0-based).
n Output Proof (don't output this)
0 => 0 [0 1] (_1 & 1_)
1 => 16 [0 4] (65536 & 65536)
1 =... | stackexchange_codegolf |
Task
The prepend,append-Sequence is defined recursively, like this
a(1) = 1
a(n) = a(n-1).n , if n is even
a(n) = n.a(n-1) , if n is odd
where the . represents an integer concatenation.
So the first few terms are: 1,12,312,3124,53124,531246,7531246,... This is A053064.
Your task is, given an integer a > 0 to return... | stackexchange_codegolf |
Task
The task is to write a script that accepts a number from 1 to 20 inclusive. It will then check if the number has a character that is found in every number that was entered before it. If the number has a character in common it will ask for another number. However if the number does not have a character in common wi... | stackexchange_codegolf |
Let's write the shortest code to perform a simplified variant of the DoD 5220.22-M Wipe Method with only two writing passes.
Any programming language accepted, but the use of disk-wiping-oriented libraries is prohibited.
Here's how we are to implement it in pseudocode:
Set x to 0
[Start]
'Write Pass
For each sector in... | stackexchange_codegolf |
Challenge
This challenge is pretty simple: Output the total number of possible Tweets. Given the fact that \$1{,}114{,}112\$ Unicode characters exist, and Tweets can be up to \$280\$ characters long, we calculate this number like so:
$$\sum_{l=1}^{280}1{,}114{,}112^l$$
Calculated, this number becomes:
13806352273767118... | stackexchange_codegolf |
Imagine a grid where the origin square \$(0,0)\$ is at the top left of the screen, and positive \$x\$ is rightwards whereas positive \$y\$ is downwards. Coloured squares are at various positions on the grid.
In a magical void separate from the grid are multiple snake-like strips of squares, each of a fixed length and a... | stackexchange_codegolf |
Title says it all. Two input 32-bit positive integers m, n >= 2, output gcd(m,n) in prime factorization form.
Input
Command line args or 1 line of stdin okay, whatever's better for golf.
Output
Single space delimited with exponents (no additional spaces). Output nothing if the inputs are relatively prime.
Examples:
$ .... | 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 |
As you probably know, there is a war going on in Ukraine. I noticed that it seems nobody has posted a Ukrainian flag challenge yet, so I thought I'd do it myself in support of Ukraine.
The Challenge
Here is the flag:
The flag is divided horizontally across the middle into two equally sized stripes.
Stripe colors: (0,... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.