1 class Solution { 2 public: 3 vector postorderTraversal(TreeNode *root) { 4 if(root->left == NULL && root->right == NULL) 5 { 6 ...
分类:
其他好文 时间:
2014-08-13 10:16:05
阅读次数:
168
当用低版本VS打开高版本VS创建的工程时,会出现:方案:将该工程的解决方案文件的后缀由xxx.sln改成了xxx.txt然后,查看其内容如下:Microsoft Visual Studio Solution File, Format Version 11.00# Visual Studio 2010...
分类:
其他好文 时间:
2014-08-12 16:11:14
阅读次数:
219
class Solution {public: int longestValidParentheses(string s) { vector stack; int maxlen = 0; int curlen = 0; int last ...
分类:
其他好文 时间:
2014-08-12 12:54:04
阅读次数:
169
状态码含义100客户端应当继续发送请求。这个临时响应是用来通知客户端它的部分请求已经被服务器接收,且仍未被拒绝。客户端应当继续发送请求的剩余部分,或者如果请求已经完成,忽略这个响应。服务器必须在请求完成后向客户端发送一个最终响应。101服务器已经理解了客户端的请求,并将通过Upgrade 消息头通知...
分类:
其他好文 时间:
2014-08-12 10:14:13
阅读次数:
282
Solution:Apparently, I am too naive and I think too few. Here's the detailed solution.What is our chat server?This is something you should discuss wit...
分类:
其他好文 时间:
2014-08-12 05:53:23
阅读次数:
210
Given a set of distinct integers,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not co...
分类:
其他好文 时间:
2014-08-12 03:00:33
阅读次数:
155
PX Deq: Execution Msg
Occurs when a parallel slave is waiting to be told what to do. This is normally considered an idle event, but can cause excessive CPU
in some cases.
Solution
Reduc...
分类:
其他好文 时间:
2014-08-11 21:38:52
阅读次数:
485
思路:先序的第一个元素和后序的最后一个元素是当前子树的根,然后遍历中序序列,找到左右子树的分界线,递归建左子树和右子树。
class Solution {
public:
/*由于是oj,这里假设给的序列是合法的,正常情况是需要判断不合法情况的 */
TreeNode *buildTree(vector &inorder, vector &postorder,int instar...
分类:
其他好文 时间:
2014-08-11 21:37:42
阅读次数:
504
思想:每次取第二个数的最高位进行一次乘法,把结果乘以10和下一次结果相加,题目来源:leetcode
class Solution {
public:
//一个整数乘以一个个位数
string multOneBit(string num,int data)
{
int i = num.size() - 1,carry = 0;
string res;
...
分类:
其他好文 时间:
2014-08-11 21:33:32
阅读次数:
262
描述:要求相邻数2进制差一位先获得n-1的列表表示小于 2^(n-1) 的符合要求的列表,加上最高位的加成 2^(n-1) 就是大于等于 2^(n-1) 的符合要求的列表,后者翻转一下就能够与前者连接上了代码: 1 class Solution: 2 # @return a list of ...
分类:
其他好文 时间:
2014-08-11 20:38:52
阅读次数:
152