Pattern · Tree

Tree interview questions

140 tree problems tagged across recent interview reports. Drilled most heavily by meta, linkedin, and apple.

Founder's read

Tree problems form the backbone of technical interviews at scale. With 140+ problems across this pattern and heavy coverage at Meta (65 problems), LinkedIn (57), and Apple (36), you'll almost certainly hit a tree problem in your live OA. Trees test recursion, traversal, and state management simultaneously, three skills interviewers weight heavily. A hard variant (path sum, serialization, node distance) can derail a candidate mid-assessment. StealthCoder solves tree problems invisibly during your live interview, so a tricky traversal or construction problem doesn't sink your round.

Most-asked tree problems

#ProblemDiff# Companies
01Binary Tree Maximum Path SumHARD27
02Binary Tree Zigzag Level Order TraversalMEDIUM19
03Binary Tree Level Order TraversalMEDIUM15
04Binary Tree Right Side ViewMEDIUM13
05Construct Binary Tree from Preorder and Inorder TraversalMEDIUM12
06All Nodes Distance K in Binary TreeMEDIUM10
07Binary Tree CamerasHARD9
08Convert Sorted Array to Binary Search TreeEASY9
09Amount of Time for Binary Tree to Be InfectedMEDIUM8
10Balanced Binary TreeEASY7
11Binary Tree Inorder TraversalEASY7
12Boundary of Binary TreeMEDIUM7
13Convert Sorted List to Binary Search TreeMEDIUM6
14Binary Tree Vertical Order TraversalMEDIUM4
15Construct Binary Tree from Inorder and Postorder TraversalMEDIUM4
16Binary Search Tree IteratorMEDIUM3
17Binary Search Tree to Greater Sum TreeMEDIUM3
18Binary Tree Level Order Traversal IIMEDIUM3
19Binary Tree PathsEASY3
20Collect Coins in a TreeHARD3
21Binary Tree Longest Consecutive SequenceMEDIUM2
22Binary Tree Preorder TraversalEASY2
23Closest Binary Search Tree ValueEASY2
24Closest Binary Search Tree Value IIHARD2
25Closest Leaf in a Binary TreeMEDIUM2
26Construct Quad TreeMEDIUM2
27Convert Binary Search Tree to Sorted Doubly Linked ListMEDIUM2
28Count Good Nodes in Binary TreeMEDIUM2
29Count Nodes Equal to Average of SubtreeMEDIUM2
30Count Nodes With the Highest ScoreMEDIUM2
31Count Pairs of Connectable Servers in a Weighted Tree NetworkMEDIUM2
32Create Binary Tree From DescriptionsMEDIUM2
33All Possible Full Binary TreesMEDIUM1
34Binary Tree Postorder TraversalEASY1
35Binary Tree PruningMEDIUM1
36Binary Tree TiltEASY1
37Binary Tree Upside DownMEDIUM1
38Build Binary Expression Tree From Infix ExpressionHARD1
39Check Completeness of a Binary TreeMEDIUM1
40Choose Edges to Maximize Score in a TreeMEDIUM1
41Complete Binary Tree InserterMEDIUM1
42Construct Binary Search Tree from Preorder TraversalMEDIUM1
43Count Complete Tree NodesEASY1
44Count Paths That Can Form a Palindrome in a TreeHARD1
45Count Univalue SubtreesMEDIUM1
46Count Valid Paths in a TreeHARD1
47Cousins in Binary TreeEASY1
48Create Components With Same ValueHARD1
49Cycle Length Queries in a TreeHARD1
50Deepest Leaves SumMEDIUM1

Showing top 50 of 140 tree problems by # companies asking.

The hedge for the live OA

You can't drill every tree variant before the assessment. StealthCoder runs invisibly during screen share and solves whichever variant they throw at you. No browser extension. No detection signature. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage.

Get StealthCoder
What this means

Tree problems break into clear categories: traversals (inorder, level-order, preorder), BST operations (insertion, validation, conversion), path/value queries (max sum, distance, ancestor), and construction (from arrays or strings). You recognize a tree problem by explicit tree structure in input, recursive subproblem hints, or questions about relationships between nodes. Start drilling binary-tree-inorder-traversal and binary-tree-level-order-traversal for fundamentals, then move to binary-tree-maximum-path-sum and all-nodes-distance-k-in-binary-tree for medium-hard variants. Meta and LinkedIn ask tree problems frequently across all levels; Bloomberg and TikTok skew harder. When a novel tree construction or balancing question lands live and you blank, StealthCoder reads the problem and feeds you the solution in seconds, undetected.

Companies that hire most on tree

The honest play

140 tree problems. You won't drill them all. Pass anyway.

Tree is one of the patterns interviews actually filter on. Memorizing every variant in a week is a fantasy. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds, no matter which tree flavor lands in your live OA. Built by an engineer who got tired of watching his cohort grind for six months and still get filtered at the OA stage. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Tree interview FAQ

How many tree problems should I drill before my OA?+

Aim for 20 to 30 core problems covering traversals, BST operations, and path queries. Meta and LinkedIn candidates report drilling 25-35 before passing consistently. Prioritize traversals and max-path-sum variants, then move to construction and serialization. Quality reps matter more than volume.

Which companies ask the hardest tree problems?+

Meta (65 problems on this pattern), LinkedIn (57), and Bloomberg (31) ask the most tree questions and weight them heavily. Meta's tree problems trend toward complex path queries and balancing. LinkedIn mixes traversals with iterators and BST variants. Expect harder versions at each tier.

How do I recognize a tree problem quickly?+

Look for tree node structures in the input, questions about parent-child relationships, or recursive hints. Problems mentioning 'path', 'distance', 'ancestor', 'traverse', 'serialize', or 'balance' are almost always trees. If you see TreeNode or a graph that's explicitly hierarchical, you're in tree territory.

What's the drill order for tree topics?+

Start with binary-tree-inorder-traversal and binary-tree-level-order-traversal. Move to binary-search-tree-iterator and binary-tree-maximum-path-sum. Then tackle all-nodes-distance-k-in-binary-tree and construction problems like all-possible-full-binary-trees. Leave rare variants (cameras, infection spread) for the last 10% of reps.

Do I need to master tree problems to pass?+

Not completely, but trees appear in roughly 1 in 5 OAs at Meta, LinkedIn, and Apple. Missing one costs you a round. You don't need to be an expert on every variant, but you must be fast on traversals, BST operations, and one hard pattern (path sum or distance). That covers 80% of live problems.

Problem and frequency data sourced from public community-maintained interview-report repos. Problems and trademarks © LeetCode.