public int sumQuery(int row1, int col1, int row2, int col2) {
        row1++;
        col1++;
        row2++;
        col2++;
        return T[row2][col2] - T[row1 - 1][col2] - T[row2][col1 - 1] + T[row1 - 1][col1 - 1];
    }
Date 03/11/2016
@author Tushar Roy

Given a 2D array find the sum in given range defining a rectangle.

Time complexity construction O(n*m)
Time complexity of query O(1)
Space complexity is O(n*m)

Reference
https://leetcode.com/problems/range-sum-query-2d-immutable/
src/com/interview/dynamic/Immutable2DSumRangeQuery.java