InterviewLegend

Intervals, Heaps and Greedy

Alex Chen34 min readUpdated 78 real interview reports

Interval and heap problems come up in two places at Morgan Stanley. The campus assessment usually wraps a classic problem in a story, sometimes a different story each time. Lateral first rounds ask the same problems with no story at all, so your first job is to strip the wording and recognize which problem you're looking at.

Each of the four problems needs either a sort or a heap. Two sort and then sweep, one keeps a heap capped at a fixed size, and one saves options in a heap and draws on them only when it has to.

Before you code the interval problem, check whether ranges that only touch count as overlapping. Every problem below runs against real tests in six languages, so get your own version passing before you open the walkthrough.

Morgan StanleyPremium lesson · Coding round

The 4 Morgan Stanley problems are below.

  1. A Premium questionCoding · Medium · Signature problem
  2. A Premium questionCoding · Hard · Frequently asked
  3. A Premium questionCoding · Medium

+ 1 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the Morgan Stanley questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

Had your Morgan Stanley interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Morgan Stanley interview guide

Know what Morgan Stanley asks before you walk in.

33 coding · 4 system design · 19 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.