instruction_seed stringlengths 34 53.1k | _source stringclasses 1
value |
|---|---|
Given an integral polynomial \$p\$, determine if \$p\$ is a square of another integral polynomial.
An integral polynomial is a polynomial with only integers as coefficients.
For example, \$x^2+2x+1\$ should gives truthy, because \$x^2+2x+1 = (x+1)^2\$.
On the other hand, \$2x^2+4x+2\$ should gives falsy: \$2x^2+4x+2 = ... | stackexchange_codegolf |
Given a positive integer N,
determine the starting pattern on a N x N-grid that yield
the longest non-repeating sequence under Game of Life-rules, and ends
with a fixed pattern (cycle of length 1), played on a torus.
The goal is not the shortest program, but the quickest.
Since the world is finite, you will eventually... | stackexchange_codegolf |
An palindrome is a word that is its own reverse.
Now there are some words that might look like palindromes but are not. For example consider the word sheesh, sheesh is not a palindrome because its reverse is hseehs which is different, however if we consider sh to be a single letter, then it's reverse is sheesh. This... | stackexchange_codegolf |
Challenge :
Given a string rotate every char by its index. e.g --> 'Hello' should be 'Hfnos'.
Input :
Input is given as string s length of string is 2 < s ≤ 100. Input will either be alphabet , number or one of the following whitespace , ! , @ , # , $ , % , ^ , & , * , ( , )
Output :
Output will be a string with all... | stackexchange_codegolf |
Introduction
I have decided that this Christmas, as a "present" to a friend, I wish to purchase the things described in the classic song "The 12 Days of Christmas". The only problem is, I don't know how to calculate the total price!
Your Task
Given a list of prices (in order from first to last), calculate the total pri... | stackexchange_codegolf |
What is the shortest amount of code that can find the minimum of an inputted polynomial? I realize that you can import packages like Numpy and others, but using only user defined functions, what is the shortest way to do this? For example, if 6x6 + 4x3-12 is entered (ignore parsing issues), what would be the shortest a... | stackexchange_codegolf |
A SMILES (Simplified molecular-input line-entry system) string is a string that represents a chemical structure using ASCII characters. For example, water (\$H_2O\$) can be written in SMILES as H-O-H.
However, for simplicity, the single bonds (-) and hydrogen atoms (H) are frequently omitted. Thus, a molecules with on... | stackexchange_codegolf |
What general tips do you have for golfing in Forth (and its clones)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Forth (e.g. "remove comments" is not an answer).
| stackexchange_codegolf |
I have written a few challenges related to matrices, and common for all are that I use a format like the one below when representing the matrices, both in examples and in test cases:
16 2 3 13
5 11 10 8
9 7 6 12
4 14 15 1
This is likely a cumbersome format in many languages.
Challenge... | stackexchange_codegolf |
Sandbox
For the purposes of the current task, a cube of unit length is rendered in oblique projection with ASCII symbols as follows:
+-----+
/ /|
+-----+ |
| | +
| |/
+-----+
+ for the vertices.
- for the X edges. The unit length along X is represented by five - between two vertices.
| for the Y edges.... | stackexchange_codegolf |
Here's a relatively simple challenge for you:
Given a list of positive integers:
Line them up in a grid, and sum each column. For example, if the input was [123, 7, 49, 681], the grid would look like this:
1 2 3
7
4 9
6 8 1
And the sum of each column would be [18, 19, 4]:
1 2 3
7
4 9
6 8 1
--... | 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 |
Given the following input:
An integer n where n > 0.
A string s where s is not empty and s~=[0-9A-Z]+ (alpha-numeric capitals only).
Using a standard, simplified QWERTY keyboard (as shown below):
1234567890
QWERTYUIOP
ASDFGHJKL
ZXCVBNM
Perform the following operation:
Find the original row that each character is in... | stackexchange_codegolf |
Currently at my work we moved to a new building. It's supposed to be state of the art and has automatic lights, automatic roll-down shutters, and is now known as the most eco-friendly building in this town.
However, it doesn't really work all that well.. The roll-down shutters sometimes go down on cloudy days and up wh... | stackexchange_codegolf |
In this challenge, you must parse a list of lists, into a simpler list format.
This challenge is based on my sadflak parser. In my sadflak parser, it has all the () removed, replaced with the sum of the ()s at the start of the list, to make the program run faster.
To parse into a Sad-List, you have to do this (python i... | stackexchange_codegolf |
Task
Given a number between 0 and 1 and another integer, print the approximated value of the first number rounded off to the specified number of digits given by the second integer. For example, if the input is 0.3212312312 , 2 then the output is:
0.32
Rules
The number of digits after the dot should always equal the s... | stackexchange_codegolf |
Background
A maximal domino placement (MDP) on a rectangular grid is a non-overlapping placement of zero or more dominoes, so that no more dominoes can be added without overlapping some existing domino.
Alternatively, it can be thought of as a tiling using dominoes and monominoes (single square pieces) so that no two m... | stackexchange_codegolf |
What is the shortest way we can express the function
f(a,b)(c,d)=(a+c,b+d)
in point-free notation?
pointfree.io gives us
uncurry (flip flip snd . (ap .) . flip flip fst . ((.) .) . (. (+)) . flip . (((.) . (,)) .) . (+))
which with a little bit of work can be shortened to
uncurry$(`flip`snd).((<*>).).(`flip`fst).((.... | stackexchange_codegolf |
Given a set of space-delimited integers, you've gotta either return a function that can generate that sequence, or return "There isn't any such function".
Sample input:
"1 11 41 79"
- x^3+x^2-1
"12 38 78"
- 7x^2 + 5x
The operations that the functions can contain are: +-/* and exponentiation.
If anyone has any other... | stackexchange_codegolf |
Your boss asks you to write a "hello world" program. Since you get paid for lines of code, you want to make it as complex as possible. However if you just add nonsense lines, or obviously useless or obfuscating stuff, you will never get it through code review. Therefore the challenge is:
Write a "hello world" program w... | stackexchange_codegolf |
Background
A polyomino of size \$n\$ is a contiguous shape made from joining \$n\$ unit squares side by side. A domino is a size-2 polyomino.
A polydomino of size \$2n\$ is defined as a polyomino of size \$2n\$ which can be tiled with \$n\$ dominoes.
The following are some examples of polydominoes for \$n=3\$ (hexomino... | stackexchange_codegolf |
Recently, I've found a rant from 2004 about Internet Explorer's color parsing. Turns out, MS made sure that just about anything will be parsed as a color somehow and I think it makes for a neat challenge.
Well, how does IE parse colors?
Let's give it an input with a length of...
...less than 4 chars:
Replace chars no... | stackexchange_codegolf |
A radiation-hardened quine can take a hit and stay standing, but nobody ever said that the quine can't be a wuss about it.
For this challenge, you should write a quine that:
If no characters are removed, prints its source code normally.
Iff any one character is removed, prints the original program's source code, follo... | stackexchange_codegolf |
In some languages, strings are started and ended with a quote mark ('). And quote itself is escaped by writing it twice sequentially. For example, empty string is written as '', and I'm is written as 'I''m'.
This question is about find out all non-overlapping strings from left to right in such format from the given inp... | stackexchange_codegolf |
Given two strings containing only 0 and 1, decide the probability that first appears earlier as a consecutive substring in an infinite random 0/1 stream.
You can assume that neither string is suffix of the other string, so 01, 1, 00, 0 are invalid. (*)
IO format flexible. Your answer should be precise given ideal float... | stackexchange_codegolf |
The knight is a chess piece that, when placed on the o-marked square, can move to any of the x-marked squares (as long as they are inside the board):
.x.x.
x...x
..o..
x...x
.x.x.
Eight knights, numbered from 1 to 8, have been placed on a 3×3 board, leaving one single square empty ..
They can neither attack each other... | stackexchange_codegolf |
Related
Task
Your task is to calculate the new Elo rating (FIDE rating system) for a player after winning, losing or drawing a game of chess.
To calculate the Elo rating two formulas are needed:
R' = R0 + K*(S - E)
E = 1 / (1 + 10 ^ ((R1 - R0) / 400))
where:
R' is the new rating for player0,
R0 is the current rating ... | stackexchange_codegolf |
A reflexicon is a self-descriptive word list that describes its own letter counts. Take for example the one found by Ed Miller in 1985 in English:
Sixteen e’s, six f’s, one g, three h’s, nine i’s, nine n’s, five o’s, five r’s, sixteen s’s, five t’s, three u’s, four v’s, one w, four x’s
This reflexicon contains exactl... | stackexchange_codegolf |
Most Android smartphones allow the user to use a swipe pattern to open their phone:
Certain patterns are legitimate, and others are impossible. Given an input swipe pattern, return a truthy or falsy indicating if the given input pattern is legal or not.
Input
The grid is labelled row-wise 1 through 9:
1 2 3
4 5 ... | stackexchange_codegolf |
Goal
Your task is to create a program taking no input that returns the link to your answer. You can find a link to your answer by clicking at the share button on your answer.
Rules
Standard loopholes apply except for searching for the answer online. In fact, you are expected to find the answer online.
You are allowed ... | stackexchange_codegolf |
Write a program or function that takes in a positive integer and prints or returns a stack of that many ASCII-art turtles, where each turtle is larger than the one above it.
Specifically, if the input is 1, the output should be:
__
/,,\o
If the input is 2:
__
o/,,\
____
/,__,\o
If the input is 3:
__
/,,\o
... | stackexchange_codegolf |
Challenge
Given a single letter (a-z) as input, output the 2 lines of Blackalicious' Alphabet Aerobics that correspond to that letter (ignoring the intro & outro).
Rules
You may take input by any reasonable, convenient means as long as it's permitted by standard I/O rules.
Input must either be case insensitive or con... | stackexchange_codegolf |
Platforms are stretches of - characters separated by one or more characters.
For example:
------ -- ------ -
The above has 4 platforms sizes 6, 2, 6 and 1.
Platforms that are not supported will fall. To be supported platforms need Jimmies.
Jimmies look like this:
\o/
They are three units wide. Don't ask me what ... | stackexchange_codegolf |
You have to write an interpreter for a cool language called Chicken!
You should read a Chicken program from a file, standard input, program or function arguments, or whatever is most convenient for your language, as well as input to the program.
You should print or return the result of interpreting the program accordi... | stackexchange_codegolf |
Challenge
Build the Wheat Wizard's stove using 2-input NAND gates. The solution with the fewest NAND gates wins.
Externally, it works in the following way: (the first line is added from the original spec for physical output)
It has 10 levels, from 0 to 9. The display has 9 lights, and if the current level is L, exactl... | stackexchange_codegolf |
Here is a simple ASCII art ruby:
___
/\_/\
/_/ \_\
\ \_/ /
\/_\/
As a jeweler for the ASCII Gemstone Corporation, your job is inspect the newly acquired rubies and leave a note about any defects that you find.
Luckily, only 12 types of defects are possible, and your supplier guarantees that no ruby will have more ... | stackexchange_codegolf |
You are working as a programmer for a bank.
Your task is to write a program that handles the transactions from one bank account to another.
The program should do the following:
Run in an infinite loop waiting for input.
The input consists of 3 numbers: Accountnumber1, Accountnumber2 and x the amount of money. e.g. 99... | stackexchange_codegolf |
It's a common problem to navigate in a 2D matrix. We've seen it many times and will see again. So let's help future us and develop the shortest solutions to generate all eight possible steps in a 2D matrix.
Challenge
Your code must output the following 8 pairs of -1,0,1 in any order:
(0,1)
(0,-1)
(1,0)
(-1,0)
(1,1)
(1,... | stackexchange_codegolf |
This is a somewhat proof-golf-like cops-and-robbers challenge. This is the robbers' thread; the cops' thread is here.
Robbers
The cops will post abstract rewriting systems. Your task is to crack their submissions by proving that the target string either can or can not be reached from the source string by applying their... | stackexchange_codegolf |
The boardgame Terra Mystica has some very interesting mechanics for one of the primary resources, power. Instead of gaining and spending units of power from a bank, each player starts the game with exactly 12 units of power which are distributed over three "bowls", which are labelled I, II and III. Gaining and spending... | stackexchange_codegolf |
The 52 week challenge is a way to save money. For example, Week 1, you save $1.00. Week 2 you save $2.00, and it continues through the year, adding one more dollar to each week’s savings goal. By Week 52, you’ll set aside $52.00, which will bring the year’s total savings to $1,378! Of course, you can decide how much mo... | stackexchange_codegolf |
Challenge
Given an ASCII representation of a Babylonian number as input, output the number in Western Arabic numerals.
Babylonian Numeral System
How did the Babylonians count? Interestingly, they used a Base 60 system with an element of a Base 10 system. Let's first consider the unit column of the system:
The Babylonia... | stackexchange_codegolf |
Task:
Given an integer number in decimal number system, reduce it to a single decimal digit as follows:
Convert the number to a list of decimal digits.
Find the largest digit, D
Remove D from the list. If there is more than one occurrence of D, choose the first from the left (at the most significant position), all oth... | stackexchange_codegolf |
Challenge
Given a string such as Hello World!, break it down into its character values: 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33.
Then calculate the difference between each consecutive pair of characters: 29, 7, 0, 3, -79, 55, 24, 3, -6, -8, -67.
Finally, sum them and print the final result: -39.
Rules
... | stackexchange_codegolf |
Win a K vs KQ endgame
Summary
The goal of this challenge is to create a program or function which will win a Chess game with a King and Queen against a lone King. The user will specify three squares, representing the locations of the computer's King, the computer's Queen, and the user's King. The computer will then a o... | stackexchange_codegolf |
In this challenge, Turing machines operate on a zero-initialized binary tape that is infinite in both directions.
You are given an integer \$N\$, where \$1 \le N \le 20000\$. Your program has to output a Turing machine that takes exactly \$N\$ steps to halt, including the final step. Alternatively, you can write a prog... | stackexchange_codegolf |
Introduction
If you're not familiar with Hexagony, it's an esoteric language created by Martin Büttner. The thing is that this language accepts multiple forms for the program. The following programs are all equivalent:
abcdefg
and
a b
c d e
f g
So basically, the code has been rolled up into a regular hexagon. But n... | stackexchange_codegolf |
Introduction
In a standard* (e.g. not 2020) tax year, estimated payments are due quarterly according to the schedule outlined in Publication 505.
Payment Period
Due Date
January 1 – March 31
April 15
April 1 – May 31
June 15
June 1 – August 31
September 15
September 1 – December 31
January 15
* Saturd... | stackexchange_codegolf |
In preparation for the AP Computer Science AP Test (Java), our teacher has been giving us FRQs from previous years for practice.
My friend and I were golfing this during class today and got it as short as we could, but I'd like to see if there are any shorter solutions any of you can come up with.
Rules:
You must use ... | stackexchange_codegolf |
.Net Technology is an incredible framework with marvellous functionalities, and among all of them, the most important one obviously stands out:
Yep, your simple task is create a program that when it takes at input:
dotnet ef
It prints the following ascii art by output:
/\__
---==/ \\
___ ___ ... | stackexchange_codegolf |
Jack is a little businessman. He found out a way to earn money by buying electricity on days when it's cheap and selling it when it's much more expensive. He stores the electricity in a battery he made by himself.
Challenge
You are given N (if required), the number of days Jack knows the cost of electricity for, and X,... | stackexchange_codegolf |
An ant starts on an edge of a dodecahedron, facing parallel to it. At each step, it walks forward to the next vertex and turns either left or right to continue onto one of the other two edges that meet there. A sequence of left/right choices that returns the ant to its initial state (edge and direction) is called a rou... | stackexchange_codegolf |
If a compiled language is used, the program must delete the compiled executable (but need not delete the source file). If an interpreted language is used, the program must delete the source file.
My opening bid:
Python (29 characters)
import os;os.remove(__file__)
Edit: to prevent solutions like rm -rf /, the program ... | stackexchange_codegolf |
This question is inspired by this awesome answer.
The challenge is to write a program or function which takes in a positive integer, and outputs "Happy new year to you" or a slight variation thereof, such that the character codes of that string add up to the inputted number. The space counts towards the sum of characte... | stackexchange_codegolf |
The Challenge
Given a rational number, determine the smallest number which is a positive integer multiple of it. Eg.
Given: 1.25
x1: 1.25
x2: 2.5
x3: 3.75
x4: 5
Thus: Answer is 5
Clarifications
Inputs will be a rational number in the range of (0,100] of which the Decimal Representation has no more than 4 ... | stackexchange_codegolf |
There are many magic squares, but there is just one non-trivial magic hexagon, as Dr. James Grime explained, which is the following:
18 17 3
11 1 7 19
9 6 5 2 16
14 8 4 12
15 13 10
As it is done in Hexagony this is easiest written as just one line, by just reading it row by row:
18 17 3 11 1 7 19 9 6 5 2... | stackexchange_codegolf |
Write a program that takes no input and prints Hello, World! to stdout or your language's closest alternative. The catch is that each line in your program must only contain printable ASCII characters and it must be in lexicographical order, a.k.a. sorted.
Here are all 95 printable ASCII characters in order:
!"#$%&'()*... | stackexchange_codegolf |
In this fastest-code challenge, you are provided with a set of \$n\$ identical blocks and need to determine how many unique buildings can be constructed with them. Buildings must satisfy the following rules:
No overhangs - each block must either be on the ground or supported by one or more blocks directly underneath i... | stackexchange_codegolf |
There is an asdfmovie video about a pie flavoured pie. Someone also made an edited version with more pies, so I created this challenge.
The input is a positive integer.
The code should first output the following string:
I baked you a pie!
Oh boy, what flavour?
Then, the next line should be PIE (input number of times)... | stackexchange_codegolf |
The goal of this challenge is to check and extend the OEIS sequence A334248: Number of distinct acyclic orientations of the edges of an n-dimensional cube.
Take an n-dimensional cube (if n=1, this is a line; if n=2, a square; if n=3, a cube; if n=4, a hypercube/tesseract; etc), and give a direction to all of its edges ... | stackexchange_codegolf |
This:
is a Glider.
In Conway's Game of Life, the glider is a famous pattern that rapidly traverses across the board. For today's challenge, we are going to draw an ASCII art Game of Life Board, and place a glider on it.
The board we are starting with is this:
|_|_|_|_|_|_|_|_|_|_|
|_|_|_|_|_|_|_|_|_|_|
|_|_|_|_|_|_|_|... | stackexchange_codegolf |
Write a program that outputs as many characters as possible, with two conditions:
The program must be 256 bytes or shorter
The program must almost surely eventually halt. In other words, the only thing not permitted in response to this question is an infinite loop.
For the purposes of this problem, any built-in psudo... | stackexchange_codegolf |
Problem
A fact you may have noticed about factorials is that as \$n\$ gets larger \$n!\$ will have an increasing number of \$0\$s at the end of it's base \$10\$ representation. In fact this is true for any base.
In this challenge you will be given a base \$b > 1\$ and an integer \$n > 0\$ and you will determine the sm... | stackexchange_codegolf |
Geobitsian language is a new perversion of English where a word is broken into segments that each must start with a different letter. Then every time one of those starting letters appears in another string, it is replaced with its entire corresponding segment, maintaining capitalization.
This process is called Geobitsi... | stackexchange_codegolf |
This challenge has been divided into parts.
Your goal is to convert a sentence into a form of 'short-hand'
For Part 1 these are the rules
Take in 1 word
Remove all vowels(a,e,i,o,u), except the ones at the beginning and the end
If a letter is repeated more than once consecutively, reduce it to only one (e.g. Hello -> ... | stackexchange_codegolf |
Given an input string, output at random the unique combinations with repetition of the characters in the input string, from length 1 up to the length of the input string, with an equal chance of each one occurring.
Example: given the input abcd (or any combination thereof of the four characters a,b,c,d) , there is an e... | stackexchange_codegolf |
Your task here is to take a LifeOnTheEdge pattern and convert it to LifeOnTheSlope.
A LifeOnTheEdge pattern is composed of these four characters: |_L . A pattern corresponds to a certain arrangement of "on" edges in a square grid. The pattern is placed in the grid first with the characters in the cells, and each of the... | stackexchange_codegolf |
Black Box is a board game, Your task is to reveal all clues.
What is black box
Black box is a board game with hidden atoms, Your task is given input, All atoms, reveal all clues.
I/O
Input
The atoms can be any 1-char that is not newline (Used for separator) Like this.
O....
...O.
..O..
.....
....O
Output
When the code... | stackexchange_codegolf |
Write a function that gets as an input a sorted array of positive numbers A, and an additional number n. The Task is to print out all distinct subsets of A, that sum to n.
Example:
Input:
A = [1,2,2,4,4]
n = 9
Output:
[1,2,2,4]
[1,4,4]
Bonus:
-50% if your code doesn't store duplicate subset (the same subset but in d... | stackexchange_codegolf |
I want to avoid responding to illegal or spoofed addresses. One type that's easy to detect is an address that should not exist on a packet received by my router: a special-use address.
Challenge
Given an IPv4 32-bit address, identify whether it is valid general-use address.
Challenge rules
Special-use addresses, as de... | stackexchange_codegolf |
Stolen from @Downgoat with permission
The point of this challenge is to (not) settle the debate on the pronunciation of "gif".
"
The pronunciation of gif is debated and while it's supposed to be (and should be) pronounced jif, it's still commonly disputed.
In this challenge you will be given a set of words that have ... | stackexchange_codegolf |
There already have been multiple challenges about carryless
multiplication, this challenge will work with the same calculation rules.
You task is given a quadratic polynomial ax²+bx+c, to find an integer r such that a*r*r+b*r+c is zero, with + meaning exclusive or and * being carryless multiplication (use xor to add up... | stackexchange_codegolf |
Create a function (or closest equivalent, or full program) that takes an list of some datatype (your choice) that may be nested and a string (in either order), and generalizes the lisp c[ad]+r functions.
Functions are provided which perform compositions of up to four car and cdr operations. Their names consist of a C,... | stackexchange_codegolf |
Note: This challenge is finished. Submissions are still welcome but can not win.
This is the cops' thread. The robbers' thread goes here.
Write a code that outputs the integer 1. If you add, remove or substitute a single character (of your choosing), the code should output the integer 2. Change one more character (th... | stackexchange_codegolf |
Summary
We already have a challenge for the minimal number of characters for Turing completeness. But what about the minimal maximum byte?
Challenge
For a language of your choice, find a subset of characters that allows your language to be Turing complete with the minimal maximum byte value.
Example
If your language is... | stackexchange_codegolf |
A zigzag scan is a method of encoding 2D information in one dimension:
Write a function or program that, given a one-dimensional string of printable ASCII characters, will reverse the zigzag scan to arrange its characters into a square.
For example, given the input string ABeIfCDgJmnKhLop, your program should return:
... | stackexchange_codegolf |
Let us say that we have a particular set of functions on strings. These functions are kind of like fill in the blanks or madlibs, except that they only take one input and use that to fill in all of their blanks. For example we might have a function that looks like
I went to the ____ store and bought ____ today.
If w... | stackexchange_codegolf |
(Related)
Given an integer n > 1,
1) Construct the range of numbers n, n-1, n-2, ... 3, 2, 1 and calculate the sum
2) Take the individual digits of that number and calculate the product
3) Take the individual digits of that number and calculate the sum
4) Repeat steps 2 and 3 until you reach a single digit. That digit ... | stackexchange_codegolf |
Define f(a,b) := a if b=1; a^f(a,b-1) if b>1 (Tetration, where ^ means power) for positive integers a and b, given four positive integers a,b,c,d, compare f(a,b) and f(c,d).
Your program should output three constant values to mean "greater", "less" and "equal".
Samples:
a b c d f(a,b) output f(c,d)
3 2 2 3 27 > ... | stackexchange_codegolf |
According to Wikipedia,
In mathematics, a natural number \$n\$ is a Blum integer if \$n = p \times q\$ is a semiprime for which \$p\$ and \$q\$ are distinct prime numbers congruent to \$3 \bmod 4\$. That is, \$p\$ and \$q\$ must be of the form \$4t + 3\$, for some integer \$t\$. Integers of this form are referred to a... | stackexchange_codegolf |
Given a string consisting of only printable ascii (letters, numbers, symbols, and spaces), how many keystrokes are required minimally to type out this string from scratch?
That is, current text is initially an empty string and should end up being equal to the input string. These are the allowed actions and their cost i... | stackexchange_codegolf |
Background
Network discovery tool Nmap takes a list of TCP/UDP port numbers as input and performs a security audit against the listed ports. The target port listing on the command line includes selected port numbers as strings separated by a comma. To make specifying big amounts of ports more convenient the tool also s... | stackexchange_codegolf |
Mathematical Background
Let A be an N by N matrix of real numbers, b a vector of N real numbers and x a vector N unknown real numbers. A matrix equation is Ax = b.
Jacobi's method is as follows: decompose A = D + R, where D is the matrix of diagonals, and R is the remaining entries.
if you make an initial guess solutio... | stackexchange_codegolf |
Your task is to accept as input two "ASCII Art"s, and align each piece of art next to each other horizontally.
For example, say you have two strings, "abc\ndef" and "123\n456". You need to align them horizontally to produce the string "abc123\ndef456". I'm calling this "aligning horizontally" because while the inputs, ... | stackexchange_codegolf |
Robbers post
A riffle shuffle is a way of shuffling cards where the deck is split into 2 roughly equal sections and the sections are riffled into each other in small groups. This is how to riffle shuffle a string:
Split the string into equal sections.
Reverse the strings, and starting from the start of each string.
Pu... | stackexchange_codegolf |
This king-of-the-hill game is a strategy game in which you must throw around a water balloon and avoid getting splashed by water. The goal is to obtain the most points. You will be given a map of the field and the location of the water balloon. You can either return that you want to hit the water balloon (if you are cl... | stackexchange_codegolf |
In Dungeons & Dragons 5th edition (as well as most other editions), there exists a magic item called the Deck of Many Things. It is an incredibly powerful item, as the cards all have very strong positive or negative effects. To use the deck, a character declares a number, and then draws up to that number of cards, with... | stackexchange_codegolf |
In informatics, we often use trees in lots of different forms and representations. The three major methods of serialising binary trees are prefix, infix and postfix notation. For example, the following binary tree:
(source: Dutch Olympiad in Informatics, finals, 2012/13)
can be represented in prefix notation as abrx... | stackexchange_codegolf |
The Challenge
Given an arbitrary amount of rectangles, output the total count of intersections of those when drawn in a 2D plane.
An intersection here is defined as a point P which is crossed by two lines which are orthogonal to each other and are both not ending in P.
Example
Each rectangle here is denoted by a 2-tupl... | stackexchange_codegolf |
Background
Sometimes, people think you didn't work at your git project. But - you can prove yourself with git shortlog -n. Now, the problem is you are a programmer and programmers are lazy. So you want to write a program which shows the person who committed at most.
Rules
You may not do the following things:
use git s... | 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 |
As preparation for the nth Exodus, Noah decides to write a program that will decide If he will let animals on his ark. However, Noah wants to go back to grass roots. Thus he decides that the program should be as small and as simple as possible.
GOAL:
Recreate the Contrabulous Choosematron, in a way that follows evange... | stackexchange_codegolf |
A standard, solved, 3×3×3 Rubik's Cube has 6 differently colored faces, where each face is a 3×3 grid of squares of one color. The white face is opposite the yellow, the red opposite orange, the blue opposite green, and when white points upward, red is to the left of blue:
Imagine an ant sits on the center square of t... | stackexchange_codegolf |
Currently at my work we moved to a new building. It's supposed to be state of the art and has automatic lights, automatic roll-down shutters, and is now known as the most eco-friendly building in this town.
However, it doesn't really work all that well.. The roll-down shutters sometimes go down on cloudy days and up wh... | stackexchange_codegolf |
Objective Given an input of text that does not contain characters [ or ], perform the following actions:
For every instance of Amen with at least one capital letter (so all instances of Amen excluding amen), output that same Amen (retain capitalization).
For every instance of /all the people said[?: ]/i (that's a Regu... | stackexchange_codegolf |
Given a \$n\$-dimensional vector \$v\$ with real entries, find a closest permutation \$p\$ of \$(1,2,...,n)\$ with respect to the \$l_1\$-distance.
Details
If it is more convenient, you can use permutations of \$(0,1,...,n-1)\$ instead. If there are multiple closest permutations, you can output any one or alternativel... | stackexchange_codegolf |
Write a function that takes an ASCII-printable-only (all charcodes ∈ [32..126]) string input x and provides an ASCII-printable-only output string f(x), such that for every x
f(f(x))=x
f(x) is all-numeric (all charcodes ∈ [48..57]) iff x is not all-numeric
You can assume input is not empty and never provide empty outp... | stackexchange_codegolf |
The robber's thread is here
The cops task is to write a function or program that, when given an input of itself, outputs a finite deterministic string. If the program is given a different input, it should return a different output.
Rules:
Submissions consist of
Language name
If any flags are used, they should be r... | stackexchange_codegolf |
BLC (Binary Lambda Calculus) is a binary encoding of untyped lambda calculus which was created to “provide a very simple and elegant concrete definition of descriptional complexity.”
What are some tips on how to golf down BLC programs/functions?
Please submit only one tip per answer!
| stackexchange_codegolf |
Adapted from the UIL - Computer Science Programming free response question "Carla" for 2018 District.
Introduction
In UNIX-like operating systems, each file, directory, or link is "owned" by a "user", who is a member of a "group", and has certain "permissions" represented by a ten-character string such as "drwxrwxrwx".... | stackexchange_codegolf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.