Data Structures19 sections · 729 units
Open in CourseQuiz: Prefix Sum + Hash
Initial value
Check Your Understanding
In subarray sum equals k, why do we initialize the frequency map with {0: 1}?
- A.To avoid division by zero
- B.To handle empty arrays
- C.It's optional, just for efficiency
- D.To count subarrays that start at index 0 (where prefix sum equals k)