instruction stringlengths 34 53.1k |
|---|
Randomly inspired by Numbers Increase While Letters Decrease
Given a list of mixed letters and integers (e.g., ['a', 2, 3, 'b']) increase the letters by one position in the alphabet (wrapping at z to a) and decrease the numbers by 1. For the above example, the output should be ['b', 1, 2, 'c'].
The input can be a mixe... |
This is a simple task. Given a positive or negative real number, round it to the next whole integer closer to zero.
The challenge
Take input through any reasonable form (stdin, function, etc.) of one positive or negative real number.
Round this number "towards zero" - this means if it is positive you will round down,... |
Winner found
It seems as if we have a winner! Unless anyone plans on contesting the world's current fastest Sudoku solver, user 53x15 wins with the staggeringly fast solver Tdoku. For anyone still working on their solvers, I'll still benchmark new submissions when I have time.
The challenge
The goal of a game of Sudoku... |
Disclaimer: ModTen is a fictional card game which was created for the sole purpose of this challenge.
The rules of ModTen
ModTen is played with a standard 52-card deck. Because the full rules are yet to be invented, we're going to focus on the hand ranking exclusively.
A winning hand in ModTen. Graphics from Wikipedia... |
And then the King said: You fought bravely, Knight, and your deed will not be forgotten for centuries. For your valor I grant you this castle and the lands around it. Things rush me, and I can not take you to the castle. Therefore, I will give you the way from this place to the castle. Now go and come back after the de... |
Church Subtraction
Lambda calculus has always been a fascination of mine and the emergent behaviors of passing functions into each other is delightfully complex. Church numerals are representations of natural numbers contructed from the repeated application of a function (normally the unary addition of a constant). For... |
Given a string, replace all left-double-quotes into two backticks and all right-double-quotes into two single-quotes.
Left-quotes means the quotes that starts a quote. Right-quotes means the quotes that ends a quote. Quotes cannot be nested. You may assume that there are an even number of double-quotes in the string.
E... |
"Talk" is a baroquified accumulator-based language that is created in response to Dennis's quote on talk.tryitonline.net.
Waiting for someone to create an esolang called talk.
. The "Talk" language has 4 commands:
00 If the accumulator is 0, set the accumulator to 0.
01 If the accumulator is 0, set the accumulator t... |
Given the 2-dimensional positions and velocities of a pair of billiard balls right before impact, calculate their velocities after a perfectly elastic collision. The balls are assumed to be ideal spheres (or equivalently: circles) with the same radius, same mass, uniform density, and no friction.
Input consists of 8 nu... |
You have locked your bike with a combination lock of 3 digits. Now you want to go for a ride and need to unlock it with the help of following program.
Input
1st parameter
The digit combination of your lock in locked state. It must be different from the 2nd parameter (=the combination of unlocked state). (Or else your b... |
This code challenge will have you compute the number of ways to reach \$n\$ starting from \$2\$ using maps of the form \$x \mapsto x + x^j\$ (with \$j\$ a non-negative integer), and doing so in the minimum number of steps.
(Note, this is related to OEIS sequence A307092.)
Example
So for example, \$f(13) = 2\$ because t... |
Programming problem:
In BotLand, Robots can understand all words of any combination of letters and letters with leading or trailing (not both) numeric value. Given a word W (string of alphanumeric). Write a function to check if W is Bot word. Don't use library functions/ regex.
Example:
Input: BotLand
Output: Bot word
... |
Wholly surprised this hasn't been posted already, given the large number of chess puzzles on the site. While I thought of this myself, credit to Anush for posting it to the sandbox back in March. But I figured it's been long enough that I could go ahead and do so myself.
A checkmate in chess is a position in which the ... |
Given a list of positive integers, find the number of triangles we can form such that their side lengths are represented by three distinct entries of the input list.
(Inspiration comes from CR.)
Details
A triangle can be formed if all permutations of the three side lengths \$a,b,c\$ satisfy the strict triangle inequal... |
In this task, you will write a program/function that takes a Normalized Malbolge program and outputs the resulting Malbolge program. (This is a secret tool that all Malbolge programmers are using!)
Input
A data structure that (somehow) represents a Normalized Malbolge program.
Output
A data structure that represents th... |
What general tips do you have for golfing in Smalltalk? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Smalltalk (e.g. "remove comments" is not an answer).
Smalltalk is a purely object-oriented language created by Alan Kay. The two links are GNU Small... |
Bowl Pile Height
The goal of this puzzle is to compute the height of a stack of bowls.
A bowl is defined to be a radially symmetric device without thickness.
Its silhouette shape is an even polynomial. The stack is described by a list of radii, each associated with an even polynomial, given as input as a list of coeff... |
Snaking Number Challenge
I wonder how many snaking numbers there are between 1 and 50,000?
Snaking Numbers, in this game, are numbers which can be typed out on a traditional numberpad (format below) by moving one key up, down, left, or right.
7 8 9
4 5 6
1 2 3
0
For example, if you start with the number 5, you could... |
Rules:
Your program must print "hello world" when executed
Your program must be interpretable or compilable into 2 or more languages
Your program must require no input or arguments
Languages with identical syntax are too easy, and will be shunned. We all know you can write echo hello world in Bash and Batch, so let's ... |
The Blow-up is a powerful tool in algebraic geometry. It allows the removal of singularities from algebraic sets while preserving the rest of their structure.
If you're not familiar with any of that don't worry, the actual computation is not difficult to understand (see below).
In the following we are considering the ... |
Background
Malbolge is truly intriguing language. But programs written in it are also extraordinairly huge (and in some cases, unpostable on PPCG).
Your challenge (shall you accept it) is, to compress and decompress given normalized Malbolge program. Devise your own lossless algorithm. You may compress your data furthe... |
Landau's function \$g(n)\$ (OEIS A000793) gives the maximum order of an element of the symmetric group \$S_n\$. Here, the order of a permutation \$\pi\$ is the smallest positive integer \$k\$ such that \$\pi^k\$ is the identity - which is equal to the least common multiple of the lengths of the cycles in the permutati... |
You have a bunch of heavy boxes and you want to stack them in the fewest number of stacks possible. The issue is that you can't stack more boxes on a box than it can support, so heavier boxes must go on the bottom of a stack.
The Challenge
Input: A list of weights of boxes, in whole kg.
Output: A list of lists describi... |
We've all been told at some point in our lives that dividing by 0 is impossible. And for the most part, that statement is true. But what if there was a way to perform the forbidden operation? Welcome to my newest creation: b-numbers.
b-numbers are a little bit like imaginary numbers: the main pronumeral involved repre... |
There is a sentence with many cats:
there is a cat house where many cats live. in the cat house, there is a cat called alice and a cat called bob. in this house where all cats live, a cat can be concatenated into a string of cats. The cat called alice likes to purr and the cat called bob likes to drink milk.
The Task
... |
Given a position with a row of rooks and/or empty spaces, output how many different rook moves are possible. A rook can move left or right to an empty space, but not to one that requires passing over another rook. When a rook moves, the other rooks remain in place.
For example, from this position, 6 moves are possible:... |
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... |
Farkle Fest 2k19
In this challenge, we will be playing the semi-popular dice game Farkle.
Farkle is a dice game that has players selecting to save dice or risk rerolling the die for more points to add to their total. Players should use probability, game-state considerations and opponent tendency to make their decisions... |
Given a single letter from A to Z (except J and K) as input, output the smallest non-negative integer containing that letter in its written form. Assume numbers never contain the word "and", so 101 is "one hundred one", not "one hundred and one". Assume American (short-scale) counting, so one million is 10^6 and one bi... |
Round away from zero
Inspired by Round towards zero.
Given a number input via any reasonable method, round the number "away from zero" - positive numbers round up, and negative numbers round down.
If you intend to take the input as a string (via STDIN, for example), you should be able to handle numbers with or without ... |
I don't like typing, so I draw my mazes in a very simple format:
# #####
# #
# ### #
# # # #
# # #
##### #
Isn't it a-maze-ing? Of course, I think all mazes should look 3d, similar but not he same as this challenge, for maximum a-maze-ingness, so I (grudgingly) manually updated the maze to look like this:
+-----... |
Draw the Biohazard symbol in an arbitrary colour on a distinctly coloured background. The specific proportions were published in the June 27th 1974 issue of the Federal Register of the US Government.
Details
As output, writing to a file (raster and vector formats are permitted) or displaying on the screen are both all... |
A number of programming languages construct large integers through 'concatenating' the digit to the end of the existing number. For example, Labyrinth, or Adapt. By concatenating the digit to the end, I mean that, if the existing number is \$45\$, and the digit is \$7\$, the result number is \$457\:(45 \times 10 + 7)\$... |
Since Euclid, we have known that there are infinitely many primes. The argument is by contradiction: If there are only finitely many, let's say \$p_1,p_2,...,p_n\$, then surely \$m:=p_1\cdot p_2\cdot...\cdot p_n+1\$ is not divisible by any of these primes, so its prime factorization must yield a new prime that was not ... |
A bit floats from the LSB to the MSB moving one position each time until it floats to the top of the container:
0000
0001
0010
0100
1000
Once one bit floats to the top, another bit begins its journey and it stops when it meets other bit:
1001
1010
1100
This happens until the container is filled with bits:
1101
1110
1... |
Task
The task is to write a program that outputs a consistent but otherwise arbitrary positive integer \$x\$ (so strictly greater than 0). Here's the catch: when the source is repeated \$N\$ times (the code is appended/concatenated \$N-1\$ to itself), the program should have a \$\dfrac{1}{N}\$ probability of outputting... |
We can represent a Rubik's Cube as a net as follows (when solved):
WWW
WWW
WWW
GGGRRRBBBOOO
GGGRRRBBBOOO
GGGRRRBBBOOO
YYY
YYY
YYY
Each letter represents the corresponding colour (W is white, G green etc.)
It has been shown that there are exactly \$43,252,003,274,489,856,000\$ (~\$43\$ quintillion) di... |
The challenge
Write a function that returns the nth element of an array even if its out of bound.
function safeGet(index, arr) {
const safeIndex = ???
return arr[safeIndex]
}
const arr = ["a", "b", "c"];
safeGet(0, arr) // "a"
safeGet(1, arr) // "b"
safeGet(2, arr) // "c"
safeGet(3, arr) // "a" go back to the be... |
Challenge
Write a program that takes as input a text and output "That's me!" if the input is equal to the program own source code, and "That's not me!" otherwise.
Notes
This is codegolf, in each programming language the shortest program wins.
The input can be taken from program arguments or function argument, and the ... |
I see your BIDMAS and raise you a BADMIS
Challenge
Given a set of numbers with operators between them: "5 + 4 * 9 / 3 - 8", return all the possible results of the expression for every permutation of the order of basic operations: [/, *, +, -].
Rules
Standard loopholes forbidden
I/O
Input must be ordered with infix o... |
The Challenge
Write a program or function that takes no input and outputs a 3-dimensional vector of length \$1\$ in a theoretically uniform random direction.
This is equivalent to a random point on the sphere described by $$x^2+y^2+z^2=1$$
resulting in a distribution like such
Output
Three floats from a theoretically ... |
Given a positive integer \$n\$ you can always find a tuple \$(k_1,k_2,...,k_m)\$ of integers \$k_i \geqslant 2\$ such that \$k_1 \cdot k_2 \cdot ... \cdot k_m = n\$ and $$k_1 | k_2 \text{ , } k_2 | k_3 \text{ , } \ldots \text{ , }k_{m-1}|k_m.$$
Here \$a|b\$ means \$b\$ is a multiple of \$a\$, say "a divides b". If \$n>... |
Leaderboard
154 Calculator
144 Taxman
138 Statistician
137 Solver
137 RandoAggroLawyer
136 Gambler
134 Turncoat
119 Lawyer
119 BloodyMurder
113 Bandit
79 Challenger
74 Mask
64 Random
An archive of the latest match, including the log and all output files, is available.
Calculator, by Brilli... |
A space cleaner is a special character which removes all spaces between it and the first non space character to its left and it is represented by a '!' character.
If it reaches the beginning of the string it stops.
Given a string output the string in any reasonable format after the cleaning process.
Trailing spaces at ... |
33 is a simple esolang I created. You may have seen me use it in a few questions. You're not going to be writing a full interpreter. The interpreter you will be writing is for a simplified version of 33.
This simplified 33 has two numeric registers: the accumulator and the counter. The accumulator holds all the post-ar... |
Interpret Volatile
Volatile is a stack-based esolang made by A_/a'_'/A that only has 8 instructions and is turing complete. However, it is also non-deterministic... meaning that programs don't always give the same output. Your task is to interpret this language.
Language specs
Taken from the esolangs page:
~: Push a r... |
You are in fact writing an interpreter for the language "Wrong keyboard position". You can pretend that you are not doing this and just follow the instructions below.
I typr re;atively accuratrly, but so,etimes I made a whole nlock of text illegible by shifting a key right. So I need a program that corrects my text ba... |
There have been a couple of challenges involving doubling source code: here and here. The task we have here is a bit harder, but should be doable in almost every language.
In this challenge, you will take in an arbitrary positive integer. Your program must output that integer doubled.
When your source code is doubled, ... |
Given a matrix, the goal is to ensure all the values in each column occur at least once, while at the same time doing so requiring the least possible amount of rows. Fastest solution wins.
Note: a value in one column (e.g. 1) is considered different from the same value in another column.
Expected output: an array/list... |
Introduction:
Two resistors, R1 and R2, in parallel (denoted R1 || R2) have a combined resistance Rp given as:
$$R_{P_2} = \frac{R_1\cdot R_2}{R_1+R_2}$$
or as suggested in comments:
$$R_{P_2} = \frac{1}{\frac{1}{R_1} + \frac{1}{R_2}}$$
Three resistors, R1, R2 and R3 in parallel (R1 || R2 || R3) have a combined resist... |
A very common need in algorithms classes and computer science in general is to iterate 4-directionally over a grid or matrix (such as in BFS or DFS). This seems to often result in a lot of clunky and verbose code with a lot of arithmetic and comparisons within loops. I've seen many different approaches to this, but I c... |
(Randomly inspired by https://mathoverflow.net/q/339890)
(Related: 1, 2)
Given an input list of distinct prime numbers (e.g., [2, 5, 7]), and a integer n, output all positive integers strictly smaller than n that contain only those primes as divisors. For input [2, 5, 7] and n=15 this means an output of [2, 4, 5, 7, 8,... |
This is a problem on Luogu OJ. I decided to post it here because on Luogu OJ, many people, including me and my friend, are interested about how to solve this problem within the fewest characters.
Your task is to output the following ASCII-art:
************
####....#.
#..###..... |
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... |
The challenge is to write a golf-code program that, given n positive real numbers from 0 to 10 (format x.y, y only can be 0 or 5: 0, 0.5, 1, 1.5, 2, 2.5 … 9.5 and 10), discard the lowest and highest values (only one, even though they are repeated) and shows the average of the remaining, in x.y format (y can be 0 or 5, ... |
Output Distinct Factor Cuboids
Today's task is very simple: given a positive integer, output a representative of each cuboid formable by its factors.
Explanations
A cuboid's volume is the product of its three side lengths. For example, a cuboid of volume 4 whose side lengths are integers can have sides [1, 1, 4], [1, 2... |
Your task is pretty simple. Given two floats, bitwise xor the binary representation of them, and output that as a float.
For example,
Normal: 16.7472 ^ 123.61 = 7.13402e-37
Binary: 01000001100001011111101001000100 ^ 01000010111101110011100001010010 = 00000011011100101100001000010110
Normal: 2.2 ^ 4.4 = 1.17549e-38
Bin... |
Challenge
Given an array of positive integers and a threshold, the algorithm should output a set of consecutive-element-groupings (subarrays) such that each group/subarray has a sum greater than the threshold.
Rules
The solution should honor two additional criteria:
be of highest cardinality of the groups (i.e. highes... |
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... |
Given:
a 12 hour time t in hours and minutes,
a rotation r in degrees,
return the time shown when an analog clock that is displaying the time t is rotated r degrees clockwise.
After rotation, the hour hand will not line up with the new position of the minute hand. To correct for this, the new hour can be derived fro... |
Original: https://james-iry.blogspot.co.at/2009/05/brief-incomplete-and-mostly-wrong.html
Alain Colmerauer designed the logic programming language Prolog. His goal was to create a programming language that is as intelligent as a two-year-old child. In order to prove that he had succeeded in his goal, he presented a P... |
Many programming language provide operators for manipulating the binary (base-2) digits of integers. Here is one way to generalize these operators to other bases:
Let x and y be single-digit numbers in base B. Define the unary operator ~ and binary operators &, |, and ^ such that:
~x = (B - 1) - x
x & y = min(x, y)
... |
You are trapped in this 5x5 labyrinth - each room is labelled from 1 to 25 and the exit is in room 1.
You are given as input the room you are currently in. Your task is to output the shortest sequence of moves (north, east, south, west) needed to reach room 1.
Moves can be output in any format you wish (list, string, ... |
This question just trended over on code-review and I figured you might like it adapted as a codegolf challenge:
You are given a non-empty list of x houses represented as booleans. Each day, the houses compete with adjacent ones. 1 represents an "active" house and 0 represents an "inactive" house. If the neighbors on bo... |
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... |
This challenge will have you count "creatures" in the tile game Palago.
A creature is any closed shape that can be formed by Palago tiles of matching colour in a hexagonal grid.
The game Palago consists of tiles like this:
These tiles can be rotated \$120^\circ\$, \$240^\circ\$, or not at all and placed anywhere on ... |
Blatant rip-off of a rip-off. Go upvote those!
Your task, if you wish to accept it, is to write a program/function that outputs/returns its integer input/argument. The tricky part is that if I reverse your source code, the output must be the original integer negated.
Examples
Let's say your source code is ABC and its i... |
This is my first question in Code golf I found it in stack-overflow (originally in JavaScript however all languages are acceptable):
Render on screen NxN (where N in range 1-16) grid where each cell have black boundary and red number inside - cells are numerated in hex starting from left-upper corner to bottom-right. E... |
Can you imagine solving the New York Times crossword puzzle without any clues? Maybe not with all of the creativity and new words and phrases appearing in modern crosswords, but with a fixed word list there's some hope. In this challenge, you create a crossword puzzle grid in which this is theoretically possible.
The... |
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... |
When making phone calls internationally, phone numbers are prefixed with a code indicating what country the number is located in. These codes are prefix codes, meaning that no code is a prefix of another.
Now, earlier today you missed a call, and you're kind of curious where that call might have come from. So you want ... |
Your task is to input a string, and output the number of spaces in the string.
This is code-golf, so least number of bytes win. Your
Test Cases
Double quotes are not part of the test cases.
"test" => 0
"Hello, World!" => 1
"C O D E G O L F" => 7
" " => 6
|
Challenge
Write a function/program that outputs either the n'th element, or the first n elements, in the well known number sequence:
1, 2, 4, 8, 16 ...
Oh, wait... I forgot the first few numbers:
1, 1, 1, 1, 2, 4, 8, 16 ...
Heck, I'll add a few more for good measure:
1, 1, 1, 1, 2, 4, 8, 16, 33, 69, 146, 312... |
Do you know the book Murderous Maths, in the Horrible Science series? In the book, the Laplace Princess' "ridiculous" cipher might be interesting enough and simple enough to be a code-golf challenge.
Task
The original cipher looks like this:
Please read primes elephant help you me like cold
The nth word is only meani... |
Stuttering is a problem which many of us might have experienced or at least seen it. Although most of famous speech recognition softwares have serious issues with stuttered speaking, let's imagine a software which understands stuttering, but cannot fix them and only writes them as is.
An example written text by such a ... |
I recently saw this language in a challenge and it's awesome. Does anyone have some tips for code-golfing in it?
Your tips should be at least somewhat specific to MarioLANG.
Please post one tip per answer.
|
Here is continuation of this question, this time lets compress/generate Mario in colors!
Image size is 64x64 (above one is zoomed). The required output is valid <img ...> tag with exact same image in dataURI form, working on chrome, firefox and safari (and IE4 - joke ;). In snippet below you can find example tag in r... |
In Imperial China, ranks in society were not decided by birth or wealth, but by a person's ability to excel in the Imperial Examinations. The Jade Emperor, divine ruler of the Heavens, has called for all his subjects to be examined to determine their worth, and whom to next give the Divine Mandate to rule China.
Rules ... |
The problem has 3 inputs.
L: a list of all numbers
size: the size each set can be
max: the max sum amongst each set
The challenge is as follows:
Given L, size and max, construct as many sets from L such that the number of elements is size and the sum of each of the elements does not exceed max.
Examples:
func(L=[1,2,3,... |
You are given a square \$n \times n\$ matrix \$A\$, and a list (or vector) \$u\$ of length \$n\$ containing the numbers \$1\$ through \$n\$ (or \$0\$ through \$n-1\$). Your task is to reorder the columns and rows of the matrix \$A\$ according to the order specified in \$u\$.
That is, you will construct a matrix \$B\$... |
Golf Golf!
This is my first challenge, so please be gentle! The challenge is to write a program that will output the correct score for a layout in the card game "Golf."
The card game Golf has many variations. The house rules I use follow the standard rules for Six-Card Golf given by Pagat, with one slight difference. T... |
Yet another blatant rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you wish to accept it, is to write a program/function that outputs/returns its string input/argument. The tricky part is that if I reverse your source code, the output must be reversed too.
For simplicity, you can assume that the inpu... |
Rip-off of a rip-off of a rip-off of a rip-off. Go upvote those!
Your task, if you wish to accept it, is to write a program/function that outputs/returns its input/argument¹. The tricky part is that if I transpose your source code², the output/result must be transposed too.
You may choose which kind of 2D data your so... |
Convert a string containing digits as words into an integer, ignoring leading zeros.
Examples
"four two" -> 42.
"zero zero zero one" -> 1.
Assumptions
Submissions can assume that:
The input string is comprised of space-separated digit words.
All words are valid (in the range "zero".."nine") and lowercase. Behaviour ... |
What is the Ultraradical?
The ultraradical, or the Bring radical, of a real number \$a\$ is defined as the only real root of the quintic equation \$x^5+x+a=0\$.
Here we use \$\text{UR}(\cdot)\$ to denote the ultraradical function. For example, \$\text{UR}(-100010)=10\$, since \$10^5+10-100010=0\$.
Challenge
Write a ful... |
Sandbox
French License Plates
French license plates come in a sequential order, following a specific pattern of numbers and letters : AB-012-CD
Challenge
Write a program or function that, for a given number, outputs the corresponding french license plate number. Your program should not handle any special case as specif... |
What general tips do you have for golfing in 1+? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to 1+ (e.g. "remove unnecessary whitespace" is not an answer).
Please post one tip per answer.
|
What general tips do you have for golfing in Keg? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Keg (e.g. "remove comments" is not an answer).
Please post one tip per answer.
|
Here is the (quite scary) Five little ducks song(it is not long):
Five little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only four little ducks came back.
Four little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack... |
Your task is to create a program that determines whether a given string is a valid regular expression or not using code snippets sourced from sites on the StackExchange network.
For the purposes of this challenge, the regular expression dialect will be a stripped down and mostly minimal set of meta-characters: ()*?|\. ... |
Starting at 1-TET, give equal temperaments that have better and better approximation of the perfect fifth(just ratio 3/2). (OEIS sequence A060528)
The formal description of the sequence, copied from the OEIS:
A list of equal temperaments (equal divisions of the octave) whose nearest scale steps are closer and closer a... |
Tichu is a card game in which players take turn playing sets of cards from a deck consisting of a standard 52-card deck, plus 4 additional cards:
the dragon, which has a greater value than any other card
the phoenix, which can act as a wildcard
the dog, which passes the turn to your partner
the Mah Jong, which has val... |
I like card game challenges so I made this one for the Italian card game Scopa. My family has been playing this game since time immemorial. It has a very interesting scoring system that should be fun to golf. I will post an answer in R to get the fun started, that I am sure people will improve upon.
The challenge: figu... |
Challenge: Add two numbers. In O(n^m) time, where n and m are the two numbers given. Sleeping, or your language equivalent, is not allowed.
Input: Two integers, separated by a space.
Output: The sum of the two integers.
Additional notes: The exact timing doesn't matter, as long as the input 1000 2 takes roughly 1/1000t... |
Introduction
Some time ago, I need to write function which split string in some specific way. At the first look, task looks trivial, but it was not so easy - especially when I want to decrease code size.
Challenge
As example we have following input string (it can be arbitrary)
Lorem ipsum dolor sit amet consectetur ad... |
In Australian Football, goals are worth 6 points and behinds are worth 1 point. Scores may include the number of goals and behinds, as well as the total score. Given the number of goals and behinds for two different teams, determine which team won the game.
Take four integers g1, b1, g2, b2 as input, and output two dis... |
The previous neural net golfing challenges (this and that) inspired me to pose a new challenge:
The challenge
Find the smallest feedforward neural network such that, given any 4-dimensional input vector \$(a,b,c,d)\$ with integer entries in \$[-10,10]\$, the network outputs \$\textrm{sort}(a,b,c,d)\$ with a coordinate-... |
Given a non-empty list of decimal digits (0, 1, ..., 9), replace each zero by the most recent nonzero, if possible.
Example 1: given
1 4 3 0 0 7 5 5 0 3
the output should be
1 4 3 3 3 7 5 5 5 3
Note how the first two zeros are replaced by 3, which is the most recent (i.e. rightmost) nonzero. Similarly, the last zer... |
Challenge
Write a program that applies an injective function which takes an ordered pair of strings as input and one string as output. In other words, each input must map to a unique output.
Specifics
The input may be any two strings of arbitrary length, but will consist only of printable ASCII characters (codes \$[32... |
I'm new to this site, so I don't know whether this challenge already appeared:
Write a piece of source code, so that after running the code, it prints out exactly (i.e. not longer, not shorter) the source code itself.
The code can be in any programming language, but preferably in commonly used ones, such as the C famil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.