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.?
Anyone can explain this problem for me please?

@junxiong Not divided into
[0,0], [0,2] and [2,2]
, it's because in these threeranges
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+51=
2
 [2,2]: the second element
1
which are all meet the range requirement[2, 2]
.
 [0, 0]: the first element