摘要: Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on Wikipedia 阅读全文
posted @ 2018-11-24 22:30 Veritas_des_Liberty 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. 阅读全文
posted @ 2018-11-24 22:11 Veritas_des_Liberty 阅读(292) 评论(0) 推荐(0) 编辑
摘要: Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of th 阅读全文
posted @ 2018-11-24 18:31 Veritas_des_Liberty 阅读(180) 评论(0) 推荐(0) 编辑
摘要: Given the root node of a binary search tree (BST) and a value to be inserted into the tree, insert the value into the BST. Return the root node of the 阅读全文
posted @ 2018-11-24 12:22 Veritas_des_Liberty 阅读(215) 评论(0) 推荐(0) 编辑
摘要: Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Retu 阅读全文
posted @ 2018-11-24 11:40 Veritas_des_Liberty 阅读(192) 评论(0) 推荐(0) 编辑
摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2018-11-24 10:51 Veritas_des_Liberty 阅读(226) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only 阅读全文
posted @ 2018-11-24 09:58 Veritas_des_Liberty 阅读(219) 评论(0) 推荐(0) 编辑