DataDrivenDataDriven
LearnPracticeInterviewDiscussDailyJobs

The Shortest Route

A medium Python interview practice problem on DataDriven. Write and execute real python code with instant feedback.

Domain
Python
Difficulty
medium
Seniority
L4

Problem

A message-routing service keeps an adjacency dict mapping each node to the nodes it can forward to directly. Given that `graph` and two node names, return the fewest hops from `start` to `end`, or -1 when `end` can't be reached.

Summary

Fewer hops is always better.

Practice This Problem

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

Related

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