Package Exports
- balance-points
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (balance-points) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
balance-points
Find the balance points of an array.
A balance point is where the left side of the index is equal to the right side of the index. This function returns an array of indices of balance points.
Install
npm install balance-points
bower install balance-points
Usage
cosnt balancepoints = require('balance-points');
console.log(balancePoints([3, -2, 0, 4, 6, -5])); // [3]
console.log(balancePoints([1, 0, 0, 1])); // [1, 2]
console.log(balancePoints([2, -1, 1, -1, 1])); // [0]
console.log(balancePoints([-4, -7, 6, 2, 9, -3])); // [4]
console.log(balancePoints([])); // []
Test
npm test
License
MIT