mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-05-02 06:46:18 -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 changed files with 2 additions and 9 deletions
|
@ -1,18 +1,11 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
# author: bt3gl
|
||||
#
|
||||
|
||||
# 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 = []
|
||||
counter = {}
|
Loading…
Add table
Add a link
Reference in a new issue