Binary Tree Cousins Problem
Binary Tree Cousins Problem — ExecCode Medium DSA Practice
Solve the Binary Tree Cousins problem on ExecCode. Free online medium DSA practice in Arrays - Basics. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Practice companion for CodeFlow binary-tree-cousins.
Examples
Input {"root": [8, 4, 12, 2, 6, 10, 14], "x": 2, "y": 10}; Output true. Input {"root": [1, 2, 3, 4], "x": 4, "y": 3}; Output false. Input {"root": [1, 2, 3, null, 4, null, 5], "x": 5, "y": 4}; Output true
Constraints
1 ≤ n ≤ 10^5
Practice Binary Tree Cousins free on ExecCode. Browse DSA problems, topic map, and placement guides.