Interview questions · ByteDance
Solve interval merging and histogram area
This question evaluates algorithmic problem-solving skills focused on interval manipulation and histogram-based area computation, emphasizing data structures, ordering, and reasoning about time and space complexity.
The coding round included two algorithm problems:
-
Merge overlapping intervals: Given a list of closed intervals
[[start1, end1], [start2, end2], ...], merge all overlapping intervals and return a new list of non-overlapping intervals sorted by start time. -
Maximum rectangle in a histogram: Given an array of non-negative integers where each value represents the height of a histogram bar of width
1, return the maximum rectangular area that can be formed using one or more consecutive bars.
Community answers
Nothing here yet.
Join in on CSWork →