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.

No answers yet

Be the first to share your approach to this question

Practice More Questions

2 answers published. Last candidate submission on May 29 2026, 6:57am PDT. Interview question asked to Software Engineers interviewing at Ant Financial, Meta, Red Hat and other companies. Original question asked: Lowest Common Ancestor on an N-ary Tree. Question last reported by a candidate interviewing at MakeMyTrip for a Software Engineer interview on Oct 22 2026, 4:44pm PDT.