Published onJune 20, 2024Implement Trie(Prefix Tree)pythonalgorithmtreeTrieA trie(prefix tree) is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. Implement the Trie class.
Published onJune 19, 2024K-th Largest Element in an arraypythonalgorithmtreeDFSBinary-search-treeGiven an integer array nums and an integer k, return the kth largest element in the array.
Published onJune 18, 2024Construct Binary Tree from Preorder and Inorder TraversalpythonalgorithmtreeDFSBinary-search-treeGiven two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.
Published onJune 17, 2024Minimum Distance between DST nodespythonalgorithmtreeDFSBinary-search-treeGiven the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different nodes in the tree.
Published onJune 16, 2024Range Sum of BSTpythonalgorithmtreeDFSBFSBinary-search-treeGiven the root of a Binary Search Tree (BST), convert it to a Greater Sum Tree
Published onJune 15, 2024Binary Search Tree to Greater Sum TreepythonalgorithmtreeDFSBinary-search-treeGiven the root of a Binary Search Tree (BST), convert it to a Greater Sum Tree
Published onJune 14, 2024Convert Sorted Array to Binary Search TreepythonalgorithmtreeBinary-search-treeGiven an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.
Published onJune 13, 2024Minimum Height TreespythonalgorithmtreeGiven a tree of n nodes, return a list of all MHT(Minimum Height Tree)s' root labels.'
Published onJune 12, 2024Balanced Binary TreepythonalgorithmtreeDFSbinary-treeGiven a binary tree, determine if it is height-balanced.
Published onJune 11, 2024Serialize & Deserialize Binary TreepythonalgorithmtreeBFSbinary-treeDesign an algorithm to serialize and deserialize a binary tree.
Published onJune 10, 2024Merge Two Binary TreespythonalgorithmtreeDFSYou are given two binary trees root1 and root2. Return the merged tree.
Published onJune 9, 2024Inverse Binary TreepythonalgorithmtreeDFSBFSGiven the root of a binary tree, invert the tree, and return its root.
Published onJune 8, 2024Longest Univalue PathpythonalgorithmtreeGiven the root of a binary tree, return the length of the longest path, where each node in the path has the same value.
Published onJune 7, 2024Diameter of Binary TreepythonalgorithmtreeGiven the root of a binary tree, return the length of the diameter of the tree.
Published onJune 4, 2024Maximum Depth of Binary TreepythonalgorithmtreeGiven the root of a binary tree, return its maximum depth.