Leaf-Similar Trees (LeetCode 872)
Approach
DFS collect leaf values for both trees; compare the sequences.
Tip
Use a generator/iterator if the interviewer asks for O(h) extra space.
Edge
Single-node trees and skewed trees — still just leaf sequences.
Prep with best AI tool for coding tests and OAs.