Bus Routes
Given an array routes where routes[i] is a bus route that the ith bus repeats forever. You start at bus stop source and want to go to bus stop target. Return the least number of buses you must take to travel from source to target, or -1 if impossible.
Bus Routes

Given an array routes where routes[i] is a bus route that the ith bus repeats forever. You start at bus stop source and want to go to bus stop target. Return the least number of buses you must take to travel from source to target, or -1 if impossible.

Example 1:
Input: {"routes":[[1,2,7],[3,6,7]],"source":1,"target":6}
Output: 2
Input
arr ={"routes":[[1,2,7],[3,6,7]],"source":1,"target":6}

Routes: 2, source: 1, target: 6

Bus Routes (source=1, target=6)

Bus 0:

1

2

7

Bus 1:

3

6

7

Source

Target

Visited

Minimum Buses:

?

Variables
No variables to display
DepthFunction Call
Stack empty
0/1