It's possible to get number of subarrays ENDING at a fixed location, starting from a non fixed location:
[0, 1, 2, 3]
Subarrays ending at i=3, starting i=1
i=3
i=1
There are 1,2,3, 2,3, 3 - 3 total.
1,2,3
2,3
3
Compute via end - start + 1
end - start + 1
Last updated 5 months ago