LeetCode知识点总结 – 872
LeetCode 872. Leaf-Similar Trees
考点难度TreeEasy
题目
Consider all the leaves of a binary tree, from left to right order, the values of those leaves form a leaf value sequence. Two binary trees are considered leaf-similar if their leaf value sequence is the same. Return true if and only if the two given trees with head nodes root1 and root2 are leaf-similar.
思路
用depth first search算出来leaf,之后比较。
答案
class Solut
共有 0 条评论