mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-30 04:36:08 -04:00
Update and rename find_duplicate_subtrees.py to bt_find_duplicate_subtrees.py
This commit is contained in:
parent
0871054dd3
commit
57075bd388
@ -1,18 +1,11 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# author: bt3gl
|
# author: bt3gl
|
||||||
#
|
|
||||||
# Given the root of a binary tree, return all duplicate subtrees.
|
# Given the root of a binary tree, return all duplicate subtrees.
|
||||||
#
|
|
||||||
# Definition for a binary tree node.
|
|
||||||
# class TreeNode:
|
|
||||||
# def __init__(self, val=0, left=None, right=None):
|
|
||||||
# self.val = val
|
|
||||||
# self.left = left
|
|
||||||
# self.right = right
|
|
||||||
|
|
||||||
|
|
||||||
def find_duplicates(root: Optional[TreeNode]) -> List[Optional[TreeNode]]:
|
def find_duplicates(root: Optional[Node]) -> list[Optional[Node]]:
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
counter = {}
|
counter = {}
|
Loading…
x
Reference in New Issue
Block a user