Dynamic Programming21 sections · 916 units
Open in CourseQuiz: Why Two Heaps
Understanding the structure
Check Your Understanding
Why does Slope Trick typically use TWO heaps (max-heap and min-heap)?
- A.To store positive and negative slopes separately
- B.To handle insertion and deletion in O(1) time
- C.To efficiently access both leftmost and rightmost slope-change points for updates
- D.To compute function minimum in O(n) time