/leetcode

Leetcode like problems and solutions

Primary LanguageJavaApache License 2.0Apache-2.0

Tree Problems

View

  • Left View
  • Right View
  • Top View
  • Bottom view

Traversal

  • Morris Order Traversal
  • Level Order Traversal
  • InOrder (Iterative, Recursive)
  • PreOrder (Iterative, Recursive)
  • PostOrder (Iterative, Recursive)

Traversal Advanced

  • Boundary Traversal
  • Diagonal Traversal
  • Vertical Order Traversal
  • Zigzag Order Traversal

Height Related

  • Find height of tree
  • Check if tree is balanced
  • Find Diameter of Tree

Path Sum

  • Max Path Sum

Transformation

  • Binary Tree to DLL
  • DLL to binary tree
  • Construct from binary tree from post-order and in order traversal

Serialization and Deserialization

  • Serialize and Deserialize the binary tree

Misc

  • Inorder Traversal
  • Preorder Traversal
  • Postorder Traversal
  • Binary Tree Level Order
  • Binary search tree to greater sum
  • Next right pointer in each node
  • Max path sum
  • Sum of distances in tree
  • right side view
  • Left View
  • Top View
  • Bottom View
  • Vertical order
  • Diagonal Traversal
  • Boundary Traversal
  • Construct from inorder and preorder
  • Construct from inorder and postorder
  • Inorder and level order
  • Kth smallest element of BST
  • clone a binary tree with random pointer
  • Delete node in bst
  • Binary tree coloring game
  • reverse level order
  • Max product splitted binary tree
  • Lowest common ancestor in BST
  • Lowest common ancestor
  • square root decomposition
  • Flatten binary tree to linked list
  • Convert a binary tree to circular doubly linked list
  • Conversion of sorted DLL to BST
  • Merge Two BST
  • Recover binary search tree
  • Longest zigzag path in binary tree
  • isBstPreorder
  • BST from Postorder
  • Construct from pre and post
  • Binary Tree Cameras
  • Distribute coins in a binary tree
  • inorder succesor
  • image multiplication
  • Univalue subtrees
  • Fenwick tree
  • Segment tree

Classic or interesting Problems

  • Skyline
  • Rat in a maze