InterviewLegend

Trees and Graphs

Alex Chen34 min readUpdated 78 real interview reports

Trees and graphs make up a smaller share of the coding at Morgan Stanley, but they still turn up, on the campus assessment, in live campus rounds and up to senior lateral loops.

None of these needs more than BFS, DFS or an in-degree count. The tree problems give you the input as a level-order list with null for a missing child, so you build the tree first. All three tree problems share that format, so write the parser once, reuse it, and test it on a lopsided tree.

For the graph problem, decide which way each dependency points before you write the loop. Then count in-degrees and keep taking the nodes that have none left.

Morgan StanleyPremium lesson · Coding round

The 4 Morgan Stanley problems are below.

  1. A Premium questionCoding · Medium
  2. A Premium questionCoding · Medium
  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.