Tag: subtree

  • Subtree of Another Tree

    Given two trees, check if the second tree is a subtree of the first tree For example, Consider the below trees : As evident from the diagram , the subRoot tree is a subtree of root. The input is : root = [3,4,5,1,2], subRoot = [4,1,2] The output is true Try out the solution here:…