Tag algorithmic snippets
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: arithmeticProgression
|
||||
tags: math,beginner
|
||||
tags: math,algorithm,beginner
|
||||
---
|
||||
|
||||
Creates an array of numbers in the arithmetic progression, starting with the given positive integer and up to the specified limit.
|
||||
@ -8,7 +8,7 @@ Creates an array of numbers in the arithmetic progression, starting with the giv
|
||||
- Use `Array.from()` to create an array of the desired length, `lim/n`, and a map function to fill it with the desired values in the given range.
|
||||
|
||||
```js
|
||||
const arithmeticProgression = (n, lim) =>
|
||||
const arithmeticProgression = (n, lim) =>
|
||||
Array.from({ length: Math.ceil(lim / n) }, (_, i) => (i + 1) * n );
|
||||
```
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: binomialCoefficient
|
||||
tags: math,beginner
|
||||
tags: math,algorithm,beginner
|
||||
---
|
||||
|
||||
Calculates the number of ways to choose `k` items from `n` items without repetition and without order.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: distance
|
||||
tags: math,beginner
|
||||
tags: math,algorithm,beginner
|
||||
---
|
||||
|
||||
Calculates the distance between two points.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: factorial
|
||||
tags: math,recursion,beginner
|
||||
tags: math,algorithm,recursion,beginner
|
||||
---
|
||||
|
||||
Calculates the factorial of a number.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: fibonacci
|
||||
tags: math,intermediate
|
||||
tags: math,algorithm,intermediate
|
||||
---
|
||||
|
||||
Generates an array, containing the Fibonacci sequence, up until the nth term.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: gcd
|
||||
tags: math,recursion,beginner
|
||||
tags: math,algorithm,recursion,beginner
|
||||
---
|
||||
|
||||
Calculates the greatest common divisor between two or more numbers/arrays.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: geometricProgression
|
||||
tags: math,intermediate
|
||||
tags: math,algorithm,intermediate
|
||||
---
|
||||
|
||||
Initializes an array containing the numbers in the specified range where `start` and `end` are inclusive and the ratio between two terms is `step`.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: hammingDistance
|
||||
tags: math,intermediate
|
||||
tags: math,algorithm,intermediate
|
||||
---
|
||||
|
||||
Calculates the Hamming distance between two values.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: isPrime
|
||||
tags: math,beginner
|
||||
tags: math,algorithm,beginner
|
||||
---
|
||||
|
||||
Checks if the provided integer is a prime number.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: lcm
|
||||
tags: math,recursion,intermediate
|
||||
tags: math,algorithm,recursion,intermediate
|
||||
---
|
||||
|
||||
Calculates the least common multiple of two or more numbers.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: luhnCheck
|
||||
tags: math,advanced
|
||||
tags: math,algorithm,advanced
|
||||
---
|
||||
|
||||
Implementation of the [Luhn Algorithm](https://en.wikipedia.org/wiki/Luhn_algorithm) used to validate a variety of identification numbers, such as credit card numbers, IMEI numbers, National Provider Identifier numbers etc.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: permutations
|
||||
tags: array,recursion,advanced
|
||||
tags: array,algorithm,recursion,advanced
|
||||
---
|
||||
|
||||
Generates all permutations of an array's elements (contains duplicates).
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: powerset
|
||||
tags: math,beginner
|
||||
tags: math,algorithm,beginner
|
||||
---
|
||||
|
||||
Returns the powerset of a given array of numbers.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: primes
|
||||
tags: math,intermediate
|
||||
tags: math,algorithm,intermediate
|
||||
---
|
||||
|
||||
Generates primes up to a given number, using the Sieve of Eratosthenes.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
title: vectorDistance
|
||||
tags: math,beginner
|
||||
tags: math,algorithm,beginner
|
||||
---
|
||||
|
||||
Calculates the distance between two vectors.
|
||||
|
||||
Reference in New Issue
Block a user