instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Originally the Multiplicative digital root
Challenge
Basically do what the title says
Method
Given a positive integer 1 <= N <= 100000000 through one of our standard input methods, multiply every digit together, ignoring zeroes.
Ex: Take a number, say 361218402:
3 * 6 = 18
18 * 1 = 18
18 * 2 = 36
36 * 1 = 36
36 * 8 =... | stackexchange_codegolf |
The Setup
Suppose you're given n fuses, with 1 ≤ n ≤ 5, each of which is a meter long, and where each fuse has an associated burn rate of N meters per D hours.
A fuse can be lit at one or both ends, subsequently extinguished at one or both ends, relit, re-extinguished, etc., as many times as needed until the fuse is fu... | stackexchange_codegolf |
In The Settlers of Catan board game, there are five resource types: Brick, Log, Ore, Wheat, and Sheep. Building a settlement costs a Brick, a Log, a Wheat, and a Sheep. However, you can also trade in four identical resources to get a resource of a different type. For instance, if you had four ores in your hand, you cou... | stackexchange_codegolf |
Consider the 74 characters from the 2016 time capsule string (note the leading space):
!!!!!#$$%&())))*+...1449:=@@@AHILOQQQTTZ\\^`````````eefmpxy{||||~~~~~~~~~
Your task is to write as many programs as possible (in the same language) using these characters. The output of each program must be nonempty. When all of th... | stackexchange_codegolf |
My attempt at stating this question, but with a more objective solving criterion.
Your task is to build a program or function that takes a solved Sudoku grid S in the format of your choice and attempts to generate a problem grid with as few clues as possible that has S as its unique solution. (It doesn't matter what me... | stackexchange_codegolf |
In this challenge you have to make an ascii pulsing heart with rhythm problems (Heart arrhythmia) and then measure the pulse.Don't worry it's easy!
Making the heart
The heart alternates between these 2 states:
state 1
,d88b.d88b,
88888888888
`Y8888888Y'
`Y888Y'
`Y'
state 2
d8b d8b
... | stackexchange_codegolf |
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... | stackexchange_codegolf |
Your task is to make a program that prints out its own source.
"Hey, we already have this challenge, and tons of variations of it! Why are you making another one?" you may ask, but this one is going to be one of the most difficult ones (hopefully, anyway).
Your quine must be "mutation-hardened", which means the quine, ... | stackexchange_codegolf |
Recently, I was introduced to a puzzle game known as Solitaire Chess. I'll summarize the rules here:
The board is a 4x4 checkerboard.
All pieces are the same color (no teams) and all pieces can capture any other piece.
Every move must be a capture. No moving to empty squares.
There must be exactly one piece remaining ... | stackexchange_codegolf |
Given some positive integer n, design a protractor with the fewest number of marks that lets you measure all angles that are an integral multiple of 2π/n (each in a single measurement).
Details
As an output, you may output a list of integers in the range 0 to n-1 (or 1 to n) that represent the position of each mark. Al... | stackexchange_codegolf |
The Dutch system for naming one's ancestors is a lot more interesting than the English version. For English, the sequence goes "parent", "grandparent", "great-grandparent", "great-great-grandparent", "great-great-great-grandparent"; and in Dutch those terms are "ouder", "grootouder", "overgrootouder", "betovergrootoude... | stackexchange_codegolf |
Write a program or function that takes as input three positive integers x, y, and a and returns or outputs the maximum number of whole a✕1 rectangles that can be packed (axis-aligned) into an x✕y rectangle. Although the result will always be an integer, the program need not give the result using an integer type; in pa... | stackexchange_codegolf |
I wrote this function in 48 bytes and I wonder, is there any way to write this code 2 characters shorter?
p=lambda n,c:(n*c)[:n//2]+(n*c)[:n//2+n%2][::-1]
The point of the function is to create a palindrome of length n by using all the characters from the string c. Example: n = 3, c = 'ab'. Result is 'aba'.
Is there s... | stackexchange_codegolf |
Fortress was a language being developed by the Sun Programming Language Research Group (R.I.P. Fortress) that had a unique property to it, it was possible to render ("Fortify") programs in different font-styles (i.e. blackboard bold, bold, italics, roman, etc. ). The goal is to represent a one-char Fortress variable in... | stackexchange_codegolf |
Your function must accept three numbers in any order:
A signed real number (or ±Infinity) - The number (N) for which you have to generate a number from the range
A signed integer - Minimum of the range
A signed integer - Maximum of the range
Input:
The minimum of the range will always be less than the maximum of the... | stackexchange_codegolf |
In R print(x, digits=n) does something a little complicated.
It always shows all the digits to the left of the decimal point and then, if there are any digits to the right it rounds the whole number so that at most n digits are shown. However, leading 0s are not counted. Here are examples to show how the function work... | stackexchange_codegolf |
During work on some project I needed to draw pixels on screen. I found some put-pixel function in JS, but code was quite big and clumsy - so I wonder, how small put-pixel function can be...
Challenge
Create the smallest put-pixel function.
We count size of whole program: initialization code (if needed), function and co... | stackexchange_codegolf |
Heavily inspired by Programming a Pristine World. Also closely related to this challenge.
Let's define a pristine prime as a number which is itself prime, but will no longer be prime if you remove any contiguous substring of N base 10 digits, where 0 < N < digits in number.
For example, 409 is a pristine prime because... | stackexchange_codegolf |
This problem is based on, A337517, the most recent OEIS sequence with the keyword "nice".
\$a(n)\$ is the number of distinct resistances that can be produced from a circuit with exactly \$n\$ unit resistors.
The sequence begins 1, 2, 4, 9, 23, 57, 151, 427, 1263, 3823, 11724, 36048, 110953, 342079.
The goal of this c... | stackexchange_codegolf |
Challenge:
Inputs:
A string containing printable ASCII (excluding spaces, tabs and new-lines)
A boolean †
Output:
The parts of the String are divided into four groups:
Lowercase letters
Uppercase letters
Digits
Other
Based on the boolean, we either output the highest occurrence of one (or multiple) of these four gr... | stackexchange_codegolf |
Please write a program that takes as input two numbers 'day of the month' and 'month number' for any day of this year (2012) and outputs day of the week.
Examples:
% ruby ./golf.rb 14 07 # 14th of July
"Sat"
% ruby ./golf.rb 14 7 # the same
"Sat"
% ruby ./golf.rb 01 12 # Dec 1
"Sat"
% ruby ./golf.rb 31 12 # Last day ... | stackexchange_codegolf |
Every integer can be expressed in powers of 2. You know this as the binary system
Assume you are given a set of k numbers (0 < k < 2^n).
You want to decide for this set whether every integer power of 2 up to 2^(n-1) occurs at least m times
One example:
n = 7 (2^n = 128, )
k = 5
set =
{100,
91,
88,
63,
44}
m = 3
Solut... | stackexchange_codegolf |
Given a list of positive integers such as [69, 420], your challenge is to generate the sequence of numbers that can be formed by concatenating numbers from the above set, in ascending numerical order.
For example, with [69, 420] the sequence begins:
69
420
6969
42069
69420
420420
Note that elements of the sequence sho... | stackexchange_codegolf |
Introduction
A sequence of numbers is passed in as the input. The program has to generate the lowest degree polynomial possible. This was my first programming project in college and it would be interesting to see how much smaller the solution could have been.
Challenge
The input is a list of integers separated by a com... | stackexchange_codegolf |
The J language has a very silly syntax for specifying constants. I want to focus on one cool feature in particular: the ability to write in arbitrary bases.
If you write XbY for X any number and Y any string of alphanumerics, then J will interpret Y as a base X number, where 0 through 9 have their usual meaning and a t... | stackexchange_codegolf |
Imagine this, we have an environment with a global scope containing just a single object, called codegolf. This object has a single child called stackexchange, which has a property called com.
Accessing this property would look like codegolf.stackexchange.com.
The challenge
The input of your program/function will be a ... | stackexchange_codegolf |
Given a variable a (non array) or (any[]) convert to (any[])
function example(s: string | string[]) {
const e = Array.isArray(s) ? s: [s]
return e
}
Is Array.isArray(s) ? s: [s] the shortest way?
| stackexchange_codegolf |
I like my job, but sometimes it can get a bit tedious and boring. As motivation, I want to know how many hours of work are left before I finally get my two days of weekend and relaxation.
I work every day from Monday to Friday, totalling 38.5 hours, starting at 9am and ending at 6pm.
Every day - except Friday - I get ... | stackexchange_codegolf |
Challenge
You find yourself in a bash terminal, and want to do some simple tests
on sqlite3.
So you issue the following command:
echo "CREATE TABLE T (id INT NON NULL PRIMARY KEY)" | sqlite3 test.db
Now you want to insert the first N integers (starting from 0, excluding N) into the table T.
For convenience, you execut... | stackexchange_codegolf |
Your task is to write a program that performs case conversion from plain text, and other case formats, into one of the specified formats below. Inputs will be either plain lowercase text, or one of the detailed cases below. You must remove non-alphabetic characters except (space), _ (underscore) and - (hyphen), then ... | stackexchange_codegolf |
Following the great advice (what do you mean it's not advice?!) on Adding unnecessary fluff we can devise the following task:
Take a list of positive integers and a positive integer \$m\$ as input.
Only keep the prime values from the list.
Define \$f(n) = F_{n^2 + 1}\$ (the \$n^2+1\$-th element in the Fibonacci sequen... | stackexchange_codegolf |
I have previously posted a challenge, smallest number of steps for a knight in chess.
Now I would like to go a step further by adding the possibility to choose your piece.
If you place a piece on any square of a chessboard, what is the smallest number of steps to reach every possible position?
Rules
It is an 8 by 8 bo... | stackexchange_codegolf |
I don't know who coined these words, and I'm not Irish, but I give you an Irish blessing:
May the road rise up to meet you
May the wind be always at your back
May the sun shine warm upon your face
The rains fall soft upon your fields
And until we meet again
May God hold you in the hollow of His hand
I was planning on ... | stackexchange_codegolf |
Given a non-negative integer skyline height list, answer how many uninterrupted 1-unit-high horizontal brush strokes are needed to cover it.
[1,3,2,1,2,1,5,3,3,4,2], visualised as:
5
5 4
3 5334
32 2 53342
13212153342
needs nine brush strokes:
1
2 3
4 5555
66 7 88888
9999... | stackexchange_codegolf |
Given a position with a row of rooks and/or empty spaces, output how many different rook moves are possible. A rook can move left or right to an empty space, but not to one that requires passing over another rook. When a rook moves, the other rooks remain in place.
For example, from this position, 6 moves are possible:... | stackexchange_codegolf |
The purpose of this task is to write a program or function to find the most common substring within a given string, of the specified length.
Inputs
A string, s, of any length and characters that are valid as inputs for your language.
A number, n, indicating the length of substring to find. Guaranteed to be equal to or... | stackexchange_codegolf |
Weirdo Incorporates have a weird way of grading their staffs by the number of days they were present in the office:
0 - 13 : F
14 - 170 : E
171 - 180 : D
181 - 294 : C
295 - 300 : B
301 - 365 : A
Note: The range is inclusive (i.e. 0-13 means 0 days and 13 days both will evaluate
as grade 'F').
Objective:
Write ... | stackexchange_codegolf |
Story
There is a woman, named Sarah, whom likes smooth horse rides. She's going to go for a ride down a path too thin to pass any other horses she may come across - and so that her ride can be as smooth as possible she does not want to have to change speed though she would prefer to get to her destination as fast as p... | stackexchange_codegolf |
From here. Every new game is the first day of the month, 12:00 PM UTC.
The goal is to create the Stack Overflow logo using ASCII characters.
It looks like this.
The exact output should look like this:
\\
\\
\= \\
\= \\
\= \\
\== \\
¯¯¯ \==
¯¯¯... | stackexchange_codegolf |
I have 2 inputs: 1 single number and some numbers separated by whitespace:
1
1 2 3 4 5
I want to loop over the second input, and I don't need the first input. I did this, which works:
input()
for x in input().split():somecode()
But can I go directly to the second input without doing the input() at the beginning or wi... | stackexchange_codegolf |
In this task, you will write a program/function that takes a Normalized Malbolge program and outputs the resulting Malbolge program. (This is a secret tool that all Malbolge programmers are using!)
Input
A data structure that (somehow) represents a Normalized Malbolge program.
Output
A data structure that represents th... | stackexchange_codegolf |
Your task is to write a program which prints following four verses extracted from the lyrics from The Beatles' song "Hey Jude" (© Sony/ATV Music Publishing LLC):
Hey Jude, don't make it bad\n
Take a sad song and make it better\n
Remember to let her into your heart\n
Then you can start to make it better\n
\n
Hey Jude, d... | stackexchange_codegolf |
Premise:
Your reputation is in Stack-Exchange Form if it can be represented by decomposing your medal counts (gold, silver, and bronze counted separately) into their base-10 digits and joining them in any given order, with a few caveats.
While decomposing, each
Gold medal digit is worth three digits.
Silver is worth... | stackexchange_codegolf |
Iterated Function Systems
An Iterated Function System (IFS) is a method of constructing self-similar fractals. Each fractal is defined recursively as the union of several copies of itself, with each copy obtained by applying a transformation function to the whole. The functions are usually affine transformations of the... | stackexchange_codegolf |
The game of Chinese checkers is played on a board with spaces in the shape of a six-pointed star:
Image from Wikipedia
We can create an ASCII-art representation of this board, using . for empty spots and the letters GYORPB for the six colored starting locations:
G
G G
G G G
G ... | stackexchange_codegolf |
Background
Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation to make programming easier and faster.
The challenge
Let's look at snippet written by Joe a moment ago:
0+++++1+++++0[3+... | stackexchange_codegolf |
task
Your task is to build a structure with \$n\$ cubes. The volume of cubes follow the following sequence (bottom -> top)
\$n^3, (n-1)^3, (n-2)^3,...,1^3\$
input
The total volume of the structure (\$V\$).
output
value of (\$n\$), i.e : The total number of cubes.
\$V = n^3 + (n-1)^3 + .... + 1^3\$
notes
Input will a... | stackexchange_codegolf |
Your job is to open a browser window of the default browser to http://codegolf.stackexchange.com.
Your code must open the browser itself, and cannot rely on an open one.
This is code-golf, so the shortest answer in bytes wins.
Moderator note: A large number of answers to this challenge use the URLs http://ppcg.lol or... | stackexchange_codegolf |
Given a positive integer, we can form a new number that's described by its digits taken pairwise (with a leading 0 added for numbers with odd number of digits).
For eg.:
1234 can be read as one 2, three 4s - so, the output for 1234 is 2444.
643 has an odd number of digits, so a leading zero is added to make it even.... | stackexchange_codegolf |
In this challenge, you implement an interpreter for a simple stack-based programming language. Your language must provide the following instructions:
push a positive number
pop two numbers and push their sum
pop two numbers and push their difference (second number - first number)
pop a number and push it twice (dup)
p... | stackexchange_codegolf |
Write the shortest function that returns the content of the first result of a Google search ("I'm feeling lucky").
Example:
lucky('cat');
Might return something like:
<!DOCTYPE html>
<html>
<head>
<title>Cats are cool</title>
<meta charset="utf-8" />
</head>
<body>
<h1>CAAAAAAAAAAATSSSSSSSSSS!!!!!!!!... | stackexchange_codegolf |
Construct a program or function that takes input in form of
<width>, <height>, <color1>, <color2>
and generates an output such that first row alternates between pixels of color <color1> and <color2> with a period of <height>. For each row that follows, the period shall be <height> - <row number>. Note that <color1> a... | stackexchange_codegolf |
In this challenge fake marquee text is text that is shown part by part, in a scrolling-like fashion.
Some examples:
testing 4
t
te
tes
test
esti
stin
ting
ing
ng
g
hello 2
h
he
el
ll
lo
o
foobarz 3
f
fo
foo
oob
oba
bar
arz
rz
z
Something a bit longer 10
S
So
Som
Some
... | stackexchange_codegolf |
Most Unicode characters have full names, for example ” is "RIGHT DOUBLE QUOTATION MARK". You can find a useful reference here, just type in the character you want to find the full name of and look in the DESCRIPTION column.
Your challenge is to write a program or function that outputs itself as a string of these. You c... | stackexchange_codegolf |
Introduction:
You are a worker, who is in charge of managing a set of bridges, connecting a square grid of "nodes":
N - N - N
| | |
N - N - N
| | |
N - N - N
(the grid here is 3 by 3, but they can be larger).
Each of the bridges has a set capacity from 1 to 10, and each of the bridges has a number of cars over... | stackexchange_codegolf |
Given a MM/DD date (12/24) and a start/end date range (11/01 - 06/24), figure out if the date is within the listed date span.
Date ranges can be sequential (05/01 - 11/01) or wrap around to the next year (11/01 - 05/01).
Examples:
12/24 is in 11/01 - 06/24 = True
06/24 is in 11/01 - 06/24 = True
06/24 is in 06/24 - 06... | stackexchange_codegolf |
You work for the military as a coder and are responsible for writing software to control missiles. Your task is to write a program or function that will output a code sequence (any length ASCII string) to launch a missile. The program should be based on a loop taking the code sequence from memory and output it in a par... | 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 |
Python is the fastest-growing major programming language today. It is the most wanted language for the third year in a row, meaning that developers who do not yet use it say they want to learn it.[1]
The reason for Python's popularity is its many versions.[citation needed] There are in fact 116 versions of Python, incl... | stackexchange_codegolf |
Not to be confused with Password Bishop Goodness!
Given a string, answer (truthy/falsy or two consistent values) if it constitutes a password which is strong against bishops.
A password is strong against bishops if it is a string consisting of alternating letters (in a-h) and digits (in 1-8) such that each pair of char... | stackexchange_codegolf |
Background
The Schläfli Symbol is a notation of the form {p,q,r,...} that defines regular polytopes and tessellations.
The Schläfli symbol is a recursive description, starting with a p-sided regular polygon as {p}. For example, {3} is an equilateral triangle, {4} is a square and so on.
A regular polyhedron that has q r... | stackexchange_codegolf |
Introduction
An abstract syntax tree (AST) is a tree of tokens that shows their connection to each other and syntactical meaning. They are commonly used in compilers and static analysis tools, as parsing a language into an AST helps remove any ambiguity and can be helpful for optimizations. Many ASTs are large and comp... | stackexchange_codegolf |
Everybody loves golfing code. Code is written in English (eh...). Therefore, everybody loves golfing English!
Your task is to write a program or function that takes a string as input, and then returns or prints the golfed version. There will be no newlines or tabs in the input.
This is how you golf a string. The order... | stackexchange_codegolf |
This question is inspired by ongoing tournament of "the hooligan's game played by gentlemen", the Rugby World Cup, which has just completed the pool stage. There are 20 teams in the tournament, and they are divided into 4 pools of 5 teams each. During the pool stage each team plays against all the other teams in their ... | stackexchange_codegolf |
Getting the average of a list (e.g [2,6,7])
Get the length of the list: [2,6,7] -> 3
Sum the numbers in the list: 2 + 6 + 7 = 15.
Divide the sum by their count: 15 / 3 = 5.
You should compare the averages of two lists of positive integers N and M, by returning a value if N has a higher average, another value if M ha... | stackexchange_codegolf |
We all know of, or at least have heard of, brainfuck, one of the most famous and influential esoteric languages. While these days most implementations use an infinite tape, the original compiler by Urban Müller had a tape of 30000 cells. A little known fact* is that there is actually a special value at the end of the t... | stackexchange_codegolf |
Consider the following list:
expected = [
'A',
'B',
'AB',
'C',
'D',
'CD',
'ABCD',
'E',
'F',
'EF',
'G',
'H',
'GH',
'EFGH',
'ABCDEFGH',
'I',
'J',
'IJ',
'K',
'L',
'KL',
'IJKL',
'M',
'N',
'MN',
'O',
'P',
'OP',
'MNOP',
'IJKLMNOP',
'ABCDEFGHIJKLMNOP',
...
]
Here's one way to look at it - you're learning how to write Chinese... | stackexchange_codegolf |
Lets play golf while we golf.
Problem:
Distance to the hole initially is 700m
Each hit to the ball will make it advance to the hole 250-350m, this should be random.
Each hit has a 5% probabilities of going into water, this will make the quantity of hits increase by 1 as a penalty.
When ball is under 250m it will adva... | stackexchange_codegolf |
I have a coding problem that goes like this:
Given a positive integer \$N\$, return a list of all possible pairs of positive integers \$(x,y)\$ such that $$\frac1x+\frac1y=\frac1N$$
I already solved the problem using Python, but I was wondering how I can code golf it. The following is my attempt at golfing (I try to ... | stackexchange_codegolf |
Goal
Write a program or function that takes a positive integer n and randomly generate a legal series of pitches (henceforth called a Pitch string) of length n.
Input
A non-zero, positive integer n <= 100
Output
Return a random string, or list of characters, that represent a possible, valid pitch string of length n. Th... | stackexchange_codegolf |
Background
We define the prime-counting function, \$\pi(x)\$, as the number of prime numbers less than or equal to \$x\$. You can read about it here.
For example, \$\pi(2) = 1\$ and \$\pi(6) = 3\$.
It can be shown, using dark magic, that
\$ \lim_{x \to \infty} \frac{\pi(x)}{x/\log x} = 1 \$
which means we can approxima... | stackexchange_codegolf |
Think of cleave as the conceptual inverse of map. If map applies a function to each number in a list...
map([1, 2, 3], x -> x * 5) -> [5, 10, 15]
then cleave applies each function in a list to a number.
cleave(5, [x -> x * 2, x -> x - 1, x -> x * x]) -> [10, 4, 25]
More formally, given:
\$n\$, an integer, and
\$L\$, a... | stackexchange_codegolf |
This is an answer-chaining challenge in which each answer builds on the previous answer. Taking no input, you are to output the most recent submission to this thread.
I would HIGHLY suggest sorting by oldest and skipping to the last page to find the most recent answer.
Scoring
The winner will be chosen based on a point... | stackexchange_codegolf |
Given seconds like 11728, write the smallest javascript function that returns a string like 3hrs. 15min. 28sec.
signature textTime([int] t,[bool] z,[bool] m)
t is the time like 11728 and you can assume int
z is optional and true means drop zero times, so 3hrs. 0min. 28sec. becomes 3hrs. 28sec.
m is optional and true me... | stackexchange_codegolf |
Challenge
Given a list of positive integers, find if there exists a permutation where taking up to one bit from each of the integers, a binary number consisting of all 1s can be created.
The number of bits in the resulting binary number is equal to the highest MSB in the list of integers.
Output
Your code must output o... | stackexchange_codegolf |
The goal is to output the number of the months given as input in a compact concatenated form which is still parsable if one knows the construction rules:
If either:
January is followed by January, February, November or December; or
November is followed by January or February
There must be a separator placed between.
... | stackexchange_codegolf |
Given a list of positive integers that contains at least 3 distinct entries, output a permutation of that list that isn't sorted in ascending or descending order.
Examples
1,2,3 -> 2,1,3 or 3,1,2 or 1,3,2 or 2,3,1
1,2,3,3 -> 2,1,3,3 or 3,1,2,3 or 1,3,2,3 etc..
Thanks @Arnauld and @NoOneIsHere for the title!
| stackexchange_codegolf |
From here. Every new game is the first day of the month, 12:00 PM UTC.
The goal is to create the Stack Overflow logo using ASCII characters.
It looks like this.
The exact output should look like this:
\\
\\
\= \\
\= \\
\= \\
\== \\
¯¯¯ \==
¯¯¯... | stackexchange_codegolf |
Figuring out whether a given number is prime, while not very complicated, is kind of hard. But making a guess doesn't need to be.
Seeing whether a number is a multiple of 2 or 5 is easy - you can just look at the last digit. Multiples of 3 isn't much harder, just add up the digits and see if you end up with a multiple ... | stackexchange_codegolf |
In this challenge, you are given a number x. You have to find the minimum number of steps required to reach x from 1. At a particular point, you have two choices:
1) Increment the number by 1.
2) Reverse the integer (remove leading zeros after reversing)
Input: n=42
Output: 1>2>3>4>5>6>7>8>9>10>11>12>13>14>41>42 **... | stackexchange_codegolf |
Introduction
Jonny wants to play Frogger. However, he's not very good. In fact, he will only try to move forward, and only after the platforms have moved.
Find out if Jonny's frog manages to reach the end of the path or if it dies on its way.
Challenge
The program will be receiving as input a Frogger grid composed by 0... | stackexchange_codegolf |
m|Y bR|ain is We|iRd. F(o)R T(h)E La|sT fi(v)e YE|ars O|R s|o, (I) ha|ve C(u)T wO|rds in h(a)lf wh|En (I) s(e)e Th|em. Wh|EN I started Do|ing it, it To|oK a meN|TaL effort - B(u)T I almost cou(l)dn't N(o)T d|o it. N(o)w, I d|o it in the back of my head, a(n)d hardly ev|en not|iCe it. However, I thought this wo|uld make... | stackexchange_codegolf |
A marquee is a low-tech board that allows customizable letters. For example, here is a marquee:
SALE ON SNEAKERS
However, someone might come along and vandalize it by removing letters to send a different message:
S N AKE
Given two non-empty string inputs, an original message and a new message, determine whethe... | stackexchange_codegolf |
In 2015 the Portland International Airport began the replacement of their iconic carpet. I want you to write a program to draw their old carpet in as few bytes as possible.
The carpet:
Specifications
Here is a link to a scalable pdf image of one tile. Your output should match the relative dimensions and placement o... | stackexchange_codegolf |
A zigzag scan is a method of encoding 2D information in one dimension:
Write a function or program that, given a one-dimensional string of printable ASCII characters, will reverse the zigzag scan to arrange its characters into a square.
For example, given the input string ABeIfCDgJmnKhLop, your program should return:
... | stackexchange_codegolf |
I like to think of a 10-adic number as a number that goes infinitely to the left, or an integer modulo a very very large power of 10.
Things carry infinitely to the left and vanish. To see what I mean, note that ...6667 * 3 = 1 in the 10-adic land, since the "2" that carries to the left goes to infinity.
Addition and m... | stackexchange_codegolf |
The challenge is simple: Print the first and last element of a list and print them
Rules:
You will take only 1 line of input, and that is the list (e.g. [1, 5, 6, 4, 2])
You are allowed to print the 2 numbers in any order with or without spaces between them
Output the 2 numbers on 1 line and the remaining list on the ... | stackexchange_codegolf |
I apologize if this isn't fit for this site but it is a puzzle, not all that practical, so I thought it would fit.
Take this code:
string s = "";
Console.WriteLine(ReferenceEquals(s, string.Empty));
This will print out true because "" is interned by the JITter at some early point and literals are reused from the inter... | stackexchange_codegolf |
Skat
I'm a fan of anagrams, so given two strings s1 and s2 write a program or function that outputs a truthy value if s2 is an anagram of s1, and a falsey value otherwise (not accounting for spaces and capital letters).
For example:
Input: s1 = "Anagram"; s2 = "Nag a ram"
true
Input: s1 = "stack overflow"; s2 = "fewe... | stackexchange_codegolf |
Thanks to @ComradeSparklePony for the title.
This challenge should be very simple. You are given three lists.
The first is a list of first names, in title case.
The second is a list of adjectives, in lower case.
The third is a list of nouns, in lower case.
Please randomly select a name, optional adjective, and noun, an... | stackexchange_codegolf |
My boss now wants me to implement a mechanism that lets him search for an item in an array, and gives him the index/indices where that value occurs.
Your Task:
Write a program or function that receives an array and a value (String, Integer, Float, or Boolean), and returns the indices of the array at which the value o... | stackexchange_codegolf |
Executive summary
Given input representing two vectors and their respective "weights", produce output that also represents the weighted sum of those vectors.
Challenge
The input will consist of one or more lines of the following characters:
exactly one occurrence of the digit 0, which represents the origin in a two-di... | stackexchange_codegolf |
Take the string of brackets ]][][[. When you rotate it to the right once, you get []][][. If you rotate it again, you get [[]][]. All brackets in this string are balanced.
The Task:
Your program (or function) will be given a string of brackets, represented in any reasonable format (including using other things in place... | stackexchange_codegolf |
What general tips do you have for golfing in Scala 3? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala 3 (e.g. "remove comments" is not an answer). Please post one tip per answer.
Also see Tips for golfing in Scala
| stackexchange_codegolf |
For each character in your program, the program with that character removed must produce a number smaller than the program with the next character removed. Your base program isn't required to do anything, and may be invalid.
An example submission could be abcd, where bcd outputs 1, acd outputs 4, abd outputs 5, and abc... | stackexchange_codegolf |
Introduction
I've seen throughout the code-golf challenges several simple tasks involving JSON, such as interpreting JSON strings with RegExs, and almost every other manipulation I could think of.
In a binding for AppleScript that I was using for a Node project, I noticed that objects would be returned in a strange wa... | stackexchange_codegolf |
Task
A reverse checkers position is a chess position where every piece for one player is on one colour and every piece for the other player is on the other colour. Your task is to find if the given (valid) position meets these criteria.
For example, this position does (click for larger images). Every white piece is on ... | stackexchange_codegolf |
Poker has etiquette in how you arrange your chips, often enforced in tournaments - your chips may not be "hidden" from your opponents by being behind others, mostly to not hide some large denomination chip(s).
The Challenge
We are going to be playing poker in ASCII, so we need to write a function or program that will ... | stackexchange_codegolf |
One of the things that makes contract bridge very interesting is its highly complicated "artificial" meta game. This system of scoring hands is a small part of it.
Bridge is a trick-taking card game. Each player gets a hand of 13 cards, and the game starts with the bidding. The bidding determines how the rest of the ga... | stackexchange_codegolf |
Each term in the squaring sequence, \$x_n\$, is created by taking \$x_{n-1}\$, squaring it, and removing all but the first four digits.
The sequence always begins with \$x_1 = 1111\$. Squaring this yields \$1234321\$, so \$x_2 = 1234\$
The first few terms are:
1111
1234
1522
2316
5363
...
The Challenge
Your task is t... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.