闭包function createComparisonFunction(propertyName) { return function (object1, object2) { var value1 = object1[propertyName]; var valu...
分类:
编程语言 时间:
2014-10-19 00:00:55
阅读次数:
300
public class Test { final static int[] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, Integer.MAX_VALUE...
分类:
编程语言 时间:
2014-10-18 23:55:01
阅读次数:
241
一次AC题目要求中有空间限制,因此没有采用字符串由量变向中间逐个对比的方法,而是采用计算翻转之后的数字与x是否相等的方法; 1 class Solution: 2 # @return a boolean 3 def isPalindrome(self, x): 4 o...
分类:
编程语言 时间:
2014-10-18 23:50:28
阅读次数:
299
Problem:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the ...
分类:
其他好文 时间:
2014-10-18 23:48:28
阅读次数:
156
1、当strs为空,直接输出“”2、当strs中含有“”,直接输出“”3、strs[0]的最长长度由最短公共长度l决定(code line:15) 1 class Solution: 2 # @return a string 3 def longestCommonPrefix(sel...
分类:
编程语言 时间:
2014-10-18 23:47:06
阅读次数:
270
一次AC字符串就是:count+char 1 class Solution: 2 # @return a string 3 def countAndSay(self, n): 4 str = "1" 5 for i in range(n-1): 6 ...
分类:
编程语言 时间:
2014-10-18 23:45:06
阅读次数:
231
1、在进入while之前,保证x是非负的;2、符号还是专门用flag保存===================3、另一思路:将integer转换成string,然后首位swap,直至中间; 1 class Solution: 2 # @return an integer 3 def ...
分类:
编程语言 时间:
2014-10-18 23:41:02
阅读次数:
253
Time Limit: 1000MS Memory limit: 65536K
题目描述
处理一个复数与一个double数相加的运算,结果存放在一个double型变量d1中,输出d1的值。定义Complex(复数)类,在成员函数中包含重载类型转换运算符:operator double(){return real;}
输入
输入占两行:
第1行是一个复数的实部和虚部,数据以空格分开。...
分类:
其他好文 时间:
2014-10-18 19:45:21
阅读次数:
190
public static final Looper myLooper() {
return (Looper)sThreadLocal.get();
}
先来个Handler执行过程的总结:
1、 Looper.prepare()方法
为当前线程绑定looper,
在looper构造方法中创建一个messageQueue
...
分类:
其他好文 时间:
2014-10-18 17:03:47
阅读次数:
178
求二叉树的镜像:
void MirrorBiTree(BiTree* pNode)
{
if(pNode == NULL||pNode->leftChild ==NULL || pNode->rightChild ==NULL)
return ;
ListNode* temp;
temp = pNode->leftChild;
...
分类:
其他好文 时间:
2014-10-18 14:03:32
阅读次数:
170