Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Same Tree

Python data engineering interview problem. Difficulty: advanced. Pattern: Trees. About 18 minutes. Part of the Pro drill bank.

Check whether two level-order trees are identical. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement is_same_tree(a: list, b: list) -> bool.

Examples

Input: is_same_tree([1, 2, 3], [1, 2, 3]) Output: True Identical structure and values.

Topics: lakebench, python, compare, dfs.

More Python interview questions · All interview problems · Learn data engineering

advanced

Same Tree

Interview-style drill: Check whether two level-order trees are identical.

Implement `is_same_tree(a: list, b: list) -> bool`. Example: `[1, 2, 3], [1, 2, 3]` → `True`. Keep the harness.