Roll Up Completion Progress Through Nested Subtasks

Last updated: November 29, 2026

Quick Overview

Tasks can have subtasks nested to any depth. Given the tree, compute for every task how many leaf work items under it are done out of the total, so the UI can show a progress percentage.

Asana
Coding & Algorithms
Software Engineer
Asana
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Tasks can have subtasks nested to any depth. Given the tree, compute for every task how many leaf work items under it are done out of the total, so the UI can show a progress percentage.

Subtasks and progress indicators appear throughout Asana, from task panes to portfolios. The interviewer checks a post-order traversal, a clear definition of what counts as progress, and awareness that very deep trees break naive recursion.

What the Interviewer Expects
  • Defines progress precisely (leaf work items, and what a completed parent means)
  • Uses post-order aggregation so each parent sums its children
  • Implements it iteratively or explains the recursion depth risk
  • Returns results for every node in one pass
  • Handles leaf-only and single-node trees
Key Topics to Cover
tree traversal
post-order
aggregation
iterative DFS
incremental updates
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you weight subtasks by estimated hours instead of counting them?
  • How would you keep the rollups updated when one subtask is completed, without recomputing the tree?
  • What if a subtask is shared by two parents?
  • How would you show progress for a project with 50,000 tasks?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: {gid: {completed, subtasks}} and a root. A leaf counts as one unit. A parent's progress is the sum of its children's. If a parent itself is marked complete, all its work counts as done. Outpu...

High-Level Design

A parent can only be computed after its children, so we need post-order. An explicit stack with an 'expanded' flag does this without recursion: the first visit pushes the node back as expanded and the...


Submit Your Answer
Markdown supported

Related Questions