finish extra/distract-the-trainers #11

Merged
seongbeom_park merged 6 commits from extra/distract-the-trainers into main 2022-04-25 17:58:38 +00:00
Showing only changes of commit cf6d493914 - Show all commits

View File

@ -24,6 +24,8 @@ def generate_trainer_pairs(trainer_id_list):
yield [(first_id, second_id)] + pairs yield [(first_id, second_id)] + pairs
def check_loop(x, y): def check_loop(x, y):
if (x + y) % 2 == 1: # sum is odd
return True
a, b = x, y a, b = x, y
memo = [] memo = []
while a != b: while a != b:
@ -38,6 +40,7 @@ def check_loop(x, y):
return False return False
tests = [ tests = [
([1], 1),
([1, 1], 2), ([1, 1], 2),
([1, 7, 3, 21, 13, 19], 0), ([1, 7, 3, 21, 13, 19], 0),
] ]