代码:@interface HttpProcessor : NSObject { NSMutableData *buffer;}@property BOOL finished;@property (strong, nonatomic) NSString *html;@end@implement...
分类:
其他好文 时间:
2014-10-09 02:00:57
阅读次数:
141
[leetcode]Implement regular expression matching with support for '.' and '*'....
分类:
其他好文 时间:
2014-10-08 18:03:55
阅读次数:
184
[leetcode]Implement wildcard pattern matching with support for '?' and '*'....
分类:
其他好文 时间:
2014-10-06 19:30:30
阅读次数:
192
这道题我的写法和别人可能不一样,总体思路是一样的
第一步就是判断n的情况,如代码所示
我是将指数n转化成二进制,比如说: 3^45
45的二进制是101101
从左到右扫一遍,跳过第一位。
如果位是0,那么就将结果平方,也就是乘自己。
如果位是1,那么除了要将结果平方,还要再乘一次x
这个的原理是根据指数的性质,如果n=10(二进制),相当于2,如果n左移一位,就是再*2,也...
分类:
其他好文 时间:
2014-10-06 14:11:00
阅读次数:
140
题目最近比赛的题目好多签到题都是找规律的考验智商的题目啊,,,我怎么越来越笨了,,,,通过列举,可以发现规律:从左往右按位扫这个数:当数的长度大于1时:当首位大于3时,答案就是4*4*4*……*4*3(即pow(4,后面的长度-1)*3);否则,则是 首位的数字*4*4*4*……*4*3;当数的长度...
分类:
其他好文 时间:
2014-10-05 21:26:48
阅读次数:
257
/*
*
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without u...
分类:
其他好文 时间:
2014-10-04 17:45:36
阅读次数:
163
/*
*
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without u...
分类:
其他好文 时间:
2014-10-04 14:32:16
阅读次数:
211
整体在一个命名空间POW中,使用时应加上POW :: **** 1namespacePOW{2typedefintt;//使用时可将"int"修改为矩阵中存储的数据类型3consttMOD=t(1e9+7);//改为快速幂要求的模数45template6Tpowmod(Ta,intn,Tmod){....
分类:
其他好文 时间:
2014-10-04 00:50:45
阅读次数:
244
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations:getandset.get(key)- Get the valu...
分类:
其他好文 时间:
2014-10-02 14:48:03
阅读次数:
261
[leetcode]Implement strStr()....
分类:
其他好文 时间:
2014-10-02 10:38:22
阅读次数:
154