Graph and Tree Walks
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.
- A Premium questionCoding · Medium
- A Premium questionCoding · Medium
- 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.
Twilio interview guideKnow what Twilio asks before you walk in.
31 coding · 3 system design · 18 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.