Dynamic Programming21 sections · 916 units
Open in Course

Quiz: Prefix Sum + HashMap

Knowledge check

Check Your Understanding

When finding subarrays with sum equal to k, why do we use a HashMap with prefix sums?

  1. A.To sort the prefix sums
  2. B.To store the subarray elements
  3. C.To find how many previous prefix sums equal (current prefix - k)
  4. D.HashMap is not useful here
Start the roadmap to answer the quizzes and solve the challenges