Jan-28-2018, 11:04 PM
def my_prisoners(p): for i in range(6): attempt=0 idx=i found= False while attempt<3: if p[idx]==i+1: found=True break else: idx=p[idx]-1 attempt += 1 if not found: return False return TrueI dont know why it has not worked before, but now it randomly works. However, iam very grateful for ur help.