Loading...
The Shortest Route
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- mid, senior
Problem
A network monitoring tool needs to find the minimum number of hops between two nodes in an unweighted graph. Given an adjacency list and two node names, write a function that returns the minimum number of edges to traverse. Return -1 if no path exists.
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.