InterviewLegend

Trees, Graphs and Nested Data

Alex Chen30 min readUpdated 266 real interview reports

Tree and graph problems at eBay usually ask you to see a graph where the prompt describes something else. Sometimes you add edges yourself, sometimes you process the graph in an order that has to survive a cycle, and nested data is a tree you walk with depth-first search.

One of these problems has opened a first coding round at eBay. Another was posed in Java types, which fits eBay's Java services, and it's the kind of small utility a service team writes once and keeps.

Before you write a line, say what the graph is. Name the nodes, say which way the edges run, and decide what counts as visited. Then ask about odd inputs, because these problems hide their hard cases in the data. A target can be missing, two items can depend on each other, and a structure can be empty. The three problems below are worked end to end.

eBayPremium lesson · Coding round

The 3 eBay problems are below.

  1. A Premium questionCoding · Medium
  2. A Premium questionCoding · Medium
  3. A Premium questionCoding · Medium

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

Get the eBay questions

$49 a year · all 100 companies · cancel anytime

From 266 eBay reports, forum threads behind logins and write-ups in Chinese.

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

Know what eBay asks before you walk in.

33 coding · 5 system design · 30 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.