Prefix Sum interview questions
Practice 3 questions on prefix sum. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
3 questions
- MEDIUM
Array Product Excluding Current
Return an array where each entry is the product of every element except the one at that index, without division and in O(n).
25 minAlgorithmsAmazon · Meta · Microsoft - MEDIUM
Weighted Random Pick
Pick items at random in proportion to their weights using prefix sums and a binary search, with an injectable RNG so picks are testable.
25 minAlgorithms - HARD
Fenwick Tree (Binary Indexed Tree)
PREMIUMBuild a Fenwick tree for logarithmic prefix-sum queries and point updates, using the lowest-set-bit trick to walk responsibility ranges.
40 minAlgorithms