DataDriven
LearnPracticeInterviewDiscussDailyJobs

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
L3

Problem

You're filling the friend-count column from a social graph export, where each record is either a pair of names, meaning those two people are mutual friends, or a single name, meaning a person who has shown up with no connections. Return a mapping from every person who appears to how many friends they have, where each pair adds one to both of its names and anyone who only ever appears alone lands at 0.

Summary

Everyone knows someone.

Practice This Problem

Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.

Related

  • All Practice Problems
  • Mock Interview Mode
  • Python Interview Questions
  • Data Engineering Interview Prep Guide
  • Daily Challenge
  • Data Engineering Lessons