码迷,mamicode.com
首页 >  
搜索关键字:implement strstr    ( 2381个结果
Leetcode | Sqrt(x)
Implement int sqrt(int x).Compute and return the square root of x.线性查找会TLE。用二分查找。注意溢出的处理。全部都改成long long. 1 class Solution { 2 public: 3 int sqrt(i...
分类:其他好文   时间:2014-07-27 10:41:02    阅读次数:181
LRU Cache leetcode java
题目:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get ....
分类:编程语言   时间:2014-07-26 09:53:37    阅读次数:402
poj 3080 Blue Jeans
题意:输入N个DNA序列,每个DNA序列长度都为60。找到这些串的最长共有子序列。 注:若找不到,或最长子序列长度小于2,则输出no significant commonalities,否则输出最长公共子串,若长度相同输出字典序最小的 思路:暴力枚举第一个DNA序列的每一个子序列,用strstr()函数与其余的序列进行匹配...
分类:其他好文   时间:2014-07-26 02:50:36    阅读次数:162
[leetcode]Pow(x, n)
Pow(x, n)Implement pow(x,n).算法思路:二分法,没什么好说的,小心点就行;这个题时间比较苛刻。return pow(x,n >> 1) * pow(x,n >> 1) 是过不去的,因此把pow(x,n / 2)求出来先。其实时间复杂度而言,是一样的。【注意】:n的取值范围;...
分类:其他好文   时间:2014-07-26 01:45:56    阅读次数:242
Java与C++相异的地方
继承标识:Java使用extends/implement,C++使用:super:调用父类的某些东西instanceof:RTTI机制(A is instanceif B)final:类似于C++中的const,static区别001:extends and implementimplement--...
分类:编程语言   时间:2014-07-24 17:20:21    阅读次数:227
Wikioi 1204寻找子串位置(strstr()函数)
1204 寻找子串位置题目描述Description给出字符串a和字符串b,保证b是a的一个子串,请你输出b在a中第一次出现的位置。输入描述Input Description仅一行包含两个字符串a和b输出描述Output Description仅一行一个整数样例输入Sample Inputabcd ...
分类:其他好文   时间:2014-07-24 10:00:03    阅读次数:177
C++学习笔记12-模板1
1.  函数模板 函数模板是一个独立于类型的函数,可作为一种方式,产生函数的特定类型版本。   // implement strcmp-like generic compare function  // returns 0 if thevalues are equal, 1 if v1 is larger, -1 if v1 is smaller  template typename...
分类:编程语言   时间:2014-07-23 21:00:05    阅读次数:279
20140723 字符串包含程序
1、字符串包含程序 #include#includeint Strstr(char *String, char *Substring){ if(String==NULL||Substring==NULL||strlen(String)<strlen(Substring)) return -1; ch...
分类:其他好文   时间:2014-07-23 16:55:11    阅读次数:236
【LeetCode】Single Number II
题目 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 wit...
分类:其他好文   时间:2014-07-23 00:13:17    阅读次数:331
Unix/Linux环境C编程入门教程(30) 字符串操作那些事儿
函数介绍 rindex(查找字符串中最后一个出现的指定字符) 相关函数 index,memchr,strchr,strrchr表头文件 #include定义函数 char * rindex( const char *s,int c);函数说明 rindex()用来找出参数s字符串中最后一个出现的参数c地址,然后将该字符出现的地址返回。字符串结束字符(NULL)也视为字符串一部分。返回值 如果找到...
分类:系统相关   时间:2014-07-21 22:37:28    阅读次数:336
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!