Python, difference between submit and custom-input options for the same input

  • 0
    class NumArray(object):
        nums = []
        def __init__(self, nums):
            for i in nums:
        def sumRange(self, i, j):
            sum = 0
            print sum
            for k in range(i, j+1):
                sum = sum + self.nums[k]
            return sum

    If i submit the above code, I am getting error for the following input.

    However, if I use "custom input" option, I am getting the correct answer. Please help me see what I am missing.

Log in to reply

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