Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for How to Find Friends by magda_kudrycka
def check_connection(network, first, second):
path = {first}
spr = 0
while(len(path) > spr):
spr = len(path)
for net in network:
one, two = net.split("-")
if one in path or two in path:
path.add(one)
path.add(two)
else:
return second in path
Nov. 27, 2016