title: sum values in a range of indices with O(1) complexity
body: <p>We are given a integer vector(<code>V[]</code>) and two index values, <code>A</code> and <code>B</code>. We need to sum all the integers between <code>V[A]</code> and <code>V[B]</code>.</p>
  
  <p>For example, </p>
  
  <pre><code>V[] == {0, 1, 2, 0, 4, 0, 3}, A == 2, B == 6
  Sum == V[3] + V[4] + V[5] == 4
  </code></pre>
  
  <p>Is it possible to solve with <code>O(1)</code> complexity?
  I thought about using memory address operations, but I'm still not sure how it would work(something like: sum the next <code>(B-A)</code> addresses values from <code>&amp;V[A]</code>)</p>