Implement strStr().Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.思路:KMP算法算是忘得一干二净,回头有时间看看...
分类:
其他好文 时间:
2014-10-27 10:43:49
阅读次数:
182
Implement strStr().
Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.
输入两个字符串,如果第二个是第一个的字串返回该串在第一个字符串开始的的子串。
比如abcd bc
则返回bcd
...
分类:
其他好文 时间:
2014-10-27 09:24:04
阅读次数:
177
As a simple way to play with functions and loops, implement the square root function using Newton's method.In this case, Newton's method is to approxi...
分类:
其他好文 时间:
2014-10-27 00:18:38
阅读次数:
219
再讲java动态代理前,先来看看代理模式。Proxy类通过组合,对Hello类进行了增强,并对其进行了委托。代理模式代码:public class ProxyPattern { interface IHello{ void say() ; } static class Hello implement...
分类:
编程语言 时间:
2014-10-26 16:54:40
阅读次数:
251
To be an better Gopher, get your hands dirty. Topcoder offered a serials of challenges for learning Golang. In this blog, I tried to implement "Go Lea...
In this challenge, I tried to implement a simple OAuth2 server basing on Simple Web API Server
在开发中经常遇到需要查看一个字符串t是否在字符串s中存在,并找到其第一次出现的位置,也就是在字符串s中查找子串t,我们平常都是怎么实现那?我们最起码有三个方法可以用,CString和string中的find函数,以及string.h中的strstr函数,用起来既简单又快捷,CString是MFC中的东西,string是C++标准库的东西,strstr是C中string.h中的东西,貌似我们没必要非要自己实现定位查找功能……但是如果我偏要想自己实现那?我们能不能模仿MFC中的CString或者C++中的str...
分类:
其他好文 时间:
2014-10-25 23:00:50
阅读次数:
251
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-25 22:57:35
阅读次数:
480
本篇主要使用Struts2实现文件的上传与动态下载功能。出于安全考虑,所以,在硬盘上存储上传的文件的时候,统一都重新命名为随机字符串。用数据库存储真实文件名与随机文件名称之间的关联。下面的是实体类?123456789101112131415public class FileBag implement...
分类:
Web程序 时间:
2014-10-25 18:32:42
阅读次数:
347
Implement strStr().
Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack.
class Solution {
public:
char *strStr(char *haystack, char *ne...
分类:
其他好文 时间:
2014-10-25 17:22:28
阅读次数:
122