~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
Interview roadmap
Trees
Traversals, BSTs, and answers built bottom-up.
34 problems
Interview roadmap
Trees Traversals, BSTs, and answers built bottom-up.
Binary trees guide
- Basics: preorder, inorder and postorder basics easy
- Orchard: branches that need a prop py · c++ · java easy
- Diameter of Binary Tree py · c++ · java easy
- Binary Tree Level Order Traversal py · c++ · java easy
- Validate Binary Search Tree py · c++ · java medium
- Lowest Common Ancestor of a Binary Tree medium
- Serialize and Deserialize Binary Tree medium
- Binary search tree from scratch Citadel py · c++ · java medium
- N-ary tree sum and leaf next-links 3 levels Citadel hard
- OA: Tree height after deleting nodes 3 levels Snowflake hard
- Maximum Depth of Binary Tree py · c++ · java easy
- Cheapest root-to-leaf path CitadelMeta py · c++ · java medium
- Directions inside a Fibonacci tree Databricks py · c++ · java medium
- Invert Binary Tree py · c++ · java easy
- Balanced Binary Tree py · c++ · java easy
- Same Tree py · c++ · java easy
- Subtree of Another Tree py · c++ · java easy
- Lowest Common Ancestor of a Binary Search Tree py · c++ · java medium
- Binary Tree Right Side View py · c++ · java medium
- Count Good Nodes in Binary Tree py · c++ · java medium
- Kth Smallest Element in a BST py · c++ · java medium
- Construct Binary Tree from Preorder and Inorder Traversal py · c++ · java medium
- Insert into a Binary Search Tree py · c++ · java easy
- Delete Node in a BST py · c++ · java medium
Tree DP guide
- Basics: Diameter of a tree basics py · c++ · java easy
- Pruning a diseased fruit tree py · c++ · java easy
- House Robber III py · c++ · java medium
- Binary Tree Maximum Path Sum py · c++ · java medium
- Binary tree cameras py · c++ · java hard
- Barn painting py · c++ · java medium
- OA: Directory encryption with the fewest operations 2 levels Databricks medium
- Best root for a one-way tree Uber py · c++ · java medium
- Count subordinates in a company tree py · c++ · java easy
- Tree Diameter py · c++ · java easy