def find_max(root, my_set, max): if root is None: # jeśli może być trzystanowy, lub "if not root" jeśli jest dwustanowy if len(my_set) >= max: max = len(my_set) my_set.add(root.val) if my_set.left: find_max(root.left, root, max) if my_set.right: find_max(root.right, root, max)