Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for How to Find Friends by TovarischZhukov
def check(data, conn1, conn2):
for i, elem in enumerate(data):
if conn1 in elem:
val = elem.split("-")
data.pop(i)
conn = val[0] if val[1] == conn1 else val[1]
if conn == conn2:
return True
else:
if check(data, conn, conn2):
return True
return False
def check_connection(data, conn1, conn2):
data = list(data)
return check(data, conn1, conn2)
Dec. 8, 2015