题意:给定两个二进制字符串,返回它们的和
思路:
1.按最长的循环,短的前面补零
2.因为变量少,不用考虑节省空间,定义为int最行了
3.用二进制可能会快一点。不过实现会麻烦一些
复杂度:时间O(m+n),空间O(m+n)...
分类:
其他好文 时间:
2014-05-15 13:17:22
阅读次数:
222
exam1204button.c:26:3: 错误: 程序中有游离的‘\200’
exam1204button.c:26:3: 错误: 程序中有游离的‘\235’
exam1204button.c:26:3: 错误: 程序中有游离的‘\342’
exam1204button.c:26:3: 错误: 程序中有游离的‘\200’
exam1204button.c:26:3: 错误: 程序中有游...
分类:
其他好文 时间:
2014-05-15 13:01:31
阅读次数:
230
Same Tree
Total Accepted: 16072 Total
Submissions: 38790My Submissions
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal i...
分类:
其他好文 时间:
2014-05-15 04:00:39
阅读次数:
319
Unique Binary Search Trees, Given n, how many structurally unique BST's (binary search trees) that store values 1...n?...
分类:
其他好文 时间:
2014-05-15 02:32:11
阅读次数:
245
第三道树的题目,我还是不会,我擦,怎么递归算法还是不能很好理解。看来还得好好研究下递归算法。题目:求一棵树的最大深度。思路:递归地求取左子树最大深度
和 右子树最大深度,返回较大值即为 整棵树的 最大深度。代码:public int maxDepth(TreeNode root) { ...
分类:
其他好文 时间:
2014-05-14 23:07:14
阅读次数:
373
Pat1043代码题目描述:A Binary Search Tree (BST) is
recursively defined as a binary tree which has the following properties:The left
subtree of a node contain...
分类:
其他好文 时间:
2014-05-14 22:03:25
阅读次数:
487
Binary Tree Preorder Traversal
Total Accepted: 18022 Total
Submissions: 51784My Submissions
Given a binary tree, return the preorder traversal of its nodes' values.
For example:
Given b...
分类:
其他好文 时间:
2014-05-14 20:43:22
阅读次数:
242
Linux/RedHat 编译安装GNU gcc g++ 4.9.0 方法及几个编译问题记录...
分类:
系统相关 时间:
2014-05-14 19:55:13
阅读次数:
369
(一)main函数调用
main函数作为程序运行时的入口函数,它是如何被调用的呢?首先必须清楚一点,main函数也是一个函数,它只有被调用才能够执行。其实,在执行可执行程序时,在调用main函数之前,内核会先调用一个特殊的启动例程,将此启动例程作为可执行程序的起始地址。启动例程是如何作为可执行程序的起始地址的?这是由链接编译器设置的,而链接编译器则是由C编译器(如gcc编译器)调用的。启动例程作...
分类:
系统相关 时间:
2014-05-14 19:43:53
阅读次数:
479
[root@OpenSIPSopensips-1.11.1-tls]#makemenuconfigcdmenuconfig;make;cd..make[1]:Enteringdirectory`/usr/local/opensips-1.11.1-tls/menuconfig‘gcc-g-Wall-DMENUCONFIG_CFG_PATH=\"menuconfig/configs/\"-DMENUCONFIG_GEN_PATH=\"etc/\"-DMENUCONFIG_HAVE_SOURCES=1-c-ocf..
分类:
其他好文 时间:
2014-05-14 16:07:32
阅读次数:
341