instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Background
Mathematicians are interested in all kinds of algebraic structures, e.g. groups, rings, boolean algebras. Generally, we have several operations (addition, multiplication, meet, join, etc.), and some equational relationships on the operations (e.g. associativity of multiplication). This makes up an algebraic ... | stackexchange_codegolf |
INTRODUCTION
I like Karma Fields : he's a music producer that creates original music tracks. His artwork also matches up really well his style.
He has a logo witch I find really interessing :
GOAL
Your goal will be to reproduce that logo, graphically or in ASCII.
Edit
@NahuelFouilleul managed to provide a readable asc... | stackexchange_codegolf |
This question is written because "Thing Explainer" is fun to read, and gave me an idea.
Write "stuff that makes computer do things" that reads/takes a set of letters, numbers and things like this "#%|? and returns True / 1 if all words are part of this set.
If all words are not part of that set, return the words that w... | stackexchange_codegolf |
List all of the combinations with replacement (or combinations with repetition) of size k from a set of n elements.
A combination with replacement is an unordered multiset that every element in it are also in the set of n elements. Note that:
It is unordered. So a previously printed set with a different order shouldn'... | stackexchange_codegolf |
While at work I spotted a nice and simple challenge.
The job was to stock products in cargo units with a certain capability.
Since an order can have various batches, coming in sequence from the production, we usually make a list of the pieces of those batches distributed in each cargo to make sure nothing is lost durin... | stackexchange_codegolf |
Given an integer n, enumerate all possible full binary trees with n internal nodes. (Full binary trees have exactly 2 children on every internal node). The tree structure should be output as a pre-order traversal of the tree with 1 representing an internal node, and 0 representing an external node (Null).
Here are exam... | stackexchange_codegolf |
Aside of nursing my child, Vitsy, and dabbling in the art of code golf, I also am an avid dubstep fan, listening to all the new dubstep that Monstercat puts out as regularly as I can. I also share a random dubstep of the day, though not regularly, in the Nineteenth Byte. This last bit is what this challenge relates to;... | 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 |
Task
Given an array of non-negative numbers, output the largest and smallest possible number that can be formed by joining them.
Rules
Input,Output can be in any convenient format.
The array may have at most 1 decimal number.
Examples
input:[22,33,44,55.55,33]
output:4433332255.55,55.5522333344
input:[34,900,3,11,9]
o... | stackexchange_codegolf |
You are given an integer n as input, and, regardless of the current date, must return the calendar year (Gregorian calendar, other calendars not allowed) taking place n seconds from now.
Rules
You may not assume that the current year is 2021. In other words, imagine a user testing your solution in five years.
Standard... | stackexchange_codegolf |
Input will consist of the following characters:
^: Go up one
v: Go down one
▲ or k: Go up two
▼ or j: Go down two
For example, the following input:
^^▲^v▼▲^^v
would produce the following output:
^
^ ^ v
▲ v ▲
^ ▼
^
Escape sequences that move the cursor such as \e[B are not allowed. You must produ... | stackexchange_codegolf |
Super permutations
Input: A string
The program should loop through all lengths of the input (decrementing one each time), generate all combinations with replacement of the string, then make permutations out of the generated combinations, and display all of the strings.
They can be separated with anything (doesn't need... | stackexchange_codegolf |
New Bonus! (See below)
The cartography team of U.S. Republican presidential hopeful Ben Carson is having some trouble with their maps (image via Washington Post):
The problem is they don't have the Right Tool For The Job™. They need the most compact and reliable program possible, so they never have to worry about maki... | stackexchange_codegolf |
My first code golf post, apologies for any mistakes...
Context
In rock climbing (bouldering specifically), the V/Vermin (USA) climbing grades start at 'VB' (the easiest grade), and then go 'V0', 'V0+', 'V1', 'V2', 'V3', 'V4', 'V5' etc. up to 'V17' (the hardest grade).
Task
You will take as input a list/array of climbin... | stackexchange_codegolf |
Cops section
The robbers section can be found here.
Thanks to FryAmTheEggman, Peter Taylor, Nathan Merrill, xnor, Dennis, Laikoni and Mego for their contributions.
Challenge
Your task is to write 2 different programs (full programs/functions/etc.) in the same language and the same version (e.g. Python 3.5 ≠ Python 3.4... | 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 |
Introduction
In this challenge your task is to generate the ISBN-10 code for books given its ISBN-13 code, assuming that such a code exists. Such an ISBN-13 code consists of several parts separated by -:
978-GG-PPPP-TTT-C
The letters G (group), P (publisher), T (title) and C (checksum) all stand for one digit. For the... | stackexchange_codegolf |
Take as input an integer in any reasonable format.
Then, output all the proper sub-strings of the base-10 digits of that integer that are powers of two, in any reasonable format.
Test cases
10230 -> [1, 2]
13248 -> [32, 1, 2, 4, 8]
333 -> []
331 -> [1]
32 -> [2] # As 32 is not a proper sub-string, since it is the whole... | stackexchange_codegolf |
i've been dabbling with a hypothetical language... now, i want to add a feature/mechanism that can easily format data in as few codes as possible.
now, i need to compare my hypothetical language feature with how it's going to be written in other languages. in particular, would it have lesser code? so i just decided i w... | stackexchange_codegolf |
\$ 1089 \$ is a very special number. To prove why, select any 3-digit number whose first and last digits differ by at least 2. Then, reverse the digits, and take the difference of these two numbers. Reverse the digits once more, and add these two numbers together. You will get \$ 1089 \$. The magic is left as an exerci... | stackexchange_codegolf |
proposed by @Adám in chat
Given an even number of finite points return a line \$y=mx+b\$ that evenly splits the points on both sides.
Specs
Take a list of distinct points \$(x,y)\$ (or a list of x-coordinates and a list of y-coordinates), output a possible \$(m,b)\$ pair
Half of the points should be true for \$y>mx+b\... | stackexchange_codegolf |
Given a, b, c the length of the three sides of a triangle, say if the triangle is right-angled (i.e. has one angle equal to 90 degrees) or not.
Input
Three positive integer values in any order
Output
Either a specific true output (true, 1, yes, ...) or a specific false output (false, 0, no, ...)
Example
5, 3, 4 ... | stackexchange_codegolf |
Over at our friends at Puzzling.SE, the following puzzle was posted: Is this chromatic puzzle always solvable? by Edgar G. You can play it here.
Puzzle explanation
Given a m x n grid with tiles of three different colours, you may select any two adjacent tiles, if their colours are different. These two tiles are then co... | stackexchange_codegolf |
Background
BitCycle is a two-dimensional Turing-complete programming language involves moving bits around a playfield.
Because I am too lazy to write BitCycle programs myself, you will be writing a program which outputs BitCycle programs for me! Unfortunately, the storage space on my computer is only about a bit, so yo... | stackexchange_codegolf |
The idea for this code golf puzzle is from link: The Bridge and Torch Problem
The inspiration for this code golf puzzle is the Bridge and Torch
problem, in which d people at the start of a bridge must all cross it
in the least amount of time.
The catch is that at most two people can cross at once, otherwise the
... | 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 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 |
Challenge closed, the shortest answer has been acccepted.
A military projection is a projection where all lengths and the angles in the X-Z plane remain unattuned.
Your task is to print a cube in military projection using /, |, \, -, and any whitespaces you want, given any integer greater than zero as it's side length.... | stackexchange_codegolf |
Challenge
Given a three digit octal permissions number, output the permissions that it grants.
chmod
On UNIX OSes file permissions are changed using the chmod command. There are few different ways of using chmod, but the one we will focus on today is using octal permissions.
The three digits in the permissions number r... | stackexchange_codegolf |
Given a list of coordinate pairs, output the Trapezoidal Riemann Sum of the values given between the first and last x-coordinates.
You will be given a sorted list of coordinate pairs, like this:
[
[1,2],
[3,5],
[5,11]
]
Note that x-coordinates will always be in increasing order, ys may not.
My way to do this is ... | stackexchange_codegolf |
Description
In this challenge, you need to write a function that takes in a list of strings and returns the smallest string based on their ASCII value. You should assume that the input list contains only lowercase alphabetical strings.
Test Cases
["a", "b", "c"] => "a"
["hello", "world", "code"] => "code"
["aaa", "aa",... | stackexchange_codegolf |
Accordion is a solitaire card game I recently came across where nearly every layout is solvable, but incredibly hard. You can play it here.
Rules
52 face cards are placed face-up in a random order. Each turn, you replace a card with a later card, where the two cards:
Share a suit or number and
Are at a distance of 1... | stackexchange_codegolf |
As a child, my friend had a magic 8 ball that we would ask questions to and see what the fate of that question was.
Challenge
Your challenge is to write a program (or function) that when run (or called), outputs (or returns) a random answer from the possible answers below. (Random being: each output should have a nonze... | stackexchange_codegolf |
This is my first time here at Code Golf SE so feel free to add your input/advice/suggestions to improve my post if necessary. The week after my computer science exam, the solutions were publicly published. One problem had a 45 line example solution but my solution was only 18 lines, (which I was very proud of), but I b... | stackexchange_codegolf |
We want to go on a night hike with the youth group, but of course not everyone has their torch, even though we told them we planned to split up. What options are there for group formation if n teens have m torches with them, but each group needs at least one torch?
Example: Three teens with torches (X) and two without ... | stackexchange_codegolf |
Given an integer n as input, write a function that dynamically allocates n bytes and returns their address.
Rules
The allocator must be able to dynamically allocate memory at runtime.
It doesn't matter where the memory is allocated to or in what form, as long as it's allocated in a valid location which can be read fro... | stackexchange_codegolf |
Here is a 1.2Mb ASCII text file containing the text of Herman Melville's Moby-Dick; or, The Whale. Your task is to write a program or function (or class, etc. -- see below) which will be given this file one character at a time, and at each step must guess the next character.
This is code-challenge. Your score will be
2... | stackexchange_codegolf |
Challenge:
Given an array of non-negative whole numbers numbers in the range of 0 to Infinity, Check whether all of them are primes or not. (You can take input as a string too if you want)
Input:
Input: An array of numbers
Output: The array with every element replaced by one of these:
-1 -----> If 0, 1
... | stackexchange_codegolf |
The Goal
The goal of this question is to put a twist on this question. Your answer should be able to convert an array of words associated with integers into those integers. As an extra challenge, allow support for , +, -, and _ in between numbers such as sixty seven, sixty+seven, sixty-seven, or sixty_seven.
Examples
... | stackexchange_codegolf |
Everyone realizes that Tic Tac Toe is a solved game. However, the Misère version of only-Xs provides an interesting alternative.
In this version of the game, both players play Xs onto the board and try to avoid making three in a row. If you'd like to see more about this, Numberphile has a nice video about this concept.... | stackexchange_codegolf |
This is an answer-chaining post, so in this challenge every answer (except the first answer) depends on the previous answer.
The goal of this challenge is to output the restricted characters. The restricted characters are the most common n - 1 characters of all answers, if happens to be a tie, then the characters with ... | stackexchange_codegolf |
You're looking at an avenue, and someone has left the trash out! You need to write a program to help fix the problem, by putting the trash into trashcans.
The task
The avenue is made up of a string of printable ASCII characters, e.g.:
[[](dust)[]] car ((paper)vomit) (broken(glass)) [[] (rotten) fence (dirty)
Some of t... | stackexchange_codegolf |
The bank has been broken into, and all the local mafia thugs have an unusual alibi: they were at home playing Connect 4! In order to assist with the investigation, you are asked to write a program to validate all the Connect 4 boards that have been seized in order to check that the positions are indeed positions from ... | stackexchange_codegolf |
The Hamming distance between two strings is the number of positions they differ at.
You are given a set of binary strings. The task is to find the length of the shortest route that visits all of them at least once and ends where it started, in a metric space where the distance between two strings is the Hamming distanc... | stackexchange_codegolf |
Inputs
A list (array) of numbers, or numerical strings if that makes it easier. You can assume there will always be at least two elements in the list and every element will be a natural number (integer larger than zero).
Outputs
A single number, or again, a numerical string.
Problem
The idea is to reduce the list of nu... | stackexchange_codegolf |
Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details.
While other Elves are busy carrying air blowers, Fen comes and shouts, "I've got a spell for this job!"
To recap, a chimney is modeled as a rectangular grid. The number in each cell represents the amount of smoke in the region. The lef... | stackexchange_codegolf |
You are an explorer, mapping an unknown world. Your ship is carried on the wind. Where it goes, who knows?
Each day, in your spyglass, you see features to the north, south, east and west. You always see four such features, corresponding to the cardinal directions. Your spyglass reports ASCII symbols like this:
~~.*, ~... | stackexchange_codegolf |
I was playing around with some numbers and found a sequence that, of course, is on OEIS. It is A005823: Numbers whose ternary expansion contains no 1's. It goes:
a(2n) = 3*a(n)+2
a(2n+1) = 3*a(n+1)
a(1) = 0
a = 0,2,6,8,18,20,24,26,54....
I wrote a CJam program that generates the first n of these numbers by convertin... | stackexchange_codegolf |
I was trying to write a short MIPS32 code for computing the median of three registers.
The rules:
Assume that some values are pre-loaded into $t0, $t1, $t2.
The median of the three values should be placed in $t0.
No branches are allowed, but otherwise any instruction is okay.
You may arbitrarily modify the values of a... | stackexchange_codegolf |
Introduction
The \$n\$-ellipse is a generalization of the ellipse with possibly more than two foci. Specifically, given \$n\$ points on the plane, called foci, the \$n\$-ellipse is the set of points of the plane whose sum of distances to the \$n\$ foci is equal to a constant \$t\$.
This challenge is about plotting the ... | stackexchange_codegolf |
Consider the equation $$\frac x {y+z} + \frac y {x+z} + \frac z {x+y} = n$$ for positive integers \$x, y, z\$ and \$n \ge 4\$. Your code will receive \$n\$ as an input, and output three integers \$x, y\$ and \$z\$ such that the equation holds. You may assume that a solution always exists.
Background
This equation is a ... | stackexchange_codegolf |
Following last year's event, we're doing Code Golf Advent Calendar 2022!
On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent calendar. It is a free-for-all and just-have-fun-by-participation event, no leaderboards and no prizes for solving them fast ... | stackexchange_codegolf |
Inspired by Does the start equal the end
Given a string s and an integer n, output a truthy/falsey as to whether the nth char in s equals the nth from the end char in s.
Input
A non-empty string and an integer. You can use 0-based indexing or 1-based indexing. The integer is guaranteed to be valid based on the string. ... | stackexchange_codegolf |
Now that other users have helped Trump build the wall, its time for you to climb it.
This is an ascii art challenge where you need to output a climbing wall with randomly placed holds.
A climbing wall is made up of panels each of which has between 3 and 10 holds and is 5 panels high. Each panel is 4 characters high and... | stackexchange_codegolf |
Given two integers, compute the two numbers that come from the blending the bits of the binary numbers of equal length(same number of digits, a number with less digits has zeros added), one after the other, like such:
2 1
10 01
1 0
1001
0 1
0110
some examples:
Input
Binary
Conversion
Output
... | stackexchange_codegolf |
This challenge requires a small amount of knowledge about chess. A description of the details required can be found at the bottom if you are not familiar with chess or want a refresher.
For a certain board configuration consisting only of queens we can say that each queens threat number is the number of other queens i... | stackexchange_codegolf |
A riffle shuffle is a type of shuffle where the deck is split into two partitions and the partitions are then spliced back together to create a new shuffled deck.
The cards are spliced together in such a way that cards maintain their relative order within the partition they are a member of. For example, if card A is b... | stackexchange_codegolf |
Our boolean operators are AND, OR, XOR, NAND, NOR, XNOR and, in conjunction with one of those operators, NOT.
Our numbers are \$1\$ and \$0\$.
The challenge is to write a program or function that calculates the results of the input.
Input
A string, array or other input format of your choice; containing alternating numb... | stackexchange_codegolf |
One nice property of a Turing-complete language is that it can be used to write any program, up to and including the simulation of the entire Universe.
Your job is to do exactly that: write a program which simulates the Universe.
Note: although I don't doubt you'll be able to accomplish this task, nowadays I don't hav... | 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 |
Curry is the Language of the Month this month and some users are starting to get into it, so let's get some tips together.
Haskell and Curry are similar in a lot of ways and a lot of tips for Haskell work well in Curry and vice versa. So I'd like in this question to gather tips for code-golf in Curry, that would be use... | stackexchange_codegolf |
Intro
The challenge is to create a program/function that prints the intersection of its own source code and a given string input. This is code golf and to be more precise:
Let I be the input set
{"a","b","c"}
Let S be the source code set
{"b","f"}
Then the intersection is what they share
I ∩ S = {"b"}
Inpu... | stackexchange_codegolf |
Challenge
The challenge is simple: print a snake.
You will get the length of the snake as input.
A snake of length 2 looks like this:
==(:)-
A snake of length 7 looks like this:
=======(:)-
In other words, the length of a snake is how many equal signs are before the head.
Usage
Let's say I made a C++ implementation a... | stackexchange_codegolf |
Braid Description
In this braid, when a strand crosses over the top of another strand it adds the other strand's value to itself and all other strand values pass through. The braid has three strands and each strand begins at 1. The first crossover is the leftmost strand crossing over the middle strand. The next crossov... | stackexchange_codegolf |
Introduction
I've previously created two challenges where the idea is to reconstruct an object using as few query-type operations as possible; this will be the third.
The task
Your inputs shall be a non-empty string S over the alphabet abc and its length, and your output shall be S.
With no restrictions, this would of ... | stackexchange_codegolf |
hgl has a "scan" function called sc. What it does in general is a little bit abstract, so we will just talk about one specific way you can use it.
If we want to take a list of integers and get the partial sums of every prefix we can scan with + for sums and 0 as a starting value:
ghci> sc (+) 0 [1,2,3,4,5,6]
[1,3,6,10... | stackexchange_codegolf |
Print the following text and nothing else:
<html>
<body>
<p>HTML is kinda annoying</p>
</body>
</html>
I'm happy I'm not a web developer.
The catch? Your code must fit the template: print(<?>), where ? can be any group of characters. You can paste your completed code (with the print(<>) part) into this Scast... | stackexchange_codegolf |
Who needs to compare things case insensitively when you're able to generate every permutation of uppercase and lowercase? No one! That's the answer. No one does. Your task is to achieve this feat; generate all possible permutations of uppercase/lowercase for a given input.
Input
A string of printable standard ascii cha... | stackexchange_codegolf |
Take as input two strings \$A\$ and \$B\$. Output a string \$C\$ that is \$A\$ but with two characters swapped such that the Levenshtein distance \$d(C,B)\$ is as small as possible. You must swap two characters and you cannot swap a character with itself, although you may swap two identical characters in different po... | stackexchange_codegolf |
Goal
You will be given a positive integer number less than 10^20. You must convert it to Korean.
For example, if the input is 12345, the output should be 일만이천삼백사십오.
Technical details (Small)
Let's starts with simple numbers.
// 1 - 9
1 -> 일
2 -> 이
3 -> 삼
4 -> 사
5 -> 오
6 -> 육
7 -> 칠
8 -> 팔
9 -> 구
// 10, 100, 1000
10 ->... | stackexchange_codegolf |
Suppose we want to encode a large integer \$x\$ as a list of words in such a way that the decoder can recover \$x\$ regardless of the order in which the words are received. Using lists of length \$k\$ and a dictionary of \$n\$ words, there are \$\binom{n+k-1}k\$ different multisets possible (why?), so we should be able... | stackexchange_codegolf |
Related
Goal:
Given two creatures with optional combat abilities, return unique but consistent values that represent which creatures died, if any.
Input:
#Longest form:
[[P,T, "<abilities>"], [P,T, "<abilities>"]]
#Shortest form:
[[P,T], [P,T]]
Each creature will be given in the form of [P,T,"<abilities>"]. It will be... | stackexchange_codegolf |
Today your challenge is to produce all possible full parenthesizations of an expression.
Your input is a single line of printable ASCII containing one or more terms separated by operators. The input might also contains spaces - you must ignore these. A term is [a-zA-Z0-9], an operator is [^ ()a-zA-Z0-9]. You may assume... | stackexchange_codegolf |
Write a program or function which, given a non-empty sequence of right or left turns, outputs the length of the shortest self-avoiding path on a 2D lattice with those turns.
The input should be taken as a string, with each character being R or L for a right or left turn respectively.
The output should be an integer, th... | stackexchange_codegolf |
Minesweeper is a popular puzzle game where you must discover which tiles are "mines" without clicking on those tiles. Each tile is either a mine (represented by *) or a clue, i.e. a number from 0 to 8 representing how many of the 8 neighboring tiles are mines. Your task today is to take a board containing the mines and... | stackexchange_codegolf |
Task
Given is a square matrix of any dimension and any integer n.
Output all possible matrices(without duplicates) by removing columns and rows from the input matrix such that the determinant of these new matrices is n.
Rules
Output should include original if determinant of original is n.
Output should be all the chopp... | stackexchange_codegolf |
The cardinality of the set \$\mathbb Q\$ of rational numbers is known to be exactly the same as that of the set \$\mathbb Z\$ of integers. This means that it is possible to construct a bijection between these sets—a mapping such that each integer corresponds to exactly one rational number, and vice versa.
Provide such ... | stackexchange_codegolf |
Take a unit circle centered on the origin. In any two neighboring quadrants, mirror the curve of the circle across the lines connecting the circle's x and y intercepts.
With the resulting shape, you can tile the plane:
I made this image with the awesome 2D physics sandbox Algodoo!
Write a program that outputs an image... | stackexchange_codegolf |
It is very hard to remember my password, so I came up with a way to generate a password.
The way I generate my password is from a word or a sentence, following these steps:
Start from left to right
Find the count of each letter
Put letter with its count in an order
Letters with higher repetition will be in the end
... | stackexchange_codegolf |
Introduction:
Some times using a 24-hour clock are formatted in a nice pattern. For these patterns, we'll have four different categories:
All the same (pattern A:AA or AA:AA):
0:00
1:11
2:22
3:33
4:44
5:55
11:11
22:22
Increasing (pattern B:CD or AB:CD, where D==C+1==B+2==A+3):
0:12
1:23
2:34
3:45
4:56
12:34... | stackexchange_codegolf |
OEIS A090461 details the ‘numbers k for which there exists a permutation of the numbers 1 to k such that the sum of adjacent numbers is a square’. This has also been the subject of Matt Parker’s Numberphile and Alex Bellos’ Monday puzzle.
This code-golf challenge is related to the square sum problem above and asks you ... | stackexchange_codegolf |
Based on How high can you count? let us give an advantage to the polyglot people.
Challenge:
Your task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The first program must output the integer 1, the second one 2 and so on.
You can not reuse any char... | stackexchange_codegolf |
When doing weightlifting, I want to make a specific weight by attaching several plates to a bar.
I have the following plates:
6 plates of 1 kg each
6 plates of 2.5 kg each
6 plates of 5 kg each
6 plates of 10 kg each
The bar itself weighs 10 kg.
It's only allowed to attach the plates in pairs - they are attached at e... | 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 |
Are you feeling jealousy towards Mathematica, Matlab et al. for their intricate plotting capabilities? If you answered yes, this challenge is for you!
Challenge
Given, via parameters or standard input, a list of numbers list and a positive integer h for the height of the plot, write a program/function/snippet that prin... | stackexchange_codegolf |
I have some JavaScript code in a <script> HTML tag I'd like to golf, while still remaining in the tag. How can I golf that code, if at all? Here's the code:
<script>document.write`<font color=#40e0d0 face=arial>YOU ARE IN THE BEDROOM.<br>YOU SEE CRAB NICHOLSON.<br>HE HAS NO MITTENS.<br>HIS CLAWS ARE... | stackexchange_codegolf |
Given an integer from 1 to 999 inclusive, output a truthy value if it appears horizontally, vertically, or diagonally, either forwards or backwards, anywhere in the 3x3 square of digits 1-9 on a standard number pad:
789
456
123
If the number does not appear, output a falsy value.
The exact 65 numbers you need to outpu... | stackexchange_codegolf |
Based on a comment by Jo King on my previous question (called 'Inverse-quotes-quine'), I present this new question. The rules are similar, but just, the opposite:
If your program is run normally, all of the code not in the speech marks (" - double quotes) should be printed.
If your program is wrapped in double quotes ... | stackexchange_codegolf |
You need to print A-Z like this:
1. A
2. B
3. C
4. D
5. E
6. F
7. G
8. H
9. I
10. J
11. K
12. L
13. M
14. N
15. O
16. P
17. Q
18. R
19. S
20. T
21. U
22. V
23. W
24. X
25. Y
26. Z
But your source code cannot use 1,2,4,6.
Trailing newlines in output allowed,, but leading ones not allowed.
Standard loopholes apply, shor... | stackexchange_codegolf |
Your task is to write a piece of code that zeros the current cell in the Brainfuck variant that, each cell can contain a signed integer of arbitrarily large magnitude, instead of the normal 0 to 255.
You may assume there are l cells to the left and r cells to the right of the current cell that are initially zero. You p... | stackexchange_codegolf |
An alphadrome is a word in which each letter in the first half of the word "reflects" its alphabetical "opposite" in the second half of the word. Write a program or function that returns truthy if the given word is an alphadrome and falsey otherwise.
For example, BEEB is a palindrome. Its first letter B "reflects" its ... | stackexchange_codegolf |
Common words should still be avoided to be used as passwords. This challenge is about coding a very simple program that munges a given password (Modify Until Not Guessed Easily).
Input
A word, which is a string written in the alphabet abcdefghijklmnopqrstuvwxyz. It does not matter if the letters are lowercase or upper... | stackexchange_codegolf |
A person has to complete N units of work; the nature of work is the same.
In order to get the hang of the work, he completes only one unit of work in the first day.
He wishes to celebrate the completion of work, so he decides to complete one unit of work in the last day.
He is only allowed to complete x, x+1 or x-1 uni... | stackexchange_codegolf |
This challenge is a riff on Dion's challenge "Is this a rectangle?". The goal of this challenge is to write a program to decide whether or not some collection of tuples of integers represents a hypercube of some dimension.
Background
A hypercube is a generalization of a square.
A \$0\$-cube is a single point.
A \$1\$... | stackexchange_codegolf |
Background
Python 3 has many types of string literals. For example, the string this 'is' an exa\\m/ple can be represented as:
'this \'is\' an exa\\\\m/ple'
"this 'is' an exa\\\\m/ple"
r"this 'is' an exa\\m/ple"
'''this 'is' an exa\\\\m/ple'''
"""this 'is' an exa\\\\m/ple"""
r'''this 'is' an exa\\m/ple'''
r"""this 'is' ... | stackexchange_codegolf |
I am quite surprised that a variant of linear regression has been proposed for a challenge, whereas an estimation via ordinary least squares regression has not, despite the fact the this is arguably the most widely used method in applied economics, biology, psychology, and social sciences!
For details, check out the W... | stackexchange_codegolf |
Sandbox
Definition: A positive integer n is almost-prime, if it can be written in the form n=p^k where p is a prime and k is also a positive integers. In other words, the prime factorization of n contains only the same number.
Input: A positive integer 2<=n<=2^31-1
Output: a truthy value, if n is almost-prime, and a fa... | stackexchange_codegolf |
Since no one has posted a "good quality question" recently, i feel it is my duty to...
Task:
You work at an electronics company in the design department. The designers that work with you have asked you to make a program that will calculate the optimum configuration of pins on a microchip they are designing. With your ... | stackexchange_codegolf |
Your job is to output the html of the current version (at the time of this writing) of the Wikipedia page for Kolmogorov complexity: https://en.wikipedia.org/w/index.php?title=Kolmogorov_complexity&oldid=781950121&action=raw (backup)
This is code-golf, so the shortest code wins.
| stackexchange_codegolf |
Given \$x\$ distinguishable balls (say they have different colors), sample with replacement repeatedly until all the balls that have been seen, have been seen at least twice.
Challenge
The input is the integer value \$x \geq 2\$.
The challenge is to compute the probability that you would have seen all the balls when yo... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.