Given an integer, write a function to determine if it is a power of two.Analyse:***Notice that if a number is a power of 2, then the highest binary di...
分类:
其他好文 时间:
2015-08-29 07:27:41
阅读次数:
243
https://leetcode.com/problems/flatten-binary-tree-to-linked-list/二叉树先序遍历,之后做成链表 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4.....
分类:
其他好文 时间:
2015-08-28 19:32:28
阅读次数:
133
直接用实例来说明序列化和反序列化:namespace DynamicTest{ class Program { static void Main(string[] args) { List list = new List(); ...
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ 2 3
5
All root-to-leaf paths are:
["1->2->5", "1->3"]
递归的方法:
publi...
分类:
其他好文 时间:
2015-08-28 17:37:44
阅读次数:
168
开发中常见错误和警告总结(二十二) 变异方法error:Binary operator '+=' cannot be applied to two int operands上面是一个常见的Switf错误,这个时候我们就要想到变异(mutating),只需要在需要修改外面属性的方法前面添加一个 mut...
分类:
移动开发 时间:
2015-08-28 14:54:29
阅读次数:
191
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-08-28 13:13:48
阅读次数:
91
题目:Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the root-to-leaf path1->2->3which ...
分类:
其他好文 时间:
2015-08-28 12:45:15
阅读次数:
125
题目:Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. ...
分类:
其他好文 时间:
2015-08-28 12:40:19
阅读次数:
194
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree. For example:Given the below binary tree, 1 ...
分类:
其他好文 时间:
2015-08-28 00:29:50
阅读次数:
131
from leetcode?https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree/ 比如序列 2, 1, 3 是如下图的BST的preorder 序列: 但是2, 3, 1就不会是一个preorder序列; 先复习一下BST,给...
分类:
其他好文 时间:
2015-08-27 23:19:14
阅读次数:
681