Anyone can explain this problem for me please?


  • 0

    Why when lower = -2 and upper = 2, the interval will be divided into [0,0], [0,2] and [2,2]? where is the interval like [0,1], etc.?


  • 2

    @junxiong Not divided into [0,0], [0,2] and [2,2], it's because in these three ranges their sums in the array [-2, 5, -1] will respectively

    • [0, 0]: the first element -2
    • [0, 2]: from the first to the second, -2+5-1=2
    • [2,2]: the second element -1
      which are all meet the range requirement [-2, 2].

Log in to reply
 

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