BFS and Flood Fill
Graph and grid search comes up in Lyft's coding rounds more than any other problem type. The Multi-Source BFS & Scheduling lesson covers the version that starts from many places at once. The four problems here use the same queue, but most of them start from a single place.
The first two look like what they are, a flood fill over a grid and a breadth-first walk where each step can open up more of the search.
The other two never show you a grid. In each, a node is a state of the puzzle and an edge is one legal move. So before you code, say out loud what a node is and what counts as a move. After that, the search is a queue and a visited set.
Lyft interviewers like to watch code run, so test the case with nothing to find first, like an empty grid or a target no move can reach. All four problems below run in six languages.
LyftPremium lesson · Coding round
The 4 Lyft problems are below.
- A Premium questionCoding · Medium
- A Premium questionCoding · Hard
- A Premium questionCoding · Medium
+ 1 more in this lesson
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.