Loading...
The Social Graph
A easy Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- easy
- Seniority
- junior, mid
Problem
Our social graph stores relationships as raw groups: a pair like ['Alice', 'Bob'] means they're friends, and a singleton like ['Sam'] means Sam exists but has no connections yet. The graph team needs a quick utility to turn this into something queryable. Given a list of these groups, return how many friends each person has.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a sandboxed Docker environment and grades it instantly.