Given a set of Cities and Interstates that City have, need to find out if other Cities roads intersects with one of the respective City say Boston and the degree of separation.
E.g : If Boston is the City for which the connecting interstates degree needs to be figured, 0 is the degree of separation for Boston. If new York can connect directly to Boston the degree of separation is 1, If new York connects to Boston through a different city road , the degree of separation is 2 and so on
E.g Input :
Boston,I-94;I-90
NewYork,I-80;I-94
Seattle,I-80;I-5
E.g Output:
0, Boston
1, NewYork
2, Seattle