Merge Meeting Intervals
Updated
Problem statement
Each row [start, end] in intervals is a meeting time interval. Return the union of these intervals as a list of merged intervals.
For this exercise, assume intervals are closed: two intervals that overlap or share an endpoint belong to the same merged interval. An interval may have equal start and end times. Input rows may arrive in any order and may repeat.
Return non-overlapping merged intervals in ascending start-time order. Return an empty array for empty input.
Function
mergeMeetings(intervals: int[][]) → int[][]Examples
Example 1
intervals = [[1,3],[2,6],[8,10],[15,18]]return = [[1,6],[8,10],[15,18]]The first two intervals overlap, so their union is [1,6]. Neither of the other intervals touches that union or each other.
Example 2
intervals = [[4,5],[1,4]]return = [[1,5]]The intervals share time 4. Closed intervals that share an endpoint merge into [1,5].
Constraints
- For this exercise, assume
0 <= intervals.length <= 2000. - Each interval contains exactly two integers.
- Every time is an integer from 0 to 10^9, inclusive.
- Each interval's start is less than or equal to its end.
More Intuit Online Assessment questions
- Employee Promotion OpportunitiesOA · Seen Oct 2026
- Next Pascal Row CoefficientOA · Seen Oct 2026
- Parse Router LogsOA · Seen Oct 2026
- Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
- Maximum Square-Free DivisorOA · Seen Oct 2026
- Two Tribes from Taller-Person CountsOA · Seen Oct 2026
- Shortest Path from an Encoded GraphOA · Seen Sep 2026
- Oldest and Youngest EmployeesOA · Seen Sep 2026
- Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
- Submask Sum QueriesOA · Seen Sep 2026
Similar questions at other companies
- Top K Frequent ElementsAmazon · OA · PHONE SCREEN
- Capping Portfolio WeightsCapstone Investment Advisors · OA
- Count Servers With No Requests in a Time WindowIBM · OAIBM interview questions
- Maximum Escape Game ScoreMicrosoft · OAMicrosoft interview questions
- Largest Team Where Every Pair OverlapsWalmart · OAWalmart interview questions
- Maximum Distinct Values After Unit AdjustmentsBirla Pivot · OA
- Minimum Meeting RoomsJP Morgan Chase · OAJP Morgan Chase interview questions
- Minimize Task Resource ConsumptionNVIDIA · OANVIDIA interview questions
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
- Macaron Order PriceOpenAI · OAOpenAI interview questions