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
- AlgorithmsCoding exercise
Array Product Excluding Current
MEDIUMReturn an array where each entry is the product of every element except the one at that index, without division and in O(n).
25 minAmazon · Apple · Meta +1Practice - AlgorithmsCoding exercise
Weighted Random Pick
MEDIUMPick items at random in proportion to their weights using prefix sums and a binary search, with an injectable RNG so picks are testable.
25 minPremium questionPractice - AlgorithmsCoding exercise
Fenwick Tree (Binary Indexed Tree)
HARDBuild a Fenwick tree for logarithmic prefix-sum queries and point updates, using the lowest-set-bit trick to walk responsibility ranges.
40 minPremium questionPractice