PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Atlassian

Find nearest common manager for multiple employees

Last updated: Mar 29, 2026

Quick Overview

This question evaluates proficiency in tree and graph algorithms (lowest common ancestor), input validation for hierarchical data (cycle and disconnected component detection), API design for constructing and querying trees, and algorithmic time/space complexity analysis.

  • Medium
  • Atlassian
  • Coding & Algorithms
  • Software Engineer

Find nearest common manager for multiple employees

Company: Atlassian

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

Given an organizational hierarchy modeled as a rooted tree, build the tree from (employee, manager) pairs and implement a function that, for k ≥ 2 employees, returns their nearest common organization node (i.e., the lowest common ancestor for multiple nodes). Specify and implement APIs to construct the tree, validate input (detect cycles/disconnected components), and compute LCA for a set of nodes efficiently. Discuss and implement approaches for preprocessing (e.g., parent pointers with depths, binary lifting, or Euler tour + RMQ) and analyze time/space complexity. Include clear unit tests for typical and edge cases (employees in different subtrees, missing employees, and the root case).

Quick Answer: This question evaluates proficiency in tree and graph algorithms (lowest common ancestor), input validation for hierarchical data (cycle and disconnected component detection), API design for constructing and querying trees, and algorithmic time/space complexity analysis.

Related Interview Questions

  • Find a secret word using match feedback - Atlassian (hard)
  • Compute a moving average on a stream - Atlassian (hard)
  • Implement sequential and parallel URL requests - Atlassian (medium)
  • Implement sliding-window rate limiter function - Atlassian (medium)
  • Merge intervals and design rating APIs - Atlassian (medium)
Atlassian logo
Atlassian
Jul 31, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
8
0

Given an organizational hierarchy modeled as a rooted tree, build the tree from (employee, manager) pairs and implement a function that, for k ≥ 2 employees, returns their nearest common organization node (i.e., the lowest common ancestor for multiple nodes). Specify and implement APIs to construct the tree, validate input (detect cycles/disconnected components), and compute LCA for a set of nodes efficiently. Discuss and implement approaches for preprocessing (e.g., parent pointers with depths, binary lifting, or Euler tour + RMQ) and analyze time/space complexity. Include clear unit tests for typical and edge cases (employees in different subtrees, missing employees, and the root case).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Atlassian•More Software Engineer•Atlassian Software Engineer•Atlassian Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.