Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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)
Advertisement
Add Comment
Please, Sign In to add comment