Angad Sandhu
Search
Browse

572_Subtree_of_Another_Tree

Source name
572_Subtree_of_Another_Tree.py
# File: Leetcode/Solutions/572_Subtree_of_Another_Tree.py

"""
Problem Number: 572
Problem Name: Subtree of Another Tree
Difficulty: Easy
Tags: Tree, Depth-First Search, Breadth-First Search, String Matching, Binary Tree, Hash Function, Neetcode 150
Company (Frequency): Amazon, Apple, Facebook, Google, Microsoft
Leetcode Link: https://leetcode.com/problems/subtree-of-another-tree/description/

DESCRIPTION

Given the roots of two binary trees, `root` and `subRoot`, return `true` if there is a subtree of `root` with the same structure and node values of `subRoot` and `false` otherwise.

A subtree of a binary tree `tree` is a tree that consists of a node in `tree` and all of this node's descendants. The tree `tree` could also be considered as a subtree of itself.
"""

Browse the library