Tree Interview Questions
120 interview questions in our bank cover Tree, most of them Coding Questions. They average 3.0/5 difficulty β medium β and each one was reported by a candidate after a real interview. Companies known to ask about Tree: Amazon, Google, Uber, Snowflake, Meta, and 15 more.
Practice these on the problems board βCompanies that ask about Tree
Question mix
- Coding Questions120
Difficulty
- 2/5 β easy22
- 3/5 β medium78
- 4/5 β hard20
Tree questions at Amazon
Employee Importance
2/5Add up the importance score of one employee together with everyone below them in the reporting chain, direct reports and their reports alike. This Amazon question is a traversal over a hierarchy given as a flat list, so the first real step is building the lookup that turns identifiers into records. You will choose between recursion and an explicit stack, avoid revisiting nodes, and reason about depth on a deep chain. Subscribers can read the full problem and the reference solution.
Coding QuestionsAmazonMaximum Depth of a Binary Tree
2/5This foundational tree-traversal problem, commonly asked during Amazon technical screenings, asks you to calculate the maximum depth of a binary tree represented via a level-order array format. It serves as an excellent test for recursion, tree traversal algorithms, and understanding hierarchical data structures. The complete problem statement, test cases, and clean code implementation are exclusively available with a paid subscription.
Coding QuestionsAmazonClassify Tree Node Relationship: Sibling, Cousin, or Other
2/5A coding question on telling how two labelled nodes of a rooted tree, where a node can have any number of children, are related. It asks whether they share a parent, sit on the same level under different parents, or neither, and how to answer when a value is absent.
Coding QuestionsAmazonMaximum-Sum Root-to-Leaf Path
3/5This Amazon coding question explores your proficiency with binary tree data structures and traversal algorithms. You are tasked with navigating a tree, represented in a specific format, to identify a particular path. The core challenge involves calculating sums along various paths from the root down to a leaf node and then determining which of these paths yields the highest total. This problem effectively tests your recursive thinking and ability to manage state during tree exploration. The full problem and model solution require a subscription.
Coding QuestionsAmazonPer-Level Mean of a Serialized Tree
2/5A coding question about a binary tree supplied as a level-order list with gaps for missing children. The learner returns the average node value of every level, from the root down, and must handle uneven levels, zero values and very deep trees.
Coding QuestionsAmazonManager With Highest Average Salary Among Reports
3/5This Amazon interview question focuses on hierarchical data processing and aggregation over employee reporting structures. You must compute statistical metrics for direct reports to identify top-performing managers, as well as aggregate performance across entire organizational trees. The challenge tests your graph traversal capabilities, recursive thinking, and efficient database or in-memory grouping techniques. Gain access to the complete challenge description and professional model solution by purchasing a subscription.
Coding QuestionsAmazonOrg-Chart Salary Aggregation
3/5A coding question on aggregating salaries over a management hierarchy. It asks for the manager with the best-paid direct team, then for the average pay across a whole reporting chain below a chosen person. A subscription is needed to see the full statement and a model solution.
Coding QuestionsAmazonSmallest String Starting From a Leaf
3/5Featured in Amazon technical screenings, this tree traversal puzzle challenges you to identify the alphabetically first character sequence formed by traveling from any bottom-most node up to the root. It tests your ability to navigate hierarchical structures while managing string comparisons efficiently. Unlock the full problem description and comprehensive solution by getting a subscription.
Coding QuestionsAmazonLowest Common Ancestor in an N-ary Tree
3/5In this interview scenario frequently used by Amazon, you are tasked with identifying the deepest shared ancestor of two specific nodes within a hierarchical tree structure where nodes can possess multiple children. The challenge examines your capability to traverse tree hierarchies and manage parent-child relationships effectively without relying on binary tree assumptions. Developing a clean, recursive approach is key to passing the evaluation. The full problem text and the complete model solution are locked behind a subscription.
Coding QuestionsAmazonBinary Tree Right-Side View
3/5Traversing hierarchical tree structures to extract specific perspectives is a fundamental algorithmic task frequently asked in technical screenings at Amazon. This coding challenge requires you to determine which nodes remain visible when observing a binary tree exclusively from the right edge, moving top to bottom. You will need to implement an efficient traversal strategy to capture the correct elements. Access to the full problem text and optimal solution code requires a subscription.
Coding QuestionsAmazonBinary Tree to String and Back
4/5A coding question about saving a binary tree of integers as a single string and rebuilding exactly the same tree from that string alone. Trees with one-sided branches, negative or repeated values and up to a thousand nodes are all part of the task.
Coding QuestionsAmazonRelationship Between Two Tree Nodes
3/5This Amazon interview question challenges candidates to analyze the structural relationship between two specified nodes within a given binary tree. You'll need to traverse the tree efficiently, likely using a breadth-first or depth-first approach, to determine if the nodes share a parent, are at the same depth but have different parents, or fall into a general "other" category. This problem assesses your understanding of tree properties and traversal algorithms. The full problem and model solution require a subscription.
Coding QuestionsAmazonPath in a Zigzag Labelled Binary Tree
3/5Explore this interesting tree-navigation puzzle featured in Amazon interviews, where rows follow an alternating directional pattern rather than standard layouts. Given a target node identifier, your goal is to reconstruct the exact sequence of steps from the tree apex down to that specific location. This problem tests your mathematical intuition regarding tree indexing and hierarchical traversal patterns. Discover the full problem statement and clean code solution by securing a subscription today.
Coding QuestionsAmazon
Tree questions at Google
Divide Tree Nodes
3/5Split the nodes of a tree into as few groups as possible with no two neighbours sharing a group, then reason about the pair values inside those groups. Asked at Google, the first half has a clean answer because a tree is two-colourable, so two groups always suffice unless the tree is a single node. You will prove the colouring bound, then handle the value-based objective the follow-up adds on top. Subscribers get the complete problem and the model solution.
Coding QuestionsGoogleCheck Whether a Template Occurs in Leaf Text of a Binary Tree
3/5Read the characters stored in a binary tree's leaves from left to right and decide whether a given pattern appears somewhere in that sequence. This Google question combines a traversal with substring search, and the interesting part is doing it without materialising the whole concatenation first. You will handle spaces inside leaves, keep the matcher fed incrementally, and give an honest complexity bound for both the traversal and the search. A subscription unlocks the complete problem and the model solution.
Coding QuestionsGoogleCompute Total Size of a File System
2/5A coding question about adding up the space used by every file in a nested directory tree. It asks for two versions of the same function, one of which must cope with directories nested far deeper than a call stack allows.
Coding QuestionsGoogleLongest Step-by-One Chain in a Tree
3/5A coding question on binary trees: report the longest chain of linked nodes whose values rise by exactly one at each step. It first asks only for parent-to-child chains and then for chains that may go up and change direction at a node.
Coding QuestionsGoogleDictionary Words by Prefix
3/5A coding question on the lookup behind an autocomplete box: given a dictionary once, answer many queries for all words that begin with what the user has typed. It checks sorted, duplicate-free output, case-sensitive matching, empty queries and very long words.
Coding QuestionsGoogleEmployee Hierarchy Add / Delete
3/5Master tree manipulation and relationship tracking with this reported Google interview question, which challenges candidates to build an organizational hierarchy management system. You will need to implement functionality for onboarding new personnel, removing records by identifier, and gracefully handling complex edge cases such as executive restructuring, circular reporting loops, and seniority-based promotions. This exercise tests your ability to maintain structural integrity and handle dynamic pointer modifications efficiently under constraints. Access the complete problem description and expert model solution with an active subscription.
Coding QuestionsGoogleHuffman Tree Construction
4/5Featured in advanced Google onsite coding rounds, this problem requires constructing an optimal prefix tree from a given frequency map of symbols. Candidates must implement a greedy algorithm utilizing a priority queue to iteratively merge the least frequent elements until a unified tree structure is formed. This exercise tests your ability to write clean, production-ready code while demonstrating strong command over fundamental data structures. Unlock the full problem details and reference solution by subscribing to our platform.
Coding QuestionsGoogleExpression Tree Single-Leaf Mutation
3/5This Google interview question requires evaluating a boolean logic tree and efficiently recalculating the root outcome following individual leaf value mutations. It assesses tree traversal strategies, state caching, and the ability to minimize redundant computations. Unlock the full problem specification and expert solution by subscribing today.
Coding QuestionsGoogleMaintain Manager/Peer Relationships and Answer Queries
3/5A design question about an employee reporting chart that answers who manages whom, directly or through a chain. It tests data modeling, edge cases such as cycles and reassignment, and query cost.
Coding QuestionsGoogleSum of Distances to All Nodes in a Tree
4/5Given an undirected tree, compute for every node the sum of its distances to all other nodes. The problem tests tree traversal, careful reuse of results between neighbouring nodes and handling large trees without deep recursion.
Coding QuestionsGoogleStreaming Insert + Find K-th Largest
3/5A coding question on a streaming collection of numbers that must answer rank queries with an arbitrary rank each time. It tests how you keep values ordered under insertions and handle repeated values.
Coding QuestionsGoogle
Tree questions at Uber
K-th Employee Receiving Data
3/5Trace how information spreads through a reporting hierarchy and report who receives it at a given position in the order. This Uber question specifies the propagation precisely: a person is served first, then passes it to their reports in ascending identifier order, each doing the same. You will build the child lists from the manager array, traverse in exactly that order, and answer several queries without redoing shared work. A subscription unlocks the full problem and the reference solution.
Coding QuestionsUberVertical Order Traversal of a Binary Tree
4/5This reported Uber interview question evaluates your ability to navigate hierarchical structures by arranging tree nodes into columns and rows. You will need to implement a strategy that accurately computes spatial coordinates for each element, ensuring proper sorting by horizontal placement, depth, and node values when ties occur. This task tests your proficiency with custom sorting logic and tree traversal algorithms. Access to the complete problem description and expert model solution requires a subscription.
Coding QuestionsUberText Codec for Binary and N-ary Trees
4/5A coding question about saving trees as text and loading them back. The learner writes encode and decode functions for a binary tree and then for a tree whose nodes have any number of children, keeping every node's position and value, including negative numbers, missing children and very deep trees.
Coding QuestionsUberMinimum Edge Reversals from Every Root
4/5A coding question on a directed tree with up to 100,000 nodes: pick the start node needing the fewest flipped edges so all nodes become reachable from it.
Coding QuestionsUberCount Palindrome-Formable Paths in a Tree
4/5A coding question on a rooted tree whose edges carry lowercase letters. You count the node pairs whose connecting path has letters that can be reordered into a palindrome, for trees far too large to examine pair by pair.
Coding QuestionsUberBinary Tree Longest Consecutive Sequence II
3/5Discover how to determine the longest unbroken sequence of adjacent values that differ by one within a hierarchical tree structure. Reported as an interview challenge at Uber, this problem evaluates your grasp of tree traversal techniques, recursive state management, and bidirectional path tracking. Candidates must handle both ascending and upward-downward transitions smoothly. Unlock the full problem description, algorithmic walkthrough, and optimal code implementation by upgrading to a paid subscription.
Coding QuestionsUberPalindrome Ancestor Path Queries
4/5In this reported Uber interview challenge, you are tasked with analyzing hierarchical tree structures to evaluate character arrangements along ancestral paths. The problem tests your proficiency with tree traversal, string frequency counting, and efficient querying of path properties without incurring performance bottlenecks. You will explore how multiset character frequencies dictate palindrome feasibility from any node up to the root. Sharpen your graph traversal and data structure optimization techniques with this engaging puzzle. The full problem and model solution require a subscription.
Coding QuestionsUberKth Smallest Element in a BST
3/5Shared as a notable interview exercise at Uber, this question asks you to locate a specific ranked value within a binary search tree. Beyond the standard recursive approach, you will need to consider advanced constraints such as operating under strict memory limits and handling alternate order variations. This problem evaluates your deep understanding of tree properties, traversal techniques, and pointer manipulation. Unlock the comprehensive problem details and a thoroughly explained model solution with a subscription.
Coding QuestionsUberDeepest Shared Ancestor of Two Nodes in a Binary Tree
3/5A binary tree coding question: given a tree in level order and two of its values, return the deepest node that has both of them below it or is one of them. It checks handling of the case where one target sits above the other, input with missing children, and very deep trees.
Coding QuestionsUberRebuild an N-ary Tree and List Its Values by Depth
3/5A coding question on rebuilding a tree whose nodes may have many children from a flat list of integers, then returning the node values one depth at a time.
Coding QuestionsUberCompress a Binary Grid into a Region Tree and Rebuild It
3/5A coding question on turning a square image of 0s and 1s into a compact tree of uniform square regions, then rebuilding the image from that tree. It checks the exact node layout and the order of the four quarters.
Coding QuestionsUber
Tree questions at Snowflake
Tree Node Deletion β Max Height
3/5Hierarchical data manipulation is a key theme in advanced algorithmic interviews, as demonstrated by this Snowflake tree modification challenge. Given an N-ary tree and a set of nodes targeted for removal, you must compute the maximum resulting height after bypassing deleted nodes and rerouting their descendants. This problem evaluates your depth-first search techniques, tree pointer restructuring, and recursive height calculations. To review the entire problem specification along with the step-by-step solution, a subscription is needed.
Coding QuestionsSnowflakeRadio Waves
3/5Find the longest path through a network of transmitters where every consecutive pair along the route broadcasts on frequencies within one step of each other. Asked at Snowflake, the network is a tree, so the answer is a constrained diameter: the usual two-pass or rooted-depth technique still applies, but an edge only counts when the two frequencies are compatible. You will compute the best downward reach per device, combine two branches at each device, and return zero when no pair can reach each other at all. The complete problem and the reference solution are available to subscribers.
Coding QuestionsSnowflakeLongest Path of Equal Values in a Binary Tree
3/5A coding question about a binary tree given as a level-order list. The learner finds the length, in edges, of the longest path whose nodes all hold the same value, wherever that path starts and ends.
Coding QuestionsSnowflakeAnti-Clockwise Outline of a Binary Tree
3/5A coding question on binary trees: list the nodes on the outer edge of a tree in anti-clockwise order without repeating any node. Careful handling of leaves and of nodes with a single child is needed.
Coding QuestionsSnowflakeThrone Inheritance Order
3/5Reported as an interview challenge at Snowflake, this problem requires you to simulate a family hierarchy and maintain a dynamic line of succession. You will need to design a system that handles birth announcements, tracks fatalities without breaking lineage connections, and generates the current inheritance sequence based on preorder tree traversal rules. This exercise evaluates your proficiency with tree-based data structures, object-oriented design, and efficient state management. Access to the full problem text and a comprehensive model solution requires a paid subscription.
Coding QuestionsSnowflakePre-order Traversal Skipping Invalid Nodes
2/5This Snowflake interview question asks you to implement a modified pre-order tree traversal that handles disconnected or skipped nodes. You will need to process hierarchical data where specific elements are marked as inactive, ensuring that their descendants are still visited in the correct sequence through their nearest active ancestors. This exercise tests your recursive depth-first search logic and ability to manipulate parent-child relationships efficiently. Unlock the full problem description and complete model solution with a subscription.
Coding QuestionsSnowflakeRewrite Second Tree With Subtree Sums
2/5A coding question on binary trees: given two trees of the same shape, fill the second so that each node holds a total taken from the first. It checks in-place updates, very deep inputs and a discussion of sharing the work across a fixed number of workers.
Coding QuestionsSnowflakeForest Parent Array: Delete a Node
2/5A coding question on removing one node from a forest stored as a parent array. The result must renumber the remaining nodes and still describe a valid forest, with the original list left as it was.
Coding QuestionsSnowflake
Tree questions at Meta
Prioritized Task Listing with Sub-task Ordering
3/5Build a task-list class that hides finished, assigned and repeated tasks and prints the rest in a precise priority order, with ties broken by several rules. A second method then places sub-tasks before or after their parent depending on due dates, at any nesting depth.
Coding QuestionsMetaSum of Search-Tree Keys Within a Range
2/5A coding question on summing the keys of a binary search tree that fall inside an inclusive numeric range. It covers inclusive bounds, empty trees, negative keys and very deep unbalanced trees.
Coding QuestionsMetaLowest Common Ancestor in Ordered and Unordered Binary Trees
3/5A coding question about finding the closest shared ancestor of two nodes, first in an ordered tree and then in an unordered one, with discussion variations on missing nodes and other tree shapes. It checks edge cases such as one node sitting above the other, repeated values and very deep trees.
Coding QuestionsMetaLowest Common Ancestor of a Binary Search Tree
2/5Mastering tree traversal algorithms is essential for passing technical screens at top firms like Meta. This coding challenge requires candidates to construct a hierarchical tree structure and determine the shared ancestor node for a given pair of elements. The problem tests your ability to leverage the ordered properties of hierarchical data structures efficiently without performing exhaustive searches. To view the comprehensive problem breakdown and examine the complete expert solution, a subscription is required.
Coding QuestionsMetaSum Root-to-Leaf Numbers
3/5Explore this intriguing tree traversal problem frequently encountered in technical interviews at Meta. The objective is to evaluate numeric sequences formed by traversing hierarchical nodes from the uppermost starting point down to the terminal endpoints. This exercise tests your ability to navigate tree data structures efficiently and apply recursive logic to aggregate values. Discovering the optimal traversal strategy and implementing a clean algorithm will sharpen your recursive problem-solving skills. The complete problem statement and model solution require a subscription.
Coding QuestionsMetaBinary Tree Boundary Sequence
3/5Reported as a classic Meta coding interview challenge, this problem requires you to extract the perimeter nodes of a binary tree in a very specific order. You will need to trace both the left and right outer boundaries while ensuring that shared elements are accounted for without duplication. This task evaluates your mastery of tree traversal techniques, recursive logic, and edge-case handling. Unlock the full problem statement and optimized model solution with a subscription.
Coding QuestionsMetaLongest Path in a Tree
3/5A coding question about finding the greatest distance between any two nodes of a tree given as an edge list. The tree can be very deep and very large, so the solution has to avoid both deep recursion and repeated work.
Coding QuestionsMetaGroup Binary Tree Nodes by Column
3/5A coding question on binary trees. Given a tree, group its node values by horizontal position and list the groups from left to right with a precise order inside each group. It checks careful handling of ties and of very deep trees.
Coding QuestionsMeta
Tree questions at Rubrik
Battle with Upper Moon 6
4/5Confront an intricate grid simulation puzzle featured in coding assessments at Rubrik, where you manage the cascading revival states of defeated entities across a matrix. Each cell updates based on precise chronological rules and hierarchical dependencies, requiring sophisticated tracking of dependent subtrees and state transitions over multiple turns. This rigorous challenge evaluates your advanced graph traversal strategies, multidimensional array manipulation, and algorithmic efficiency under complex business rules. The full problem and model solution require a subscription.
Coding QuestionsRubrikSave the Universe
4/5This advanced tree-partitioning challenge, featured in Rubrik technical interviews, evaluates your ability to decompose hierarchical structures into linear segments under strict size and weight constraints. Candidates must carefully analyze nodes and paths to optimize grouping efficiently while adhering to cumulative thresholds. Tackling this problem requires sophisticated dynamic programming or greedy strategies combined with tree traversal techniques. Discovering the complete problem statement and reviewing the expert model solution require a subscription.
Coding QuestionsRubrikKey Sum Management
3/5Hierarchical data management and sequential update propagation are tested in this sophisticated algorithmic challenge reported from Rubrik. The exercise requires maintaining a tree-like network of keys where nodes can be dynamically appended and batched value modifications apply across entire depth levels. It evaluates your expertise in designing custom tree structures and handling cascading updates efficiently. Access to the full problem text and the complete reference solution requires an active subscription.
Coding QuestionsRubrikMaximize Happiness
4/5Tackle a complex hierarchical optimization challenge encountered during engineering interviews at Rubrik, where you select an ideal managerial subtree and a cost-effective team subset to maximize overall enterprise satisfaction within budget limits. This task blends tree traversals and knapsack-like constraints. Gain full access to the complete problem instructions and a professional implementation by subscribing.
Coding QuestionsRubrikValidate BFS Order on a Tree Built from Two Parent Vectors
4/5Reported as a challenging interview question from Rubrik, this problem requires you to reconstruct a hierarchical tree structure from edge lists and validate whether given sequences represent legitimate breadth-first search traversal orders. Candidates must verify complex queue behaviors and level-by-level node relationships under strict structural hierarchies. This task tests your deep understanding of tree properties and graph traversal validation. Get full access to the complete problem description and model solution with a subscription.
Coding QuestionsRubrik
Tree questions at Apple
Collapsible Tree View With +/- Toggle State
2/5A coding question that models a familiar user-interface widget as plain data: a nested hierarchy whose branches open and close, and a text listing of what a user would currently see. It checks careful state handling when ancestors close and reopen, controls pressed on rows that are out of view, childless entries and bad identifiers.
Coding QuestionsAppleCount Value Occurrences in a Binary Tree
3/5Count how many nodes of an arbitrary binary tree hold a particular value, with no ordering to exploit. This Apple phone-screen question is short on purpose: what the interviewer watches is whether you clarify the value type and the empty-tree case before writing anything. You will traverse every node exactly once, pick recursion or an explicit stack with a reason, and state the cost in terms of node count and tree height. Subscribers can read the full problem and the reference solution.
Coding QuestionsAppleTree Column Order with Row and Value Tie-Breaks
4/5A coding question about reading a binary tree column by column, as if it were drawn on a grid. It checks precise ordering rules for nodes that share a column or occupy the very same grid cell.
Coding QuestionsAppleWord Index with Exact and Prefix Lookup
3/5A coding question about building a small word index class. You add words one at a time and answer two kinds of question: whether a word was stored, and whether any stored word begins with a given string.
Coding QuestionsAppleLazy Sorted-Order Iterator over a Binary Search Tree
3/5A coding question about building an ascending-order iterator over a binary search tree. The iterator must produce one value per call, keep memory proportional to the tree height rather than its size, and stay correct with several independent iterators; a discussion follow-up covers concurrent updates.
Coding QuestionsApple
Tree questions at Two Sigma
SWE / QSE OA β Sewer Tree Partition
3/5Reported as a Two Sigma SWE/QSE OA question, this problem presents a rooted tree structure defined by parent pointers and associated node values. The task is to identify a single edge to remove such that the tree splits into two components, and the absolute difference between the sums of values in these two new subtrees is minimized. This evaluates your ability to perform tree traversals, calculate subtree aggregates, and apply optimization techniques. The full problem and model solution require a subscription.
Coding QuestionsTwo SigmaMaximum Independent Set on a Tree
4/5Examine this classic graph theory challenge featured in software engineering interviews at Two Sigma. The task involves finding the largest possible subset of nodes within a hierarchical network such that no two chosen elements share a direct connection. This problem tests your expertise in dynamic programming on trees and optimizing independent sets under structural constraints. Working through this scenario enhances your ability to design efficient algorithms for complex relationship networks. The complete problem statement and model solution require a subscription.
Coding QuestionsTwo SigmaHuffman-Style Binary Encode / Decode
4/5Master data compression techniques by developing a compression and decompression utility inspired by Huffman encoding, previously featured in interviews at Two Sigma. This challenge evaluates your ability to build hierarchical frequency structures and translate textual data into compact bit streams while adhering to precise rules. Candidates must carefully handle tree construction logic and byte manipulations to successfully pass the evaluation. Access the complete problem description and an optimized reference solution with a paid subscription.
Coding QuestionsTwo Sigma
More Tree questions
Maximum Reporting Layer (Tree Height)
2/5Measure how many levels deep a company's reporting structure goes, given the manager-to-report pairs rather than a ready-made tree. This Rippling question is a height computation whose first step is building the child lists; after that it is one traversal. You will decide between a breadth-first level count and a recursive depth, agree on whether the root counts as a level, and handle a company of one person. A subscription unlocks the complete problem and the reference solution.
Coding QuestionsRipplingDistributed Machine Cluster Count and Topology
3/5Discover facts about a cluster of machines arranged as a tree, where each machine can only pass messages to its immediate parent and children. Asked at OpenAI, the difficulty is that sends are asynchronous, delivery order is not guaranteed, and messages can arrive more than once. You will design a request-and-aggregate protocol over that unreliable channel, make handlers idempotent, and decide how a node knows its subtree has finished reporting. A subscription unlocks the full problem and the complete protocol design.
Coding QuestionsOpenAIDelete a File System Subtree with Limited APIs
3/5This file system manipulation puzzle, featured in Datadog interviews, tasks developers with deleting an entire directory subtree using a severely restricted set of immutable application programming interfaces. Because deletion rules prevent removing non-empty directories directly, candidates must devise a reliable traversal strategy to clean up nested paths safely. This problem evaluates recursive problem-solving skills and meticulous edge-case handling within hierarchical structures. Gain immediate access to the full problem breakdown and expert solution with a subscription.
Coding QuestionsDatadogJob Tree Total Cost and Top Root Jobs
3/5A coding question on a tree of jobs linked by which job launched which. You roll each job's duration up into the total cost of its subtree, then compare the top-level jobs, pick a winner with a fixed tie-break rule and report the third-ranked total. Very deep nesting must be handled without overflowing the call stack.
Coding QuestionsCollegeVineValidate Binary Search Tree
3/5Explore how to analyze hierarchical tree structures to verify adherence to strict ordering rules, a classic graph traversal challenge frequently featured in technical evaluations at Pinduoduo. This exercise assesses your ability to recursively or iteratively enforce boundaries across descendant nodes while handling edge cases cleanly. Sharpen your algorithmic thinking for validating relational hierarchies efficiently. Access to the comprehensive problem description, optimal strategies, and complete code solutions requires a platform subscription.
Coding QuestionsPinduoduoFile / Folder / Team Permissions β Fewest Grants
3/5This coding interview question, featured by Figma, requires you to evaluate hierarchical access control lists spanning teams, folders, and files to determine the minimal set of nodes needed to summarize a user's permissions. The exercise tests your tree traversal proficiency and object-oriented design skills when dealing with inherited privileges over unconventional data models. Access the full problem description, optimal traversal algorithms, and clean implementation code with a subscription.
Coding QuestionsFigmaLongest Path in an Undirected Tree (Edge-List Diameter)
3/5A coding question about an acyclic connected network described by its links: how many links lie on the longest route between any two of its points? It checks whether a candidate can reason about where such a route must end, avoids assuming it passes through a particular point, and copes with long chain-shaped inputs without running out of stack.
Coding QuestionsQualcommInvert Binary Tree
2/5Mirror a binary tree so that every node's children swap sides, and return the same root. This Microsoft warm-up is three lines recursively and is asked to check that you recurse before or after the swap consistently, and that you handle a missing child without a special case. You will choose between recursion and an explicit queue, note the depth cost of each, and confirm the tree is modified rather than copied. A subscription unlocks the complete problem and the reference solution.
Coding QuestionsMicrosoftNested Todo List
3/5Reported during Notion interview loops, this problem asks candidates to build a hierarchical task manager capable of handling nested structures and completion states. The exercise evaluates tree manipulation, efficient node lookup, and state mutation within a forest data model. Developers must carefully manage parent-child relationships and sequential updates. To unlock the complete problem specifications and model solution, a subscription is required.
Coding QuestionsNotionDesign a Workspace File System (Folders and Tables)
3/5This Clay interview question challenges you to build a memory-based directory structure supporting directories and tabular data elements. You will need to implement core management actions including generation, direct enumeration, and cascading removal of hierarchical items. Candidates must focus on efficient tree traversal and state management. Access to the complete problem breakdown and verified code implementation requires a subscription.
Coding QuestionsClayMinimum Flips to Match Expected Binary Values in a Tree
3/5Examine a tree manipulation puzzle reported as an interview question at UKG, where you must transform initial binary node states to match a target configuration using selective parity-based subtree operations. This challenge tests your grasp of tree traversals, recursive state propagation, and greedy optimization techniques. You will learn how to plan operation sequences efficiently to minimize total transformations. Unlock the complete problem details and optimal model solution with a subscription.
Coding QuestionsUKGBuild Nested Comments from Flat List with parentId
3/5Transforming a flat array of user remarks into a hierarchical tree structure is a common frontend engineering challenge often encountered in interviews at companies like Bobyard. This problem tests your ability to efficiently organize related records using parent identifiers while handling edge cases such as missing nodes or chronological sorting requirements. To view the complete problem statement along with an optimized algorithmic solution, a subscription is required.
Coding QuestionsBobyardChain of Command
3/5Explore this organizational hierarchy challenge reported during interviews at IMC Trading. The task involves navigating a corporate tree structure to determine which employee receives a directive based on a specific propagation sequence and query parameter. This exercise tests your ability to handle tree traversal, parent-child relationships, and efficient indexing strategies. Access to the comprehensive problem statement and verified model solution requires a subscription.
Coding QuestionsIMC TradingPrint Directory Tree Given a File Path
3/5This Adobe interview challenge asks developers to traverse a nested data structure representing a hierarchical file system and output a visually formatted tree of directories and files. The task evaluates recursion, string manipulation, and error handling for missing or unexpected path types. Building a clean, indented visual representation tests fundamental tree traversal skills under structured constraints. Unlock the full problem description and expert reference solution by subscribing today.
Coding QuestionsAdobeBinary Tree Maximum Path Sum (Tree Kadane)
4/5Featured frequently in Adobe technical rounds, this tree-based challenge requires finding the maximum possible sum along any continuous path within a binary tree where nodes can hold negative integers. Unlike traditional root-to-leaf traversals, the path can start and end at arbitrary nodes, demanding a dynamic programming approach akin to Kadane's algorithm adapted for hierarchical structures. This problem thoroughly tests your recursion, tree manipulation, and optimal substructure identification skills. Get full access to the problem description and expert solution with a subscription.
Coding QuestionsAdobeCount Levels
3/5In this BlackRock interview task, you are given a hierarchical list of employee and manager relationships to compute the distance or number of intervening levels between two individuals within an organization. The exercise evaluates your ability to model tree structures, construct adjacency graphs, and find paths or lowest common ancestors efficiently. Navigating hierarchical relationships is a practical skill frequently applied in enterprise software design. Gain full access to the problem breakdown and model solution by subscribing.
Coding QuestionsBlackRockMenu Tree Diff β Count Changed Nodes
3/5A coding question on comparing two versions of a hierarchical menu and counting the items that changed, were removed or were added. It tests careful reading of how identity is defined, subtree counting and handling very deep inputs.
Coding QuestionsDoorDashXOR-Shift Generator and Tree Document Encryption
3/5A two-stage bit manipulation exercise: build a tiny deterministic random generator out of shifts and exclusive-or, then turn its output into a stream cipher for a nested document. It checks 32-bit masking in a language without overflow, canonical serialization, and strict failure on a bad key, and it ends with why such a scheme is not secure.
Coding QuestionsBasetenMaximum Time Required to Transfer Data
3/5Find the longest transfer time between any two machines in a network shaped as a tree, where each hop costs one unit. This Rippling question is the tree diameter, and the two-sweep technique is the expected answer: the farthest node from anywhere is an endpoint, and the farthest node from there gives the length. You will justify why two sweeps suffice, handle a single-machine network, and avoid the quadratic all-pairs computation. The complete problem and the reference solution are available with a subscription.
Coding QuestionsRipplingTree Diameter
3/5Explore how to determine the longest distance between any two vertices within an acyclic connected graph in this reported interview question from Verkada. This exercise evaluates your proficiency with graph traversal algorithms, tree properties, and efficient node distance calculations. You will learn how to approach hierarchical structures to find maximal spans without relying on a fixed root. Access to the complete problem breakdown and optimal model solution requires an active subscription.
Coding QuestionsVerkadaComment System Formatting
3/5This interview question, frequently asked at Nextdoor, challenges candidates to format and display hierarchical data structures with proper indentation levels. The task tests your ability to handle tree-like relationships, parse parent-child identifiers, and manage missing nodes by leaving empty placeholders while preserving the structure of subsequent descendants. You will need to implement an efficient traversal algorithm that correctly orders the elements. Unlock the complete problem description and an optimal model solution by acquiring a subscription.
Coding QuestionsNextdoorCount Invalid Nodes in a Binary Search Tree
3/5A binary tree coding question: given a tree in level order that is meant to be a binary search tree, count how many children break the ordering rule relative to the node directly above them. It checks careful reading of the ordering rule, tree input with missing children, and very deep trees.
Coding QuestionsAppLovinBest Bending Path Sum in a Binary Tree
4/5A coding question on binary trees whose node values may be negative: find the largest total along any chain of connected nodes, then return the values on one such chain in order. Trees can be large and deeply unbalanced.
Coding QuestionsByteDanceBuild Binary Tree from Edges / S-Expression
3/5Encountered during technical screenings at Optiver, this parsing challenge requires candidates to reconstruct hierarchical structures from parent-child relationship pairs. You must rigorously validate incoming text against a strict hierarchy of error rules and, upon success, format the resulting hierarchy into a standardized S-expression representation. This problem tests your aptitude for robust input validation, tree manipulation, and simulation logic. Access to the full problem specification and optimal code solution requires an active subscription.
Coding QuestionsOptiverRemove Subtrees Below a Threshold
2/5A coding question on cleaning up an ordered tree: every value under a given cutoff must go, together with everything hanging beneath it, and the remaining tree is returned. Reading the removal rule precisely matters, because it differs from keeping the still-valid descendants.
Coding QuestionsPayPalFilter Nested Comments β Keep Matched Nodes and Descendants
3/5Tackle this Bobyard technical screening question centered around hierarchical tree filtering and traversal. Given a nested discussion forest and a specific match condition, you need to prune the structure so that any matching nodeβalong with its entire subtree of descendantsβis preserved while unrelated branches are discarded. This challenge tests your recursive programming abilities, tree manipulation techniques, and optimization strategies for linear time complexity. Unlock the complete problem details and model solution with a subscription.
Coding QuestionsBobyardCourse Scheduler β Print Path (Simplified)
2/5Featured during a technical screening at Oracle, this simplified dependency resolution task requires candidates to generate an ordered sequence of study modules based on single prerequisite links. The challenge tests your graph traversal capabilities and how well you can map out linear execution orders under strict dependency rules. Interviewers use this scenario to evaluate clean implementation speed and foundational data structure handling within a tight timeframe. Access to the full problem description and the expert-crafted model solution requires an active subscription.
Coding QuestionsOracleGrant / Revoke / Check Access on Hierarchy
3/5Explore a hierarchical access control design problem reported during Pinterest interviews. You will implement a robust permission management class capable of granting, revoking, and verifying entity rights across a static tree structure with high efficiency. The exercise emphasizes optimizing lookup paths and traversing parent nodes rather than descending the tree. Unlock the complete technical breakdown and professional implementation guide by subscribing today.
Coding QuestionsPinterestReport Chain Org Tree
3/5Navigate hierarchical data structures with this engaging organizational tree question reported during Reddit engineering interviews. The exercise assesses your graph traversal proficiency, ability to construct parent-child relationships from flat data, and skill in solving structural queries like lineage tracking and lowest common ancestors. You will strengthen your mastery of recursive algorithms and tree-based indexing techniques. Gain access to the complete problem description, traversal strategies, and verified model solution with a paid subscription.
Coding QuestionsRedditRoot-to-Leaf Path Sum and All Matching Paths
3/5Given a binary tree and a target number, decide whether a route from the top node down to an end node adds up to that number, and list every route that does. The task checks careful handling of end nodes, negative values and recorded copies of partial results. Subscribers can see the full statement, constraints and model solution.
Coding QuestionsHudson River TradingImplement Nested Comments Feature for a Comment System
2/5In this Bobyard reported interview question, you must transform a flat collection of comment records into a hierarchical structure where individual responses correctly nest beneath their corresponding parent items. The task requires building a recursive or pointer-based grouping function that efficiently handles multiple levels of depth using unique identifiers. It tests your data organization abilities and proficiency with hierarchical JSON payloads. Access to the complete problem breakdown and expert model solution requires an active subscription.
Coding QuestionsBobyardConvert a BST to a Sorted Circular Doubly Linked List
3/5A pointer-manipulation question on trees: rearrange the nodes of a binary search tree into an ordered ring that can be walked in both directions, without creating new nodes. A follow-up asks how to keep the ring ordered as values are added, and the edge cases include empty and single-node trees.
Coding QuestionsPinterestCount Subtrees with Height-Diff <= 1 and Even Sum
3/5Count the subtrees of a binary tree that pass two checks at once: the heights of their two sides differ by at most one, and the values inside add up to an even number. The task asks you to reason about each node together with everything below it. The full problem and model solution require a subscription.
Coding QuestionseBayOrg Chart Subtree Report Count with Incremental Updates
3/5A coding question on maintaining an organisation chart that answers how many people sit below a given person, while employees are added and reassigned between managers. The focus is keeping answers correct and cheap to read after each change, including invalid changes.
Coding QuestionsMicrosoftTree Preorder Merge
2/5Two binary trees are overlaid so that coinciding nodes add their values and lone nodes carry over. The task is to report the combined tree's values in root, left, right order.
Coding QuestionsHudson River TradingDesign a Workspace Folder Tree (File-System-like API)
3/5In this system design and data structure challenge reported from Clay, you are tasked with architecting an in-memory hierarchical directory tree that supports recursive creation, ordered listing, relocation, and deletion of paths. The prompt evaluates your capability to design clean object-oriented APIs, manage tree-based pointer mutations, and handle edge cases involving nested path hierarchies. Read the full problem requirements and study the production-ready model implementation by obtaining a subscription.
Coding QuestionsClayCount Downward Paths With a Target Sum
3/5A coding question on counting the parent-to-child paths in a tree with any number of children whose values add up to a given number. Values can be negative or zero, and paths may begin and end at any node.
Coding QuestionsByteDanceBST from Scratch (insert - search - delete)
3/5Reported as a rigorous coding challenge during Citadel interviews, this task requires building a binary search tree data structure completely from scratch, supporting standard insertion, membership testing, and node deletion while maintaining tree invariants. The core difficulty lies in safely handling complex node removal scenarios and managing pointer logic under varying structural conditions. Review the detailed technical breakdown and optimal class design by securing your subscription.
Coding QuestionsCitadelPrint Comments Hierarchically by Parent-Child Relationship
2/5In this engaging coding exercise reported during Nextdoor interviews, engineers are tasked with organizing a flat collection of user remarks into a structured, tree-like hierarchy based on parent-child identifier relationships. The primary objective is to render these discussion threads correctly indented and sequentially ordered in the output. This challenge evaluates your proficiency in graph traversal, recursive thinking, and efficient data structuring using mapping techniques. To view the complete problem statement, detailed constraints, and a robust reference implementation, a paid subscription is required.
Coding QuestionsNextdoorGet Most Hydrated Team
3/5Featured in Airtable engineering interviews, this organizational hierarchy challenge requires determining which corporate branch maintains the highest beverage consumption average. Given employee records and reporting structures that form tree-like networks, you must aggregate metrics across reporting lines to find the winning group. The task assesses your proficiency in tree traversal, recursion, and hash-based data aggregation. Unlock full access to examine the complete problem statement, constraints, and an optimal code solution.
Coding QuestionsAirtableRBAC Role Resolver with Inheritance
3/5This Stripe interview question requires building a permission verification mechanism that handles hierarchical organizational structures. Candidates must write a resolver class capable of tracking user permissions across parent and child entities while correctly accumulating and filtering inherited authorizations. This exercise tests graph traversal techniques, efficient caching strategies, and data modeling for access control systems. Accessing the complete problem statement, test suites, and expert-crafted reference implementation requires a paid subscription.
Coding QuestionsStripeUser Journey Paths (Action Log Trie Summary)
3/5Analyzing sequential event logs to understand user behavior patterns is a common task in modern product engineering. Featured in technical rounds at Whatnot, this coding problem asks you to process user activity logs, chronologically sort individual event histories, and aggregate these trajectories into a specialized prefix tree structure. The challenge evaluates your data structure design skills, particularly in maintaining distinct user counts across hierarchical action nodes. Discover the full problem description, edge-case analysis, and fully tested reference implementation with an active subscription.
Coding QuestionsWhatnotCalculate Total Size of Files in Nested Directories
2/5Explore how to traverse hierarchical file systems and compute cumulative byte counts in this Datadog interview question. Candidates will practice handling recursive data structures and aggregating numerical properties across arbitrary tree depths. This challenge evaluates tree traversal techniques and clean implementation habits. Access the complete problem description and model solution with a subscription.
Coding QuestionsDatadogTree Points
4/5Navigating hierarchical structures while optimizing numerical outcomes is a frequent theme in advanced algorithm screenings, such as this reported D. E. Shaw interview question. Participants must evaluate a network of connected nodes, each possessing specific weights, and decide between distinct point-collection strategies that may propagate effects to neighboring vertices. The challenge evaluates your depth in tree-based dynamic programming and recursive state evaluation. The complete problem statement and verified model solution are available to subscribers.
Coding QuestionsD. E. ShawEmployee Training Status + Group Tree Aggregation
3/5This Vanta interview problem requires you to evaluate employee compliance status regarding security training across specified windows and aggregate these metrics hierarchically across organizational group trees. You will build logic to compute exact overdue days for individuals and roll those statistics upward to calculate cumulative headcounts and total delays for overarching departments. The challenge tests your ability to handle date arithmetic alongside recursive tree traversal and data aggregation. Access the full problem details and a clean model solution by subscribing today.
Coding QuestionsVantaN-ary Tree Sum + Leaf next Pointer
3/5In this multi-stage technical assessment from Citadel, candidates must work with custom tree structures, aggregate node values, and restructure references during traversal. The exercise progressively increases in difficulty, culminating in an optimized routine that rearranges pointers in constant auxiliary memory without relying on external collections. Tackling this problem demands strong pointer intuition and careful state management. Unlock the full problem description and expert code implementation with a paid subscription.
Coding QuestionsCitadelSerialize Arithmetic Expression Tree with Minimum Parentheses
4/5A coding question on writing an expression tree of variables and arithmetic operators out as a text formula. The output must stay as compact as possible while still meaning exactly the same thing. It tests careful reasoning about grouping and the order in which operations apply.
Coding QuestionsWaymoHierarchical Path Key-Value Store
3/5A coding and object-oriented design question about a key-value store addressed by directory-style paths. You implement create, update, lookup and delete with folder-like rules for parents and children, precise handling of malformed and trailing-slash paths, and discuss concurrency and durability follow-ups.
Coding QuestionsDoorDashAggregate user journeys from logs and count path/prefix frequencies
3/5Process sequential telemetry records in this data aggregation challenge frequently featured in Whatnot technical rounds. You are tasked with reconstructing chronological user pathways from raw logs and subsequently organizing those trajectories into a prefix tree to compute path frequency statistics at scale. This problem tests your ability to combine sorting operations with efficient tree-based data structures for analytics. Access the complete problem description and optimal reference solution with a subscription.
Coding QuestionsWhatnotOrg Tree Lowest Common Department
3/5In this algorithmic problem reported at Atlassian, you must traverse a corporate hierarchy tree to locate the closest common departmental ancestor for a given set of employees. The task tests your capability to navigate hierarchical data structures, handle multiple search targets, and implement efficient tree traversal algorithms. Access to the comprehensive problem breakdown and optimal solution code requires a paid subscription.
Coding QuestionsAtlassianBinary Tree Right Side View
3/5This tree traversal exercise, often highlighted in software engineering interviews at ByteDance, requires you to extract the outermost visible nodes of a hierarchical structure from a lateral perspective. The task evaluates your mastery of tree traversal techniques, such as breadth-first search and depth-first search, while managing custom data structures and manual test case setup. Access the complete problem description, complexity analysis, and clean code solutions with a subscription.
Coding QuestionsByteDancePath Between Nodes in a Fibonacci Tree
4/5A coding question on a recursively defined binary tree that is far too large to store. Candidates return the list of node labels between two given nodes, in a fixed direction, from the tree's order and the labels alone.
Coding QuestionsDatabricksFile System Encryption Count and Minimum-Cost Encryption
2/5A coding question on a tree of files and folders: first tally the files by state, then choose the cheapest mix of per-file and per-folder operations that leaves every file in the desired state. It covers tree traversal and cost trade-offs on nested structures.
Coding QuestionsDatabricksList Every Root-to-Leaf Value Path
2/5A coding question about traversing a binary tree and returning every complete route to a leaf in deterministic order. It checks edge cases, very deep unbalanced trees and careful management of per-route state.
Coding QuestionsCapital OneRobbing a Tree
3/5Presented during Zip software engineering interviews, this graph theory problem asks you to maximize accumulated value across a hierarchical village network where adjacent nodes cannot be selected simultaneously. It builds upon classic dynamic programming concepts on trees, requiring you to handle general multi-branch relationships rather than standard binary constraints. Discover the complete problem guidelines and optimized algorithmic solution with a paid subscription.
Coding QuestionsZipSame N-ary Tree Comparison
2/5A coding question about checking whether two trees with any number of children per node match exactly. The trees can be very deep, so the comparison has to avoid relying on the call stack.
Coding QuestionsOracle
Studied alongside
Tree interview FAQ
- How many Tree interview questions are there?
- 120 reported questions, mostly Coding Questions.
- Which companies ask Tree questions?
- Amazon (13), Google (11), Uber (11), Snowflake (8), Meta (8), Rubrik (5), Apple (5), Two Sigma (3).
- How hard are Tree questions?
- They average 3.0 out of 5: 22 at 2/5, 78 at 3/5, 20 at 4/5.