Trees and Recursion
Trees show up less at Lyft than graphs or intervals, but they still come up in phone screens, including two infrastructure screens a couple of months apart that asked the same question.
A third problem belongs with them even though it doesn't look like a tree problem at first. Nested data is a tree, and the solution is one function that checks the type of a value and calls itself on each child. Once you have that recursion right, all three problems follow the same pattern.
The two tree problems run in six languages, and the third runs in five, all but C++. Try the empty input on every one before you trust it.
LyftPremium lesson · Coding round
The 3 Lyft 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 Lyft questions$49 a year · all 100 companies · cancel anytime
From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.
Lyft interview guideKnow what Lyft asks before you walk in.
28 coding · 2 system design · 12 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.