Dynamic Programming21 sections · 916 units
Open in CourseQuiz: 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?
- A.To sort the prefix sums
- B.To store the subarray elements
- C.To find how many previous prefix sums equal (current prefix - k)
- D.HashMap is not useful here