title: Given an Array A[1..n] as input,fill in a second Array B[1..n] such that B[i] = A[1] + ... + A[i]
body: <p>The running time should be O(n), this is what I came up with, is it correct? THANKS</p>
  
  <pre><code>for (i = 1 ; i &lt; A[n]; i++)
    A[i] = 0
  
  B[i] = 0;
  for i in A[1..n]
    B[i] = B[i] + A[i]
  </code></pre>