~/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.
41 problems
Interview roadmap
Trees Traversals, BSTs, and answers built bottom-up.
Binary trees guide
- Play first: The Door Maze 1-minute game Binary search tree lookup
- Preorder, inorder and postorder basics py · c++ · java easy
- Orchard: branches that need a prop py · c++ · java easy
- Search in a Binary Search Tree code the boss py · c++ · java easy
- Maximum Depth of Binary Tree ▶ boss game py · c++ · java easy
- Invert Binary Tree ▶ boss game py · c++ · java easy
- Binary Tree Level Order Traversal ▶ boss game py · c++ · java medium
- Validate Binary Search Tree py · c++ · java medium
- Serialize and Deserialize Binary Tree py · c++ · java hard
More practice: 23 problems
- Same Tree py · c++ · java easy
- Diameter of Binary Tree py · c++ · java easy
- Balanced Binary Tree py · c++ · java easy
- Subtree of Another Tree py · c++ · java easy
- Binary Tree Zigzag Level Order Traversal py · c++ · java medium
- Insert into a Binary Search Tree py · c++ · java medium
- Cheapest root-to-leaf path CitadelMeta py · c++ · java medium
- Path Sum II py · c++ · java medium
- Lowest Common Ancestor of a Binary Search Tree ▶ boss game py · c++ · java medium
- Binary Tree Right Side View py · c++ · java medium
- Binary Tree Vertical Order Traversal py · c++ · java medium
- Count Good Nodes in Binary Tree py · c++ · java medium
- Kth Smallest Element in a BST py · c++ · java medium
- Binary Search Tree Iterator py · c++ · java medium
- Lowest Common Ancestor of a Binary Tree py · c++ · java medium
- All Nodes Distance K in Binary Tree py · c++ · java medium
- Path Sum III py · c++ · java medium
- Delete Node in a BST py · c++ · java medium
- Binary search tree from scratch Citadel py · c++ · java medium
- Directions inside a Fibonacci tree Databricks py · c++ · java medium
- Construct Binary Tree from Preorder and Inorder Traversal py · c++ · java medium
- N-ary tree sum and leaf next-links assessment 3 levels Citadel py · c++ · java hard
- Tree height after deleting nodes assessment 3 levels Snowflake py · c++ · java hard
Tree DP guide
- Play first: The Night Owl 1-minute game Tree DP (rob or skip)
- Height of a tree basics py · c++ · java easy
- Pruning a diseased fruit tree py · c++ · java easy
- Count subordinates in a company tree py · c++ · java easy
- Tree Diameter py · c++ · java medium
- House Robber III code the boss py · c++ · java medium
- Barn painting py · c++ · java medium
- Binary Tree Maximum Path Sum py · c++ · java hard
- Binary tree cameras py · c++ · java hard
More practice: 2 problems
- Best root for a one-way tree Uber py · c++ · java medium
- Directory encryption with the fewest operations assessment 2 levels Databricks py · c++ · java medium