← back

Tree

197 questions · 0 seen

All Tree problems

Problems

⊣ 94 Binary Tree Inorder Traversal
⊣ 95 Unique Binary Search Trees II
⊣ 96 Unique Binary Search Trees
⊣ 98 Validate Binary Search Tree
⊣ 99 Recover Binary Search Tree
⊣ 100 Same Tree
⊣ 101 Symmetric Tree
⊣ 102 Binary Tree Level Order Traversal
⊣ 103 Binary Tree Zigzag Level Order Traversal
⊣ 104 Maximum Depth of Binary Tree
⊣ 105 Construct Binary Tree from Preorder and Inorder Traversal
⊣ 106 Construct Binary Tree from Inorder and Postorder Traversal
⊣ 107 Binary Tree Level Order Traversal II
⊣ 108 Convert Sorted Array to Binary Search Tree
⊣ 109 Convert Sorted List to Binary Search Tree
⊣ 110 Balanced Binary Tree
⊣ 111 Minimum Depth of Binary Tree
⊣ 112 Path Sum
⊣ 113 Path Sum II
⊣ 114 Flatten Binary Tree to Linked List
⊣ 116 Populating Next Right Pointers in Each Node
⊣ 117 Populating Next Right Pointers in Each Node II
⊣ 124 Binary Tree Maximum Path Sum
⊣ 129 Sum Root to Leaf Numbers
⊣ 144 Binary Tree Preorder Traversal
⊣ 145 Binary Tree Postorder Traversal
⊣ 173 Binary Search Tree Iterator
⊣ 199 Binary Tree Right Side View
⊣ 222 Count Complete Tree Nodes
⊣ 226 Invert Binary Tree
⊣ 230 Kth Smallest Element in a BST
⊣ 235 Lowest Common Ancestor of a Binary Search Tree
⊣ 236 Lowest Common Ancestor of a Binary Tree
⊣ 257 Binary Tree Paths
⊣ 297 Serialize and Deserialize Binary Tree
⊣ 331 Verify Preorder Serialization of a Binary Tree
⊣ 337 House Robber III
⊣ 341 Flatten Nested List Iterator
⊣ 404 Sum of Left Leaves
⊣ 427 Construct Quad Tree
⊣ 429 N-ary Tree Level Order Traversal
⊣ 437 Path Sum III
⊣ 449 Serialize and Deserialize BST
⊣ 450 Delete Node in a BST
⊣ 501 Find Mode in Binary Search Tree
⊣ 508 Most Frequent Subtree Sum
⊣ 513 Find Bottom Left Tree Value
⊣ 515 Find Largest Value in Each Tree Row
⊣ 530 Minimum Absolute Difference in BST
⊣ 538 Convert BST to Greater Tree
⊣ 543 Diameter of Binary Tree
⊣ 558 Logical OR of Two Binary Grids Represented as Quad-Trees
⊣ 559 Maximum Depth of N-ary Tree
⊣ 563 Binary Tree Tilt
⊣ 572 Subtree of Another Tree
⊣ 589 N-ary Tree Preorder Traversal
⊣ 590 N-ary Tree Postorder Traversal
⊣ 606 Construct String from Binary Tree
⊣ 617 Merge Two Binary Trees
⊣ 623 Add One Row to Tree
⊣ 637 Average of Levels in Binary Tree
⊣ 652 Find Duplicate Subtrees
⊣ 653 Two Sum IV - Input is a BST
⊣ 654 Maximum Binary Tree
⊣ 655 Print Binary Tree
⊣ 662 Maximum Width of Binary Tree
⊣ 669 Trim a Binary Search Tree
⊣ 671 Second Minimum Node In a Binary Tree
⊣ 687 Longest Univalue Path
⊣ 690 Employee Importance
⊣ 700 Search in a Binary Search Tree
⊣ 701 Insert into a Binary Search Tree
⊣ 703 Kth Largest Element in a Stream
⊣ 783 Minimum Distance Between BST Nodes
⊣ 814 Binary Tree Pruning
⊣ 834 Sum of Distances in Tree
⊣ 863 All Nodes Distance K in Binary Tree
⊣ 865 Smallest Subtree with all the Deepest Nodes
⊣ 872 Leaf-Similar Trees
⊣ 889 Construct Binary Tree from Preorder and Postorder Traversal
⊣ 894 All Possible Full Binary Trees
⊣ 897 Increasing Order Search Tree
⊣ 919 Complete Binary Tree Inserter
⊣ 938 Range Sum of BST
⊣ 951 Flip Equivalent Binary Trees
⊣ 958 Check Completeness of a Binary Tree
⊣ 965 Univalued Binary Tree
⊣ 968 Binary Tree Cameras
⊣ 971 Flip Binary Tree To Match Preorder Traversal
⊣ 979 Distribute Coins in Binary Tree
⊣ 987 Vertical Order Traversal of a Binary Tree
⊣ 988 Smallest String Starting From Leaf
⊣ 993 Cousins in Binary Tree
⊣ 998 Maximum Binary Tree II
⊣ 1008 Construct Binary Search Tree from Preorder Traversal
⊣ 1022 Sum of Root To Leaf Binary Numbers
⊣ 1026 Maximum Difference Between Node and Ancestor
⊣ 1028 Recover a Tree From Preorder Traversal
⊣ 1038 Binary Search Tree to Greater Sum Tree
⊣ 1080 Insufficient Nodes in Root to Leaf Paths
⊣ 1104 Path In Zigzag Labelled Binary Tree
⊣ 1110 Delete Nodes And Return Forest
⊣ 1123 Lowest Common Ancestor of Deepest Leaves
⊣ 1145 Binary Tree Coloring Game
⊣ 1161 Maximum Level Sum of a Binary Tree
⊣ 1261 Find Elements in a Contaminated Binary Tree
⊣ 1302 Deepest Leaves Sum
⊣ 1305 All Elements in Two Binary Search Trees
⊣ 1315 Sum of Nodes with Even-Valued Grandparent
⊣ 1325 Delete Leaves With a Given Value
⊣ 1339 Maximum Product of Splitted Binary Tree
⊣ 1361 Validate Binary Tree Nodes
⊣ 1367 Linked List in Binary Tree
⊣ 1372 Longest ZigZag Path in a Binary Tree
⊣ 1373 Maximum Sum BST in Binary Tree
⊣ 1376 Time Needed to Inform All Employees
⊣ 1377 Frog Position After T Seconds
⊣ 1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree
⊣ 1382 Balance a Binary Search Tree
⊣ 1443 Minimum Time to Collect All Apples in a Tree
⊣ 1448 Count Good Nodes in Binary Tree
⊣ 1457 Pseudo-Palindromic Paths in a Binary Tree
⊣ 1483 Kth Ancestor of a Tree Node
⊣ 1519 Number of Nodes in the Sub-Tree With the Same Label (PRO)
⊣ 1530 Number of Good Leaf Nodes Pairs (PRO)
⊣ 1569 Number of Ways to Reorder Array to Get Same BST
⊣ 1600 Throne Inheritance
⊣ 1609 Even Odd Tree
⊣ 1617 Count Subtrees With Max Distance Between Cities
⊣ 1719 Number Of Ways To Reconstruct A Tree
⊣ 1766 Tree of Coprimes
⊣ 1916 Count Ways to Build Rooms in an Ant Colony
⊣ 1932 Merge BSTs to Create Single BST
⊣ 1993 Operations on Tree
⊣ 2003 Smallest Missing Genetic Value in Each Subtree
⊣ 2049 Count Nodes With the Highest Score
⊣ 2096 Step-By-Step Directions From a Binary Tree Node to Another
⊣ 2196 Create Binary Tree From Descriptions
⊣ 2236 Root Equals Sum of Children
⊣ 2246 Longest Path With Different Adjacent Characters
⊣ 2265 Count Nodes Equal to Average of Subtree
⊣ 2322 Minimum Score After Removals on a Tree
⊣ 2331 Evaluate Boolean Binary Tree
⊣ 2368 Reachable Nodes With Restrictions
⊣ 2385 Amount of Time for Binary Tree to Be Infected
⊣ 2415 Reverse Odd Levels of Binary Tree
⊣ 2421 Number of Good Paths
⊣ 2440 Create Components With Same Value
⊣ 2458 Height of Binary Tree After Subtree Removal Queries
⊣ 2467 Most Profitable Path in a Tree
⊣ 2471 Minimum Number of Operations to Sort a Binary Tree by Level
⊣ 2476 Closest Nodes Queries in a Binary Search Tree
⊣ 2477 Minimum Fuel Cost to Report to the Capital
⊣ 2509 Cycle Length Queries in a Tree
⊣ 2538 Difference Between Maximum and Minimum Price Sum
⊣ 2581 Count Number of Possible Root Nodes
⊣ 2583 Kth Largest Sum in a Binary Tree
⊣ 2603 Collect Coins in a Tree
⊣ 2641 Cousins in Binary Tree II
⊣ 2646 Minimize the Total Price of the Trips
⊣ 2673 Make Costs of Paths Equal in a Binary Tree
⊣ 2791 Count Paths That Can Form a Palindrome in a Tree
⊣ 2846 Minimum Edge Weight Equilibrium Queries in a Tree
⊣ 2867 Count Valid Paths in a Tree
⊣ 2872 Maximum Number of K-Divisible Components
⊣ 2920 Maximum Points After Collecting Coins From All Nodes
⊣ 2925 Maximum Score After Applying Operations on a Tree
⊣ 2973 Find Number of Coins to Place in Tree Nodes
⊣ 3067 Count Pairs of Connectable Servers in a Weighted Tree Network
⊣ 3068 Find the Maximum Sum of Node Values
⊣ 3203 Find Minimum Diameter After Merging Two Trees
⊣ 3241 Time Taken to Mark All Nodes
⊣ 3249 Count the Number of Good Nodes
⊣ 3319 K-th Largest Perfect Subtree Size in Binary Tree
⊣ 3327 Check if DFS Strings Are Palindromes
⊣ 3331 Find Subtree Sizes After Changes
⊣ 3367 Maximize Sum of Weights after Edge Removals
⊣ 3372 Maximize the Number of Target Nodes After Connecting Trees I
⊣ 3373 Maximize the Number of Target Nodes After Connecting Trees II
⊣ 3425 Longest Special Path
⊣ 3486 Longest Special Path II
⊣ 3515 Shortest Path in a Weighted Tree
⊣ 3544 Subtree Inversion Sum
⊣ 3553 Minimum Weighted Subgraph With the Required Paths II
⊣ 3558 Number of Ways to Assign Edge Weights I
⊣ 3559 Number of Ways to Assign Edge Weights II
⊣ 3562 Maximum Profit from Trading Stocks with Discounts
⊣ 3575 Maximum Good Subtree Score
⊣ 3585 Find Weighted Median Node in Tree
⊣ 3590 Kth Smallest Path XOR Sum
⊣ 3593 Minimum Increments to Equalize Leaf Paths
⊣ 3715 Sum of Perfect Square Ancestors
⊣ 3772 Maximum Subgraph Score in a Tree
⊣ 3786 Total Sum of Interaction Cost in Tree Groups
⊣ 3812 Minimum Edge Toggles on a Tree
⊣ 3820 Pythagorean Distance Nodes in a Tree
⊣ 3841 Palindromic Path Queries in a Tree