text stringlengths 180 608k |
|---|
[Question]
[
## Creating a Crossed Square
You are to take input of an integer of one or more and output a square made of any printable character of your choice with a diagonal cross through the centre.
The general idea is for the output to be a hollow square that has a diagonal cross through it.:
```
Input: 7
Outpu... |
[Question]
[
All integers \$n > 0\$ can be expressed in the form
$$n = \prod\_{\text{prime } p} p^e = 2^{e\_2} 3^{e\_3} 5^{e\_5} 7^{e\_7} \cdots$$
This form is also known as it's [prime factorisation](https://en.wikipedia.org/wiki/Prime_number#Unique_factorization) or prime decomposition, and each integer has a [un... |
[Question]
[
Had my software final exams recently, one of the last questions had me thinking for a while after the exam had finished.
## Background
IEEE754 numbers are according to the below layout
[](https://i.stack.imgur.com/V5zks.pn... |
[Question]
[
[The Möbius function](https://en.wikipedia.org/wiki/M%C3%B6bius_function) is an important number theoretic function.
Your submission should accept a positive integer \$n\$ and return the value of the Möbius function evaluated at \$n\$.
### Definition
The Möbius function \$μ(n)\$ is defined as follows:
... |
[Question]
[
Your task today is to apply a wave to an array of numbers. A wave looks like this: `[1, 0, -1, 0, 1, 0, -1, 0, 1...]` Applying it to a given array means adding together the first elements, the second elements, etc.
More precisely:
Your program or function will receive an array of integers. It must prin... |
[Question]
[
Driftsort is a simple way to "sort" an array. It works by "sliding" or "rotating" the elements over in the array until the array is sorted, or until the array fails to be sorted.
Let's walk through two examples. First, consider the array `[10, 2, 3, 4, 7]`. Since the array is not sorted, we rotate it o... |
[Question]
[
Diagonalize a vector into a matrix.
## Input
A vector, list, array, etc. of integers \$\mathbf{v}\$ of length \$n\$.
## Output
A \$n \times n\$ matrix, 2D array, etc. \$A\$ such that for each element \$a\_i \in \mathbf{v}\$,
$$
A =
\left( \begin{array}{ccc}
a\_1 & 0 & \cdots & 0 \\
0 & a\_2 & \cdots &... |
[Question]
[
Given a word, decide if it is an ambigram.
When rotated:
```
b > q
d > p
l > l
n > u
o > o
p > d
q > b
s > s
u > n
x > x
z > z
```
Assume only lowercase letters as input.
---
Test input:
```
this,
another,
lll,
lol,
dad,
dab,
dap,
wow,
ooi,
lollpopdodllol,
```
---
Ones That Should Return Truthy Values:... |
[Question]
[
Given a non-negative integer, return the absolute difference between the sum of its even digits and the sum of its odd digits.
## Default Rules
* Standard Loopholes apply.
* You can take input and provide output by any standard Input / Output method.
* You may take input as a String, as an Integer or a... |
[Question]
[
## Background
**-rot transform** (read as "minus-rot transform") is a sequence transformation I just invented. This transform is done by viewing the sequence as a stack in Forth or Factor (first term on the top) and repeatedly applying `-rot +`. `-rot` is a command that moves the top of the stack to tw... |
[Question]
[
Inspired by this listing from the Commodore 64 User's Guide:
```
10 PRINT "{CLR/HOME}"
20 POKE 53280,7 : POKE 53281,13
30 X = 1 : Y = 1
40 DX = 1 : DY = 1
50 POKE 1024 + X + 40 * Y, 81
60 FOR T = 1 TO 10 : NEXT
70 POKE 1024 + X + 40 * Y, 32
80 X = X + DX
90 IF X <= 0 OR X >= 39 THEN DX = -DX
100 Y = Y ... |
[Question]
[
## Description
Given a list of positive integers, write the shortest code to find the number count of the longest consecutive sequence of numbers within the list.
## Input
A list of positive integers. You can assume the list is not empty and may contain duplicates.
## Output
The length of the longest c... |
[Question]
[
Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details.
The story continues from [AoC2015 Day 5](https://adventofcode.com/2015/day/5), Part 2.
---
Santa needs help figuring out which strings in his text file are naughty ... |
[Question]
[
This is a copy cat question of [Simplify ijk string](https://codegolf.stackexchange.com/questions/226278/simplify-ijk-string) applied to the other nonabelian group of order 8. See also [Dihedral group composition with custom labels](https://codegolf.stackexchange.com/questions/185140/dihedral-group-d4-... |
[Question]
[
Given the coordinates of the centres and the radii of 2 circles, output a truthy value of whether they do or do not overlap.
## Input
* Input may be taken via STDIN or equivalent, function arguments, but not as a variable. You can take them as a single variable (list, string etc) or as multiple inputs ... |
[Question]
[
[American odds](https://en.wikipedia.org/wiki/Fixed-odds_betting#Moneyline_odds) (aka *moneyline odds*) are numbers like \$+150\$ or \$-400\$ used to express how much a winning bet would pay out. Convert odds to a fair win probability like this:
* Positive odds \$+n\$ with \$n \geq 100\$ correspond to ... |
[Question]
[
In chess, *fork* means to target two pieces with just one piece, and one of the best pieces for forking is the knight.
In this challenge, you will be given three coordinates in `a` to `h` and `1` to `8` (like `a8` or `e7`) format. The first and second coordinates are for two other random pieces, and th... |
[Question]
[
[Elixir](https://elixir-lang.org/) is a programming language with a feature called the [pipe operator](https://elixirschool.com/en/lessons/basics/pipe-operator/), `|>`, similar to the pipe in Bash and other languages. It passes the result of an expression on the left as the first parameter of a given f... |
[Question]
[
Given a \$2\times N\$ maze, determine if you can get from the start top left corner to end bottom right corner using only up, down, left, and right moves.
## Input
A \$2\times N\$ block (\$1 \le N \le 100\$) of your choice of two distinct characters, one representing walls and the other representing em... |
[Question]
[
Given a decimal integer `n` as input, output the smallest (in terms of absolute value) decimal integer `m` such that the absolute value of `n-m` is a binary integer (composed only of `1`s and `0`s).
`n` and `m` can be any integer, positive or negative.
### Example
Let `n = 702`. The closest binary inte... |
[Question]
[
Given an integer `n`, find the next number that follows the following requirements:
* The next greater number is a number where each digit, from left to right, is greater than or equal to the previous one. For example, `1455`:
`1<4`
`4<5`
`5<=5`
* The next greater number has to be bigger than `n`
# Tes... |
[Question]
[
# Challenge
Here's a simple one.
Write a function or program when given a number in base 10 as input, it will return or print that number's value in [Hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal "Hexadecimal - Wikipedia").
# Examples
```
15 -> F
1000 -> 3E8
256 -> 100
```
# Rules
* No built-i... |
[Question]
[
Simple challenge: try to output the following text in as few bytes as you can:
```
the answer
toli fetheuniv
ersea nde ver
ything the ans
wer tol ife the
uni ver sean
dev ery thin
gth ean swer
tolifetheuni ... |
[Question]
[
Inspired by [this question](https://askubuntu.com/questions/600018/how-to-display-the-paths-in-path-separately) on AskUbuntu.
Your job is extremely simple. Take the PATH environment variable (`echo $PATH`) and export it such that each entry (separated by the `:` character) is on its own line.
For examp... |
[Question]
[
This should be a fairly simple challenge.
For an array of numbers, generate an array where for every element all neighbouring elements are added to itself, and return the sum of that array.
Here is the transformation which occurs on the input array `[1,2,3,4,5]`
```
[1,2,3,4,5] => [1+2, 2+1+3, 3+2+4, 4... |
[Question]
[
**Note 2: I accepted `@DigitalTrauma`'s 6-byte long answer. If anyone can beat that I will change the accepted answer. Thanks for playing!**
**Note: I will be accepting an answer at 6:00pm MST on 10/14/15. Thanks to all that participated!**
I am very surprised that this has not been asked yet (or I did... |
[Question]
[
Write a function which takes in a list of positive integers and returns a list of integers approximating the percent of total for the corresponding integer in the same position.
All integers in the return list must exactly add up to 100. You can assume the sum of integers passed in is greater than 0. H... |
[Question]
[
The goal of radiation hardening is to make a program still work after you remove a byte. However, what if a skilled competitor is purposefully trying to mess with you?
In this game, each bot will take turns removing one character from the next bot down the line. If the bot fails to produce valid output... |
[Question]
[
Given the diagonals of a matrix, reconstruct the original matrix.
The diagonals parallel to the major diagonal (the main diagonals) will be given.
[](https://i.stack.imgur.com/iwfTs.png)
Diagonals: `[[5], [4, 10], [3, 9, 15], [2, 8, 14, 20], [1, 7... |
[Question]
[
## Challenge
Given an input string `X`, determine if `X` can be obtained from reshaping a *strict prefix* of itself (a prefix that is not `X` itself).
Reshaping a string to a length `N` means repeating the string as many times as needed and then taking the first `N` characters of it.
## Examples:
The s... |
[Question]
[
*[Not a duplicate of the valid move challenge because that asks for specific pieces](https://codegolf.stackexchange.com/questions/148587/is-it-a-valid-chess-move)*.
## Backstory
The other night I was doing [a little trolling](https://chat.stackexchange.com/rooms/145373/conversation/plausible-chess) wit... |
[Question]
[
### Background
Being in a philosophical mood, I remembered one old idea. I think it is suitable for CG.
Duplicates are not found, but it's of course just a kind of totalistic cellular automaton or [erosion](https://en.wikipedia.org/wiki/Erosion_(morphology)).
Given an infinite board filled with empty (... |
[Question]
[
Given a non-empty string (or an integer, or a list/array if you prefer) composed exclusively of digits in the range [1-9], your task is to write a function (or a whole program) that applies a "Match-3 type of rule" from left to right and outputs the resulting string, like this :
```
[parameter] "12223"... |
[Question]
[
Given a positive integer `n`, output all of its anti-divisors in any order.
From OEIS [A006272](http://oeis.org/A066272):
>
> Anti-divisors are the numbers that do not divide a number by the largest possible margin. E.g. 20 has anti-divisors 3, 8 and 13. An alternative name for anti-divisor is unbiase... |
[Question]
[
Your task is to create a program or function that takes, as input, a natural number (`n`) between 1 and 25 (inclusive) and prints an isometric representation of a slide and ladder with `n` number of rungs.
### Ladder and slide specifications
The ladder is always oriented on the left and the slide on th... |
[Question]
[
This is inspired by an [05AB1E answer](https://codegolf.stackexchange.com/a/114226/76162) by [Magic Octupus Urn](https://codegolf.stackexchange.com/users/59376/magic-octopus-urn).
Given two arguments, a positive integer and a string/list of characters:
1. Translate the number to base-n, where n is the ... |
[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/98866/edit).
Closed 2 years ago.
[Improve this question](/posts/98866/edit)
... |
[Question]
[
Write a function that when given a buffer `b` (1 - 104857600 bytes long) and a number of bits `n` (1 <= n <= 64), splits the buffer into chunks of `n` bits. Right-pad the last chunk with `0`s up to `n` bits.
e.g.
Given the buffer `b = "f0oBaR"` or equivalently `[102,48,111,66,97,82]` and `n = 5`, retur... |
[Question]
[
(Inspired by an early draft of [PhiNotPi's fractal line challenge](https://codegolf.stackexchange.com/q/47701/8478).)
You're given a width `W > 1`, a height `H > 1` and string consisting of `2(W+H-2)` printable ASCII characters. The task is to print this string wrapped around a rectangle of the given w... |
[Question]
[
## Intro
The Tetris Guidelines specify what RNG is needed for the piece selection to be called a Tetris game, called the Random Generator.
Yes, that's the actual name (["Random Generator"](https://tetris.wiki/Random_Generator)).
In essence, it acts like a bag without replacement: You can draw pieces ou... |
[Question]
[
This is a QWERTY keyboard.
```
Q W E R T Y U I O P
A S D F G H J K L
Z X C V B N M
```
We can "spiral out" on this keyboard, starting from G. The spiral will start at G, go to H, then to Y, then to T, then F, then V, then B, then N, then J, then U, then R, then D, then C,... etc. Your challenge is t... |
[Question]
[
The non-negative integers are bored of always having the same two\* neighbours, so they decide to mix things up a little. However, they are also lazy and want to stay as close as possible to their original position.
They come up with the following algorithm:
* The first element is 0.
* The \$n^{th}\$ e... |
[Question]
[
This is a rather simple challenge, but I couldn't find any question that was really similar to it. The challenge is to take a frequency in using STDIN or an equivalent, and then output a tone that matches that frequency, in Hz, for 5 seconds. For example
```
Input: 400
Output: (a tone of 400 Hz with a ... |
[Question]
[
If an integer has a digit/sequence of digits in it which repeats continuously (You will understand why I said "continuously") 5 or more times, we call It "Boring".
For example, `11111` is Boring, whereas `12345` is not.
# Instructions
Take an Integer as Input
Output a truthy value if the integer is bor... |
[Question]
[
Given two strings as input, return the result of XORing the code-points of one string against the code points of the other.
For each character in the first input string, take the code-point (e.g. for `A`, this is 65) and XOR the value against the corresponding index in the second string and output the ... |
[Question]
[
Inspired by this [blog post](http://matt.might.net/articles/i-love-you-in-racket/).
Write a program that outputs 99 distinct programs (in the same language) that output the string `I love you`.
How the programs are separated from one another in the output will be defined by you. However, Each byte of o... |
[Question]
[
[Bertrand's Postulate](https://en.wikipedia.org/wiki/Bertrand%27s_postulate) states that for every integer **n ≥ 1** there is at least one prime **p** such that **n < p ≤ 2n**. In order to verify this theorem for **n < 4000** we do not have to check 4000 cases: The *Landau trick* says it is sufficient ... |
[Question]
[
The pyramid begins with the row `1 1`. We'll call this row 1. For each subsequent row, start with the previous row and insert the current row number between every adjacent pair of numbers that sums to the current row number.
$$
1\quad1\\
1\quad\color{red}{2}\quad1\\
1\quad\color{red}{3}\quad2\quad\colo... |
[Question]
[
In this task, you have to write a program, that computes the prime factors of a number. The input is a natural number 1 < n < 2^32. The output is a list of the prime factors of the number in the following format. Exponents must be omitted if they are 1. Only output prime numbers. (Assuming the input is... |
[Question]
[
Given a matrix, output a representation of the matrix where the top left element is on top, the anti-diagonal is the central row and the bottom right element is at the bottom.
For example, consider the following matrix:
```
1 2 3
4 5 6
7 8 9
```
The diamond version of this matrix is:
```
1
4 2
7 5 3... |
[Question]
[
**This question already has answers here**:
[MacGyver's Second Toolbox](/questions/128464/macgyvers-second-toolbox)
(3 answers)
Closed 6 years ago.
In this question each answer will get a "toolbox" that can be used to construct a program/function. The toolbox will consist of two things:
* a list... |
[Question]
[
Given a string containing only the characters `-`, `|`, `+` and newline determine the longest straight line contained in it. A straight line is either an uninterupted run of `-`s and `+`s in a single row or an uninterupted run of `|`s and `+`s in a single column.
So for example:
```
|
| ... |
[Question]
[
**The [bounty](https://codegolf.stackexchange.com/help/bounty) expires in 5 days**. Answers to this question are eligible for a +100 reputation bounty.
[Adám](/users/43319/ad%c3%a1m) wants to **reward an existing answer**:
>
> [This](https://codegolf.stackexchange.com/a/270056/43319) well-explained... |
[Question]
[
Output the area \$A\$ of a triangle given its side lengths \$a, b, c\$ as inputs. This can be computed using [Heron's formula](https://en.wikipedia.org/wiki/Heron%27s_formula):
$$ A=\sqrt{s(s-a)(s-b)(s-c)}\textrm{, where } s=\frac{a+b+c}{2}.$$
This can be written in various ways, such as
$$ A= \frac{1}... |
[Question]
[
## Challenge
Given a positive integer \$n\$, count the number of \$n\times n\$ binary matrices (i.e. whose entries are \$0\$ or \$1\$) with exactly two \$1\$'s in each rows and two \$1\$'s in each column.
Here are a few examples of valid matrices for \$n=4\$:
```
1100 1100 1100
11... |
[Question]
[
Welcome to the grinder.
Your task is to make big rocks into small rocks by grinding them.
Take an input of a big rock of size `n > 3` and grind it.
Continue to grind the rocks by dumping them into the grinder until the size of all the rocks are `2`.
rocks are always grinded into equal even halves. If... |
[Question]
[
Say that you have a string like this:
`abaabbbbbaabba`
Count the number of times that a specified character appears in the input string, but only if the character appears *only once in a row*. For example, if the character is `a`,
```
abaabbbbbaabba
^ x x ^
```
The total would be 2 (the `aa`'s ... |
[Question]
[
## Challenge
Given a string of any length, write it as a triangle, spiraling out from the center. For example, `abcdefghijklmnop` becomes:
```
g
fah
edcbi
ponmlkj
```
Or more explicitly:
[](https://i.stack.imgur.com/NyzLX.png)
... |
[Question]
[
We are all used to the old-school telephone keypad, right? For reference, here is what it looks like:
[](https://i.stack.imgur.com/MPi6I.png)
---
Given a String consisting only of **lowercase ASCII letters and single spaces**, your task is to retu... |
[Question]
[
*A continuation of [Inverse Deltas of an Array](https://codegolf.stackexchange.com/questions/101057/inverse-deltas-of-an-array)*
Your task is to take an array of signed 32 bit integers, recompile it with its deltas reversed.
## Example
The List,
```
18 19 17 20 16
```
has the deltas:
```
1 -2 ... |
[Question]
[
[Conways' Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are:
* Any live ce... |
[Question]
[
# ~~Code~~Drawing one-liner
# Teaser
Behold this formidable drawing:

Can you draw this in a single stroke? Give it a try.
Can you do this one, now:

Give it a try.
# How it works
These "make this drawing with one pen strok... |
[Question]
[
## Challenge
Given nine numbers, `a, b, c, d, e, f, g, h, i`, as input which correspond to the square matrix:
$$\mathbf{M} = \begin{pmatrix}a& b& c\\ d& e& f\\ g& h& i\end{pmatrix}$$
Find the inverse of the matrix, \$\mathbf{M}^{-1}\$ and output its components.
## Inverse Matrix
The inverse of a matrix... |
[Question]
[
Draw a program or function that will write to `STDOUT` `n` times (each for one step) a string that contains a dot `.` at the location of the walker. The program also needs to write a line every `s` seconds (or wait `s` seconds after each line).
A random walk is a mathematical formalization of a path th... |
[Question]
[
From the infinite triangular array of positive integers, suppose we select every 2nd numbers on every 2nd row as shown below:
$$
\underline{1} \\
\;2\; \quad \;3\; \\
\;\underline{4}\; \quad \;5\; \quad \;\underline{6}\; \\
\;7\; \quad \;8\; \quad \;9\; \quad 10 \\
\underline{11} \quad 12 \quad \underl... |
[Question]
[
[Related](https://codegolf.stackexchange.com/questions/103902/wrap-a-seasonal-present)
A room, in the context of this challenge, is a multidimensional array where the elements on the "outside" are `1`, to represent the walls, and all the other elements are `0` (empty space inside the room)
Here's a 1D ... |
[Question]
[
[This question](https://codegolf.stackexchange.com/questions/17239/convert-a-decimal-to-a-fraction) doesn't need to apply to just terminating decimals - repeating decimals can also be converted to fractions via an algorithm.
Your task is to make a program that takes a repeated decimal as input, and out... |
[Question]
[
The purpose of this task is to write a program or function to find the most common substring within a given string, of the specified length.
## Inputs
1. A string, `s`, of any length and characters that are valid as inputs for your language.
2. A number, `n`, indicating the length of substring to find.... |
[Question]
[
Several years back, Hot Wheels made a simple flash game called ["Formula Fuelers Racers"](http://play.hotwheels.com/en-us/games/formula-fuelers-racers.html)\*. To play the game, you select three ingredients from a fridge to put into your car, which is then raced against the computer's randomly-generate... |
[Question]
[
Given a non-negative integer (`n`), create a function that returns `n` in alphabetical order, according to the literal spelling of each digit in `n`.
### Examples:
```
Input: 101
>> one, zero, one
>> one, one, zero
Output: 110
Input: 31948
>> three, one, nine, four, eight
>> eight, four, nine, one, thr... |
[Question]
[
Write a program that prints out all the good rational approximations of pi with denominator < 1000000, in increasing denominator order. `a/b` is a "good rational approximation" of pi if it is closer to pi than any other rational with denominator no bigger than `b`.
The output should have 167 lines tota... |
[Question]
[
>
> Edit 2020-11-06: This challenge has been edited with new provisions to encourage participation. The edits have been **bolded** for emphasis.
>
>
>
Welcome to a cops and robbers version of [Find an Illegal String](https://codegolf.stackexchange.com/questions/133486/find-an-illegal-string).
An *i... |
[Question]
[
Your function takes a natural number and returns the smallest natural number that has exactly that amount of divisors, including itself.
Examples:
```
f(1) = 1 [1]
f(2) = 2 [1, 2]
f(3) = 4 [1, 2, 4]
f(4) = 6 [1, 2, 3, 6]
f(5) = 16 [1, 2, 4, 8, 16]
f(6) = 12 [1, 2, 3, 4, 6, 12]
...
```
The function... |
[Question]
[
In this challenge, you will write a bot that play's the prisoner's dilemma. Here's the catch: you will not have access to the history of previous games. Instead, you will have access to the opponent itself. In this version, both players get +2 points if they both cooperate, +1 points if they both defec... |
[Question]
[
When using a tool such as git to merge two files, a conflict could be detected and added to the result of the merge.
A merge of these two files:
my file:
```
Common line of code 1
Common line of code 2
my lines
Common line of code 3
Common line of code 4
```
their file:
```
Common line of code 1
Common... |
[Question]
[
Your task is to determine if a given string is of proper length and can be represented with Scrabble tiles and, if so, output the sum of each letter's score.
If you don't know how to play Scrabble:, you have 100 tiles with various letters A–Z printed on them, as well as two wildcards that can represent... |
[Question]
[
*Alternatively, guess who's doing a course on operating systems*
Round Robin scheduling is a way to schedule ready processes in an operating system. Each process in the queue is run for a certain amount of time (quantum), interrupted after that time (if not yet finished), and then added back to the rea... |
[Question]
[
Who doesn't love action movies with fast noisy cars, especially those with a lot of crashes? Who doesn't love action shots in ascii art?
# The scene is:
Two cars are starting at opposite sides of a straight road (with 60 spaces between). They start driving towards each other at constant speeds. The car... |
[Question]
[
Implement a simple digital [Stopwatch](https://en.wikipedia.org/wiki/Stopwatch),
which will display the time elapsed in seconds and minutes, as described below.
>
> **Important**
>
>
> Please read both *Display* and *Controls* sections !
>
>
>
**Display**
Time elapsed, should be displayed in the ... |
[Question]
[
## Substitute a string with itself
Your goal is to substitute a string with itself by replacing each character in the original string with the one before it, starting with the first character and wrapping around. Here are some examples to show what I mean:
1st example:
```
Input: program
Output: apgopr... |
[Question]
[
The [Dottie number](http://mathworld.wolfram.com/DottieNumber.html) is the fixed point of the cosine function, or the solution to the equation **cos(x)=x**.1
Your task will be to make code that approximates this constant. Your code should represent a function that takes an integer as input and outputs ... |
[Question]
[
Challenge: Implement [ROT-47](http://rot47.net/) in code that works as both itself and as the ROT-47 version of itself.
### Scoring:
Your score is calculated as a percentage of **used, ROT-47 eligible bytes in total of both versions of the program** divided by **total bytes (all characters) of both ver... |
[Question]
[
## Background
An **almost regular hexagon** is a hexagon where
* all of its internal angles are 120 degrees, and
* pairs of the opposite sides are parallel and have equal lengths (i.e. a [zonogon](https://en.wikipedia.org/wiki/Zonogon)).
The following is an example of an almost regular hexagon, with si... |
[Question]
[
Recently I posted [a](https://codegolf.stackexchange.com/questions/114578/find-diffy-games) question about Diffy games which has gone unanswered. Thats fine, the question is really hard, but I would like to make an easier question about Diffy games so that we can get the ball rolling.
---
# How Diffy w... |
[Question]
[
Sometimes to fall asleep, I'll count as high as I can, whilst skipping numbers that are not [square-free](https://en.wikipedia.org/wiki/Square-free_integer). I get a little thrill when I get to skip over several numbers in a row - for example, `48,49,50` are all NOT square-free (48 is divisible by 2^2,... |
[Question]
[
It is trivially possible to create a [bijective](https://en.wikipedia.org/wiki/Bijection) function from \$\mathbb{Z}\$ (the set of all integers) to \$\mathbb{Z}\$ (e.g. the identity function).
It is also possible to create a bijective function from \$\mathbb{Z}\$ to \$\mathbb{Z}^2\$ (the set of all pai... |
[Question]
[
Given a string `s` and an array/list `l`, determine whether or not `s` can be made with parts from `l`.
For example, if the string is `"Hello, world!"` and the list is `[' world!', 'Hello,']`, then the program/function should return a truthy value, because you can arrange the list to form the string. T... |
[Question]
[
## Task:
Your task is, when given three inputs:
* a numerator `n`
* a denominator `d`
* another integer, `x`
Create a program/function that finds the `x`th digit of the number after the decimal place.
## Specs:
* The range of `n` and `d` is between `1` and `2^31 - 1`, inclusive.
* The range of `x` is b... |
[Question]
[
My coworker, [Jimmy](https://blog.codinghorror.com/new-programming-jargon/) is kinda new to C/C++. He's also kind of a slow learner. Now, to be fair, his code always compiles, but he has some really sloppy habits. For example, everybody knows that you can define an array like this:
```
int spam[] = {4,... |
[Question]
[
# Challenge
## Premise
Bob is a novice pianist who can only play sequences of single notes. In addition, he does quite an interesting thing: for every note after the first, if it's higher than the previous note was, he uses the finger directly to the right of the previous finger used; if lower, to the ... |
[Question]
[
(Note: This is my first ever code golf question, but as far as I can tell, nobody else has done exactly this, so I should be good.)
Your task is to make a program or function that takes in a string `s` and an integer `n`, and returns or outputs that text wrapped into multiple lines. Each word must be w... |
[Question]
[
# Introduction
A bell tower will ring its bells every hour, `n` times, with `n` being the the current hour on a 12 hour clock.
For example, a bell will ring 5 times at 5pm, and 10 times at 10am.
# Task
Given two times in a suitable format, output the number of times the bell will ring, inclusive of the... |
[Question]
[
**Monday Mini-Golf:** A series of short [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") challenges, posted (hopefully!) every Monday.
Many web applications (especially social media) automatically truncate long passages of text so they fit within the app's formatting. In thi... |
[Question]
[
# Create a Sudoku solution CHECKER
There are oodles of Sudoku SOLVERS here, but I want you to create a solution CHECKER as small as humanly possible (code-golf).
* A valid entry will be able to either take a 9x9 array as an argument (passed by reference, serialized on the command line, or however you ... |
[Question]
[
[Chef Avillez](https://en.wikipedia.org/wiki/Jos%C3%A9_Avillez) is about to cook us some really nice meal. He is just waiting for us to give him some ingredients and to request a meal.
# Task
Given a list of ingredients (strings matching `/[a-z]+/`) and a requested meal (string matching `/[a-z][a-z ]*/... |
[Question]
[
A bit floats from the [LSB](https://en.wikipedia.org/wiki/Bit_numbering#Least_significant_bit) to the [MSB](https://en.wikipedia.org/wiki/Bit_numbering#Most_significant_bit) moving one position each time until it floats to the *top* of the container:
```
0000
0001
0010
0100
1000
```
Once one bit floats... |
[Question]
[
Given a string and the characters used to encode it, you need to compress the string by only using as many bits as each character needs. You will return the character codes for each character needed to create a compressed string.
For example, given the string `"the fox"` and the encoder characters `" a... |
[Question]
[
Frustration is a solitaire card game which is played by calling out the sequence:
“Ace”, “Two”, “Three”, ... , "Nine", "Ten", “Jack”, “Queen”, “King”, “Ace”, “Two”, etc.
With each call, you simultaneously flip over a card from a shuffled deck of 52 cards. You win the game if you get through the entire ... |
[Question]
[
Inspired by [this challenge](https://codegolf.stackexchange.com/q/188556/78849).
## Goal:
Given a pre-configured switchboard and a list of indexes, invert the switches at the given indexes.
A switchboard is made up of some number of switches (`v` or `^`) wrapped in `-`'s and arranged into rows of varyi... |
[Question]
[
# Input :
Two decimal integers `m` and `n` that respectively give the number of rows and columns of the table.
`m` and `n` are greater than or equal to 1.
# Output :
A table in HTML that has m rows and n columns.
The table should be displayable by a modern browser of your choice. Most browsers will dis... |
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.