周五的晚上,女朋友看爸爸去哪儿,电脑都是我的,狂刷LeetCode,做了十来题,最有印象的还是Power。题目如下:Implement pow(x,n).就是实现x的n次方。这是一题很传统的题目了,但是之前没认真思考过。第一个想法:比如计算pow(x, 100), 计算x,x^2,x^4,x^8,x...
分类:
其他好文 时间:
2014-08-23 01:05:09
阅读次数:
235
利用map判断一本书的状态,0代表借出去了,1代表在暑假,2代表换回来但是还未放回书架
设计一些字符串的处理问题,用一些字符串搜索函数比如 strstr , strchar等等
14072706
230
Borrowers
Accepted
C++
0.015
2014-08-21 02:59:27
AC代码:
#in...
分类:
其他好文 时间:
2014-08-21 11:31:04
阅读次数:
227
Implement pow(x, n).刚开始没想到,后来看remlost的博客才写出来,代码很简练:class Solution {public: double pow(double x, int n) { if(n<0) return 1/power(x...
分类:
其他好文 时间:
2014-08-21 10:59:53
阅读次数:
188
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-08-20 14:04:32
阅读次数:
250
Wildcard Matching
Implement wildcard pattern matching with support for '?' and '*'.
'?' Matches any single character.
'*' Matches any sequence of characters (including the empty sequen...
分类:
其他好文 时间:
2014-08-18 18:34:13
阅读次数:
214
strstr(string,string) = strchr(,) //从前面第一次出现某个字符串的地方截取到最后strrchr(string,string) //从某个字符串从最后出现的位置截取到结尾strpos(string,string[,int]) //某个字符串第一次出现的位置strrpo...
分类:
Web程序 时间:
2014-08-18 09:11:43
阅读次数:
230
下面写怎么让每个首字母相同的联系人归类展示:
在adapter implement SectionIndexer
这样adapter里必须实现以下3个接口:
@Override
public Object[] getSections() { //section的集合
}
@Override
public int getPositionForSection(int...
分类:
移动开发 时间:
2014-08-18 08:05:03
阅读次数:
345
//-----------------------------------------------------------------------------
// File: bulkloop.c
// Contents: Hooks required to implement USB perip...
分类:
其他好文 时间:
2014-08-16 09:36:50
阅读次数:
254
leetcode这道题还挺有意思的,实现通配符,'?'匹配任意字符,'*'匹配任意长度字符串,晚上尝试了一下,题目如下:Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single chara...
分类:
其他好文 时间:
2014-08-16 01:01:59
阅读次数:
351
原题:
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 withou...
分类:
其他好文 时间:
2014-08-15 14:46:48
阅读次数:
207