text stringlengths 180 608k |
|---|
[Question]
[
# Inspiration
There is a problem on the most recent AMC 12B test, the one held on November 16, 2022, which goes like this:
>
> (AMC 12B 2022, Question 17)
>
> How many \$4\times4\$ arrays whose entries are \$0\$s and \$1\$s are there such that the row sums (the sum of the entries in each row) are \... |
[Question]
[
Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details.
Related to [AoC2017 Day 16](https://adventofcode.com/2017/day/16). I'm using the wording from [my Puzzling SE puzzle based on the same AoC challenge](https://puzzli... |
[Question]
[
*From [Codidact](https://codegolf.codidact.com/posts/282075) with [permission](https://chat.stackexchange.com/transcript/message/58267570#58267570).*
## Description
APL [trains](https://aplwiki.com/wiki/Tacit_programming#Trains) are a series of functions, that get applied to an argument in this way:
`(... |
[Question]
[
a.k.a. You Can Output Anything With Labyrinth Or Hexagony™
## Challenge
In a recent [restricted-source](/questions/tagged/restricted-source "show questions tagged 'restricted-source'") [challenge](https://codegolf.stackexchange.com/q/223439/78410), I could print any character with only half of the allo... |
[Question]
[
# Interpret Volatile
[Volatile](https://esolangs.org/wiki/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... |
[Question]
[
# Background
A [Ruth-Aaron pair](http://mathworld.wolfram.com/Ruth-AaronPair.html) is a pair of consecutive positive integers `n` and `n+1` such that the sum of the prime factors (counting repeated prime factors) of each integer are equal. For example, `(714,715)` is a Ruth-Aaron pair, since `714=2*3*7... |
[Question]
[
You love lunch. However, you are on a diet and want to make sure you don't accidentally eat lunch twice in one day. So you need to make a program to help you make sure.
However, one complication is that you eat lunch on a very weird schedule. The time you eat lunch at is **MONTH:DAY PM** (you can use U... |
[Question]
[
The [Wilson score interval](https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval#Wilson_score_interval) is a confidence interval of the probability of success, based on the proportion of successes in a set of Bernoulli trials (a Bernoulli trial is a trial in which exactly two outcomes ... |
[Question]
[
Define a *prepend-append sequence* of length `n` to be a permutation of the numbers `1, 2, ..., n` that can be generated by the following procedure:
* Start with the number `1`.
* For each number from `2` to `n`, place this number to the beginning or end of the sequence (either *prepend* or *append* it... |
[Question]
[
This challenge is similar to [Can you Meta Quine?](https://codegolf.stackexchange.com/questions/5510/can-you-meta-quine)
A quine is a program that produces itself on STDOUT. This challenge is to produce a program A which when run produces a program B on STDOUT. Program B when run produces program A on ... |
[Question]
[
An ant starts on an edge of a [dodecahedron](https://en.wikipedia.org/wiki/Regular_dodecahedron), facing parallel to it. At each step, it walks forward to the next vertex and turns either left or right to continue onto one of the other two edges that meet there. A sequence of left/right choices that re... |
[Question]
[
Your input is a ragged list of positive integers and a positive integer. Your task is to find that positive integer and return it's index, or if the positive integer doesn't exist, indicate it's nonexistence.
How are indices in ragged lists defined? They are simply lists of indices that when used conse... |
[Question]
[
In this challenge, your past self comes back to help or hurt someone else!
The task is simple: write a **full program**, not a function, that prints the first code submission on this site submitted by the previous user, **in the language of *your* first answer**. (In the case that your first answer was... |
[Question]
[
Significantly harder version of [Spanning tree of a rectangular grid](https://codegolf.stackexchange.com/q/195408/78410).
## Background
A spanning tree ([Wikipedia](https://en.wikipedia.org/wiki/Spanning_tree)) of an undirected graph is a subgraph that is a tree which includes all of the vertices of th... |
[Question]
[
A [*nondeterministic finite automaton*](https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton) is a finite state machine where a tuple \$(state,symbol)\$ is mapped to multiple states. Ie. we replace the usual \$\delta : Q \times \Sigma \to Q\ \$ transition function of a [DFA](https://en.wikip... |
[Question]
[
Given a *triangulation* of the surface of a polyhedron `p`, calculate its Euler-Poincaré-Characteristic `χ(p) = V-E+F`, where `V` is the number of vertices, `E` the number of edges and `F` the number of faces.
### Details
The vertices are enumerated as `1,2,...,V`. The triangulation is given as a list,... |
[Question]
[
The famous Fibonacci sequence is `F(0) = 0; F(1) = 1; F(N+1) = F(N) + F(N-1)` (for this challenge we are beginning with 0).
Your challenge: Given *n*, output the sum of all the *d*th Fibonacci numbers for all divisors *d* of the *n*th Fibonacci number. If you prefer more formal notation,
 outputs. (I.e. for every pair of programs their should be some input which generates different (but valid) sets of output numbers.)
## The task
*... |
[Question]
[
**Edit: Allowed to reuse whitespaces.**
Your task is to write *n* programs (or functions, or bodies of functions without using parameters or the function names) in the same language. The *k*th program should output the [(cardinal) number *k* in standard English](http://en.wikipedia.org/wiki/English_nu... |
[Question]
[
Write a program that outputs the contents of the first HTML `<code>...</code>` block of the answer to this question that is just above yours when the answers are sorted by votes. Output `Top!` if you are the top answer.
Ignore answers that have negative votes or no `<code>...</code>` tags. The source o... |
[Question]
[
Write the shortest function to convert an integer into a numeric representation given a radix between 2 and 62. e.g.:
```
to_string(351837066319, 31) => "codegolf"
```
[Answer]
## dc - 43 chars
```
[sb[58-]s_[lb~dZ39*+dB3<_9+rd0<xrP]dsxxk]sf
```
We can shorten this a little if we assume the stack ... |
[Question]
[
The following data contains the (approximate) population of each UTC timezone in the world ([source](https://observablehq.com/@mattdzugan/population-by-time-zone-creating-a-dataset)):
```
UTC;Population (in thousands)
-11;57
-10;1853
-9.5;8
-9;639
-8;66121
-7;41542
-6;272974
-5;332101
-4.5;31923
-4;777... |
[Question]
[
Given a positive integer `N`, output this doubling pattern of slash squares/rectangles.
For `N=1`, the base is:
```
/\
\/
```
The next square is added in the bottom right direction for `N=2`:
```
/\
\/\
\/
```
After that, a 2x1 rectangle is added in the bottom left direction for `N=3`:
```
/\
/\/\
\ ... |
[Question]
[
Your challenge is to write a function/program that takes a matrix of integers m and a number n as input and:
* Splits m into n by n chunks
* Replaces each chunk with the most common value in that chunk (In case of a tie, any of the tied values is fine).
* Outputs the resulting matrix.
Note: You can tak... |
[Question]
[
**Find the runs inside an array**
A run is defined as three or more numbers that increment from the previous with a constant step. For example `[1,2,3]` would be a run with step 1, `[1,3,5,7]` would be a run with step 2, and `[1,2,4,5]` is not a run.
We can express these runs by the notation `i to j by... |
[Question]
[
## Challenge
Given an integer, n, as input where `0 <= n <= 2^10`, output the nth even perfect number.
## Perfect Numbers
A perfect number is a number, x where the sum of its factors (excluding itself) equals x. For example, 6:
```
6: 1, 2, 3, 6
```
And, of course, `1 + 2 + 3 = 6`, so 6 is perfect.
If ... |
[Question]
[
## Background
A **[linear recurrence relation](https://en.wikipedia.org/wiki/Linear_difference_equation)** is a description of a sequence, defined as one or more initial terms and a linear formula on last \$k\$ terms to calculate the next term. (For the sake of simplicity, we only consider *homogeneous... |
[Question]
[
If we assign each letter a respective integer, starting from 1, then a is 1, b is 2, c is 3, and so on. After z, the letters loop back around, but with a in front (aa, ab, ac). It then goes to ba, bb, bc... After this is completed, as you may have figured, another letter is added (aaa, aab, aac). "Prim... |
[Question]
[
Your task is to decipher a non-empty string consisting of printable ASCII characters in the range **[32..126]**.
Reading the string character per character:
* each time you encounter a letter in lowercase, associate it with the next letter in uppercase, starting with **'A'**
* each time you encounter a... |
[Question]
[
This is the Cop post. The [Robber post is here](https://codegolf.stackexchange.com/q/146927/31516).
---
Your task is to take an integer input **N** and output the **Nth** digit in the sequence [OEIS A002942](http://oeis.org/A002942).
The sequence consists of the square numbers written backwards:
```
1,... |
[Question]
[
Consider a connected undirected graph. A [matching set of edges](https://en.wikipedia.org/wiki/Matching_(graph_theory)) on this graph is defined as a set of edges such that no two edges in the set share a common vertex. For example, the left figure denotes a matching set in green, while the right figur... |
[Question]
[
From what I've seen throughout my time here on PPCG, most JavaScript entries involving fat arrow functions tend to be one of two camps:
1. The simple ones that are capable of running as a single statement and returning an answer, straight off the bat, like `x=(a,b)=>a*a+b`
2. The more complex ones that... |
[Question]
[
Write a program that is capable of randomly generating itself.
It must do this based on the *tokens* used in its source code. If your program's source code is composed of 50 unique tokens and is 60 tokens long, then the program should output 60 tokens where each token is randomly chosen from one of the... |
[Question]
[
A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1.
So the sequence [4,1,2,4] has absolute differences [3,1,2] which is equivalent to the set [1,2,3] (1 to n-1 where n is the length of original ... |
[Question]
[
According to [MDN](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers), every WebSocket message is sent as one or more *frames*. Your job is to extract the payload given a (masked) client-to-server text frame. The steps to extract the payload is as follows:
* igno... |
[Question]
[
## Challenge
Your goal is to write a function that puts quotes around a sequence of capital letters in a string.
## So some examples (everything on the left (before function) and right (after function) are STRINGS):
`Hello the name's John Cena` -> `"H"ello the name's "J"ohn "C"ena`
`I got BIG OLD truck... |
[Question]
[
A [permutation](https://en.wikipedia.org/wiki/Permutation) of a set \$S = \{s\_1, s\_2, \dotsc, s\_n\}\$ is a [bijective](https://en.wikipedia.org/wiki/Bijection) function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a permutation:
$$
... |
[Question]
[
Write a program or function that draws an ASCII star, given the size of the arms as input.
Here's a star of size `1`
```
_/\_
\ /
|/\|
```
Here's a star of size `2`
```
/\
__/ \__
\ /
\ /
| /\ |
|/ \|
```
Here's a star of size `3`
```
/\
/ \
___/ \___
\ /
\ ... |
[Question]
[
The task is as follows: Given a positive integer `x` and a prime `n > x`, output the smallest positive integer `y` such that `(y * y) mod n = x`. An important part of this question is the time limit specified below which excludes brute force solutions.
If there is no such value `y` then your code shoul... |
[Question]
[
# Background
Ramanujan's number, \$1729\$, is called a [taxi-cab number](https://simple.wikipedia.org/wiki/Taxicab_number) due to the (possibly apocryphal) tale of Hardy boarding a cab to visit Ramanujan in hospital having this number, which seemed bland to him.
It's since known as the most famous of a... |
[Question]
[
Yup, you read the title right. play the sound of pi.
More specifically, for every digit of pi in the first 1000, map it to a musical note and output the resulting melody to a file.
Basically, each digit turns to a note on the C Major scale (basically the normal scale). so 1 turns to Middle C, 2 turns t... |
[Question]
[
Write program, which verifies [Erdős–Straus conjecture](http://en.wikipedia.org/wiki/Erd%C5%91s%E2%80%93Straus_conjecture).
Program should take as input one integer`n` (`3 <= n <= 1 000 000`) and print triple of integers satisfying identity `4/n = 1/x + 1/y + 1/z`, `0 < x < y < z`.
Shortest code wins... |
[Question]
[
The task is simple: write a program that branches differently in x86 (32-bit) and x86-64 (64-bit) using only printable visible ASCII characters 0x21...0x7e (space and del are not allowed) in the machine code.
* Conditional assembly is not allowed.
* Using API calls in not allowed.
* Using kernel-mode (... |
[Question]
[
As one of the less popular languages, it's difficult to find literature on the avant garde of postscript hackery. So what discoveries have the golfers here made to exploit the stack model (or other features) to overcome Postscript's inherent verbosity?
[Answer]
When generating graphical output and... |
[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/7346/edit).
Closed 7 years ago.
[Improve this question](/po... |
[Question]
[
After having implemented [QuickSort in BrainF\*\*\*](https://codegolf.stackexchange.com/questions/2445/implement-quicksort-in-brainf), I realized it probably wasn't that quick. Operations that are O(1) in normal languages (like array indexing) are significantly longer in BF. Most of the rules for what ... |
[Question]
[
A [basis](https://en.wikipedia.org/wiki/Basis_(linear_algebra)) of a vector space \$V\$ is a set of vectors \$B\$ such that every vector \$\vec v \in V\$ can be uniquely written as a linear combination of the vectors in \$B\$. In other words, let \$B = \{\vec b\_1, \dots, \vec b\_n\}\$ be a basis of so... |
[Question]
[
## Background
**K** functions have a feature called **projection**, which is essentially partial application of values to a function. The syntax for projections is a natural extension of the regular function call syntax:
```
f[1;2;3] / call a ternary function f with three arguments 1, 2, 3
f[1;2;] ... |
[Question]
[
*Inspired by [this Stack Overflow question](https://stackoverflow.com/q/52657041/2586922)*.
## The challenge
### Input
An array of square matrices containing non-negative integers.
### Output
A square matrix built from the input matrices as follows.
Let \$N \times N\$ be the size of each input matrix, ... |
[Question]
[
*[Geobitsian language](https://chat.stackexchange.com/transcript/message/30147329#30147329)* is a new perversion of English where a word is broken into segments that each must start with a different letter. Then every time one of those starting letters appears in another string, it is replaced with its... |
[Question]
[
## Introduction
The two most common trigonometric functions, `sine` and `cosine` (or `sin` and `cos` for short), can be extended to be matrix-valued functions. One way to compute the matrix-valued analogs is as follows:
Consider these two important trigonometric identities:
$$
e^{i x} = \cos(x) + i \si... |
[Question]
[
# Input description
A string (for best results, all characters should be printable and be the same width).
# Output description
A character star following the pattern:
```
0 0 0
1 1 1
222
0123210
222
1 1 1
0 0 0
```
where `0`, `1` ... are subsequent characters of the string. The output ... |
[Question]
[
Implement a function `divide(int a, int b, int c)` that prints the base 10 value of `a/b`. without using any floating point math nor `BigInteger`/`BigDecimal` or equivalent libraries whatsoever. At least `c` accurate characters within the set of `0123456789.` must be printed, except for the (possible) ... |
[Question]
[
Your task – should you choose to accept it – is to build a program that parses and evaluates a string (from left to right and of arbitrary length) of tokens that give directions – either left or right. Here are the four possible tokens and their meanings:
```
> go right one single step
< go left one ... |
[Question]
[
Your function or program should take a year as input and return (or print) the date (in the Gregorian calendar) of that years Easter (not the Eastern Orthodox Easter). The date returned should be formatted according to ISO 8601, but with support for years greater than 9999 (such as *312013-04-05* or *2... |
[Question]
[
**Closed**. This question is [opinion-based](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it can be answered with facts and citations by [editing this post](/posts/197/edit).
Closed 6 years ago.
[Improve this question]... |
[Question]
[
What is the **shortest sequence** of moves that, from the solved state of the cube, creates a pattern that meets the following criteria:
* 6 colors on each face
* at most 2 facelets of the same color
* no adjacent facelets of the same color
EDIT: I made up the name of the pattern. I asked [this questio... |
[Question]
[
# Barbrack
Your task is to write a program or function that takes a non-negative integer (in decimal or any other convenient base for your language), and output a number in the numbering system **Barbrack**.
## What's that?
Barbrack is a numbering system I made up that can represent non-negative intege... |
[Question]
[
## Background
Adám and I were once discussing [a way to properly extend some features in Dyalog APL](https://chat.stackexchange.com/transcript/message/54813110#54813110). I came up with the following extension to Take, a function that takes some front or back elements (and an analogous extension to Dro... |
[Question]
[
Shorter version of [Skyscrapers Challenge](https://www.conceptispuzzles.com/index.aspx?uri=puzzle/skyscrapers/techniques)
### Task
Given an array of building heights and a positive integer `k`, find all the permutations(without duplicates) of the heights such that exactly `k` buildings are visible.
Any... |
[Question]
[
Consider this spiral
```
###########
#
# #######
# # #
# # ### #
# # # # #
# # # # #
# # # #
# ##### #
# #
#########
```
Starting in the centre:
* The first line (upwards) has 3 characters.
* The second line has the same number of characters (3)
* Next, we add two chars (5) for the next two... |
[Question]
[
Given a string `l`, find all palindromic substrings `p` of `l` (including duplicates and single character strings). Next, rearrange all sub-strings in `p` into a valid palindrome (there may be multiple correct answers). If it is not possible to rearrange `p` into a single palindrome, your program may h... |
[Question]
[
Who doesn't absolutely love permutations, right? I know, they are amazing––so much fun!
Well, why not take this fun and make it *funner*?
Here's the challenge:
Given an input in the exact form: `nPr`, where `n` is the pool taken from and `r` is the number of selections from that pool (and `n` and `r` a... |
[Question]
[
The Great Pyramid of Giza, the largest pyramid in Egypt, is not only the oldest of the Seven Wonders of the Ancient World, but it is also the **only** one to remain largely intact. The Egyptian Pyramids can take up to 20 years to build and are so big that Al-Aziz Uthman, son of the great Saladin who cr... |
[Question]
[
*This is not a duplicate of [this challenge](https://codegolf.stackexchange.com/q/71476/9288).*
Here by an *array*, I mean a nested list that is "not ragged", i.e., it is either a list of elements, or a list of arrays of the same shape. For example, this is an array of shape `(2,3)`:
```
[[1, 2, 3], [4... |
[Question]
[
There are 31 positive integers that cannot be expressed as the sum of 1 or more distinct positive squares:
```
2, 3, 6, 7, 8, 11, 12, 15, 18, 19, 22, 23, 24, 27, 28, 31, 32, 33, 43, 44, 47, 48, 60, 67, 72, 76, 92, 96, 108, 112, 128
```
There are 2788 positive integers that cannot be expressed as the su... |
[Question]
[
# Background
[Wuxings](https://en.wikipedia.org/wiki/Wuxing_(Chinese_philosophy))(五行) are the five "elements" in Chinese philosophy. They are **Fire**(火), **Water**(水), **Wood**(木), **Metal**(金), and **Soil**(土). You can find them on East Asian calendar, where some days (Tuesday through Saturday) are n... |
[Question]
[
# Introduction
Logic gates! Everyone knows them, everyone loves them (unless you're starting to learn them). Take two booleans, compare them, get a single boolean in return. `AND`, `NAND`, `OR`, `NOR`, `XOR`, `XNOR`. Fun! But, what if you only had the inputs and output, but *not* the operator?
[![Logic... |
[Question]
[
We have a challenge [to output your own score](https://codegolf.stackexchange.com/questions/160646/output-your-score), but it seems like all the answers there just hardcode the output and that's *boring*1. So lets have a new challenge. Your program must output its own length in bytes followed by the st... |
[Question]
[
# Challenge :
Check if the given number forms a `number staircase` or not
---
# Input :
A integer (greater than 0 and not decimal). NOTE : You can take input as string , array of digits.
---
# Output :
a truthy / falsy value depending on whether the number forms a staircase or not
---
# Number staircas... |
[Question]
[
So, here's a map of, let's say, a dungeon...
```
##########
# #####
# #####
##########
##########
##########
##########
#### ##
#### ##
##########
```
Let's say that the hero is in Room A (at the top left) and their goal (a prince in distress?) is in Room B (to the bottom right). Our map do... |
[Question]
[
## Self-limiting lists
Consider a nonempty list **L** containing nonnegative integers.
A *run* in **L** is a contiguous sublist of equal elements, which cannot be made longer.
For example, the runs of **[0,0,1,1,3,3,3,2,1,1]** are **[0,0], [1,1], [3,3,3], [2], [1,1]**.
The list **L** is *self-limiting*... |
[Question]
[
# Challenge
Given a string describing a cutting rule and another string, cut parts out of the second string using the rule described by the first string.
Both strings will consist of letters `a-z` or `A-Z`, whichever one you choose (they don't have to be represented the same way). The way the second st... |
[Question]
[
Given two lists of dice rolls for a battle in Risk, your program or function must output how many troops each player loses.
## Background
You do not have to read this, for it is merely background. Skip to "Task" subheading to continue unabated.
In the game of [Risk](https://en.wikipedia.org/wiki/Risk... |
[Question]
[
Given an input number `n` from `1` to `26` (or `0` to `25`), output the alphabet reading left-to-right up to and including that corresponding letter, with `a=1, b=2, c=3, ...`. The twist is the letters must also be repeated vertically corresponding to their position in the alphabet. Odd numbers (when `... |
[Question]
[
### Introduction
A [pentagonal number](https://en.wikipedia.org/wiki/Pentagonal_number) ([A000326](https://oeis.org/A000326)) is generated by the formula **Pn= 0.5×(3n2-n)**. Or you can just count the amount of dots used:
[](https://i.... |
[Question]
[
# 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](https://en.wikipedia.org/wiki/Church_encoding#Church_numerals) are representations of natural numbers contructed from the... |
[Question]
[
# Introduction
Recently, me and a couple of my friends decided to play some cards, and one of them suggested the game 'Irish Snap', which was the inspiration for this challenge. However, I later learnt that the game has a lot of different rules that you can play with, some of which are listed [here](ht... |
[Question]
[
# Input
A single integer \$1 \leq x \leq 10^{15}\$.
# Output
The maximum number of distinct positive integers that have the product \$x\$.
# Examples
Input: 1099511627776. Output: 9. One possible optimal list of factors is: (1, 2, 4, 8, 16, 32, 64, 128, 4096).
Input: 127381. Output 4. One possible opti... |
[Question]
[
Your task is to fill the bucket with numbers upto a given input.
### Rules
Numbers occupy the leftmost position then rightmost, then leftmost and so on.
After overflow, the numbers start to gather around the bucket in a similar manner. They occupy position diagonally.
The examples should make it clear ... |
[Question]
[
# Task
Encode a string that entirely consists of uppercase alphabets (`A-Z`) using only zeros and ones, using your own favorite scheme. But the rule isn't that simple!
# Rules
1. Your program/function must correctly handle any valid input string of **length 8**.
2. The results must have the same length... |
[Question]
[
**Motivation**: Sometimes you need to know where you are in a string. You want to be able to look at any part of a string and know exactly where you are, as far as possible.
**Challenge**: write a program to output a **tape measure string** of a given length. A **tape measure string** self describes it... |
[Question]
[
# Introduction
Time is confusing. Sixty seconds to a minute, sixty minutes to an hour, twenty-four hours to a day (and not to mention that pesky am/pm!).
There's no room for such silliness nowadays, so we've decided to adopt the only sensible alternative: decimal days! That is to say, each day is consi... |
[Question]
[
For those with a little linear algebra background, the challenge is as simple as this: determine the [eigenvalues and eigenvectors](http://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors) of a given complex 2x2 matrix. You may skip ahead to The Challenge for I/O details, etc. For those who need a li... |
[Question]
[
# Directions
Write a program that, given an input integer *n* (`n >= 0`), outputs the **smallest positive integer** *m* where:
* `n = a[1]^b[1] + a[2]^b[2] + a[3]^b[3] + ... + a[k]^b[k]`
* `a` and `b` are finite sequences of the same length
* all elements of `a` are less than `m`
* all elements of `b` ... |
[Question]
[
May be you know [the game of Set](http://www.setgame.com/set/daily_puzzle) (a wonderful game for kids btw) a card game with 81 cards, where each card has a figure on it with 4 different attributes (form , number, colour and fill). Each attribute has 3 different values:
```
form: wave, oval, diamond
col... |
[Question]
[
Traditionally when you compare two strings you use lexicographical comparison. That can be described by the recursive algorithm:
$$
f(x, y)=
\left\{\begin{array}[rr] \\
\mathrm{EQ} & \mathrm{if}\,\mid x\mid=0\,\mathrm{and}\,\mid y\mid=0 \\
\mathrm{GT} & \mathrm{if}\,\mid x\mid>0\,\mathrm{and}\,\mid y\m... |
[Question]
[
Part of [**Code Golf Advent Calendar 2022**](https://codegolf.meta.stackexchange.com/questions/25251/announcing-code-golf-advent-calendar-2022-event-challenge-sandbox) event. See the linked meta post for details.
---
On the flight to Hawaii for vacation, I'm playing with a deck of cards numbered from 1... |
[Question]
[
[Futoshiki](https://en.wikipedia.org/wiki/Futoshiki) is a logic puzzle where an \$n×n\$ Latin square must be completed based on given numbers and inequalities between adjacent cells. Each row and column must contain exactly one of each number from \$1\$ to \$n\$ while satisfying the inequalities.
 = cx^{c - 1}e^{-x^c}
\$
\$
g\_1(x) = 0.5e^{-x}
\$
\$
g\_2(x) = 5 e^{-10 x}
\$
We will have that \$c \geq 0.2\$. Your code should be correct for any value ... |
[Question]
[
In this challenge, you are given a number x. You have to find the minimum number of steps required to reach x from 1. At a particular point, you have two choices:
**1) Increment the number by 1**.
**2) Reverse the integer** (remove leading zeros after reversing)
```
Input: n=42
Output: 1>2>3>4>5>6>... |
[Question]
[
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 r... |
[Question]
[
## Input
A non-empty array of positive integers.
## Task
Convert each integer to either binary, octal, decimal or hexadecimal in such a way that each digit (**0** to **F**) is used at most once.
## Output
The list of bases that were used to solve the puzzle.
## Detailed example
The expected output for ... |
[Question]
[
In this challenge, you'll get four different but somewhat related tasks that must be solved in a specific manner. First, I'll explain the tasks, then follows an explanation of how you must solve it.
Your code should for all four tasks take two positive integers as input: `n,m`, where `n<m`. All tasks m... |
[Question]
[
## Introduction
The [Sierpinski Arrowhead Curve](https://en.wikipedia.org/wiki/Sierpi%C5%84ski_arrowhead_curve) is a curve that's limit is Sierpinski's Triangle.
It first starts like this:
```
_
/ \
```
Then, each line is replaced with a rotated version of the first one:
```
_
/ \
\ /
_/ \_
```
Ne... |
[Question]
[
Mayan pyramids were (and are) an important part of ancient architecture, that were generally used for religious purposes.
They were usually step pyramids, but the steps on each were too steep to climb. Priests would climb to the tops of them via alternative staircases to perform ceremonies. The pyramid... |
[Question]
[
# It's time... to count the votes!
Today there are local elections in my entire country. Here, the number of seats for each party is decided using the [D'Hondt method](http://en.wikipedia.org/wiki/D%27Hondt_method). Your goal is to implement a program or function that will decide how many seats each pa... |
[Question]
[
Given a unique, sorted list of integers, create a balanced binary-search tree represented as an array without using recursion.
For example:
```
func( [1,2,3,5,8,13,21] ) => [5,2,13,1,3,8,21]
```
Before we start, a hint: we can simplify this problem a ton so that we don't actually have to think about th... |
[Question]
[
Ptolemy's *Almagest* contains a [table of chords](https://en.wikipedia.org/wiki/Ptolemy%27s_table_of_chords) that effectively served as the world's only comprehensive trigonometric table for over a millennium. In modern form it looks like this:
\begin{array}{|l|rrr|rrr|}
\hline
{}\,\,\,\,\,\,\,\,\,\, \... |
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.