Leetcode-cn.com 2022-03-21
🟢 653.two-sum-iv-input-is-a-bst
🏷️ Tags
#tree #depth_first_search #breadth_first_search #binary_search_tree #hash_table #two_pointers #binary_tree
Description
给定一个二叉搜索树
Example
🟢 653.two-sum-iv-input-is-a-bst
🏷️ Tags
#tree #depth_first_search #breadth_first_search #binary_search_tree #hash_table #two_pointers #binary_tree
Description
给定一个二叉搜索树
root 和一个目标结果 k,如果 BST 中存在两个元素且它们的和等于给定的目标结果,则返回 true。Example
输入: root = [5,3,6,2,4,null,7], k = 9
输出: true
Leetcode-cn.com 2022-05-01
🟡 1305.all-elements-in-two-binary-search-trees
🏷️ Tags
#tree #depth_first_search #binary_search_tree #binary_tree #sorting
Description
给你
Example
🟡 1305.all-elements-in-two-binary-search-trees
🏷️ Tags
#tree #depth_first_search #binary_search_tree #binary_tree #sorting
Description
给你
root1 和 root2 这两棵二叉搜索树。请你返回一个列表,其中包含 两棵树 中的所有整数并按 升序 排序。.Example
输入:root1 = [2,1,4], root2 = [1,0,3]
输出:[0,1,1,2,3,4]
Leetcode-cn.com 2022-05-11
🟡 449.serialize-and-deserialize-bst
🏷️ Tags
#tree #depth_first_search #breadth_first_search #design #binary_search_tree #string #binary_tree
Description
序列化是将数据结构或对象转换为一系列位的过程,以便它可以存储在文件或内存缓冲区中,或通过网络连接链路传输,以便稍后在同一个或另一个计算机环境中重建。
设计一个算法来序列化和反序列化 二叉搜索树 。 对序列化/反序列化算法的工作方式没有限制。 您只需确保二叉搜索树可以序列化为字符串,并且可以将该字符串反序列化为最初的二叉搜索树。
编码的字符串应尽可能紧凑。
Example
🟡 449.serialize-and-deserialize-bst
🏷️ Tags
#tree #depth_first_search #breadth_first_search #design #binary_search_tree #string #binary_tree
Description
序列化是将数据结构或对象转换为一系列位的过程,以便它可以存储在文件或内存缓冲区中,或通过网络连接链路传输,以便稍后在同一个或另一个计算机环境中重建。
设计一个算法来序列化和反序列化 二叉搜索树 。 对序列化/反序列化算法的工作方式没有限制。 您只需确保二叉搜索树可以序列化为字符串,并且可以将该字符串反序列化为最初的二叉搜索树。
编码的字符串应尽可能紧凑。
Example
输入:root = [2,1,3]
输出:[2,1,3]