Skip to content

Instantly share code, notes, and snippets.

@MichaelWalker-git
Created October 21, 2016 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelWalker-git/d7a75e32ac9af4c7cb3c9e2293206847 to your computer and use it in GitHub Desktop.
Save MichaelWalker-git/d7a75e32ac9af4c7cb3c9e2293206847 to your computer and use it in GitHub Desktop.
function prefixSums(A){
var leng = A.length;
p = [0] * (leng +1);
for(var i = 0; i< leng+1; i++){
P[i] = P[i-1] + A[i-1];
}
return P;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment