DSA: sliding window
Intuition
For a list of size n, you can form a total of (n*(n+1))/2
subarrays. For each new element added to a subarray, we can form exactly n more subarrays.
Implementation
Visual
DSA: sliding window
Intuition
For a list of size n, you can form a total of (n*(n+1))/2
subarrays. For each new element added to a subarray, we can form exactly n more subarrays.
Implementation
Visual