Tag algorithmic snippets
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: arithmeticProgression
|
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.
|
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.
|
- 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
|
```js
|
||||||
const arithmeticProgression = (n, lim) =>
|
const arithmeticProgression = (n, lim) =>
|
||||||
Array.from({ length: Math.ceil(lim / n) }, (_, i) => (i + 1) * n );
|
Array.from({ length: Math.ceil(lim / n) }, (_, i) => (i + 1) * n );
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: binomialCoefficient
|
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.
|
Calculates the number of ways to choose `k` items from `n` items without repetition and without order.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: distance
|
title: distance
|
||||||
tags: math,beginner
|
tags: math,algorithm,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Calculates the distance between two points.
|
Calculates the distance between two points.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: factorial
|
title: factorial
|
||||||
tags: math,recursion,beginner
|
tags: math,algorithm,recursion,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Calculates the factorial of a number.
|
Calculates the factorial of a number.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: fibonacci
|
title: fibonacci
|
||||||
tags: math,intermediate
|
tags: math,algorithm,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Generates an array, containing the Fibonacci sequence, up until the nth term.
|
Generates an array, containing the Fibonacci sequence, up until the nth term.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: gcd
|
title: gcd
|
||||||
tags: math,recursion,beginner
|
tags: math,algorithm,recursion,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Calculates the greatest common divisor between two or more numbers/arrays.
|
Calculates the greatest common divisor between two or more numbers/arrays.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: geometricProgression
|
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`.
|
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
|
title: hammingDistance
|
||||||
tags: math,intermediate
|
tags: math,algorithm,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Calculates the Hamming distance between two values.
|
Calculates the Hamming distance between two values.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: isPrime
|
title: isPrime
|
||||||
tags: math,beginner
|
tags: math,algorithm,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Checks if the provided integer is a prime number.
|
Checks if the provided integer is a prime number.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: lcm
|
title: lcm
|
||||||
tags: math,recursion,intermediate
|
tags: math,algorithm,recursion,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Calculates the least common multiple of two or more numbers.
|
Calculates the least common multiple of two or more numbers.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: luhnCheck
|
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.
|
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
|
title: permutations
|
||||||
tags: array,recursion,advanced
|
tags: array,algorithm,recursion,advanced
|
||||||
---
|
---
|
||||||
|
|
||||||
Generates all permutations of an array's elements (contains duplicates).
|
Generates all permutations of an array's elements (contains duplicates).
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: powerset
|
title: powerset
|
||||||
tags: math,beginner
|
tags: math,algorithm,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Returns the powerset of a given array of numbers.
|
Returns the powerset of a given array of numbers.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: primes
|
title: primes
|
||||||
tags: math,intermediate
|
tags: math,algorithm,intermediate
|
||||||
---
|
---
|
||||||
|
|
||||||
Generates primes up to a given number, using the Sieve of Eratosthenes.
|
Generates primes up to a given number, using the Sieve of Eratosthenes.
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: vectorDistance
|
title: vectorDistance
|
||||||
tags: math,beginner
|
tags: math,algorithm,beginner
|
||||||
---
|
---
|
||||||
|
|
||||||
Calculates the distance between two vectors.
|
Calculates the distance between two vectors.
|
||||||
|
|||||||
Reference in New Issue
Block a user