Consider all the leaves of a binary tree, evaluated from left to right order. The values of these leaves form a leaf value sequence.
Two binary trees are considered leaf similar if their leaf value sequences are identical.
Given the roots of two binary trees, root1 and root2, return true if and only if the two trees are leaf similar, otherwise return false.
Constraints:
The number of nodes in each tree is in the range
Both trees contain values in the range
Consider all the leaves of a binary tree, evaluated from left to right order. The values of these leaves form a leaf value sequence.
Two binary trees are considered leaf similar if their leaf value sequences are identical.
Given the roots of two binary trees, root1 and root2, return true if and only if the two trees are leaf similar, otherwise return false.
Constraints:
The number of nodes in each tree is in the range
Both trees contain values in the range