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 Lenskart, Criteo, Trello and other companies. Original question asked: Lowest Common Ancestor on an N-ary Tree. Question last reported by a candidate interviewing at Infosys for a Software Engineer interview on Sep 25 2026, 2:06pm PDT.