Data Structures19 sections · 729 units
Open in Course

Quiz: Prefix Sum + Hash

Initial value

Check Your Understanding

In subarray sum equals k, why do we initialize the frequency map with {0: 1}?

  1. A.To avoid division by zero
  2. B.To handle empty arrays
  3. C.It's optional, just for efficiency
  4. D.To count subarrays that start at index 0 (where prefix sum equals k)
Start the roadmap to answer the quizzes and solve the challenges