Mock Interviewer

Ask Coach

Ask Coach
Clarify requirements before you design — kept separate from your stage notes.

Tap a question to start, or type your own below.

Nearby Friends System Design Interview

Visual Problem Diagram

Nearby Friends System Design Interview architecture diagram

Scenario

Picture opening a map app at a concert to find the friends who said they would be there. The app shows one friend as nearby, so you start walking toward that dot, but the friend left ten minutes ago, because the map is still using the last spot their phone shared before they crossed town. The part of the app that decides which friends to show on that map is called nearby friends. It has to be quick, gentle on the phone battery, and careful about privacy, since a wrong dot can point at someone who does not want to be found. A good answer explains how the map stays fresh, who is allowed to see whom, and what happens when thousands of people stand in one small area.

Stuck on where to start? Ask Coach

Clarify this problem here, or open Pathway Coach if you want a prep plan first.

Free Coach trial
How should I start prep?

This problem asks you to design nearby friends, the feature in a social or maps app that shows which of your friends are close to you right now. People choose to share a rough location from their phones. When someone opens the map, the app shows the friends who are within some distance, along with a rough distance and how recently each location was updated. A person can pause sharing whenever they like, and can block someone so that person never sees them. The map does not drop a precise pin on anyone's home.

In the interview you need to explain six things. First, how the app finds nearby friends without checking every person in the city. Second, how often a phone sends its location so that the battery lasts. Third, how a person who paused sharing, or whom you blocked, stays hidden even if an old location is still stored somewhere. Fourth, how a location that is too old to trust gets dropped. Fifth, how a packed concert is answered without listing every person in the crowd. Sixth, how the system stops someone from checking one person again and again to follow them home. The names of the libraries that cut the map into areas matter much less, so mention one and move on.

Constraints

Functional

A person opts in and shares location. They update it as they move. They ask who is nearby. They can pause sharing and block someone. The map shows a rough distance and when the location was last true.

Non-functional

Most nearby lookups finish in under about 500 milliseconds, so the map does not sit blank. A location older than about 10 to 15 minutes is hidden or marked old. Raw location is kept only a short time. The phone does not send a reading on every tick. If it is unclear whether someone may be shown, they stay hidden.

Scale

Tens of millions of people share location. The hot action is opening the map. Updates spike inside a region. A typical person has hundreds of friends. A concert or stadium packs one small area, and that crowded spot dominates the lookup.

Stages ahead

1Requirement Analysis
2API Design
3High-Level Design
4HLD Extensions
5Trade-offs

Not ready to design yet?

Try the free Coach trial — ask how to prep, what to practice first, or how InterviewCrafted works. Sign in when you want to start this problem.

Try Coach free

Log in to start practicing

Preview the problem below. Sign in to start your timed session, save progress, and use the AI coach.

Want full access now? View Pro pricing