Question looks pointless.  Super-simple Java accepted.
Developing elaborate data structures that take extra space, instead of just using the array, seems like a big, inefficient waste of developer time, which tends 
Developing elaborate data structures that take extra space, instead of just using the array, seems like a big, inefficient waste of developer time, which tends to be more expensive than processor time.\n\nIf update() got called a less often than sumRange(), pre-computing things would make more sense, but the problem specifies they get called about equally often.  So, here, no extra space used, no upfront cost, no update cost, and you only calculate what you need, when you need it:\n\n```\nclass NumArray {\n    int[] n;\n    \n    public NumArray(int[] nums) {\n        n=nums;\n    }\n    \n    public void update(int i, int val) {\n        n[i]=val;\n    }\n    \n    public int sumRange(int i, int j) {\n        int retVal = 0;\n        for( int k=i; k<=j; k++ ) retVal+=n[k];\n        return retVal;\n    }\n}\n```
[]