I recently came across the sentence in the Book Introduction to Algorithms section **4.1** The maximum sub-array problem:

We still need to check $ \binom{n-1}{2} = \Theta(n^2)$ subarrays for a period of $ n$ days.

Here $ n$ is the number of days taken as an example to show the changes in price of stock.

We can consider this is the size of an array A.

Where we are provided with an Array A and we need to find the net change is maximum from the first day to the last day.

To explain more specifically it means for an array $ A$ of size $ n$ we need to check $ \binom{n-1}{2}$ subarrays.

But, I cannot understand how we need $ \binom{n-1}{2}$ sub-arrays?

If we take an array of size **5** could someone please explain to me why we need only **6** sub-arrays. Won’t the sub-arrays be:

`[1...5] [1...4] [1...3] [1...2] [2...4] [2...5] [3...5] [4...5] `

Please correct me if I am wrong. References: Maximum Subarray Problem

Thank you.