As reported: AMD Senior Software System Designer, Bengaluru (2026), round 1 (online): coding plus a resume discussion — lowest common ancestor of two nodes in a binary tree, with the focus on approach, code quality and complexity.
Given a binary tree and two nodes p and q in it, return their lowest common ancestor — the deepest node that has both p and q as descendants (a node counts as a descendant of itself). This is LeetCode 236 — Lowest Common Ancestor of a Binary Tree.
Example 1
root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 1 -> 3
Example 2
root = [3,5,1,6,2,0,8,null,null,7,4], p = 5, q = 4 -> 5
Constraints: 2 ≤ nodes ≤ 10^5; values are unique; p ≠ q and both exist in the tree.
Code runner format: one JSON value per line: the tree (LeetCode's level order), then the values of p and q. Implement lowestCommonAncestor(root, p, q); the harness prints the value of the returned node.