Problem
Problem page: https://leetcode.com/problems/same-tree/
Topics: Tree, Depth-first Search
Difficulty: Easy
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
Analysis
Check whether two binary trees are equal. Recursive backtracking is a common approach here.
Code
1 | class Solution: |
Article link: https://xnerv.wang/en/leetcode-same-tree/
