FastPrepTime to Burn a Binary Tree From One Node
Problems/Time to Burn a Binary Tree From One Node

Time to Burn a Binary Tree From One Node

Adobe logoAdobe● MediumFULLTIMEINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem measures how long a fire takes to spread through a whole binary tree when it starts at one node and moves one edge per minute. Two Adobe reports name it. One post by an SDE 2 candidate (posted August 2023, rejected after the third round) links the classic task as the second item of Round 1. It notes a breadth-first and a depth-first approach next to it, and marks the item as done. The other is an entry for an SDE intern role in Bengaluru, India (a copy of a review, January 2022, offer accepted). It comes from an on-campus interview with a college alumnus that also covered databases. It lists the same task under another common name, next to a graph question on bridges. Neither gives limits or examples.

The rules here are those of the linked task: the answer is the number of minutes until the last node burns. Our choices: trees of 1 to 500 nodes with different values from 1 to 10^5, the start given by its value, and new examples.

Our version is about 95% the same as the reported questions.

You are given the root of a binary tree with different node values, and the value start of one node. At minute 0 that node catches fire.

Each minute, every burning node sets fire to the nodes it is directly connected to: its left child, its right child and its parent. Return the number of minutes until every node in the tree is burning.

Function

burnTime(root: TreeNode, start: int) → int

Examples

Example 1

root = [6,2,9,1,4,null,11,null,null,3,5,10]start = 4return = 5
root
62143591110

Minute 1: 2, 3 and 5 catch fire. Minute 2: 6 and 1. Minute 3: 9. Minute 4: 11. Minute 5: 10, the last node. Answer: 5.

Example 2

root = [7]start = 7return = 0
root
7

The only node is already burning at minute 0. Answer: 0.

Example 3

root = [1,2,3,4,5]start = 1return = 2
root
12453

The fire starts at the root. Minute 1 reaches 2 and 3; minute 2 reaches 4 and 5. Answer: 2.

Constraints

  • The tree has between 1 and 500 nodes.
  • 1 <= node.val <= 10^5, and all node values are different
  • start is the value of a node in the tree

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Find All Paths for a Name in a File SystemThe Walt Disney Company · PHONE SCREENThe Walt Disney Company interview questions
  • Tree Height After Child PromotionSnowflake · PHONE SCREENSnowflake interview questions
  • Binary Tree Spiral Level OrderAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Check a Complete Binary TreeGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
  • Tree DiameterQualcomm · PHONE SCREENQualcomm interview questions
  • Frog Position After T SecondsInMobi · PHONE SCREENInMobi interview questions
  • Distance Between Two Nodes in a Binary TreeBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Transform and Prune a Mode-Valued Binary TreeGoogle · PHONE SCREENGoogle interview questions
  • Team Cost Under a ManagerRippling · PHONE SCREENRippling interview questions
  • Symmetric Binary TreeDocuSign · PHONE SCREENDocuSign interview questions

Interview reports that mention this question

  • Adobe SWE Intern Interviews: 27 Experiences (Part 2 of 4)
  • Adobe SDE and Senior SWE Interviews: 9 Experiences (Part 3 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
All Adobe interview questionsSee Adobe hiring insights
Saved
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    public int burnTime(TreeNode root, int start) {
        // Write your code here.
    }
}
Checking account…