Smallest Department Covering Two Employees (LCA Variant on an Org Tree)

Problem: Smallest Department Covering Two Employees (LCA Variant)

A company's org structure is represented as a tree:

  • Internal nodes are departments.
  • Leaf nodes are employees.
  • A...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: