Generate all subarrays. For each, find the minimum in time.
Total: . Even optimizing to (tracking min while extending) is too slow for .
Can you count each element's contribution in ?
The trap
Generate all subarrays. For each, find the minimum in time.
Total: . Even optimizing to (tracking min while extending) is too slow for .
Can you count each element's contribution in ?