mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-12-19 06:58:15 +08:00
chore: update spelling mistakes (#1790)
* chore: update spelling mistakes * chore: add spellignore * chore: update sp mistakes
This commit is contained in:
@@ -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 }
|
||||
@@ -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)
|
||||
})
|
||||
})
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user