Trees, Graphs and Nested Data
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.
- A Premium questionCoding · Medium
- A Premium questionCoding · Medium
- 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.
eBay interview guideKnow what eBay asks before you walk in.
33 coding · 5 system design · 30 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.