随笔分类 - Trees
摘要:297. Serialize and Deserialize Binary Tree Serialization is the process of converting a data structure or object into a sequence of bits so that it ca
阅读全文
摘要:124. Binary Tree Maximum Path Sum A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connect
阅读全文
摘要:105. Construct Binary Tree from Preorder and Inorder Traversal Given two integer arrays preorder and inorder where preorder is the preorder traversal
阅读全文
摘要:230. Kth Smallest Element in a BST Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the valu
阅读全文
摘要:##98. Validate Binary Search Tree Given the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as foll
阅读全文
摘要:102. Binary Tree Level Order Traversal Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to rig
阅读全文
摘要:235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in
阅读全文
摘要:572. Subtree of Another Tree Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure a
阅读全文
摘要:100. Same Tree Given the roots of two binary trees p and q, write a function to check if they are the same or not. Two binary trees are considered the
阅读全文
摘要:217. Contains Duplicate Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the long
阅读全文
摘要:226. Invert Binary Tree Given the root of a binary tree, invert the tree, and return its root. Constraints: The number of nodes in the tree is in the
阅读全文