Challenge: Find the Shortest Path between Two Vertices

Try to solve the Find the Shortest Path between Two Vertices problem.

We'll cover the following

Statement

Given a directed graph of n nodes and two vertices, src and dest, return the length of the shortest path between src and dest. The shortest path will contain the minimum number of edges.

If no path exists between src and dest, return -1.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.