码迷,mamicode.com
首页 >  
搜索关键字:implement strstr    ( 2381个结果
LeetCode "Implement Queue using Stacks"
Very similar as "Implement Stack using Queues".class Queue { stack _s0; stack _s1; int _front; public: // Push element x to the back of...
分类:其他好文   时间:2015-07-07 07:03:55    阅读次数:112
[LeetCode][Java] String to Integer (atoi)
题目: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible...
分类:编程语言   时间:2015-07-06 14:19:22    阅读次数:145
leetcode | Implement strStr() | 实现字符串查找函数
Implement strStr() : https://leetcode.com/problems/implement-strstr/Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 如:haystack = “bcbcda”; nee...
分类:其他好文   时间:2015-07-05 16:48:14    阅读次数:342
Implement Stack using Queues 用队列实现栈
Implement the following operations of a stack using queues. push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element. empty() -- Retur...
分类:其他好文   时间:2015-07-05 16:44:56    阅读次数:148
一个字符串中查找另一个字符串出现的次数
#include #include int strstrcount( char *str1, char *str2 ) { char *str = str1; int c = 0; while( (str = strstr( str, str2 )) != NULL ) { c++; str++; } return c; } int main() {...
分类:其他好文   时间:2015-07-04 21:04:33    阅读次数:131
【c语言】模拟库函数strstr
// 模拟库函数strstr #include #include const char* my_strstr(const char *parent, const char *child) { const char *pgo = parent; const char *cgo = child; const char *pgos = parent; assert(parent != ...
分类:编程语言   时间:2015-07-04 12:43:16    阅读次数:216
【C语言】判断一个字符串是否是一个字符串的旋转字符串
//判断一个字符串是否是一个字符串的旋转字符串 //利用库函数实现 #include #include #include int IsRotate(char *str1, const char *str2) { assert(str1); assert(str2); strncat(str1, str1,strlen(str1)); if (NULL == strstr(str1, ...
分类:编程语言   时间:2015-07-04 11:20:31    阅读次数:211
[C语言】模拟实现库函数strstr,查找子字符串
//模拟实现库函数strstr,查找子字符串 #include #include char * my_strstr( char *dst, const char * src) { assert(dst); assert(src); int i, j, k; for (i = 0; dst[i] != '\0'; i++) { for (j = i, k = 0; src[k] !...
分类:编程语言   时间:2015-07-04 11:19:02    阅读次数:174
Leetcode 28 Implement strStr()
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.在一个字符串中查找另外一个字符串是否存在。暴力 O(...
分类:其他好文   时间:2015-07-04 09:36:32    阅读次数:110
Implement strStr()
称号Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack.方法仅仅须要遍历一遍就可以。 publi...
分类:其他好文   时间:2015-07-03 20:28:49    阅读次数:93
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!