# All Questions

13,814 questions
Filter by
Sorted by
Tagged with
110 views

Input: Two space-seperated strings of one of these forms: A floating-point number, for example -1234.5678 (support of exponential notation is optional) ...
1 vote
263 views

2k views

### Longest Consecutive Sequence

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 ...
1 vote
176 views

### DP approach gives TLE [closed]

There is a question to basically find the largest sum in an array, such that no two elements are chosen adjacent to each other. The concept is to recursively calculate the sum, while considering and ...
2k views

### Simulate Round Robin Scheduling

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 ...
3k views

### What's my type? Well... Probably

There are a lot™ of pokemon. One of the defining characteristics of pokemon is their type, of which every1 pokemon has up to two types, a primary type and an optional secondary type. There are ...
258 views

### Pseudo-Quantum Bogosort [closed]

Pseudo-Quantum Bogosort Quantum Bogosort is as follows: Quantumly randomise the list, such that there is no way of knowing what order the list is in until it is observed. This will divide the ...
2k views

### Decimalize a Fraction

Preamble A common pain-point when working with rational numbers and decimals is how infrequently one can represent their rational number as a clean, non-repeating decimal. Let's solve this by writing ...
2k views

### Sum of consecutive nth powers

Related. Given a positive integer $n$, output all integers $b$ (such that $1<b<n-1$) where $n$ can be written as the sum of any number of consecutive powers of $b$. Example: Let's say \...
2k views

### Order by Earliest Lower Digit

Given two strings of digits, determine which string, if any, has the earliest digit which is lower than the other string's digit at the same index. Do note that this differs from alphabetization, as ...
4k views

### Add two really big numbers

Preamble We've already proven we're good at adding two numbers, but many solutions only operate on tiny numbers like 2³²-1, honestly we can do a lot better. The Challenge Given two unsigned, non-...
2k views

### Golf the fast growing hierarchy

The fast growing hierarchy is a way of categorizing how fast functions are growing, defined the following way (for finite indices): $f_0(n)=n+1$ $f_k(n)=f_{k-1}^n(n)$ with $f^n$ meaning ...
3k views

### Be big more often

Related You are a manager at a large number factory. You want to show everyone your business is doing well, by showing randomly chosen samples. Unfortunately, your business is not doing that well. But ...
520 views

### We already have pipes & pattern matching at home! [closed]

Inspired by this tweet where a user stated the following: it's insane how much code would be cleaned up if JS got pipes and pattern matching i often do this since it's the best way to make use of TS ...
1k views

### Inverse trigonometric functions

There are 3 (commonly used) trigonometric functions sin cos and tan each of these functions ...
479 views

### Pick a random string at a fixed edit distance

I have string $s$ of length $n$ and some constant integer $k$ which is at most $n$. Give the fastest algorithm to sample a random string with Levenshtein distance $k$ from $s$ uniformly. ...
554 views

### Prefix code generator

In this challenge, we consider an encoding from positive integers (up to a limit) to binary sequences. Some examples: ...
572 views

### Minimal number of jumps to reach a square

A Knight in chess moves two squares vertically and one square horizontally, or two squares horizontally and one square vertically (with both forming the shape of a capital L) Given a Knight current ...
974 views

### Spell date in Japanese

Objective Given a date, spell it out in Romanized Japanese. I/O Format The input format is flexible. The output format is <month spelling> <day spelling>...
1k views

### Convert a Gaussian integer to its positive form

We already have a challenge for computing the GCD of two Gaussian integers, but that challenge explicitly allows to choose any of the four possible values. Your task now is to bring the Gaussian ...
3k views

### Is it an Element?

𝖧ello all, I hope this finds you well. There are 118 elements on the Periodic table at the moment, each one corresponds to the number of protons in an atom's nuclei. Each element also has a 'symbol'. ...
1k views

### Compile TailwindCSS to CSS

TailwindCSS is a utility that lets one write CSS code using only HTML classes, which are then converted to CSS code with the Tailwind compiler. Ordinarily, one would write CSS in a separate file from ...
938 views

### Calculate the Distance to a Line Segment

The Challenge Given two vertexes and a point calculate the distance to the line segment defined by those points. This can be calculated with the following psudocode ...
The round function in Python 3 will round values of the form $k+\frac{1}{2}$ (with $k$ being an integer) to the nearest even integer, which is apparently better ...