Question bank › Graphs Bfs
Dsa Graphs Bfs Warm-up

Marketing Influence Rings

A marketing agency wants to target people exactly D 'degrees of separation' away from a seed influencer. Given a list of friendships, a seed person's ID S, and a distance D, find all person IDs that are exactly distance D from S. Print them in ascending order. If no such people exist, print 'NONE'. Example: Input: 6 5 0 1 0 2 1 3 2 4 4 5 0 2 Output: 3 4 (Distance 1: {1, 2}. Distance 2: {3, 4}.)

Key concepts

graphsbfsdistance tracking

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.