odd-subarray-count-formula

Status: IN

Element at index `i` in an array of length `n` appears in exactly `((i+1)*(n-i)+1)//2` odd-length subarrays, derived from total subarray count `(i+1)*(n-i)` with ceiling division by 2

Source: entries/2026/06/06/sum-of-all-odd-length-subarrays-solution.md

Depended on by

JSON