mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 08:16:50 +08:00
changes made
This commit is contained in:
@ -23,13 +23,4 @@ function kadaneAlgo (array) {
|
|||||||
return maxSum
|
return maxSum
|
||||||
// This function returns largest sum contiguous sum in a array
|
// This function returns largest sum contiguous sum in a array
|
||||||
}
|
}
|
||||||
function main () {
|
export { kadaneAlgo }
|
||||||
// input array
|
|
||||||
const myArray = [1, 2, 3, 4, -6]
|
|
||||||
// calling the function
|
|
||||||
const result = kadaneAlgo(myArray)
|
|
||||||
// result is the variable for storing the ourput of kadaneAlgo function
|
|
||||||
console.log(result)
|
|
||||||
}
|
|
||||||
main()
|
|
||||||
module.exports = { kadaneAlgo }
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
const fc = require('../kadaneAlgo')
|
import { kadaneAlgo } from '../KadaneAlgo'
|
||||||
test('test1', () => {
|
test('it is being checked that 15 is the answer to the corresponding array input', () => {
|
||||||
expect(fc.kadaneAlgo([1, 2, 3, 4, 5])).toBe(15)
|
expect(fc.kadaneAlgo([1, 2, 3, 4, 5])).toBe(15)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('test2', () => {
|
test('it is being checked that 5 is the answer to the corresponding array input', () => {
|
||||||
expect(fc.kadaneAlgo([-1, -2, -3, -4, 5])).toBe(5)
|
expect(fc.kadaneAlgo([-1, -2, -3, -4, 5])).toBe(5)
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user