← ALL NOTES
Tree

872. Leaf-Similar Trees

Two trees are "leaf-similar" if their leaf values, read left to right, form the same sequence. So collect each tree's leaf sequence with a left-to-right traversal and compare the two lists.

Loading…