Pattern 22: LeetCode Interview Patterns24 sections · 736 units
Open in CourseQuiz: Segment Tree Advantage
Test your understanding
Check Your Understanding
With an array and prefix sums, sumRange is O(1) but update is O(n). Segment tree makes both operations:
- A.O(log n) for both
- B.O(n) for both
- C.O(n log n) for both
- D.O(1) for both