InterviewLegend

Graph and Tree Walks

Alex Chen45 min readUpdated 197 real interview reports

Graphs are the other topic Twilio's onsite asks most, next to class design. The input is rarely a graph yet. It usually arrives as a flat list of rows, and turning that list into something you can search is half the work.

The three problems below start with a reachability question. Next is a hierarchy built from flat rows, asked as a two-part phone screen, and the last is a grouping problem that's a job for union-find.

Say which way each edge points before you build anything, since an edge one way says nothing about the way back. Then pick the search. A stack and a seen set cover most of it. Recursion is fine when the depth is small, and union-find fits when you only need to know who is grouped with whom.

TwilioPremium lesson · Coding round

The 3 Twilio 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 Twilio questions

$49 a year · all 100 companies · cancel anytime

From 197 Twilio reports, forum threads behind logins and write-ups in Chinese.

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

Know what Twilio asks before you walk in.

31 coding · 3 system design · 18 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.