text stringlengths 180 608k |
|---|
[Question]
[
[Gematria](https://en.wikipedia.org/wiki/Gematria) is an ancient Jewish method to determine a numeric value of a letter sequence, using a fixed value for each letter. Gematria is originally applied to Hebrew letters, but for the context of this challenge, we'll use Latin script instead. There are man... |
[Question]
[
We can model a rail network as a directed graph, where each node is a train station and each edge is a train connecting two train stations. We'll assume that each train travels between its corresponding stations at a regular schedule and takes a fixed amount of time
Your code should take a list of tr... |
[Question]
[
Implement a function or program that can run simplified [BitCycle](https://github.com/dloscutoff/Esolangs/tree/master/BitCycle) code. The functions you must implement are:
`<^>v`: Change the direction of a bit to the direction this is pointing.
`+`: Turn all 0s left and all 1s right.
`\` and `/`: Ref... |
[Question]
[
## Input
A positive integer N representing the size of the problem and four positive integers v, x, y, z.
## Output
This is what your code should compute. Consider a set of N distinct integers and consider all ways of choosing 3 subsets (which can overlap) from the set. There are \$2^{3N}\$ different... |
[Question]
[
You are given an array \$A\$, **which may contain duplicate elements**. In each swap, you may swap the value of any two indices \$i, j\$ (i.e. switch the values of \$A\_i\$ and \$A\_j\$). What is the **least** amount of swaps needed to sort the array, and what are the corresponding swapped indices?
#... |
[Question]
[
## Challenge:
### Input:
* An integer `n` (`> 0`)
* An integer-array `a` of size `> 0` (which contains positive and negative values, but no zeroes)
### Output:
1. First output the first `n` items
2. Then take the last item you've outputted (let's call it `e`), and go `e` steps forward if `e` is posit... |
[Question]
[
# World Time Conversion
### Challenge:
Given an initial clock time in UTC and a list of countries: for each country in the list, output the local time it is in that country based on the initial time. In cases where a country is big enough to have multiple local time zones (like the United States), yo... |
[Question]
[
# Introduction
[*Maximum-length sequences*](https://en.wikipedia.org/wiki/Maximum_length_sequence), usually known as *m-sequences*, are binary sequences with some interesting properties (pseudo-noise appeareance, optimal periodic autocorrelation) which make them suitable for many applications in tele... |
[Question]
[
The challenge is simple: given two parameters, *x* and *y*, output *y* staircases with *x* steps. For example:
f(3,1) - 1 staircase with 3 steps.
```
_
_|
_|
```
f(5,2) - 2 staircases with 5 steps.
```
_ _
_| _|
_| _|
_| _|
_| _|
```
Make ... |
[Question]
[
## The Setup
You are given a [simple web page](http://jsfiddle.net/nrek29rp/) with 11 elements:
* 10 `input` elements with IDs `i1` thru `i10`, in order
* one `output` element with ID `out`
The input elements have `value` attributes defined in the HTML source. The value of any given input may be any ... |
[Question]
[
Read infinitely from stdin, and convert every number to the corresponding symbol on a US qwerty keyboard.
No string or character literals anywhere are permitted.
E.g. if the input is `117758326`, the output is `!!&&%*#@^`.
Letters and symbols that aren't on numbers are left alone; `11g2;;'1g2311hh21... |
[Question]
[
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/24101/edit).
Closed 5 years ago.
[Improve this question](... |
[Question]
[
Write a plain TeX program that lists the first two hundred primes (in base-10 notation). Including external files/resources is not permitted. The output may be to the terminal, the log file, or the actual dvi/pdf file, at your option, but should be easily readable to a human; in particular, there mus... |
[Question]
[
## objective
write a program that can perform addition, subtraction, multiplication, and division, using only bit-wise operators, by bit-wise operators i mean the equivalent of JavaScript `&`, `|`, `^`, `~`, `<<` ,`>>` ,`>>>`. (`AND`, `OR`, `XOR`, `NOT`, and `SHIFT`s)
## rules
* you **can use other o... |
[Question]
[
[We're back](https://codegolf.stackexchange.com/q/222560/43266)! And this time with an objective scoring criteria!
---
This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :)
##... |
[Question]
[
[The McGill Billboard Project](https://ddmal.music.mcgill.ca/research/The_McGill_Billboard_Project_(Chord_Analysis_Dataset)/) annotates various audio features of songs from a random sample of the Billboard charts. I scraped this data to produce the following file of chord progressions:
[`chords.txt`]... |
[Question]
[
# Challenge
The challenge is to write a function that prints the number of **repeats** a given array of integers has.
### What are repeats?
Repeats of a slice (as in a section of an array) `[ a1, a2, a3, ..., an]` are any other non-overlapping slices of the forms `[ a1+an, a2+an, a3+an, ..., an+an]`,... |
[Question]
[
## Statement
Given an input like this `35 15 0 0 10` that matches the following constrains:
* `Width` in characters of the grid (5-50)
* `Height` in characters of the grid (5-25)
* Initial `X` position of the ball (0-(`Width`-1)
* Initial `Y` position of the ball (0-(`Height`-1)
* Number of movements... |
[Question]
[
I used to play the oboe, the instrument that is, for some reason, used to tune the orchestra to A440. Anyways, continuing on with my story, I was bad at it and quit.
Write a program that generates a valid, full scale, 5 second, [WAV file](http://en.wikipedia.org/wiki/Waveform_audio_format) with a sam... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/7105/edit).
Closed 1 year ago.
[Improve this question](/posts/7105/edit)
P... |
[Question]
[
In the game manufactoria, take in a binary number and output that number of red pieces.
The catch? The board-size is only 7x7:
Here's the manufactoria code for the problem:
<http://pleasingfungus.com/Manufactoria/?ctm=Razors;Treat_the_input_as_a_binary_number_and_output_that_number_of_reds;b:r|brr:rr... |
[Question]
[
## Background
This challenge is about [Convolutional neural networks](https://en.wikipedia.org/wiki/Convolutional_neural_network), and its two main building blocks, namely [Convolutional layer](https://en.wikipedia.org/wiki/Convolutional_neural_network#Convolutional_layer) and [Pooling layer](https:/... |
[Question]
[
Given a positive integer, write it as the sum of numbers, where each of them is in \$\{kt|k\in{1,9,81},t\in{1,2,3,...,64}\}\$. How many numbers at least are used? Shortest code win.
Samples:
```
Input Output Method
1 1 1
2 1 2
64 1 64
65 2 64+1
72 1 72
... |
[Question]
[
# Introduction
A childhood game designed to help children learn to count in french in Canadian schools is played as follows:
* Students go around the room counting up to 11
* A number greater than 11 cannot be said
* A student can say either 1, 2, or 3 numbers
* If a student says the number 11 then t... |
[Question]
[
It's annoying when you have to search for a language homepage, get its link, and add it to your SE comment/answer, right? Let's write a script to do that for you!
# Challenge
For each language name (intentional or not) in the input, replace it with the markdown link to the language home page, defined... |
[Question]
[
**Background**
Here you have another work-inspired challenge, but from my wife's work in this case. Imagine you have a service that returns the list of nodes in a tree structure (much like the files and folders in a file system), but in no particular order. For every node you get a tuple with its nam... |
[Question]
[
# Description:
A [non-integer representation](https://en.wikipedia.org/wiki/Non-integer_representation) of a number uses non-integer numbers as the bases of a positional numbering system.
e.g. Using the golden ratio (the irrational number 1 + √5/2 ≈ 1.61803399 symbolized by the Greek letter φ) as its... |
[Question]
[
A CSS selector is made up of five elements:
1. The element type (tag name)
2. The id of the element
3. The classes of the element
4. The attributes of the element
5. Operators to chain these element selectors
This challenge will only involve the first four--also taking into account operators would m... |
[Question]
[
Poke is a really simple incomplete-information game. It's like "Poker", but simpler. At the start of every round, each player is dealt a hand. To simplify things, a hand is a uniformly distributed random number between 0 and 1. Each player only knows their own hand. The player that wins the round is ... |
[Question]
[
This is a variant on the self-replicating program, defined here as a program that outputs its source (or a [quine](/questions/tagged/quine "show questions tagged 'quine'")). Below is an example of a self-replicating program in Python:
```
s = 's = %r\nprint(s%%s)'
print(s%s)
```
When run from a file,... |
[Question]
[
Here in the absolutely made up country Rnccia we have a lot of good stuff, but the roads aren't good. There are lots of holes and only half of them get fixed. Even then, only half of the fixes are well done. Your task is to embrace the bad roads of this country and draw them for me.
## Input
You rece... |
[Question]
[
**This question already has answers here**:
[Evaluate the nth hyperoperation](/questions/11520/evaluate-the-nth-hyperoperation)
(15 answers)
Closed 6 years ago.
Inspired by [Expand exponentation](https://codegolf.stackexchange.com/questions/110596/expand-exponentiation).
[Knuth's up arrow nota... |
[Question]
[
**This question already has answers here**:
[Find the nth decimal of pi](/questions/84444/find-the-nth-decimal-of-pi)
(17 answers)
Closed 7 years ago.
**Task**
Given an input `n`, calculate the n-th decimal digit of pi
**Rules**
* Answer can be a full program or a function.
* Input must be tak... |
[Question]
[
Your task is to make a histogram given a sample of arbitrary size.
**Input**
A float array or any other reasonable form of input with an arbitrary number of elements.
**Output**
The histogram; more to follow.
**How to make a histogram**
We'll use the sample: `[1.1, 3, 5, 13, 15.5, 21, 29.7, 63, 16,... |
[Question]
[
## Challenge
Write a program which takes the URL of a PPCG answer as input and outputs the length of the answer's first code block in bytes.
## Code Blocks
There are three different ways of formatting code blocks:
**Four spaces before the code (`-` represents a space, here)**
```
----Code goes here
`... |
[Question]
[
Given six unique non-negative integers, print the two 3-digit integers comprised of those numbers that sum to the smallest amount.
Additionally,
* If there is more than one set of numbers that meets the smallest-sum requirement, print the two that have the greatest difference. For example, `269 + 15... |
[Question]
[
# Columnar Transposition Cipher
While I have plenty of programs I have written for more advanced ciphers, I just realised I don't actually have one for one of the simplest: [Columnar Transposition](https://en.wikipedia.org/wiki/Transposition_cipher#Columnar_transposition). The cipher, in case you don... |
[Question]
[
# The Challenge:
Just as the title says, your challenge is to use the printable ASCII characters to create a program that prints out a random polygon in the terminal based on the number of sides, *n* provided by the user, where n is an integer in the range `3 -> 10` including 3 and 10, in as few byte... |
[Question]
[
An [*linear discrete convolution*](https://en.wikipedia.org/wiki/Convolution#Discrete_convolution) is an operation that turns two vectors of numbers into a third vector of numbers by multiplying elements inside-out. Formally, for two vectors `a` and `b` with elements `0` to `n - 1`, the discrete line... |
[Question]
[
Consider the following ASCII image of five concentric anti-aliased ASCII aureoles:
```
........
.@..............@.
..... .....
.@.. ...@@@@@@@@... ..@.
.@. ..@@.. ..@@.. .@.
.@. .@@. ........ .@@. .@.
.@ ... |
[Question]
[
*Initech* are setting up an office of 36 employees in a soul-crushingly efficient square of cubicles, 6 desks long and 6 desks deep. Management has bought wireless keyboards in bulk from a cheap, international wholesaler. IT are quickly discovering that the wireless keyboards only operate on 3 differ... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/3163/edit).
Closed 5 years ago.
[Improve this question](/posts/3163/edit)
... |
[Question]
[
A [redox reaction](https://chem.libretexts.org/Bookshelves/Analytical_Chemistry/Supplemental_Modules_(Analytical_Chemistry)/Electrochemistry/Redox_Chemistry/Oxidation-Reduction_Reactions#:%7E:text=An%20oxidation%2Dreduction%20(redox),gaining%20or%20losing%20an%20electron.) is a chemical reaction in w... |
[Question]
[
# Introduction
A circle-tangent polynomial is a polynomial of degree \$N\ge3\$ or above that is tangent to the unit circle from inside at all of its N-1 intersection points. The two tails that exits the circle are considered tangent at their intersection points from inside as well. You may consider s... |
[Question]
[
What general tips do you have for golfing in Lexurgy? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Lexurgy (e.g. "remove comments" is not an answer).
Please post one tip per answer.
Lexurgy is a tool created by Graham Hill/`def-gthi... |
[Question]
[
In as few bytes as possible in t-sql, return 100 rows containing the phrase 'Have a great Christmas'
92 (I think) to beat :D
```
CREATE TABLE #(m char(99))
GO
INSERT # SELECT'Have a great Christmas'
GO 100
SELECT * FROM #
```
Previous best effort was:
```
WITH t(m,r)AS(SELECT'Have a great Christmas',... |
[Question]
[
# Introduction
This challenge is about producing a code to count the frequency of bigrams in a text. A bigram is two consecutive letters in a text. For instance 'aabbcd' contains the bigrams aa, ab, bb, bc, cd once each. Counting bigram frequencies is super useful in cryptography. In a brute force al... |
[Question]
[
What general tips do you have for golfing in [Scala 3](https://dotty.epfl.ch/)? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala 3 (e.g. "remove comments" is not an answer). Please post one tip per answer.
Also see [Tips for golfi... |
[Question]
[
This challenge is inspired by the same task I read some time ago in CACM.
There are many ways to sort stuff. Most attempt to sort in as few operations as possible (= as fast as possible). However, it is also possible to consider how few resources you might require to sort stuff, which seems more fitt... |
[Question]
[
I was doing some investigation into trig functions using compound angles recently, and noticed that the results are really long and tedious to write:
$$
\cos(A+B) = \cos A \cos B - \sin A \sin B \\
\cos(A-B) = \cos A \cos B + \sin A \sin B \\
\sin(A+B) = \sin A \cos B + \sin B \cos A \\
\sin(A-B) = \... |
[Question]
[
There's a little-known secret in Banjo-Kazooie that you can interleave the three Cheato codes on the Treasure Trove Cove Sandcastle floor and it will still recognize all of them. So you could, for instance, enter `BLUREEGOLDDFFEEGEAATHTHEEGSRSRS`, activating `BLUEEGGS`, `REDFEATHERS`, and `GOLDFEATHE... |
[Question]
[
>
> **ALERT: IN CASE YOU DOUBT, NO PUN ON "QUINE" IS INTENDED**
>
>
>
In regulated horse-racing for gambling, bets called *Quinella bets* [exist and in which a person bet on the first two places of a race.](https://en.wiktionary.org/wiki/quinella) In racecourses, usually there is a display which ... |
[Question]
[
# Description
OEIS sequence [A096004](https://oeis.org/A096004) gives the
>
> Number of convex triangular polyominoes [[polyiamonds](https://en.wikipedia.org/wiki/Polyiamond)] containing n cells.
>
>
>
It begins:
```
1, 1, 1, 2, 1, 2, 2, 3, 2, 2, 2, 3, 2, 3, 3, 5
```
For example, a(8)=3 with the ... |
[Question]
[
Inspired by [this comment](https://codegolf.stackexchange.com/questions/149585/coffee-machine-machine#comment365526_149585).
# Input
The number of seconds on the timer.
# Output
Here's our basic microwave:
```
_____________________________________________________________
| ... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/147919/edit).
Closed 6 years ago.
[Improve this question](/posts/147919/edi... |
[Question]
[
I need this down to as few characters as possible. I would use Test-NetConnection but I need PSv2 compatability. Any help would be appreciated.
```
$socket = new-object Net.Sockets.TcpClient
$socket.Connect("192.168.5.5",445)
$socket.Connected
```
As a note I have tried this but it doesn't work
```
(... |
[Question]
[
This is similar to prime factorization, where you find the smallest prime factors of a number (i.e. 8 = 2 x 2 x 2). But this time, you are to return an array/list of the smallest composite factors of any given positive integer `n`. If `n` is prime, simply return an empty list.
**Examples:**
* Prime:
... |
[Question]
[
Today (March 15) is the [Ides of March](https://en.wikipedia.org/wiki/Ides_of_March), best known for being the date that Julius Caesar was assassinated.
What's “Ides”? Well, the ancient Romans didn't simply number the days of month from 1 to 31 like we do. Instead, they had a more complex system of c... |
[Question]
[
**This question already has answers here**:
[Is it Christmas?](/questions/4106/is-it-christmas)
(38 answers)
Closed 8 years ago.
The community reviewed whether to reopen this question 6 months ago and left it closed:
>
> Original close reason(s) were not resolved
>
>
>
## Task
Constantly h... |
[Question]
[
On occasion I get a little blue and need a little music to cheer me up, but clicking the start button and finding my media player takes *sooooooo* long. I want a faster way to play a song.
**The challenge:**
Write a program that:
* Choose a song from my home directory *(so you don’t mix-up program ... |
[Question]
[
## Introduction
Pi is
```
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089...
```
Let's treat each digit as an instruction as to how to get to the next digit.
* The first digit is 3.
* Counting three digits after the first digit, we arrive at 1.
* One digit after this... |
[Question]
[
In [this problem on Puzzling.SE](https://puzzling.stackexchange.com/questions/274/choosing-units-for-drug-testing/297?noredirect=1#297), I ask a question about determining the amounts of drug to use in a clinical test to minimize total drug usage and fulfill the requirements of the testing procedure.... |
[Question]
[
Your challenge is to write a program that takes input from *stdin*, creates a set of `1` to `n`colors and outputs them on *stdout*, formatted as a 6-digit-hex value with a prefixed #.
* The starting color should have following values (in a hsv colorspace) (pesudocode)
+ `h=rand(), s=0.5, v=0.95`.
* ... |
[Question]
[
Write the shortest program possible which outputs a table of Normal distribution values
```
phi(z) = Integral[t from -infty to z of e^(-t^2/2) /sqrt(2 pi) dt]
```
for `z` from 0.00 to 3.99, giving values accurate to 4 decimal places.
The canonical format for such a table appears to be:
```
0.00 ... |
[Question]
[
The [Roman numeral](https://en.wikipedia.org/wiki/Roman_numerals) for 499 is usually given as `CDXCIX` which breaks down as `CD + XC + IX` = 400 + 90 + 9 where numerals like `CD` and `IX` are written using subtractive notation. Some programming languages have a `roman()` function that extends this su... |
[Question]
[
Classic Tetris was often a difficult game to play. One problem was that you could only work with the Tetris piece you were given, so if you had an awkward board, it would sometimes be difficult to find a suitable location to put your piece. Another problem was that you could only look one piece ahead... |
[Question]
[
Your task is to convert non-empty strings - between strings using the 26 letters, and programs, which are strings of bytes, where each byte has 256 possible values. You should use the same codepage your answer is written in for the possible values of bytes.
You need to do the following to do the conv... |
[Question]
[
I have a coding problem that goes like this:
>
> Given a positive integer \$N\$, return a list of all possible pairs of positive integers \$(x,y)\$ such that $$\frac1x+\frac1y=\frac1N$$
>
>
>
I already solved the problem using Python, but I was wondering how I can code golf it. The following is m... |
[Question]
[
Given a map from arrays of integers of same size to single integers, determine if there is a set of indices such that the output is equal to the maximum of the elements at those indices for every corresponding pair.
You can take the input as a map if your language support, arrays of pairs, separated ... |
[Question]
[
**Challenge**: Given an expressions made of additions and multiplications, output an expression that is a sum of products. The output must be equivalent to the input modulo the law of distribution. For example, \$1 + ((2 + 5\times 6) \times(3+4))\$ becomes \$1 + 2 \times 3 + 2 \times 4 + 5\times6\tim... |
[Question]
[
[Gelatin](https://codegolf.stackexchange.com/questions/224491/interpret-gelatin) is a worse version of [Jelly](https://github.com/DennisMitchell/jelly). It is a tacit programming language that always takes a single integer argument and that has 7 (or maybe 16) commands.
## Gelatin
Gelatin programs wi... |
[Question]
[
This is a relatively simple question. I'm trying to golf a Snake game I've written, and I'm trying to work out if there's a way to golf the following conditional assignments which control x and y coordinates of the snake ensuring a wrap around of the play area:
```
if (P<0) {
P = T-1;
}
if (P>T-1) ... |
[Question]
[
# Objective
Given an Arabic string consisting of ISO/IEC 8859-6 Arabic letters (U+0621–063A, 0640–064A), decode it to Arabic Presentation Forms-B (U+FE70–FEFF).
# Behavior of Arabic letters
ISO/IEC 8859-6 Arabic letters change their displayed form to letters in Arabic Presentation Forms-B, which are ... |
[Question]
[
This is a simple game of getting rid of those damn numbers.
You start with the numbers from 1 to 19, written in a grid of 9 by 3:
```
1 2 3 4 5 6 7 8 9
1 1 1 2 1 3 1 4 1
5 1 6 1 7 1 8 1 9
```
You may notice that the number 10 is missing, this because the number zero would be hard to get rid of later ... |
[Question]
[
Given a range and a list thereof, while keeping the existing intervals in the list unchanged, split the additional range into sub-intervals and add them to the list, such that all the ranges in the final list are disjoint and contain all numbers present in the input ranges.
The goal is to create an ... |
[Question]
[
Here you can see g-code parser, written in JavaScript to use in microcontroller (like espruino). But you can run it in browser, because it don't use any specific features.
```
function gcode(str){
//Removes comment, parses command name and args
const [,f,args] = (str.match(/^([GM]\d+) ([^;]+)/) |... |
[Question]
[
A number theory expression contains:
```
There exists at least one non-negative integer (written as E, existential quantifier)
All non-negative integers (written as A, universal quantifier)
+ (addition)
* (multiplication)
= (equality)
>, < (comparison operators)
&(and), |(or), !(not)
(, ) (for groupi... |
[Question]
[
## Introduction
For a given rational number `r`, find a pair of integers `p,q` so that `p/q=r` and the number of less used bits in `p` and `q` are minimized (details below).
## Challenge
A positive rational number `r` can be expressed as the ratio of two positive integers, `r=p/q`. The representation... |
[Question]
[
There are *n* places set around a circular table. Alice is sat on one of them. At each place, there's a cake. Alice eats her cake, but it doesn't taste very nice. Then the Mad Hatter comes in. He gives Alice a list of *n*-1 numbers, each between 1 and *n*-1. For each item *i* in the list, Alice has t... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/145840/edit).
Closed 6 years ago.
[Improve this question](/posts/145840/edi... |
[Question]
[
## Introduction
This is the evolution of [this previous challenge](https://codegolf.stackexchange.com/q/84103/55329) which was about checking satisfieability of normal formulae in [conjunctive normal form (CNF)](https://en.wikipedia.org/wiki/Conjunctive_normal_form). However, this problem is [NP-comp... |
[Question]
[
This is very similar to [this challenge](https://codegolf.stackexchange.com/q/75151/42649), "Implode the Box". It was a pretty nice challenge and it didn't get many answers, so I'm going to post a similar challenge (strongly) inspired by it.
ASCII Boxes look like this:
```
++ +---+ +------+ ... |
[Question]
[
What general tips do you have for [golfing in V](https://github.com/DJMcMayhem/V)? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to V (e.g. "remove comments" is not an answer).
Since V is heavily based on vim, most of the [tips for golf... |
[Question]
[
[Related](https://codegolf.stackexchange.com/questions/110825/calculate-elo-rating-expected-score)
## Task
Your task is to calculate the new [Elo rating](https://en.wikipedia.org/wiki/Elo_rating_system) ([FIDE rating system](https://en.wikipedia.org/wiki/Elo_rating_system#FIDE_ratings)) for a player ... |
[Question]
[
## Introduction
Suppose we have a network of railroads.
Each junction in the network is controlled by a *switch*, which determines whether an incoming train turns left or right.
The switches are configured so that each time a train passes, the switch changes direction: if it was pointing left, it now... |
[Question]
[
**This question already has answers here**:
[Code Golf: Number of paths!](/questions/1326/code-golf-number-of-paths)
(9 answers)
Closed 7 years ago.
### Definition
Define the **n**th term of the CRAU sequence as follows.
1. Begin with the singleton array **A = [n]**.
2. Do the following **n** ... |
[Question]
[
Here we go again! This is my last flag for now!
I originally wanted to do my national flag but I thought the stars were too hard so I posted [Print the British Flag!](https://codegolf.stackexchange.com/questions/52643/print-the-british-flag) instead, which itself was inspired by [Print the American F... |
[Question]
[
We have a lot of IPV4 address, to group into subnets, so we need a tool for doing this:
Our list is very ugly, not ordered and sometime in subnet notation, sometime in simple address.
**Sample:**
```
192.168.5.16/30
192.168.5.18
192.168.2.231/27
192.173.17.0/24
192.168.1.5/32
192.168.5.18/32
192.168.... |
[Question]
[
From [Erich Friedman's Math Magic](https://erich-friedman.github.io/mathmagic/0912.html), (problem #2 on that page) your challenge is to find the edge elimination number of a connected graph.
A single **edge elimination** is the removal of an edge from a graph, without disconnecting the graph, except... |
[Question]
[
Today computers use millions of bytes of memory, and decimal or hexadecimal notations get less and less informative.
Most human-readable formatting just display the number with the highest unit prefix. What about the rest?
I devised a notation that I use for myself, and since then, I'm often faced wi... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win.
Closed 7 years ago.
[Improve this que... |
[Question]
[
You are the treasurer and you have received information that a counterfeit coin has entered the treasury. All you know is that the counterfeit coin is lighter than the original.
Knowing how many coins you have in total and using only a balance scale, you need to determine the minimum number of weighi... |
[Question]
[
J-uby is the [Language of the Month for June 2022](https://codegolf.meta.stackexchange.com/questions/24817/language-of-the-month-for-june-2022-j-uby), so I'm looking for tips for golfing in it. As usual, please post one tip per answer, and avoid general tips such as "remove whitespace" or "avoid comm... |
[Question]
[
On Unix-like systems, the `ls` command lists files. GNU's version of `ls` also colors them according to their properties and the environment variable `LS_COLORS`. The main file property that `ls` bases its colors on is the file's **mode**. In this challenge, you will determine what keys from LS\_COLO... |
[Question]
[
## Background
This is loosely based on the now closed [Kaomoji question](https://codegolf.stackexchange.com/questions/219146/typing-faces-with-programming) asked a few hours ago.
Kaomojis are sequences of characters designed to express a given emotion. In this [code-challenge](/questions/tagged/code-... |
[Question]
[
I'm new to code golf challenges. My problem came up in [Advent of Code 2020 Day 8](https://adventofcode.com/2020/day/8)
The input is an array of arrays. In part two of the problem one needs to run several trials to produce a result by changing an element in the input array. My current code is this (c... |
[Question]
[
>
> Your challenge is to turn a Japanese word and a dictionary pitch accent number into a new string where the rises and falls in pitch are marked: e.g. **(2, ウシロ)** → `ウ/シ\ロ`.
>
>
> To help you out with this, I'll explain a little about Japanese phonology.
>
>
>
# Background: on *moras*
For th... |
[Question]
[
One day, I saw the challenge to [multiply two strings](https://codegolf.stackexchange.com/questions/125470/multiply-two-strings) and I thought I might be able to do one better.
That challenge was fake. It was elementwise maximum. It was not real multiplication. So I set out to make something real. R... |
[Question]
[
Prior to the decimalisation of Sterling in February 1971, a pound (**£** - from Roman *libra*) comprised 20 shillings (**s** - *solidus*), each of 12 pennies (**d** - *denarius*). Additionally, until 1960, each penny could be divided into four farthings (some parts of the Commonwealth also had fracti... |
[Question]
[
I'm trying to strip down my python code to be as few lines as possible. The task: count how many square numbers are below 100. Here's my code so far:
```
m = 0
for x in range(0, 100):
m+=1-(-((-((x+1)**(0.5)-((x+1)**(0.5))//1))//1));
print(m)
```
That addition statement adds 1 to m (the counter) ... |
Subsets and Splits
Python Q&A Count
Counts the number of questions and answers related to Python in the dataset, providing insight into the prevalence of Python content.