mirror of
https://github.com/autistic-symposium/master-algorithms-py.git
synced 2025-04-29 20:26:07 -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
|
||||
# -*- 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…
x
Reference in New Issue
Block a user