//判断字符串是否是回文?
int fun(char *sre)
{
char *s1,*s2;
s1 = str;
s2=str+strlen(str)-1;
if(strlen(str)%2 != 0)
{
return 0;
}
while(s1
{
if(*s1==*s2)
{
s1++;
s2--;...
分类:
其他好文 时间:
2015-06-22 15:01:57
阅读次数:
225
Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and co...
分类:
其他好文 时间:
2015-06-22 12:30:27
阅读次数:
215
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
...
分类:
其他好文 时间:
2015-06-22 11:14:13
阅读次数:
94
function ClassA() {
var value=4;
this.getValue= function()
{
return value;
}
this.setValue= function(value)
{
this.value=value;...
分类:
编程语言 时间:
2015-06-22 11:14:02
阅读次数:
140
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
For example:
Given the following binary tree,
1...
分类:
其他好文 时间:
2015-06-22 11:13:01
阅读次数:
127
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between).
For example:
Given binary ...
分类:
其他好文 时间:
2015-06-22 11:11:22
阅读次数:
99
/**
* 将二进制字符串转为正常字符串
* @param sBin
* @return
*/
private static String BinaryToString(String sBin) {
StringBuffer sb = new StringBuffer();
//将sBin分割成String数组...
分类:
其他好文 时间:
2015-06-22 11:09:19
阅读次数:
138
1、匿名函数(lambda函数):lambda函数是一种快速定义单行的最小函数,是从Lisp借用来的,可以用在任何需要函数的地方。普通函数定义如下:def f(x,y): return x*yf(2,3)lambda函数定义如下:g=lambda x,y:x*yg(2,3)2、使用lambda...
分类:
编程语言 时间:
2015-06-22 11:05:14
阅读次数:
122
仅在}之前、一个或多个换行之后和程序输入的结尾被插入也就是说你只能在一行、一个代码块和一段程序结束的地方省略分号。也就是说你可以写如下代码function square(x) { var n = +x return n * n}但是却不可以写的像下面代码一样,这样就报错了哦functio...
分类:
Web程序 时间:
2015-06-22 10:58:55
阅读次数:
177
非常巧,前后做了两次,写的代码思路、甚至是空行都是一模一样的...
代码:
class Solution
{
public:
bool isHappy(int n)
{
if (int_set.find(n) != int_set.end())
{
return false;
}
int_set.insert(n)...
分类:
移动开发 时间:
2015-06-22 09:53:56
阅读次数:
140