strstr函数用于判断str2是否是str1的子串,如果是,则返回str2在str1中首次出现位置的地址,如果不是则返回NULL.其模拟实现代码如下:#include<iostream> using namespace std;#include<assert.h>char* my_strstr(c ...
分类:
其他好文 时间:
2016-09-27 19:36:18
阅读次数:
144
https://my.oschina.net/yushulx/blog/298140 How to Implement a Java WebSocket Server for Image Transmission with Jetty 创建一个从WebSocketHandler继承的类WSHandl ...
分类:
编程语言 时间:
2016-09-25 07:24:21
阅读次数:
330
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the ...
分类:
系统相关 时间:
2016-09-24 10:28:55
阅读次数:
189
【线程的创建和启动的步骤(实现Runnable接口方式)】 1.定义Runnable接口的实现类,并重写其中的run方法。run()方法的方法体是线程执行体。class SonThread implement Runnable{ public void run(){......}} 2.创建Runn ...
分类:
编程语言 时间:
2016-09-23 21:35:59
阅读次数:
172
Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. ...
分类:
其他好文 时间:
2016-09-22 01:14:20
阅读次数:
145
题意: Implement int sqrt(int x). Compute and return the square root of x.(Medium) 分析: 二分搜索套路题,不能开方开尽的时候,取结果整数位。 注意:判定条件中,用x / mid == mid而不是 mid * mid == ...
分类:
其他好文 时间:
2016-09-22 01:07:30
阅读次数:
172
php 基本函数explode(" ",$str) 字符串转数组 implode(" ",$arr) 数组转字符串strrchr("I love Shanghai!","Shanghai") 查找子串最后出现的位置,返回该位置到字符串结尾的所有字符strstr("I love Shanghai!", ...
分类:
Web程序 时间:
2016-09-21 18:42:42
阅读次数:
182
Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure.find ...
分类:
其他好文 时间:
2016-09-21 14:35:19
阅读次数:
115
Implement pow(x, n). 看不动书了,简直已经读不进去!!还剩dp和部分hashtable median没看,有兴致再看吧。马丹书上都没有binomial heap为毛老师会讲这种很难实现的数据结构!! Solution1: 思路:递归。要注意把一半的pow存在一个变量再输出,不然复 ...
分类:
其他好文 时间:
2016-09-21 11:38:58
阅读次数:
131