Skip to content

Interview Solver

FeaturesPricingHelp
Sign In
FeaturesPricingHelpSign In
Interview Questions›Topics›Dp On Trees

Dp On Trees Interview Questions

Master 27 dp on trees problems frequently asked in technical interviews. These questions test your understanding of dp on treesconcepts and are essential for coding interview success.

27
Total Problems
2
Easy
20
Medium
5
Hard

Related Topics

TreeDepth-First SearchBinary TreeDynamic ProgrammingBreadth-First SearchHash TableArrayGraph Theory
#124HardFrequency: 90.2%

Binary Tree Maximum Path Sum

Asked at DoorDash
Dynamic ProgrammingTreeDepth-First SearchBinary TreeDP on Trees
#1
Rank
#543EasyFrequency: 86.8%

Diameter of Binary Tree

Asked at Meta
TreeDepth-First SearchBinary TreeDP on Trees
#2
Rank
#366MediumFrequency: 76.7%

Find Leaves of Binary Tree

Asked at LinkedIn
TreeDepth-First SearchBinary TreeDP on Trees
#3
Rank
#2175MediumFrequency: 59.9%

Count Nodes With the Highest Score

Asked at DoorDash
ArrayTreeDepth-First SearchBinary TreeDP on Trees
#4
Rank
#337MediumFrequency: 52.1%

House Robber III

Asked at Uber
Dynamic ProgrammingTreeDepth-First SearchBinary TreeDP on Trees
#5
Rank
#1643MediumFrequency: 47.5%

Number of Nodes in the Sub-Tree With the Same Label

Asked at Uber
Hash TableTreeDepth-First SearchBreadth-First SearchCountingDP on Trees
#6
Rank
#298MediumFrequency: 44%

Binary Tree Longest Consecutive Sequence

Asked at TikTok
TreeDepth-First SearchBinary TreeDP on Trees
#7
Rank
#1554MediumFrequency: 40.7%

Minimum Time to Collect All Apples in a Tree

Asked at Meta
Hash TableTreeDepth-First SearchBreadth-First SearchDP on Trees
#8
Rank
#1653MediumFrequency: 39.1%

Number of Good Leaf Nodes Pairs

Asked at TikTok
TreeDepth-First SearchBinary TreeDP on Trees
#9
Rank
#1177MediumFrequency: 39.1%

Tree Diameter

Asked at TikTok
TreeDepth-First SearchBreadth-First SearchGraph TheoryTopological SortDP on Trees
#10
Rank
#896MediumFrequency: 38.5%

Smallest Subtree with all the Deepest Nodes

Asked at Meta
Hash TableTreeDepth-First SearchBreadth-First SearchBinary TreeBinary LiftingLowest Common AncestorDP on Trees
#11
Rank
#1665MediumFrequency: 35.6%

Diameter of N-Ary Tree

Asked at Salesforce
TreeDepth-First SearchDP on Trees
#12
Rank
#1008HardFrequency: 35.1%

Binary Tree Cameras

Asked at Amazon
Dynamic ProgrammingTreeDepth-First SearchBinary TreeDP on Trees
#13
Rank
#1475HardFrequency: 35.1%

Maximum Sum BST in Binary Tree

Asked at Amazon
Dynamic ProgrammingTreeDepth-First SearchBinary Search TreeBinary TreeDP on Trees
#14
Rank
#1218MediumFrequency: 34%

Lowest Common Ancestor of Deepest Leaves

Asked at Meta
Hash TableTreeDepth-First SearchBreadth-First SearchBinary TreeBinary LiftingLowest Common AncestorDP on Trees
#15
Rank
#863HardFrequency: 31.8%

Sum of Distances in Tree

Asked at Google
Dynamic ProgrammingTreeDepth-First SearchGraph TheoryDP on Trees
#16
Rank
#333MediumFrequency: 27.3%

Largest BST Subtree

Asked at Microsoft
Dynamic ProgrammingTreeDepth-First SearchBinary Search TreeBinary TreeDP on Trees
#17
Rank
#1201MediumFrequency: 27.3%

Delete Tree Nodes

Asked at Microsoft
ArrayTreeDepth-First SearchBreadth-First SearchDP on Trees
#18
Rank
#508MediumFrequency: 26.5%

Most Frequent Subtree Sum

Asked at Amazon
Hash TableTreeDepth-First SearchBinary TreeDP on Trees
#19
Rank
#1021MediumFrequency: 21.9%

Distribute Coins in Binary Tree

Asked at Amazon
TreeDepth-First SearchBinary TreeDP on Trees
#20
Rank
#3218HardFrequency: 21.9%

Find Number of Coins to Place in Tree Nodes

Asked at Amazon
Dynamic ProgrammingTreeDepth-First SearchSortingHeap (Priority Queue)DP on Trees
#21
Rank
#549MediumFrequency: 20.3%

Binary Tree Longest Consecutive Sequence II

Asked at Uber
TreeDepth-First SearchBinary TreeDP on Trees
#22
Rank
#687MediumFrequency: 16.4%

Longest Univalue Path

Asked at Google
TreeDepth-First SearchBinary TreeDP on Trees
#23
Rank
#3191MediumFrequency: 16.4%

Maximum Score After Applying Operations on a Tree

Asked at Google
Dynamic ProgrammingTreeDepth-First SearchDP on Trees
#24
Rank
#250MediumFrequency: 10.3%

Count Univalue Subtrees

Asked at Amazon
TreeDepth-First SearchBinary TreeDP on Trees
#25
Rank
#1474MediumFrequency: 7.3%

Longest ZigZag Path in a Binary Tree

Asked at Microsoft
Dynamic ProgrammingTreeDepth-First SearchBinary TreeDP on Trees
#26
Rank
#563EasyFrequency: 7.2%

Binary Tree Tilt

Asked at Amazon
TreeDepth-First SearchBinary TreeDP on Trees
#27
Rank
View All Topics

Master Dp On Trees in Real Interviews

Get AI-powered assistance when solving dp on trees problems during your actual interviews.

Get Started Free

No credit card required

Interview Solver
  • Home
  • About
  • Pricing
  • Sign in
  • Contact
  • Blog
  • Companion
  • Help Center
  • Developers
  • Use Cases
  • Software Engineer
  • Product Manager
  • Misc
  • Privacy Policy
  • Terms and Conditions
  • Refund & Cancellation
  • Discord Community
  • Affiliate Program
  • Compare
  • All Comparisons
  • vs Final Round AI
  • vs UltraCode
  • vs Interview Coder
  • vs LockedIn AI
  • vs AI Apply
  • Free Tools
  • ATS Resume Checker
  • STAR Method Builder
  • Salary Lookup
  • Big O Cheat Sheet
  • Total Comp Calculator
  • View All →
  • Interview Questions
  • Google Questions
  • Amazon Questions
  • Microsoft Questions
  • Meta Questions
  • Apple Questions
  • TikTok Questions
  • View All →
© 2026 Interview Solver, Inc. All rights reserved.