Merge Intervals, Trade Scheduling & Ship Capacity
- Pin down a vague interval prompt with a few questions before you write code
- Merge overlapping intervals by sorting once and holding one open interval
- Pick non-overlapping trades for maximum profit with a sorted DP and binary search
- Attend the most events with a min-heap of end days
- Find the least ship capacity by binary searching the answer
No live problem comes up more often in Expedia coding rounds than merge intervals. Five candidates have described it since 2023, and the two newest were both in 2026. A Senior SWE technical screen had it in March, and an SDE III (GenAI/ML) elimination round in India opened with it in April.
The other three problems here turned up in the same rounds. That March senior screen followed merge intervals with something like picking non-overlapping stock trades for the most profit. A March 2026 SDE II loop asked for the most events you can attend in round one, then capacity to ship packages within D days in round two. Ship capacity has no intervals in it at all. It's here because it has three reports from 2024 to 2026, and twice it came up in the same candidate's Expedia loops as an interval problem.
Clarify the input before you code
In a December 2023 SDE II round in India, the interviewer opened with a very vague prompt. Only after a few clarifying questions did it turn out to be merge intervals. The rest of the 45 minutes was graded as if the code were headed to production. Readability and extensibility came up, and even the function names were questioned in review.
The 2026 reports read cleaner, but the habit still pays. One March 2026 write-up describes an expected output that departs from the textbook version: when nothing overlaps, return one interval covering them all. That's a good reason to agree on the output with one small example before you type. These are the questions worth asking for any interval prompt:
- Is the input sorted by start, or do I sort it?
- Do ranges that only touch, like [1, 4] and [4, 5], count as overlapping?
- What comes back for an empty list or a single range?
- Should I return a new list, or is changing the input in place fine?
The touching question changes the code by one character, <= or <. In booking data a checkout and a same-day check-in share a date without clashing, so a calendar of booked nights may want them kept apart. Ask, then say which one you picked out loud.
Three moves cover this lesson. Sort the intervals and sweep them once, holding only the latest merged one. For weighted picks, sort by end time and binary-search the last compatible choice. When the question asks for the smallest value that works, binary-search the value itself and test each guess with a greedy pass.
Asked at Expedia
Each problem below runs against tests in the editor, the way Expedia's HackerRank rounds do. Merge intervals goes first because it's asked most. The other three follow the rounds they came from.
Merge overlapping intervals
Five firsthand reports, from March 2023 to April 2026. In the March 2026 Senior SWE screen, intervals came as [start_time, end_time] pairs and the ask was a new array of merged ones. That candidate finished quickly and then explained the time complexity. In April 2026 an SDE III candidate tried comparing neighbours pairwise, lost track of the merged state partway through and only partly converged. An October 2025 SDE III round in India had it too. So did a March 2023 SDE III round in Gurugram, along with a variation the candidate didn't spell out.
Merge Overlapping Intervals
Problem
[start, end] with start <= end. The list is in no particular order.Merge every group of overlapping intervals into one interval that covers the whole group, and return the merged intervals sorted by start. Two intervals that only touch, such as
[1, 4] and [4, 5], count as overlapping. An empty list returns an empty list.[1,3] and [2,6] overlap, so they become [1,6]. The other two stand alone.
Sort by start. Keep the merged list and compare each interval only with its last entry: stretch that entry when they overlap, otherwise append a new one.
Merge Overlapping Intervals
Click "Run" to execute your code
merge_intervals, name the loop variables start and end, and return a new list so the caller's input stays untouched.Non-overlapping trades for maximum profit
The March 2026 Senior SWE screen followed merge intervals with this one. The input was something like a log of stock trades, each [buy_time, sell_time, profit], and you choose trades that don't overlap to get the most total profit. Selling and buying at the same time doesn't count as overlap, since you can sell on day 3 and buy again on day 3. The candidate sorted on the wrong field, hit a binary search bug and failed one of three tests, yet still got the next round. A December 2023 SDE II assessment in India had the same problem as plain job scheduling.
Non-Overlapping Trades for Maximum Profit
Problem
[buy_time, sell_time, profit] with buy_time < sell_time and a positive profit.You can hold one trade at a time, so two chosen trades must not overlap. A trade that sells at time
t doesn't overlap one that buys at time t.Return the largest total profit you can make from a set of non-overlapping trades. An empty list returns 0.
The first and third trades share time 3, which is allowed, for 20 + 10. The first and second overlap.
Sort the trades by sell time. Let best[i] be the most profit from the first i trades. For each trade, either skip it or add its profit to best[k], where k counts the earlier trades that sell at or before its buy time.
Non-Overlapping Trades for Maximum Profit
Click "Run" to execute your code
bisect_right on the sell times to keep those chains. That candidate failed a test on a binary search bug and still advanced, so say the complexity even if one test stays red.Maximum number of events you can attend
Round one of a March 2026 SDE II loop was this problem, and it's the only report so far. Each event runs over a range of days, you can go to it on any single day in that range, and you attend at most one event a day. You want as many events as possible. It resembles the trades problem, though with every event worth the same, a greedy rule is enough and no table is needed.
Maximum Number of Events You Can Attend
Problem
[start_day, end_day] with both days included. You can attend an event on any one day from its start day to its end day.You can attend only one event per day. Return the largest number of events you can attend.
Attend the first on day 1, the second on day 2 and the third on day 3.
Walk the days in order. Push the end day of every event that has started onto a min-heap, drop the ones that have already ended, and attend the one that ends soonest.
Maximum Number of Events You Can Attend
Click "Run" to execute your code
best[j][i] is the most value using j events from the first i. Taking event i adds its value to best[j - 1][k], where k counts the events that end before it starts, found by binary search on end days.Capacity to ship packages within D days
Three firsthand reports, from February 2024 to March 2026. The newest opened round two of the March 2026 SDE II loop. An October 2025 SDE III round in India had it too, and the candidate solved it. The February 2024 SDE III version in Gurugram told it as a conveyor belt of package weights to ship within B days, loading in order each day. Same problem, different letters.
Capacity to Ship Packages Within D Days
Problem
weights[i] is the weight of the i-th one. Each day you load the ship with packages in belt order, without going over the ship's weight capacity, and ship them.Return the smallest capacity that ships every package within
days days. Packages can't be reordered or split.With capacity 15 the days are [1,2,3,4,5], [6,7], [8], [9], [10]. Capacity 14 needs six days.
The capacity is somewhere between the heaviest package and the total weight. Binary search that range, and for each guess count the days a greedy load needs.
Capacity to Ship Packages Within D Days
Click "Run" to execute your code
days days, which is fine, since an empty day at the end costs nothing. Say that so the interviewer knows you saw it.Common questions
Is merge intervals still asked at Expedia?
Yes. It's the most repeated live problem, with five firsthand reports from 2023 to April 2026. The two 2026 reports came from a Senior SWE technical screen and an SDE III elimination round in India.
Are Expedia interview questions on LeetCode?
All four problems here have LeetCode equivalents: Merge Intervals, Maximum Profit in Job Scheduling, Maximum Number of Events That Can Be Attended and Capacity To Ship Packages Within D Days. Expedia's wording can differ, like trades instead of jobs, so learn the shape rather than the text.
What do Expedia SDE 2 coding interview questions look like?
One March 2026 SDE II loop gives a feel for it. Round one was the events problem. Round two had ship capacity and a stock-trading DP with at most k transactions. Expect mediums with a hard mixed in, run against test cases in HackerRank.
How should I practice these four?
Code each from a blank file on a timer, starting with the clarifying questions out loud. Expedia rounds often put two problems in one hour, so aim to finish merge intervals in about 15 minutes. That leaves time for a harder second problem.
Key Takeaways
- ✓Merge intervals is the most repeated Expedia live problem. Sort once and compare only with the last merged interval.
- ✓Ask about sorting, touching endpoints and empty input first. One reported round started with a very vague prompt.
- ✓For weighted trades, sort by sell time and use bisect_right, since a sell and a buy can share a time.
- ✓Ship capacity is binary search on the answer, from the heaviest package to the total weight.
Expedia interview guideKnow what Expedia asks before you walk in.
39 coding · 6 system design · 23 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.