Coding

Lowest Common Ancestor on an N-ary Tree

Find the lowest common ancestor on an N-ary tree.

Input: root = [1,null,2,3,4], p = 2, q = 3

Output: 1

Explanation: Both nodes 2 and 3 are direct children of the root node 1, making 1 the lowest common ancestor.

Was asked at

Practice this question with AI

First session is free - no credit card required.

Go Premium

More interviews, more skills, more success.

Community Answers

1 answer from the community

Unlock Full Access

Answer any un-answered question from our database to unlock all community answers for 30 days.

Give & Take

Practice More Questions

3 answers published. Last candidate submission on Nov 6 2026, 9:37am PDT. Interview question asked to Software Engineers interviewing at TikTok, Braintree, Ironclad and other companies. Original question asked: Lowest Common Ancestor on an N-ary Tree. Question last reported by a candidate interviewing at Mollie for a Software Engineer interview on Nov 3 2026, 1:17pm PDT.