InterviewLegend

Binary Tree Problems

Alex Chen40 min readUpdated 172 real interview reports

Binary tree questions in VMware's coding rounds tend to come with a rule attached. Sometimes recursion is off the table. Sometimes a node you're asked about isn't in the tree at all. The walk itself is usually short, so most of your planning goes into the rule.

Before you write code, decide what each call hands back to its parent. It might be a node, or the best sum down one branch. Once that return value is right, the rest is a short traversal. When the interviewer bans recursion, an explicit stack on the heap does the same walk, so practice writing both versions.

The three problems below each come with a rule attached, and one reuses a pass from The Core Coding Round. Your code has to compile and run against the interviewer's tests, so check an empty tree and a single node before you call it done.

VMwarePremium lesson · Coding round

The 3 VMware problems are below.

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

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

Get the VMware questions

$49 a year · all 100 companies · cancel anytime

From 172 VMware reports, forum threads behind logins and write-ups in Chinese.

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

Know what VMware asks before you walk in.

33 coding · 3 system design · 15 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.