PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Atlassian

Find smallest common organization for employees

Last updated: Mar 29, 2026

Quick Overview

The question evaluates competency in hierarchical and graph data structures, including tree lowest-common-ancestor reasoning, DAG ancestor minimality, membership-set handling, dynamic updates, and algorithmic complexity analysis.

  • medium
  • Atlassian
  • Coding & Algorithms
  • Software Engineer

Find smallest common organization for employees

Company: Atlassian

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given an organization structure and employee-to-organization membership. Define any reasonable data structures you need. ## Part 1 (base) Assume the org structure is a **tree** (each org has at most one parent). Each employee belongs to **exactly one** org node. Implement a function that returns the **smallest / lowest** organization that contains **both** employees (i.e., the lowest common ancestor org of their org nodes). - Input: `employeeAId`, `employeeBId` - Output: the org id/node representing the minimal common org - You may assume each org node can have a `parent` pointer. ## Part 2 (follow-up) Now assume an employee can belong to **multiple** orgs in the same org tree. Implement a function that returns the **minimal** org that contains both employees, meaning: - the returned org is an ancestor of **at least one** org of employee A, and - an ancestor of **at least one** org of employee B, - and among all such orgs, it is the “lowest/smallest” one (closest to the employees). Clarify how you break ties if there are multiple valid minimal orgs. ## Part 3 (follow-up) Now assume an org can belong to **multiple parent orgs** (i.e., the org structure is a **DAG**, not a tree). Employees may still belong to one or multiple orgs. Return the set of **minimal common org(s)** that satisfy the condition above. (There may be more than one minimal common org in a DAG.) - Define precisely what “minimal” means in a DAG (e.g., no descendant of that org is also a common org). ## Part 4 (follow-up / discussion) The membership edges (employee→org and org→org) can change over time. Discuss how you would support: - `add/remove` employee membership edges - `add/remove` org-to-org edges (while preventing cycles if you require a DAG) - repeated queries for minimal common org(s) State what time/space tradeoffs you would target and any constraints/assumptions (e.g., number of orgs, number of employees, query/update ratio).

Quick Answer: The question evaluates competency in hierarchical and graph data structures, including tree lowest-common-ancestor reasoning, DAG ancestor minimality, membership-set handling, dynamic updates, and algorithmic complexity analysis.

Related Interview Questions

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

You are given an organization structure and employee-to-organization membership. Define any reasonable data structures you need.

Part 1 (base)

Assume the org structure is a tree (each org has at most one parent). Each employee belongs to exactly one org node.

Implement a function that returns the smallest / lowest organization that contains both employees (i.e., the lowest common ancestor org of their org nodes).

  • Input: employeeAId , employeeBId
  • Output: the org id/node representing the minimal common org
  • You may assume each org node can have a parent pointer.

Part 2 (follow-up)

Now assume an employee can belong to multiple orgs in the same org tree.

Implement a function that returns the minimal org that contains both employees, meaning:

  • the returned org is an ancestor of at least one org of employee A, and
  • an ancestor of at least one org of employee B,
  • and among all such orgs, it is the “lowest/smallest” one (closest to the employees).

Clarify how you break ties if there are multiple valid minimal orgs.

Part 3 (follow-up)

Now assume an org can belong to multiple parent orgs (i.e., the org structure is a DAG, not a tree). Employees may still belong to one or multiple orgs.

Return the set of minimal common org(s) that satisfy the condition above. (There may be more than one minimal common org in a DAG.)

  • Define precisely what “minimal” means in a DAG (e.g., no descendant of that org is also a common org).

Part 4 (follow-up / discussion)

The membership edges (employee→org and org→org) can change over time.

Discuss how you would support:

  • add/remove employee membership edges
  • add/remove org-to-org edges (while preventing cycles if you require a DAG)
  • repeated queries for minimal common org(s)

State what time/space tradeoffs you would target and any constraints/assumptions (e.g., number of orgs, number of employees, query/update ratio).

Comments (0)

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 7,500+ 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.