All Questions

Filter by
Sorted by
Tagged with
12 votes
9 answers
272 views

Wait, ASCII was 128 characters all along?

Challenge In this challenge, you have to take a nonnegative integer as input, convert it into base-128 bytes (0 → 0x00, 127 → ...
squareroot12621's user avatar
-5 votes
0 answers
55 views

Choosing the best approach for developing a system for buyers to sell to multiple sellers on your market place [closed]

I have been messing around with the PayPal API v2, and I have asked a Question with no reply of what to do next once the seller onboards. So then I looked at Braintree and started to get used to that ...
redoc01's user avatar
  • 91
20 votes
15 answers
2k views

Sorting with a deque

You're given an array of positive integers. Your job is to sort them using an initially empty deque (double-ended queue) by the following procedure: Take a number from the front of the array, and ...
Bubbler's user avatar
  • 77.5k
-4 votes
1 answer
70 views

Calling functions and addressing arrays without operators [closed]

Is there a language where they write just ai for a[i] and sqrt2 for sqrt(2). I mean that arrays are treated like functions and calling a function does not need an operator.
Марат Рамазанов's user avatar
6 votes
39 answers
1k views

Calculate sum of self-exponentation

Given an array of positive integers, calculate the sum of each number raised to its own power. For example, given 4,6,7, the code needs to return \$4^4+6^6+7^7=...
Andy Liu's user avatar
14 votes
9 answers
928 views

Draw a Regular Reuleaux Polygon

Related: Draw A Reuleaux Triangle!, Draw a regular polygon A Reuleaux polygon is a curve of constant width made up of circular arcs of constant radius. The most well-known Reuleaux polygon is the ...
noodle person's user avatar
16 votes
15 answers
2k views

o y u (or and or)

In Spanish, the word 'or' is represented as 'o', with the exception of cases where the following letter starts with 'o' or 'ho' (including accented forms like 'ó' or 'hó'). Numbers also follow this ...
Fmbalbuena's user avatar
  • 4,167
17 votes
9 answers
2k views

A Ring of Cubes

Given an integer greater than or equal to 2, output ASCII-art resembling an isometric-perspective cube ring with that side length. Expected outputs given below for 2, 3. You can imagine the rest. You ...
noodle person's user avatar
2 votes
2 answers
466 views

Largest possible relative error

Output \$20\$ float64s with absolute value between 1 and 2 inclusive whose sum has the largest possible relative error. We can assume the true sum is not zero. The sum is to be computed from left to ...
Simd's user avatar
  • 3,088
9 votes
12 answers
3k views

Keyboard Ping Pong

Keyboard Ping Pong (This question was inspired by this post.) Challenge Given a string of letters, determine if the word "ping-pongs" across the keyboard. (Letters alternating between sides ...
SanguineL's user avatar
  • 728
9 votes
13 answers
1k views

Is it an option for the ls utility specified in POSIX.1-2017?

The ls utility lists specified directory content. It is infamous for stupidly lots of options which is known for anti-pattern design of implementing software.(...
鳴神裁四点一号's user avatar
11 votes
15 answers
2k views

Is this a Hadamard matrix?

Hadamard matrices is a square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal. In other words, it means that each pair of rows has matching entries in exactly half of ...
Fmbalbuena's user avatar
  • 4,167
14 votes
19 answers
879 views

Rolling median of all K-length ranges

Given an array of integers of length N and an odd integer K, return N - K + 1 integers, where the ith integer represents the median of a K-length subarray starting from i. You may write a full program ...
Redz's user avatar
  • 291
3 votes
1 answer
117 views

Detect revokes in Jass

Jass is a trick-taking game for four players and the national card game of Switzerland. It is played with a 36-card deck, four suits each with ranks 6, 7, 8, 9, 10, J, Q, K, A. We will be using French ...
Parcly Taxel's user avatar
  • 3,845
3 votes
2 answers
173 views

Non-Decreasing Fibonacci Sequence modulo M

Given integers \$a,b,m, k, n\$ and array \$F = (f_1, f_2,...,f_n)\$ defined as: \begin{cases} f_1 = \text{a}\\ f_2 = \text{b}\\ f_i = (f_{i-1} + f_{i-2}) \text{ mod m},∀i > 2 \end{cases} When \$F\$ ...
TruongVi's user avatar
  • 123
12 votes
0 answers
219 views

Plot the ground path of a satellite

If you model a satellite as a free point orbiting a body, you can pretty easily see it has 6 degrees of freedom: three for the X, Y, and Z position, and three for the X, Y, and Z velocity. However, ...
guest4308's user avatar
  • 1,043
9 votes
12 answers
683 views

Minimum number of select-all/copy/paste steps for a string containing n copies of the original

This challenge is based on this Mathematics answer. Write the shortest program or function that, when given some natural number \$n\$, outputs \$S(n)\$, which is the minimum number of steps for ...
bigyihsuan's user avatar
  • 10.1k
26 votes
39 answers
2k views

Segments of a string, doubling in length

Simple task today. Given a string whose length is one less than a whole power of 2, divide it into segments with doubling length. For example for the string ...
noodle person's user avatar
9 votes
8 answers
1k views

Sort Number Array

Given array \$A\$ \$(a_0, a_1,... , a_n) \$ as a permutation of \$(0, 1,...,n)\$ where \$n ≥ 2\$. Sort array \$A\$ into array \$(0, 1,...,n\$) with \$2\$ caveats: \$1\$ swap is counted when swapping ...
TruongVi's user avatar
  • 123
7 votes
7 answers
809 views

Parity of a number with missing digits

It turns out that you need every digit of a number to determine its parity, if it is written in an odd base. Your programs should take input as a number between 2 and 36 inclusive, and a nonempty ...
3-1-4-One-Five's user avatar
22 votes
6 answers
1k views

Output the Steiner system S(5,8,24)

Output 759 "rows", each of which consists of 8 distinct integers in the range 0,1,...,23, with the property that every set of 5 integers in the range 0,1,...,23 is contained in exactly one ...
aeh5040's user avatar
  • 761
23 votes
11 answers
2k views

Binary Slashes Display

(easy mode of Seven Slash Display) Given a positive integer (or alternatively, a string/list of bits of its binary representation) output it with this diagonal ASCII-art formation: (output for 53 / <...
noodle person's user avatar
16 votes
15 answers
2k views

Transpose these notes!

In this challenge, you should take input as a number between 0 and 11 inclusive and a (possibly empty) list of the following strings/notes: ...
3-1-4-One-Five's user avatar
13 votes
13 answers
4k views

NaN is not equal to NaN

In many programming languages, the floating-point value NaN, or "not a number", in some programming languages generated by the expression ...
3-1-4-One-Five's user avatar
16 votes
3 answers
2k views

Find 10 float64s that give the least accurate sum

Input Integer \$n > 1\$ Output Ten 64 bit floating point numbers between \$-n\$ and \$n\$, inclusive, whose sum is the least accurate. Details and examples. These examples are not claimed to be ...
Simd's user avatar
  • 3,088
1 vote
2 answers
237 views

Write a function that takes an input string and encodes it using a modified Fibonacci sequence in reverse [closed]

Given an input string, first convert each character to its ASCII value. Generate a reversed Fibonacci sequence of the same length as the input string. Encode each character by adding its ASCII value ...
Dhanush's user avatar
  • 21
11 votes
5 answers
1k views

9-16-25 2D Matrix

Given three grids and the sum of rows and columns of each grid, your task is: Grid \$3×3\$: Fill the grid from \$1\$ to \$9\$, ensure no repeats within the grid. Grid \$4×4\$: Fill the grid from \$1\...
user avatar
14 votes
5 answers
366 views

Generate a subgroup of a free group

In group theory, the free group with \$n\$ generators can be obtained by taking \$n\$ distinct symbols (let's call them \$a, b, c ...\$ etc), along with their inverses \$ a^{-1},b^{-1},c^{-1} ...\$ . ...
emanresu A's user avatar
  • 39.1k
-1 votes
3 answers
463 views

Sum of Positive and Negative Powers of 2

Given a binary string equivalent to \$n\$, write out the least possible number of terms needed to express \$n\$. A term is defined as an addition of either \$2^k\$ or \$(-2^k)\$, where \$k\$ is a non-...
user avatar
16 votes
23 answers
2k views

Smallest Harmonic number greater than N

The sequence of Harmonic numbers are the sums of the reciprocals of the first k natural numbers (not including zero): \${\displaystyle H_{k}=1+{\frac {1}{2}}+{\frac {1}{3}}+\cdots +{\frac {1}{k}}=\sum ...
noodle person's user avatar
13 votes
9 answers
1k views

Sum of square roots (as an algebraic number)

An algebraic number is a number that is a root of a non-zero polynomial with integer coefficients. It is well-known that the sum of two algebraic numbers is algebraic. In particular, the sum of a list ...
alephalpha's user avatar
  • 48.7k
19 votes
22 answers
1k views

Find characters common among all strings

Find characters common among all strings You are given multiple Strings as an input. Your task is to find the characters that are present in every string, and ...
Mark's user avatar
  • 299
7 votes
7 answers
585 views

Build the first 6 letters of an Italian codice fiscale (tax identification number)

Given a single string with a person's name and surname, output the first 6 characters of their codice fiscale. Codice fiscale Codice fiscale is a 16-character long alphanumeric string that identifies (...
Nicola Sap's user avatar
  • 3,684
3 votes
7 answers
339 views

Find the most isolated point

Given two non-empty sets of points \$P,T = \{(x,y)\ |\ x,y \in \mathbb{Z} \}\$, find the point \$p \in P\$ such that it is the "most isolated" from all points in \$T\$. The "most ...
bigyihsuan's user avatar
  • 10.1k
5 votes
3 answers
294 views

Clicks for minesweeper [duplicate]

Given a mine map of minesweeper, output how many left clicks at least needed to win the game. Each left click reveals a cell, and if there's no mine in the 3x3 range, recursively reveal nearby 3x3 ...
l4m2's user avatar
  • 24.8k
20 votes
23 answers
1k views

Is this a valid PZN?

Is this a valid PZN? A Pharmazentralnummer, or PZN, is an eight-digit code which uniquely identifies medications, medical products, and similar items in the German healthcare system. Examples include ...
Ciaran_McCarthy's user avatar
10 votes
14 answers
723 views

Looping counter extended

The looping counter is a challenge that prints an infinite number of lines. The first line has one *, the next line has one more ...
None1's user avatar
  • 1,115
17 votes
18 answers
1k views

Output the inventory sequence

Goal Write a program that outputs this list: ...
12431234123412341234123's user avatar
5 votes
5 answers
300 views

Calculating Graph Powers

Calculating Graph Powers (very similar to my other question asked here) According to Wikipedia, "the \$k\$th power \$G^k\$ of an undirected graph \$G\$ is another graph that has the same set of ...
SanguineL's user avatar
  • 728
8 votes
13 answers
4k views

Cellular Automata Rule 30

What are cellular automata? Cellular automata describes a broad category of computational models that covers various cellular automations, some of the most intriguing of which involve 'simple' rules ...
stevec's user avatar
  • 197
20 votes
30 answers
2k views

Break a word into vowels and consonants

Objective Given an string \$n\$, output two strings, namely the string consisting of vowels "a", "e", "i", "o", and "u", and the string consisting of ...
Arunabh's user avatar
  • 311
14 votes
8 answers
1k views

Compare two strings, with NaC

I just thought of this idea: if we have NaN ("not a number") for floats, how about NaC ("not a character") for a single unknown character in a string? Your input should be two ...
3-1-4-One-Five's user avatar
9 votes
14 answers
811 views

Convert CSV tables to MediaWiki tables

Input a CSV table, like this: data00,data01,data02,...,data0m data10,data11,data12,...,data1m ... datan0,datan1,datan2,...,datanm The cells in the CSV table is ...
None1's user avatar
  • 1,115
15 votes
5 answers
1k views

Is this a solvable Numberlink?

Challenge Per Wikipedia: Numberlink is a type of logic puzzle involving finding paths to connect numbers in a grid. The player has to pair up all the matching numbers on the grid with single ...
badatgolf's user avatar
  • 1,477
8 votes
7 answers
681 views

Complex Exponentiation [closed]

As the title says! Raise one complex number to the power of another. (a+bi)^(c+di)(using the principal branch of the complex logarithm) Requires four inputs a, b, c, d. You can combine a, b, c, d into ...
ThePlaneGuy45's user avatar
21 votes
14 answers
3k views

Cold Bee and Old Beer

Introduction: Inspired by this silly meme video, which states 'COLD BEER', but is slightly too large for the scrolling advertisement board, causing it to display either 'COLD BEE' or 'OLD BEER' ...
Kevin Cruijssen's user avatar
6 votes
4 answers
1k views

Hoop, Hoop, Hoop, Hoop, Eye-Eye-Eye-Eye

The Horrible Histories song "Learn Your Hieroglyphics" mentions a fanmade number system. Numbers are written as a sum of 10's ("hoops") and 1's ("eyes"), for example 99 ...
3-1-4-One-Five's user avatar
14 votes
5 answers
1k views

Decode a Caesar ciphertext with high probability

Caesar ciphers A Caesar cipher with shift=N is the process of replacing any alphabetic character in a string with the letter which is N positions ahead in the alphabet (wrapping back at the beginning)....
Nicola Sap's user avatar
  • 3,684
13 votes
13 answers
2k views

Compute the degree of a string

The input is a string made of the letters a,b,c only. The output is an integer representing the degree of the sequence. The degree of a sequence is computed as follows: Assume that each of the ...
Erel Segal-Halevi's user avatar
-3 votes
4 answers
240 views

Integrate a function from -1 to 1 [closed]

Create a function or program that takes any continuous, well-defined, single-input function (f(x)=...) and returns an approximate integration from -1 to 1. (at ...
ThePlaneGuy45's user avatar

15 30 50 per page
1
2 3 4 5
283