Why Time Limit Exceeded?


  • -1
    N
    public class NumArray {
    int[] array;
    public NumArray(int[] nums) {
        array = nums;
    }
    
    void update(int i, int val) {
        array[i] = val;
    }
    
    public int sumRange(int i, int j) {
        int result = 0;
        for(int k = i; k <= j; k++)
        {
            result += array[k];
        }
        return result;
    }}

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.