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

@@ -44,6 +44,6 @@ const findMaxPointIndex = (
}
}
const LocalMaximomPoint = (A) => findMaxPointIndex(A, 0, A.length - 1, A.length)
const LocalMaximumPoint = (A) => findMaxPointIndex(A, 0, A.length - 1, A.length)
export { LocalMaximomPoint }
export { LocalMaximumPoint }

View File

@@ -1,29 +1,29 @@
import { LocalMaximomPoint } from '../LocalMaximomPoint'
import { LocalMaximumPoint } from '../LocalMaximumPoint'
describe('LocalMaximumPoint tests', () => {
it('test boundary maximum points - last element', () => {
const Array = [1, 2, 3, 4, 5, 6, 12]
expect(LocalMaximomPoint(Array)).toEqual(6)
expect(LocalMaximumPoint(Array)).toEqual(6)
})
it('test boundary maximum points - first element', () => {
const Array2 = [13, 6, 5, 4, 3, 2, 1]
expect(LocalMaximomPoint(Array2)).toEqual(0)
expect(LocalMaximumPoint(Array2)).toEqual(0)
})
it('test boundary maximum points - should find first maximom point from the top', () => {
it('test boundary maximum points - should find first maximum point from the top', () => {
// Test a mix of number types (i.e., positive/negative, numbers with decimals, fractions)
const Array = [13, 2, 3, 4, 5, 6, 12]
expect(LocalMaximomPoint(Array)).toEqual(6)
expect(LocalMaximumPoint(Array)).toEqual(6)
})
it('test inner points - second element', () => {
const Array2 = [13, 16, 5, 4, 3, 2, 1]
expect(LocalMaximomPoint(Array2)).toEqual(1)
expect(LocalMaximumPoint(Array2)).toEqual(1)
})
it('test inner points - element some where in the middle', () => {
const Array2 = [13, 16, 5, 41, 3, 2, 1]
expect(LocalMaximomPoint(Array2)).toEqual(3)
expect(LocalMaximumPoint(Array2)).toEqual(3)
})
})

View File

@@ -1,6 +1,6 @@
import { NumberOfLocalMaximumPoints } from '../NumberOfLocalMaximumPoints'
describe('LocalMaximomPoint tests', () => {
describe('LocalMaximumPoint tests', () => {
it('test boundary maximum points - last element', () => {
const Array = [1, 2, 3, 4, 5, 6, 12]
expect(NumberOfLocalMaximumPoints(Array)).toEqual(1)

View File

@@ -64,7 +64,7 @@ class SegmentTree {
}
}
// interval [L,R) with left index(L) included and right (R) excluded.
// interval [L, R) with left index(L) included and right (R) excluded.
query(left, right) {
const { size, tree } = this
// cause R is excluded, increase right for convenient