Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
remove_from_back solution in Clear category for How to Find Friends by Cjkjvfnby
# migrated from python 2.7
def check_connection(network, first, second):
network = [x.split('-') for x in network]
first_network = {first}
while True:
length = len(network)
for i in reversed(list(range(len(network)))):
val = network[i]
if not first_network.isdisjoint(val):
first_network.update(val)
del network[i]
if second in first_network:
return True
if length == len(network):
return False
Aug. 5, 2014