instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Given an image, output the [width in pixels of a full vertical section]1 (if one exists). If no vertical section exists, output 0.
Input may be provided as a local file or a nested array. If you choose to take input as a nested array, white pixels should be represented by a truthy value while non-white pixels should be... | stackexchange_codegolf |
The Challenge
Everybody loves genetics, right? In this challenge, you will be given the genotypes of two parents. You must find each possible genotype of a child produced by the parents. You must account for dominant and recessive alleles as well as incomplete dominance and codominance.
An example input for the parents... | stackexchange_codegolf |
Introduction
A pure word (or perfect word), as defined by me, is a word where the sum of the position in the alphabet of each letter in the word is perfectly divisible by the total length of the word. For example, abcb is a perfect word because 1 + 2 + 3 + 2 = 8, and 8 / 4 = 2.
Your task
Given a word as input, output w... | stackexchange_codegolf |
Related: Counting polystrips
Background
Link-a-Pix is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules:
Connect two cells with number N with a line spanning N cells, so that the two cells are at the two ends of the line.
The number 1 is considered connected t... | stackexchange_codegolf |
Given an ordered list of numbers (possibly with leading zeros), arrange the numbers vertically, then let all zeros drop all the way to the bottom and all overhangs drop to the bottom-most open slot. Output the resulting integers, removing leading zeros.
Worked Example
Say we were given the following as input:
['0000312... | stackexchange_codegolf |
Given a number from 1 to 24, output the kissing number to the best of current knowledge (some numbers will have more than one acceptable output). Knowledge of geometry is not essential as the outputs are all listed below.
From the Wikipedia page on the Kissing Number Problem:
a kissing number is defined as the number ... | stackexchange_codegolf |
Create a function which takes in a input integer and then returns the number of factors it has, like if you pass 25 then it will return 3 since it has 3 factors i.e. 1,5,25.
Challenge:
Make the fastest and the smallest code!
| 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 |
So the golf question was like this:
You are given a number T and then a total of T number of 17-character strings. For each of the strings, output yes if it contains four consecutive identical characters or contains the substring DX, else output no.
The following constraints are promised for each of the 17-character ... | stackexchange_codegolf |
Given as input a list of positive integers, your task is to determine if every integer present has exactly two neighbors in the list. The neighbors of a integer \$x\$ are the distinct integers that appear next to an \$x\$ anywhere in the list. For example in the list:
[1,3,4,4,3,2,1]
The number 3 has 3 neighbors 1, 4... | stackexchange_codegolf |
Here is another simple one:
The Challenge
Given two points in an n-dimensional space, output the distance between them, also called the Euclidean distance.
The coordinates will be rational numbers; the only limits are the restrictions of your language.
Lowest dimension is 1, highest is whatever your language can handl... | stackexchange_codegolf |
Write a program to play the game of Connect 4. You are given the state of the board as input and you must decide which column to place your piece in to either get 4 in a row (horizontally, vertically, or diagonally) or block your opponent from doing the same.
The board is a 6x7 array, where each cell may be empty (' '... | stackexchange_codegolf |
Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. (2, ウシロ) → ウ/シ\ロ.
To help you out with this, I'll explain a little about Japanese phonology.
Background: on moras
For the purpose of this challenge, we will write Japane... | stackexchange_codegolf |
Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a visually appealing explanation.
How do I do that?
The current iteration index starts at 0.
If the iteration index is even,... | 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 |
Print the following output of a happy coincidence addition pattern:
8
8
8
88
+888
----
1000
Rules:
No leading spaces except the ones already present
There can be a trailing newline
+ sign needs to be displayed
Order of parcels needs to be the same
No winner. It is code-golf per language.
| 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 |
emanresu A posted a challenge to reconstruct an ordered list of integers from its unordered set of unordered prefixes. Many users (beginning with xnor's answer) noticed that summing each unordered prefix led to a very short solution. Well, let's cruelly take that possibility away by using data that isn't integers!
A fe... | stackexchange_codegolf |
Given a string which is guaranteed to be either odd, even, square, cube, prime or composite, your program or function must return an integer \$100\le N\le 999\$ which meets this description.
Rules
Your code must be deterministic.
The choice of the integers is up to you. However, the six answers must be distinct. (For ... | stackexchange_codegolf |
Input: You will be passed a string containing a single english word. All letters will be lowercase, and there will be no non-alphabetic characters in the string.
Output: You will return an integer from 1 to 7 representing how many syllables you think are in the word.
Scoring: Your program will be run against all of th... | stackexchange_codegolf |
This is part of a cops-and-robbers challenge. Go here for the cops' part.
The Robbers' Challenge
A cop's answer can be cracked by removing any subset of characters from the Haystack program, so that it outputs Needle instead of Haystack (while still being a valid submission in the same language). You don't have to find... | stackexchange_codegolf |
Consider a binary tree built the following way:
The root node is \$1\$
For a given node \$n\$:
If \$n\$ is odd, its only child is \$2n\$
If \$n\$ is even, one of its children is \$2n\$. If \$\frac {n-1} 3\$ is an integer and not already part of the tree, its right child is \$\frac {n-1} 3\$
Recursively and infinite... | stackexchange_codegolf |
Introduction
You have to simulate playing golf over an input string that represents the green. The 2-character substring () represents the hole, and is guaranteed to appear only once in the string.
This is a sample green:
ABCDEFGHIJKLM()NOPQRSTUVWXYZ
The simulation consists of outputting the characters that the ball f... | stackexchange_codegolf |
You must write a program or function.
The input is a 'map' of numbers. You can choose to take the map as either a string with new line characters (\n) or a 2D array of strings.
All maps are 5 characters by 5 characters, and the characters are always either digits greater than 0 or spaces.
Here is an example of a map... | stackexchange_codegolf |
Introduction
You are listening to a car radio. You are pressing seek up/down, moving you to the next frequency some radio station broadcasts on, to avoid all this pointless music and listen to all the ads, or vice versa. If you try to go below the lowest frequency radio can handle, it jumps to the highest (and vice ver... | stackexchange_codegolf |
Inspired by the challenge A pile of weights.
Challenge
Given an integer as a weight in pounds, output an ASCII barbell that can represent the weight. Weights will come in the form of the barbell (which will weigh 45lbs) and plates with the following weights: 45lbs, 35lbs, 25lbs, 10lbs, and 5lbs. Weights will be repre... | stackexchange_codegolf |
Given a set of intervals \$\mathcal{I} = \{I_1, \ldots, I_m\}\$, where each interval \$I_j\$ is represented by its bounds \$(a_j, b_j)\$, find a partition \$\mathcal{T}\$ of \$\mathcal{I}\$ of minimal cardinality such that for each set \$T_i \in \mathcal{T}\$ it holds \$\bigcap T_i \ne \emptyset\$. In other words, find... | stackexchange_codegolf |
Task
Read the contents of a table given a set of coordinates.
Table formatting
Tables will be in this basic format:
|[name]|[name]|
---------------------
[name]| [val]|[val] |
[name]| [val]|[val] |
Column names are always unique within columns. Row names are also unique within rows. This includes names that are ... | stackexchange_codegolf |
We have a Brainf*** to TinyBF converter, but not the other way around, so here's one.
Rules:
Your interpreter must take a valid TinyBF program, on one line, and it must output the corresponding BrainF*** program, on one line, with optional trailing whitespace/newline. No leading whitespace is allowed
The input may or ... | stackexchange_codegolf |
Objective
Given a date, spell it out in Romanized Japanese.
I/O Format
The input format is flexible. The output format is <month spelling> <day spelling>; note the space. You can freely mix cases in output. You may output trailing newline.
Mapping
Months
Month
Spelling
January
Ichigatsu
February
Nigatsu
Mar... | stackexchange_codegolf |
Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a visually appealing explanation.
How do I do that?
The current iteration index starts at 0.
If the iteration index is even,... | stackexchange_codegolf |
Last time you were required to write program that output a file, such that no byte is same as original file. The request meant to let everyone carry part of information, but it ends up that everyone carry same info to reduce their storage... This challenge is similar.
Write at most 1024 programs that output at least 85... | stackexchange_codegolf |
(Inspired by ASCII's 95 Characters...95 Movie Quotes)
The Challenge
Given input n, output the nth Fibonacci number. You can use either 0 or 1 indexing, please state which in your submission. Simple, yeah? The catch is you must take the character set of the immediate previous answer, remove two characters from it, and a... | stackexchange_codegolf |
Your goal is to write a program / script which "converts" real images into ascii art.
General:
Your program will get a path to a image file over stdin or as parameter (whatever you prefer). The format will be jpeg.
It should "convert" it to ascii art and save it to the harddrive.
The image will be in grayscale. You don... | stackexchange_codegolf |
I somewhat miss those old demos showing the capabilities of computers when they were called x86 instead of i3, i5 and i7. One of the first I watched in my 386 was the Unreal demo from Future Crew that is now celebrating its 25th anniversary. At minute 0:43 the first part of the demo starts and we see a scrolling text f... | stackexchange_codegolf |
Imagine you have a positive integer number \$n\$. Let \$m\$ be the number obtained by reversing \$n\$'s digits. If \$m\$ is a whole multiple of \$n\$, then \$n\$ is said to be a reverse divisible number. If neither are a palindrome, \$m\$ is called a palintiple.
For example, \$1089 \cdot 9 = 9801\$, so \$9801\$ is a pa... | stackexchange_codegolf |
Introduction
The EKG sequence begins with 1 and 2, then the rule is that the next term is the smallest positive integer not already in the sequence and whose common factor with the last term is greater than 1 (they are not coprimes).
The first terms are:
1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, ...
It's called EKG because... | stackexchange_codegolf |
While bored in high-school (when I was half my current age...), I found that \$f(x) = x^{x^{-1}}\$ had some interesting properties, including e.g. that the maximum \$f\$ for \$0 ≤ x\$ is \$f(e)\$, and that the binding energy per nucleon of an isotope can be approximated as \$6 × f(x ÷ 21)\$...
Anyway, write the shortes... | stackexchange_codegolf |
Given a positive integer N, output this doubling pattern of slash squares/rectangles.
For N=1, the base is:
/\
\/
The next square is added in the bottom right direction for N=2:
/\
\/\
\/
After that, a 2x1 rectangle is added in the bottom left direction for N=3:
/\
/\/\
\ \/
\/
Then a 2x2 square is added in the t... | stackexchange_codegolf |
Consider the following ASCII image of five concentric anti-aliased ASCII aureoles:
........
.@..............@.
..... .....
.@.. ...@@@@@@@@... ..@.
.@. ..@@.. ..@@.. .@.
.@. .@@. ........ .@@. .@.
.@ @@ .@@@@@..@@@@@. ... | stackexchange_codegolf |
Input:
Two strings without newlines or whitespaces.
Output:
Both input strings on separate lines, with spaces where necessary† for one of the two strings. And a third line with the characters A, R, M and , representing added, removed, modified, and unchanged.
† We add spaces to either the top or bottom input string (if... | stackexchange_codegolf |
They say that hate is a strong word. I wanted to find out why, so I had a good look at the word.
I noticed that every consonant had a vowel after it. That made it look quite strong to me, so I decided that that's what makes a word strong.
I want to find more strong words, so I'll need a program for it!
Finding strong w... | stackexchange_codegolf |
At the time of writing this puzzle, there are soon to be 269 puzzles related to primes. To celebrate/mourn this event (269 is prime), this challenge will be about exploding primes. In preparation for this task, I've obtained a permit (legal, I assure you) for dynamite charges of military grade, along with enormous dyna... | 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 |
Brief
Print an ASCII representation of a binary search tree.
You should write your own minimum implementation logic of a BST (node, left, right, insert)
(50,30,70,20,80,40,75,90) gives:
__50__70__80__90
| |
| |__75
|
|__30__40
|
|__20
Detailed requirements
Items are inserted ... | stackexchange_codegolf |
There is an N x N square of numbers.
All columns increase strictly monotonically from top to down
All rows increase strictly monotonically from left to right
There is exactly one valid answer for each input.
You are given 2N-1 rows of N numbers representing rows or columns in this square. The task is to find the row ... | stackexchange_codegolf |
Write a program that accesses Project Gutenberg's KJV Bible, either from a file called pg10.txt in the working directory or in any other way that is typical for the language, takes a Bible verse reference as input, and prints the corresponding verse, with no newlines except optionally one at the end, as output.
The sta... | stackexchange_codegolf |
Given a matrix of positive integers, output whether it's possible to generate it by starting with an empty1 matrix of the same dimensions and repeatedly filling a whole row or a whole column with the same value, overwriting any values already written.
Example
The following matrix:
$$\begin{pmatrix}1&1&1\\2&3&4\\2&3&4\e... | stackexchange_codegolf |
Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of".
The Gregorian calendar will be used and the program should not account for leap years, so your program should never output "29th February" in any circumstance. Any ... | stackexchange_codegolf |
Given a constructible point \$(x, y) \in \mathbb R^2\$, output the steps required to construct \$(x, y)\$
Constructing a point
Consider the following "construction" of a point \$(\alpha, \beta)\$ in the Cartesian plane:
Begin with the points \$(0, 0)\$ and \$(1, 0)\$. Then, more points can be added by performing a fini... | stackexchange_codegolf |
Goal:
Write a complete program or function which takes a formula in propositional logic (henceforth referred to as a logical expression or expression) and outputs that formula in conjunctive normal form. There are two constants, ⊤ and ⊥ representing true and false, a unary operator ¬ representing negation, and binary o... | stackexchange_codegolf |
Given a PPCG User ID, output that user's current username.
Examples
Input -> Output
61563 -> MD XF
2 -> Geoff Dalgas
12012 -> Dennis
foo ->
-3 ->
Rules
Input/output can be taken via any allowed means.
The output must be the full username with proper capitalization and spacing, nothing more and nothing less... | stackexchange_codegolf |
Don't ask me how or why but while coding on a project I noticed that the characters of a couple of words had a particular pattern referred to the alphabet, I connected each character of the words with the pencil on the alphabet and I obtained two spirals, then I noticed that the first spiral was clockwise and the other... | stackexchange_codegolf |
Background
This challenge is about the Game of Go. Here are some rules and terminology relevant to this challenge:
Game of Go is a two-player game, played over a square board of size 19x19.
One of the players plays Black, and the other plays White. The game is turn-based, and each player makes a single move each turn... | stackexchange_codegolf |
Input a scientific notation number (base 10), output scientific notation in base 16 (as defined below).
Details
In scientific notation, all non-zero numbers are written in the form
$$ m \times 10^n $$
Where \$ n \$ is an integer, and \$ m \$ is a real number, \$ 1 \leq |m| < 10 \$.
Consider scientific notation in base ... | 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 |
Coming from this sandbox post
This is inspired from an 8th graders math test
Intro
We have a cube with following corners
A(0, 0, 0)
B(1, 0, 0)
C(1, 1, 0)
D(0, 1, 0)
E(0, 0, 1)
F(1, 0, 1)
G(1, 1, 1)
H(0, 1, 1)
This cube clearly has 8 corners, 12 edges and 6 faces. If we now cut off corner G, such that our cut plane goe... | stackexchange_codegolf |
ROT-128 is a variant of ROT-13, where instead of cycling through the 26 letters, you cycle through the 256 possible bytes. Your task is to create a program that outputs the ROT-128 of its own source. The outputted program must also be a valid program and output the original program.
Scoring
This is code golf, so leas... | stackexchange_codegolf |
(yes, "generating generating" in the title is correct :) )
Context
In middle (?) school we are taught about sequences and, in particular, we are taught about linear sequences where the nth term is generated with an expression of the form an + b, where a and b are some coefficients. In this challenge, we will deal with ... | stackexchange_codegolf |
Challenge
Create a program that outputs a square grid showing visible and non-visible points \$(x, y)\$ from the origin based on their greatest common divisor (GCD).
A point \$(x, y)\$ is considered visible from the origin \$(0, 0)\$ if the \$\gcd(x, y) = 1\$. Otherwise, it's non-visible.
Input
An integer \$n\$, repre... | stackexchange_codegolf |
I was wondering if there is any way to assign 2 values (G and H) to say a list of ["egg", "chicken"] in Pyth. In python it would be something along the lines of
G, H = ["egg", "chicken"]
At the moment the shortest way I can think of would be something like
=N["egg""chicken")=G@N0=H@N1
which uses the lookup function t... | stackexchange_codegolf |
Introduction
It is somewhat like DVORAK Keyboard layout , but MUCH harder.
Let's talk about the Korean keyboard first. As you can see in Wikipedia, there is a Kor/Eng key to change between Korean and English key sets.
Koreans sometime type wrong : they attempt to write in Korean on a qwerty keyboard or in English on a ... | stackexchange_codegolf |
You are an employee of Microteque, a leading Silicon Valley startup creating smart microwave ovens for all kinds of strange places. Your customers can get their microwaves printed with patterns to match their kitchens, campers, man caves; even the kitchens of large nation-state facilities have shiny new branded microwa... | stackexchange_codegolf |
A long period prime is a prime number \$p\$ such that decimal expansion of \$1/p\$ has period of length \$(p-1)\$. Your task is to output this number sequence. For purposes of this challenge we will consider only odd primes.
Period of a decimal expansion of a rational number is the smallest period \$k\$ that makes the ... | stackexchange_codegolf |
This challenge is rather simple:
You are given an array of positive (not including 0) integers, and have to select a random element from this array.
But here's the twist:
The probability of selecting an element is dependent on the value of the integer, meaning as the integer grows larger, the probability of it to get s... | stackexchange_codegolf |
The Setup
Jim the student who attempts to use Stack Overflow to do his homework has asked how to get his program to say "Hello World" in under 100 lines of code, you decide mere mortal trolling is not enough...
The Challenge
You need to provide Jim with a program less than 100 lines long that outputs a satisfactory ans... | stackexchange_codegolf |
An analog clock has 2 hands*: Hour and minute.
These hands circle the clock's face as time goes by. Each full rotation of the minute hand results in 1/12th of a rotation of the hour hand. 2 full rotations of the hour hand signifies a full day.
As these hands are fixed to the same central point, and rotate around that p... | stackexchange_codegolf |
This challenge is to produce the shortest code for the constant \$\pi^{1/\pi}\$. Your code must output the first \$n\$ consecutive digits of \$\pi^{1/\pi}\$, where \$n\$ is given in the input. Alternatively, your program may accept no input, and output digits indefinitely
This is code golf, so the shortest submission ... | stackexchange_codegolf |
A sequel to What dice do I need to display every integer up to X?
Numbers are great, but let's take it to the next level. I'd like to have a set of dice that can be arranged and rotated to display any words I want. Think Boggle:
And not just that; I want to specify the number of sides those dice have. The set should c... | stackexchange_codegolf |
The Challenge
Given a n x n matrix of integers with n >= 2
1 2
3 4
and a list of integers with exactly 2nelements
[1,2,-3,-1]
output the rotated matrix. This matrix is contructed in the following way:
Take the first integer in the list and rotate the first row to the right by this value.
Take the next integer and ... | stackexchange_codegolf |
Background
Tents and Trees (try here) is a puzzle played on a square (or rectangular) grid, where the objective is to place tents horizontally or vertically adjacent to each of the trees, so that no two tents touch each other in 8 directions (horizontally, vertically, and diagonally) and the number of tents on each row... | stackexchange_codegolf |
Inspired by this video of Infinite Series.
Introduction
Pi is defined as the ratio of the circumference to the diameter of a circle. But how is a circle defined? Usually a circle is defined as the points with constant distance to the centerpoint (let us assume that the center is at (0,0)). The next question would be: H... | stackexchange_codegolf |
Introduction:
I think we've all heard of it, but here a very brief summary: Noah gathered two of every species of animal on the planet, male and female, to save in his Ark during a great flood. The actual quote from the Bible is:
Genesis 7:2-3
You must take with you seven of every kind of clean animal, the male and it... | stackexchange_codegolf |
Question
If you are currently on a cell with a value x, you can move to any
cell in the same row or column, provided it has a value y such that x >
y. This move is called a switch.
The input consists of:
two integers 0 < m,n < 50
an integer k indicating the number of switches allowed 0 < k < 20
an m by n grid ... | stackexchange_codegolf |
Divide the first quadrant (including the positive x-axis, the positive y-axis, and the origin) into 1x1 grids, with each grid labelled by the coordinates of its bottom-left corner, as demonstrated below:
Note that each grid contains its boundaries and its vertices. Using mathematical symbols, the grid labelled (m,n) w... | stackexchange_codegolf |
September 1993 is known on Usenet as the September that never ended. Thus, for example, the day this question is being posted is Saturday, September 8740, 1993.
Your program or function should take any Gregorian date (with positive year) as input and return the same date as output if it's prior to September 1993 or the... | stackexchange_codegolf |
In the wake of the many (two?) FizzBuzz-related challenges posted recently on PPCG, I've been tempted to come up with my own. Behold...
Fizz Buzz Lightyear
Write a program or function that takes an integer n and prints out FizzBuzz for any number divisible by 15, Fizz for any number divisible by 3, and Buzz for any num... | stackexchange_codegolf |
I am working on a code to print all semimagic squares [1] of a given size. I am working with the following definition:
An \$n\times n\$ consists of numbers \$1,2,\cdots, n^2\$.
All numbers must be distinct.
Sum of each row and each column is equal.
According to Ripatti A. (2018) [1]:
\$n\$
number of semimagic squ... | stackexchange_codegolf |
One of many unique features of the Malbolge programming language is its highly unintuitive OP operator, referred to only as "op" in the documentation and source code but popularly known as the "crazy" operator. As described by Ben Olmstead, the creator of the language, in its documentation: "don't look for pattern, it'... | stackexchange_codegolf |
When manufacturing chips, circular silicon wafers are cut into dies of needed size:
The goal of this challenge is maximizing the number of whole dies that can be cut from a wafer of a given diameter.
The machine puts the wafer into an angular compartment:
_____________________
| xxxxxx
| xxxxxxxxxxxx
| xxxxxxxxxx... | stackexchange_codegolf |
Web safe colors are in intervals of 51, they include 0, 3, 6, 9, c, and, f as digits in hex (such as #993333), or 0, 51, 102, 153, 204, 255 in decimal. Your task today is convert a given color to a web safe one. You may read more about web safe colors on Wikipedia.
Input
You will take in 3 integers between 0, 255 inclu... | stackexchange_codegolf |
You and some buddies are going bowling. There are a total of N bowlers. However, there are only N-1 chairs to sit in. The solution is simple: whoever's turn it currently is doesn't get a chair. Then when their turn is over, they sit in the chair of the person that goes next.
Lets take an example. Say You are named A, ... | stackexchange_codegolf |
A checkerboard program is a program where each individual character's ordinal value alternates from even to odd, excluding the line terminator (which can be any standard line-endings).
A triangular program is a program where each line has one additional character than the preceding line, with the first line having one ... | stackexchange_codegolf |
The challenge is to golf a program when given a string composed of any number of asterisks, then a comma, than any number of asterisks, say which side has more.
The asterisk-strings can be empty.
Output
0 for ties.
1 for the left.
2 for the right.
Examples
Input: ***,**** Output: 2
Input: ***, Output: 1
Input: ***,*** ... | stackexchange_codegolf |
\$\newcommand{T}[1]{\text{Ta}(#1)} \newcommand{Ta}[3]{\text{Ta}_{#2}^{#3}(#1)} \T n\$ is a function which returns the smallest positive integer which can be expressed as the sum of 2 positive integer cubes in \$n\$ different ways. For example, \$\T 1 = 2 = 1^3 + 1^3\$ and \$\T 2 = 1729 = 1^3 + 12^3 = 9^3 + 10^3\$ (the ... | stackexchange_codegolf |
Related as it requires you to measure the time between the first and last input. But here you're required to count how many inputs in a period of time.
I was assigned a task to stand by a gate and count how many students enter it. The problem is that my memory is not as good as it was when I first started this job. I... | stackexchange_codegolf |
Your mission is to write 2 functions that accept a list of N integers (positive or negative).
N can be higher than 2.
The first one returns the greater common divisor of the N numbers
Example: [10, 15, 20] -> 5
the second one returns the smallest common multiple of the N numbers
Example: [10, 15, 20] => 60
Smallest cod... | stackexchange_codegolf |
Introduction
The idea is to use the asterisk character (star) * to display an ascii-art star at a specified dimension. The dimension is an input number greater than or equal to \$1\$ that specifies the height in lines of the upper point of the star. The stars here are intended to be six pointed stars with larger sizes ... | stackexchange_codegolf |
This is a repost of this challenge, intended to revamp it for looser I/O formats and updated rules
You are to write a program which takes an integer polynomial in \$t\$ as input and outputs the Laplace transform of this polynomial. Some definitions and properties:
The Laplace transform of a given function \$f(t)\$ is
... | stackexchange_codegolf |
Write a program or function that given an integer radius r returns the number of unit squares the circle with radius r centered at the origin passes through. If the circle passes exactly through a point on the grid that does not count as passing through the adjacent unit squares.
Here's an illustration for r = 5:
Illu... | stackexchange_codegolf |
Given a number N, the challenge is to get the sum of the pyramid of N primes. To clarify things, here is an example:
Input: 4
We will list the first 4 primes, and then compute the sum of them. After that, we will compute the sums of the sums, and so on:
2
> 5
3 > 13
> 8 > 33
5 > 20
> 12
... | stackexchange_codegolf |
Description
I guess everyone knows the fairy tale of Rapunzel and the prince. For those who do not: read it here. However, Rapunzel had just had her hair cut, so it might not be long enough to let her prince climb up! She may get very sad..
Challenge
Your task is to write a function that evaluates what Rapunzel will be... | stackexchange_codegolf |
Your friend has been caught sleeping in class again! As punishment, his computer science teacher has assigned him homework, knowing that he will not be able to solve it due to not having paid any attention.
The assignment seems deceiving simple at first; all that is required is to output the string:
John Doe
Unfortunat... | stackexchange_codegolf |
The narcissist is a program which, given its own source as input, prints a truthy value and, given anything other than that, prints a falsey value. Today, we're reversing this.
Create a program that, given the name of whatever your language's truthy value is (True, true, 1), prints its own source. Given the name of wha... | stackexchange_codegolf |
Word's A▲ and ᴀ▼ buttons change the font size according to these rules:
The starting font size is 11.
If ᴀ▼ is pressed when the font size is 1, the size stays 1.
The font size changes with 1 point in the range 1 – 12.
The font size changes with 2 points in the range 12 – 28.
The choices are 28, 36, 48, 72, and 80 in t... | stackexchange_codegolf |
Given a deck consisting of N copies of cards with integer values [1,M] for a total of N*M cards, compute the probability that a card with the value of 1 is adjacent to a card with the value of 2.
Your solution may be exact or approximated, and it does not need to be the same for every run given the same inputs. The giv... | stackexchange_codegolf |
Challenge
Given two lists of strings where each string is of length 50 and each list is also of length 50 generate the shortest regex you can that fully matches all the strings in the first list and does not match any of the strings in the second list.
Scoring
Your score will be the average length of the regexes your p... | stackexchange_codegolf |
Based on a chat message
The Challenge
Given an input number \$n > 9\$, construct its reverse, ignoring leading zeros. Then, construct a list of all prime factors that the number and its reverse don't have in common. Multiply those factors together to create the Uncommon Factor Number of the input.
Or, to put it another... | stackexchange_codegolf |
Box blur is a simple operation for blurring images. To apply box blur, simply replace each pixel with the average of its and the surrounding 8 pixels' values. Consider, for example, the following example, in which each "pixel" has a one-digit value:
\begin{array} {|r|r|}\hline 1 & 1 & 1 \\ \hline 1 & 7 & 1 \\ \hline 1 ... | stackexchange_codegolf |
Given a single digit integer and a three digit integer, output a mathematical formula that uses only the single digit and a given list of operators to equal the three digit integer.
Input: A one digit positive integer (1-9) and a three digit integer (100-999)
Output: A mathematical formula meeting the following requir... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.