0.0.3 • Published 3 years ago

max-sub-arr-sum v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

max-sub-arr-sum, khadan's algo

What is this?

It's basis on khadan's algorithm which provides us calculate maximum sub-array sum of an array in linear time O(n).

Installation

npm i max-sub-arr-sum --save

How to use?

....

const {maxSubArrSum} = require('max-sub-arr-sum');

let result = maxSubArrSum(-2, -3, 4, -1, -2, 1, 5, -3);

....

Note

If the given array is empty then it will return "undefined".

And every time array will be a numeric array. String or non-numeric elements are not allowed.