title: Calculate the sum of elements in a matrix efficiently
body: <p>In an interview I was asked if I was given an n*m matrix how to calculate the sum of the values in a given sub-matrix (defined by top-left, bottom-right coordinates).  </p>
  
  <p>I was told I could pre-process the matrix.</p>
  
  <p>I was told the matrix could be massive and so could the sub-matrix so the algo had to be efficient.  I stumbled a bit and wasn't told the best answer.</p>
  
  <p>Anyone have a good answer?</p>