instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
So, there's a famous children's rhyme...
This is the house that Jack built.
This is the malt
That lay in the house that Jack built.
This is the rat
That ate the malt
That lay in the house that Jack built.
This is the cat
That killed the rat
That ate the malt
That lay in the house that Jack built.
This is the do... | stackexchange_codegolf |
Introduction
In the wake of the left-pad npm package fallout, let's have a code golf for implementing left-pad.
The left-pad function consists of 2 default arguments and 1 additional argument, in the form string, length, (padchar). If the padchar is not given, this is standardized to a space character. Let's take an ex... | 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 |
Write a program or a function that takes two non-empty lists of the same length as input and does the following:
uses elements of first list to get numerators,
uses elements of the second list to get denominators,
displays resulting fractions after simplification (2/4=>1/2), separated by "+"s,
displays "=" and result ... | stackexchange_codegolf |
Write two programs, each taking a string s and a number n ≥ 0, such that:
The first program prints s n times, separated by newlines.
The second program prints each character of s n times, with repeated characters separated by newlines.
Every character at column x, line y in one program equals the character at column y... | stackexchange_codegolf |
This is the same question as Solve the CodeSprint4 Leibniz code golf challenge in Python in 66 characters. The variation is that I'm a C programmer. My code for the above question is:
#include <math.h>
main(){
int i,t,p;
scanf("%d",&t);
while(t--)
{
double s=1;
scanf("%d",&p);
for(i=1;i<p;++i)
s+=pow(-1... | stackexchange_codegolf |
The McGill Billboard Project annotates various audio features of songs from a random sample of the Billboard charts. I scraped this data to produce the following file of chord progressions:
chords.txt
Write the shortest code that outputs the above file (or its contents).
Edit: Here's a quick description of the notation... | stackexchange_codegolf |
Overview
The sharpness of a word is the sum of the sharpness of each of its letters, using the following rules:
Sharp letters
A, and V each have a sharpness of 1
N and Z each have a sharpness of 2
M and W each have a sharpness of 3
Dull letters
C and U each have a sharpness of -1
S has a sharpness of -2
O has a shar... | stackexchange_codegolf |
Given Google's recent announcement of official Kotlin support for Android development, I thought it might be timely to poll the community for some awesome golfing tips for this relatively new JVM language.
Kotlin includes a unique combination of features among it's JVM siblings which makes it potentially attractive for... | stackexchange_codegolf |
Cleaning the dishes
In this task, you will be given a bar of soap with a width of 1 or more units. You will also be given a plate, which you will have to clean, using the soap as few times as you can. The plate will be at least 1 character. You will have to output a plate with the 'clean' character representing the pla... | stackexchange_codegolf |
From Codidact with permission.
Description
APL trains are a series of functions, that get applied to an argument in this way:
(f g) x = f g x here f and g are prefix functions
(f g h) x = (f x) g (h x) here f and h are prefix functions, while g is an infix function
(a b c d e f) x = (a (b c (d e f))) x = a (b x) c (d x... | stackexchange_codegolf |
Challenge
Inspired by this video.
As you may know, a palindrome is a word that is spelled the same forward as it is backward. The word "PULP" is not a palindrome, but when translated into Morse Code (with the spacing between letters removed), "PULP" becomes ".--...-.-...--." which is a palindrome. Your task is to write... | stackexchange_codegolf |
Given a string ending in either "er", "ir", or "re" (the "infinitive"), output the full conjugation of the string as a French verb in the seven simple tenses. For each tense (in the order given below), output each subject pronoun in the following order: je, tu, il, elle, nous, vous, ils, elles; followed by a space, the... | stackexchange_codegolf |
Write a program or function that transforms an input string into Zalgo text.
For example, for an input string Zalgo, a possible output might look like:
Z̗̄̀ȧ̛̛̭̣̖̇̀̚l̡̯̮̠̗̩̩̥̭̋̒̄̉̏̂̍̄̌ģ̨̭̭̪̯̫̒̇̌̂o̢̟̬̪̬̙̝̫̍̈̓̅̉̇
Zalgoification specs
Each letter (upper or lower case) must be zalgoified, and nothing else (spaces, pun... | stackexchange_codegolf |
Goal
Write a program or function that translates a numerical telephone number into text that makes it easy to say. When digits are repeated, they should be read as "double n" or "triple n".
Requirements
Input
A string of digits.
Assume all characters are digits from 0 to 9.
Assume the string contains at least one cha... | stackexchange_codegolf |
Background
Conway immobilizer problem is a puzzle that reads like the following:
Three positions, "left," "middle," and "right," are marked on a table.
Three cards, an ace, a king, and a queen, lie face up in some or all
three of the positions. If more than one card occupies a given
position then only the top ca... | stackexchange_codegolf |
For this challenge, the objective is to take a list of integers, and output the sum of every unique integer in that list, i.e. count multiples of the same integer only once.
Your input will be a string in the format "{1,2,3,4}" with any amount of elements. The string will never have whitespace or be in a format that do... | stackexchange_codegolf |
There are 18 primes with distinct prime digits (A124674). Namely, they are:
\$2, 3, 5, 7, 23, 37, 53, 73, 257, 523, 2357, 2753, 3257, 3527, 5237, 5273, 7253, 7523\$
Your task is to output this sequence.
Rules
sequence rules apply. This means valid solutions may use any of the following formats:
Given some index \$n\$... | stackexchange_codegolf |
Overview
Write a program that prints out simple fractal patterns given a bit pattern encoding the fractal, plus the per-generation scale factor of the fractal and number of generations.
Explanation
Here is an ASCII representation of the Sierpinski Carpet:
Generation 0:
#
Generation 1:
# # #
# #
# # #
Generation... | stackexchange_codegolf |
This challenge will be based on an R language trivia: every release is named and it's a reference to Peanuts comic strips (see here and here).
Task
Given a release name, output its number.
For reference, use the below list:
Great Pumpkin 2.14.0
December Snowflakes 2.14.1
Gift-Getting Season 2.14.... | stackexchange_codegolf |
An alternating permutation is a permutation of the first \$ n \$ integers \$ \{ 1 ... n \} \$, such that adjacent pairs of values in the permutation alternate between increasing and decreasing (or vice versa).
Equivalently, it is a permutation where there are no "runs" of continuously increasing or decreasing values wi... | stackexchange_codegolf |
Basically, between every character of a uni-line string, add a space, but there can't be two spaces in between one character.
aesthetic becomes a e s t h e t i c.
The quick brown fox jumps over the lazy dog becomes T h e q u i c k b r o w n f o x j u m p s o v e r t h e l a z y d o g.
I'm Nobody! Who are you? becomes ... | stackexchange_codegolf |
It's simple: Make a proper quine where if you remove any character, it's still a quine.
The difference between this and a radiation hardened quine is that if your program is AB, in a radiation hardened quine A would output AB, but here, A would output A.
Code golf, all standard rules, standard loopholes apply, no cheat... | stackexchange_codegolf |
Hexcells is a game based off of Minesweeper played on hexagons. (Full disclosure: I have nothing to do with Hexcells. In fact I don't really like the game.) Most of Hexcells rules can be pretty easily expressed in Generalized Minesweeper (Minesweeper played on an arbitrary graph). The one that is most difficult is th... | stackexchange_codegolf |
Inspired by this tweet where a user stated the following:
it's insane how much code would be cleaned up if JS got pipes and pattern matching
i often do this since it's the best way to make use of TS inference and pattern matching would make it less hacky
const result = (() => {
if (scenario1) {
return {
t... | 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 |
Given a string s and a positive integer N, gradually duplicate each character more and more until N duplicates, and then staying at N duplicates until N characters away from the end, then step down again.
For example, given abalone and 3:
a we start with 1 copy
bb then 2 copies
aaa then 3 copies, which is our sec... | stackexchange_codegolf |
There was a challenge up a while ago about multiplying strings. It showed us how we can multiply not only numbers, but also strings. However, we still can't multiply a number by a string properly. There has been one attempt to do so but this is obviously wrong. We need to fix that!
Your Task:
Write a function or pr... | stackexchange_codegolf |
Disclaimer
While I know there is this particular related question, my question uses two garage doors, a randomizing component, and I'm also basing this on real life events, seeing my son accidentally lowered one of said garage doors whilst I was walking out of the garage last week... Nothing like a blow to the head to ... | stackexchange_codegolf |
Task
Your task is to write a program that will take input, and then output the lyrics to We Are Number One, changing specific words. The input will contain both the words to be changed, and the replacement word.
Input
The input will be in the following format:
one, two\n
net, villain\n
(\n is a newline, it's not actua... | stackexchange_codegolf |
Challenge:
Take a rectangular figure consisting of the two characters # and (whitespace, ASCII-32), and identify which direction the lines are. The options are: 'Vertical', 'Horizontal', 'Left Diagonal' and 'Right Diagonal'.
Input:
The input will be a figure of size n-by-m where 5 <= m,n <= 20. There will be two space... | stackexchange_codegolf |
Here is the 3rd ABACABA city:
_
A|_|
B|__|
A|_|_
C|___|
A|_|
B|__|
A|_|
It is made out of the ABACABA sequence, which is basically:
A (1st iteration)
place B - AB
repeat A - ABA (2nd iteration)
Place C - ABAC
Repeat ABA - ABACABA (3rd iteration)
and you get the idea.
The buildings have a height (corresponded by no... | stackexchange_codegolf |
The picture below shows a RLC circuit. A RLC circuit is an electrical circuit consisting of a resistor (R), an inductor (L), and a capacitor (C), connected in series or in parallel. (1)
In order to simplify computations, it's common to work in the frequency (Laplace) domain instead of the time domain.
Your task is:
Ta... | stackexchange_codegolf |
I got into code-golfing recently and tried to write the smallest tautogram checker.
A tautogram is a sentence in which all words start with the same letter, for example: Flowers flourish from France.
Given a sentence as input, determine whether it is a tautogram.
Test Cases
Flowers flourish from France
True
This i... | stackexchange_codegolf |
Given a possibly nested, non-empty array of single-digit positive integers (not guaranteed unique), output the ASCII-art representation as a tree, using the box-drawing characters ┌ ┴ ┐ ─ │ ┬ ┼. (These were copied from Code Page 437, but you can use any equivalent representation).
Every integer of the array should be a... | stackexchange_codegolf |
Challenge
You will be given an input represented by x, which is a string containing at least 3 characters. It will consist only of the standard numeric characters, 0 through 9. Your job is to find and output how many right triangles can be formed with the given numbers.
Rules
Numbers must be kept in the order they wer... | stackexchange_codegolf |
Sandbox
What is Hexagonification™?
Hexagonification™ is a transformation that creates a hexagon with 3 copies of a rectangle block, each skewed to the right by 30 degrees and then rotated by 0, 120 and 240 degrees respectively, as shown in the following image. A triangle hole may appear in the middle, but that isn't a ... | stackexchange_codegolf |
We do seem to have a fastest square root challenge, but it's very restrictive. In this challenge, your program (or function) will be given an arbitrarily sized nonnegative integer, which is the square of an integer.
Input
You may take input in any normally allowed way, including (but not limited to) an arbitrary sized ... | stackexchange_codegolf |
This is the robbers' thread to a cops-and-robbers challenge. Click the link to find the cops' thread.
In the cops' thread of this challenge, answerers will be writing programs which output two numbers, \$x\$ and \$y\$. As robbers, your goal will be to crack their submissions. To do this, you find a program in the ... | stackexchange_codegolf |
Your task is to print out this exact text:
-
||
-|-
|---
|-|--
-|-|--
-|-----
|-|-----
|---|-|--
-|-----|--
---|-|-----
|---|-|-----
|---|-----|--
-----|---|-|--
-|-|---|-------
------|---|-----
|-|---------|-|--
---|-----|---|----
-|-----|-|---------
|-|---|-|-----------
|-----------|---|-|--
-|-----|-|---------|--
--... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
Happy Hanukkah!
A beloved Hanukkah tradition for many, the game of Dreidel (s'vivon in Hebrew) is a betting game (for money or for chocolate gelt (coins)) centered on the titular spinning tops called dreidels. Dreidels have four sides:... | stackexchange_codegolf |
I've been posting relatively hard challenges recently, so here goes an easy one.
Task
Given an array \$A\$ and a number \$n\$, calculate the sum of all numbers of \$A\$ multiplied by \$n\$, except the last one. All numbers (the elements of \$A\$ and the value of \$n\$) are positive integers, and \$A\$ is non-empty. Sho... | stackexchange_codegolf |
Your challenge, should you choose to accept it, is simple:
Implement RFC 862, also known as the Echo Protocol:
The Echo protocol
An echo service simply sends back to the originating source any data it receives.
TCP Based Echo Service
One echo service is defined as a connection based application on TCP. A server listens... | stackexchange_codegolf |
Or Fix American Kennel Club's database
As covered by the recent video by Matt Parker, the American Kennel Club permits thirty-seven (37) dogs of each breed to be assigned the same name (source), because of a database restriction for Roman numeral length.
Given an integer, your task is to output the length of its Roman ... | stackexchange_codegolf |
Credit: Marco Verch CC BY 2.0
A two-cube calendar, as shown in the picture, uses two cubes with digits painted on the faces to display the date. For dates in the range 1-9, a leading zero is used ("01", "02", ..., "09").
Now, if you do the math, you might come to the conclusion that these calendars should be impossibl... | stackexchange_codegolf |
In this challenge you will be determining how controversial a vote is, given an array of other votes, by figuring out a number called the C-factor. What is the C-factor, you ask?
Well, imagine you've got multiple votes on an election. We'll use 1 and 0 for the sake of the challenge to represent two different candidates... | stackexchange_codegolf |
For a 2 dimensional array we will call the elements in either the first row or the last column the "J-Bracket" of the array. For example in the following array elements in the J-bracket are highlighted:
\$
\begin{bmatrix}
\color{red}{\underline 1} & \color{red}{\underline 2} & \color{red}{\underline 4} & \color{red}{\... | stackexchange_codegolf |
This challenge is from a game called Keep Talking And Nobody Explodes.
Memory is a fragile thing but so is everything else when a bomb goes off, so pay attention! – from the manual
The Objective
A number from 1–4 is given as the "display", along with scrambled numbers 1–4 as the "buttons."
The output must be the label ... | stackexchange_codegolf |
Problem statement
Pólya is playing about with his urn again and he wants you to help him calculate some probabilities.
In this urn experiment Pólya has an urn which initially contains 1 red and 1 blue bead.
For every iteration, he reaches in and retrieves a bead, then inspects the colour and places the bead back in the... | stackexchange_codegolf |
Given an integer N perform the following steps: (using 9 as an example).
Receive input N. (9)
Convert N from base10 to base2. (1001)
Increase every bit by 1. (2112)
Treat the result as base3 and convert it back to base10. (68)
Return/Output the result.
Input
May be received in any reasonable number format.
You only ... | stackexchange_codegolf |
A variable-length quantity (also referred to as VLQ or uintvar) is a way to encode up to a 28 bit integer value using only as many bytes as necessary. This was used in MIDI file format as a way to minimize the size of certain event data.
The way it works is fairly simple. As a big-endian series of bytes, the most sign... | stackexchange_codegolf |
Find the max number of Xs you can fit onto a rectangular tic-tac-toe board of length l and height h without ever having 3 consecutive Xs in a row diagonally, horizontally, or vertically.
This is a code-golf challenge so shortest code wins!
Input
A single line containing values l and h, representing the length and heigh... | stackexchange_codegolf |
Implement a simple digital Stopwatch,
which will display the time elapsed in seconds and minutes, as described below.
Important
Please read both Display and Controls sections !
Display
Time elapsed, should be displayed in the MM:SS format,
by replacing the previously displayed time string "in-place"
(clearing the who... | stackexchange_codegolf |
In a fictional document management system, input documents are structured with weighted headings. Lowest weighted headings are the most important.
This is a sample document:
H1 All About Birds
H2 Kinds of Birds
H3 The Finch
H3 The Swan
H2 Habitats
H3 Wetlands
From this document we would like to produce an outline usin... | stackexchange_codegolf |
Shocking news: Dr. Mad J Scientist has released a proof of P = NP to the world. But the proof is nonconstructive, and she's keeping the algorithm to herself.
Worry not. Without even looking at her proof, we can still (almost) write a computer program that solves NP-complete problems in polynomial time.
The Problem
Inpu... | stackexchange_codegolf |
Disclaimer: This challenge is inspired by a coding error I once made.
Okay, time for a maths lesson. A normal mean average looks like this:
Work out the sum of all numbers in a list
then divide by the size of the list.
But what if we don't know all the numbers at the time we're working out the average? We need a way ... | stackexchange_codegolf |
Given a ragged list of positive integers, where the maximum depth is \$d_\text{max}\$, return the same list, except for every element \$e\$, its depth is \$d_\text{max}+1-d_e\$ (where \$d_e\$ is the depth of that element).
Your output should contain the minimal number of brackets, and you can assume the same from your ... | stackexchange_codegolf |
Introduction
Given five points in the plane, your task is to compute the area of the ellipse passing through these points.
You can assume that exactly one non-degenerate ellipse can be constructed with the given input values.
Rules
Input is 10 integers in any convenient form, corresponding to the x and y coordinates of... | stackexchange_codegolf |
This challenge is inspired by this app.
This is a much easier version of this challenge. This challenge is code-golf, while the other one is fastest-code.
You'll be given a square input grid, of dimensions 6-by-6 which is divided into 6 areas, where the cells of each area have a unique identifier (I'll use lower case... | stackexchange_codegolf |
Background
The systematic chemical symbol is defined as such for \$ 118 < n < 1000 \$:
The first letter corresponds to the first digit, capitalized.
The second letter corresponds to the second digit.
The third letter corresponds to the third digit.
This can be generalized for all \$ n > 0\$:
For each digit, get the ... | stackexchange_codegolf |
For context, this problem is based on a old chat-bot project I did.
Problem:
Given a string of words containing any of the characters:
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
Find the frequency of each triplet of words. All non-alphanumeric characters should ... | stackexchange_codegolf |
zipwith is a functional construct that takes three arguments: one binary function and two lists of the same length, and returns a single list where each element is constructed by applying the binary function to each pair of elements from the two lists:
zipwith (a+b) [1,2,3] [4,5,6] = [5,7,9]
You are to take a black-bo... | stackexchange_codegolf |
Your challenge is to construct a proper quine using as few distinct characters as possible.
Scoring
Your score is equal to the number of distinct characters in your code, aiming to minimise this. Standard quine rules apply.
| stackexchange_codegolf |
In North America, most electrical outlets/receptacles follow standards set by NEMA. For this challenge, you'll be given a few properties of a device you need to plug in, and your program (or function) should return all of the outlets that would be compatible.
For this challenge, an outlet has three properties: voltage,... | stackexchange_codegolf |
Background
In X11 (a windowing system used by a lot of Unix-like OS), what you would call the clipboard behave a bit differently than on other OSes like MacOS or Windows. While the "traditional" clipboard using ctrl+v/ctrl+c works, there is also another clipboard, called PRIMARY selection, that behave as following:
wh... | 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 |
The Meeker numbers are a 7 digit number in form of \$abcdefg\$, where \$a×b=10c+d\$ and \$d×e=10f+g\$. As an example \$6742612\$ is a meeker number, here \$6×7=10×4+2\$ and \$2×6=10×1+2\$, so it is a meeker number.
Additionally, a Meeker number does not have any leading zeros (so \$a \ne 0\$)
The Challenge
Your program... | stackexchange_codegolf |
The Task
The task is easy: given an Alpha-2 country code, output the Alpha-3 equivalent. The input may be in any case you choose, and the output in any consistent case of your choosing. Here are the codes:
[["AF", "AFG"], ["AX", "ALA"], ["AL", "ALB"], ["DZ", "DZA"], ["AS", "ASM"], ["AD", "AND"], ["AO", "AGO"], ["AI", "... | stackexchange_codegolf |
Your task is to determine whether two numbers are easy to multiply. This means that their base-10 long multiplication doesn't have any carrying (regrouping) between place values, looking at both the multiplication steps and the addition step. This happens when each pair of digits being multiplied gives 9 or less and th... | stackexchange_codegolf |
In this challenge, you are going to take a number and turn it into a string, but not in the common way. You will use the aaaaa way!
The aaaaa way is simply replacing each digit of the input number with the letter at that position in the alphabet. For example, 11111 would become aaaaa and 21223 would become babbc. If th... | stackexchange_codegolf |
A ragged list is a (finite depth) list where each element is either a positive integer or a ragged list.
A ragged list is properly tiered if it contains either all positive integers or all properly tiered ragged lists.
For example [1,2,3,6] is properly tiered because it is a list of only positive integers. [[1,2],[[1]... | stackexchange_codegolf |
You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but cannot be longer than 8 characters.
Your goal is to output all dates between 6th of December 1919 and 5th of December 2019 which fit the input in these formats:
day - month - year (dmy)
mont... | stackexchange_codegolf |
Taken from StackOverflow Question
Challenge
Given an encoded string in format n[s] where n is the amount of times s will be repeated, your task is to output the corresponding decoded string.
n will always be a positive number
s can not contain empty spaces
strings only contains letters from the alphabet
s length can b... | 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 |
For more MtG-goodness: Magic: The Gathering Combat with Abilities
Premise:
In Magic: the Gathering, you cast spells by paying their mana cost by tapping lands for the required amount. These lands can produce one of the five colors which are:
White (W)
Blue (U)
Black (B)
Red (R)
Green (G)
The cost is made up of two... | stackexchange_codegolf |
The Specs
Your program must read the image from one file and write the results to another file, the name of at least the first of which should be taken from the input
You may accept and return any image format or formats, as long as you specify in your answers which ones you are using
An exception should be thrown if ... | stackexchange_codegolf |
In this challenge, you will be given a text block, and you need to perform reflection on the text.
Input:
A string to be reflected. The text may not be supplied as an array whose elements are the lines of text. For example, "ab\ncd" and ['a','b','\n','c','d'] are allowed, but ['ab','cd'] or [['a','b'],['c','d']] are n... | stackexchange_codegolf |
For this challenge, a word is defined as a string of letters, separated by spaces.
Given a string of words, and an integer i representing an index into that string, output the whole word which contains the character at index i.
For example (using 0-based indexing), with the string code golf, and the index 6, the 7th ch... | stackexchange_codegolf |
At 1998, Brian Kernighan, while working on the book "The Practice of Programming", wanted to demonstrate realisation of regular expression engine. But struggled to find small engine, that cod could fit in the book.
So Brian Kernighan asked Rob Pike to write one for him, and Rob did it gracefully. Here is original sourc... | stackexchange_codegolf |
Your task is, given a array of numbers, that is strictly increasing, output the crate stack. The input is an array of positive integers which represents which layer has how many crates there are. So the first number is the top layer and so on. The sum of the array is the size of the crate.
Since the array order follows... | stackexchange_codegolf |
Basic rules (different from mine)
Story
It is the year 4579, humans now have 2 hands with 1001 fingers each. Chopsticks has become based off of points. And @Dennis has more rep then @Martin... Hand drawn red circles are now downvoted... Jon Skeet has hit 2 trillion rep on every SE site... Yeah scary I know
Chopsticks i... | stackexchange_codegolf |
There are \$a\$ honest man(always tell the truth), \$b\$ dishonest man(always tell lie), and \$c\$ random man(tell random Y/N). How many times at least should you ask one of them a yes/no question about who they are, to guarantee you get knowledge of who they are? You may assume that it's possible.
Test cases:
(a,b,c) ... | stackexchange_codegolf |
This is a cops-and-robbers challenge based around defining languages and proving they are Turing complete.
This is the robbers' thread. The cops' thread is here.
Robbers
The cops will post definitions of Turing-complete languages. Your task is to crack them by proving that they are indeed Turing complete. See the cops'... | stackexchange_codegolf |
Cops challenge
The Robbers' Challenge
Find a vulnerable answer. That is, an answer which hasn't been cracked yet and which isn't safe yet either.
Crack it by figuring out its language. That is, find any language in which the given program is a valid program (subject to the rules outlined in the Cops' Challenge above)... | stackexchange_codegolf |
Innovation is a card game where players battle through the ages, from prehistory to modern times, in an attempt to earn achievements faster than their opponents.
Each card in Innovation is unique, and provides a player with a number of icons. If we treat each card as a 2x3 grid, then three of the four slots on the left... | stackexchange_codegolf |
Stack Exchange automagically detects serial
voting (when one user either
upvotes or downvotes many of another user's posts) and reverses it. In this
challenge, you will implement a very, very simple "serial vote" detector.
Input
The input is a string representing a list of votes. Every group of two
characters represent... | stackexchange_codegolf |
This challenge is to golf an implementation of SKI formal combinator calculus.
Definition
Terms
S, K, and I are terms.
If x and y are terms then (xy) is a term.
Evaluation
The following three steps will be repeated until none of them apply.
In these, x, y, and z must be terms.
(Ix) will be replaced by x
((Kx)y) will be... | stackexchange_codegolf |
Final results
1st place goes to Follow!
Honourable mentions to The diff predictor (2nd), and Simple Killer, Low Blow and High to Low (joint 3rd).
Other winners:
(score competition) 1st - Simple Killer
Honourable mentions: The diff predictor and Naiive.
(wins competition) 1st - Crab
Honourable mentions: Follow and High ... | stackexchange_codegolf |
The Steenrod algebra is an important algebra that comes up in algebraic topology. The Steenrod algebra is generated by operators called "Steenrod squares," one exists for each positive integer i. There is a basis for the Steenrod algebra consisting of "admissible monomials" in the squaring operations. It is our goal to... | stackexchange_codegolf |
Pre-Note
Because of popular demand, and to avoid disqualifying certain languages, the dictionary can now be provided as input parameter.
Intro
Given a dictionary of words, you should write an autocomplete program or function.
Autocompletion
"Autocomplete, or word completion, is a feature in which an application predict... | stackexchange_codegolf |
Your task, if you wish to accept it, is to write a program that outputs a non-zero number(can be integer or float). The tricky part is that if I reverse your source code, the output must be the original integer negated.
Rules
You must build a full program. That is, your output has to be printed to STDOUT.
Both the num... | stackexchange_codegolf |
On the advice of Ms. Pac-Man who's worried about him getting overweight, Pac-Man has decided to keep track of his daily Pac-Dot intake. Help him count the number of Pac-Dots on a given path in the maze!
The maze
To help you build your own encoding of the maze, you can get some raw data here.
Pac-Man's journey
In the c... | stackexchange_codegolf |
An integer \$x\in[0,2^{32}-1]\$ divided by an integer \$d\in{[1,2^{31}]}\$ will produce an integral quotient \$q\$ and a remainder \$r\$, so that \$x=d\times q+r\$.
Any \$q\$, in fact, can be calculated by the following formula.
$$y=\left\lfloor\frac{mx}{2^{32}}\right\rfloor\\q=\left\lfloor\frac{y+f\lfloor(x-y)/2\rfloo... | stackexchange_codegolf |
Background
I have a bunch of square-shaped boxes of equal size, and since I'm a neat person, I want to arrange them all into a square formation.
However, their number is not necessarily a perfect square, so I may have to approximate the square shape.
I want you to find me the most aesthetically pleasing arrangement -- ... | stackexchange_codegolf |
Today (or tomorrow, depending on your timezone, by the time of posting) is the birthday of the great mathematician and physicist Leonhard Euler. To celebrate his birthday, this challenge is about one of his theorems in geometry.
For a triangle, we define its incircle to be the largest circle inside the triangle and its... | stackexchange_codegolf |
In the United States, the two opposing directions of traffic on a road are separated by a dashed yellow line if passing is allowed and two solid yellow lines if passing is not allowed.
(Just one side can be dashed to allow passing on that side, and yellow lines can mean other things like center or reversible lanes, bu... | stackexchange_codegolf |
Given two arrays of non-negative integers \$A = [A_1,A_2,\ldots,A_n]\$ and \$R = [R_1,R_2,\ldots,R_n]\$ which are equal in length, return an array which has the element \$A_1\$ repeated \$R_1\$ times, then element \$A_2\$ repeated \$R_2\$ times, all the way up to \$A_n\$.
Standard loopholes are forbidden. As this is co... | stackexchange_codegolf |
For 2 arrays each with X elements, what is the SHORTEST code to subtract every element in the second from every element in the first, 1 to 1
so, for example:
A1 = [10,11,12]
A2 = [1,2,3]
A1 "-" A2 should == [9,9,9]
| stackexchange_codegolf |
In this challenge, you need to simulate a frog jumping back and forth on lily pads. The pond is infinitely big, has a line of an infinite number of lily pads, and the frog can jump across as many lily pads as he likes.
This frog likes to jump back and forth: after jumping forward, he always jumps backwards, and vice ... | stackexchange_codegolf |
If you wanted to compute a very large long problem, that on a machine that you could buy today for an inflation adjusted price, will take some amount of years/decades. The issue is, if you only have that budget, and so can only purchase one machine. So if you purchase the machine now, it may actually take longer to com... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.