摘要:
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
leetCode(41):Convert Sorted Array to Binary Search Tree 分类: leetCode 2015-07-17 17:03 95人阅读 评论(0) 收藏
摘要:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.取中间的结点作为根结点即平衡二叉树/** * Definition for a binary tree n... 阅读全文
摘要:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
摘要:
1。目录map简介map的功能map的定义在map中添加元素查找并获取map中的元素从map中删除元素map对象的迭代遍历2。map简介map是一类关联式容器,它是模板类。关联的本质在于元素的值与某个特定的键相关联,而并非通过元素在数组中的位置类获取。它的特点是增加和删除节点对迭代器的影响很小,除了... 阅读全文
摘要:
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.According to thedefinition of LCA on Wikipedia: “The lowest ... 阅读全文