pattern / MEDIUM
Merge, overlap, and process interval lists
complexity
time
O(n log n)
space
O(n)
02' — visual
interactive
Maximum sum subarray
03'
mental
model.
Sort by start time, then process sequentially. Track current interval and update based on overlap.
Interval patterns deal with overlapping, merging, and scheduling problems on ranges of values.
when to use ✓
when not ✗
04'
List of intervals [start, end]
Merge overlapping intervals
Find conflicts
Meeting rooms problems
05'
1# Beginner: Fixed-size sliding window2def max_sum_k(nums, k):3 n = len(nums)4 if n < k:5 return 06 window_sum = sum(nums[:k])7 max_sum = window_sum8 for i in range(k, n):9 window_sum += nums[i] - nums[i - k]10 max_sum = max(max_sum, window_sum)11 return max_sum
common mistakes
interview tips
06'
5 curated problems from LeetCode
07'