chore: update spelling mistakes (#1790)

* chore: update spelling mistakes

* chore: add spellignore

* chore: update sp mistakes
This commit is contained in:
Ridge Kimani
2025-09-04 07:02:03 +03:00
committed by GitHub
parent 19ecb18f0a
commit 08d8c6b674
21 changed files with 29 additions and 27 deletions

View File

@@ -16,7 +16,7 @@ const abs = (num) => {
throw new TypeError('Argument is NaN - Not a Number')
}
return validNumber < 0 ? -validNumber : validNumber // if number is less than zero mean negative then it converted to positive. i.e -> n = -2 = -(-2) = 2
return validNumber < 0 ? -validNumber : validNumber // if number is less than zero means negative, then it converted to positive. i.e., n = -2 = -(-2) = 2
}
export { abs }

View File

@@ -1,4 +1,4 @@
// To calculate x^n i.e. exponent(x, n) in O(log n) time in iterative way
// To calculate x^n i.e., exponent(x, n) in O(log n) time in iterative way
// n is an integer and n >= 0
// Explanation: https://en.wikipedia.org/wiki/Exponentiation_by_squaring

View File

@@ -17,7 +17,7 @@ export const EulersTotient = (n) => {
while (n % i === 0) {
n = Math.floor(n / i)
}
// i is a prime diving n, multiply res by 1 - 1/i
// i is a prime dividing n, multiply res by 1 - 1/i
// res = res * (1 - 1/i) = res - (res / i)
res = res - Math.floor(res / i)
}

View File

@@ -13,7 +13,7 @@ const gcdOfTwoNumbers = (x, y) => {
// let gcd of x and y is gcdXY
// so it divides x and y completely
// so gcdXY should also divide y%x (y = gcdXY*a and x = gcdXY*b and y%x = y - x*k so y%x = gcdXY(a - b*k))
// and gcd(x,y) is equal to gcd(y%x , x)
// and gcd(x,y) is equal to gcd(y%x, x)
return x === 0 ? y : gcdOfTwoNumbers(y % x, x)
}

View File

@@ -17,7 +17,7 @@ const matrixCheck = (matrix) => {
}
}
// tests to see if the matrices have a like side, i.e. the row length on the first matrix matches the column length on the second matrix, or vice versa.
// tests to see if the matrices have a like side, i.e., the row length on the first matrix matches the column length on the second matrix, or vice versa.
const twoMatricesCheck = (first, second) => {
const [firstRowLength, secondRowLength, firstColLength, secondColLength] = [
first.length,

View File

@@ -11,7 +11,7 @@
class Polynomial {
constructor(array) {
this.coefficientArray = array // array of coefficients
this.polynomial = '' // in terms of x e.g. (2x) + (1)
this.polynomial = '' // in terms of x e.g., (2x) + (1)
this.construct()
}

View File

@@ -36,6 +36,6 @@ describe('Testing powFaster function', () => {
})
it('should return the result in O(lonN) complexity', () => {
expect(powFaster(2, 64)).toBe(18446744073709552000) // execution time Math.log2(64) -> 6
expect(powFaster(2, 64)).toBe(18446744073709552000) // execution time Math. log2(64) -> 6
})
})