मुख्य कंटेंट तक स्किप करें

4 docs tagged with "prefix-sum"

सारे टैग देखें

2D Prefix Sum

Extend the Prefix Sum technique to two dimensions — efficiently answer rectangular range sum queries on a 2D grid in O(1) after O(m×n) preprocessing. Includes intuition, dry runs, and multi-language implementations.

Left and Right Sum Differences

The Left and Right Sum Differences problem on LeetCode involves finding the absolute difference between the sum of elements to the left and right of each index in an array.

Prefix Sum Algorithm

Learn the Prefix Sum technique — a powerful range-query optimization that answers range sum queries in O(1) after O(n) preprocessing. Includes dry runs, complexity analysis, common mistakes, and multi-language implementations.