Skip to content

Latest commit

 

History

History

Leetcode100

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Same Tree Solution

  1. Approach
  • Recursively compare nodes of both trees
  • Base case: if both nodes are None, return True
  • If one node is None and the other is not, return False
  • If values of nodes are different, return False
  • Recursively check left and right subtrees
  • Time: O(n) where n is the number of nodes in the tree
  • Concepts: Recursion, Binary Trees

Link to problem Leetcode Problem Number #100 STATUS : Accepted