ArraysEvidence Contributing
Prefix Sum
Precompute running sums (or products) so range queries or comparisons become O(1) instead of re-scanning.
Practice Problems: 15
Difficulty: 4 Easy·9 Medium·2 Hard
Core technique
Review the technique, then try the mapped problems below. The right approach depends on each problem's constraints.
- Core Strategy: Precompute running sums (or products) so range queries or comparisons become O(1) instead of re-scanning.