#kmp class Solution(object): def strStr(self, haystack, needle): """ :type haystack: str :type needle: str :rtype: int ...
分类:
编程语言 时间:
2015-11-29 23:06:26
阅读次数:
187
题目来源https://leetcode.com/problems/next-permutation/Implement next permutation, which rearranges numbers into the lexicographically next greater permut...
分类:
编程语言 时间:
2015-11-27 21:53:57
阅读次数:
219
题目:Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in fron...
分类:
其他好文 时间:
2015-11-27 14:36:37
阅读次数:
129
俩stack模拟queue,每次往第一个里面push,要pop的时候pop第二个,如果第二个为空,先把第一个的都放到第二个里面,再pop第二个。平均下来每个数据的时间复杂度为o(1)class MyQueue { // Push element x to the back of queue. ...
分类:
其他好文 时间:
2015-11-27 06:45:50
阅读次数:
161
1.strcat<两个字符串连接函数>2.strlwr<将字符串中大写字母转化成小写字母>3.strupr<将字符串中小写字母转化成大写字母>4.部分函数实现。<strcat,strset,strstr,strchr>1.strcat函数实现自己连接自己此方法不会实现自己给自己连接,会出现死循环。原因..
分类:
其他好文 时间:
2015-11-27 01:17:35
阅读次数:
165
题目:Implement a basic calculator to evaluate a simple expression string.The expression string contains onlynon-negativeintegers,+,-,*,/operators and em...
分类:
其他好文 时间:
2015-11-26 06:57:15
阅读次数:
173
模拟实现strstr:在系统库函数中,存在strstr函数,它用于查找子字符串。它的函数原型为:char*strstr(constchar*string,constchar*strCharSet);这个函数中是要从*string中查找*strCharSet子字符串。因为只是查找,这两个字符串都不用发生改变,所以将他们声明为常量字符串。模..
分类:
其他好文 时间:
2015-11-25 19:39:14
阅读次数:
120
14.6 Implement a CircularArray class that supports an array-like data structure which can be efficiently rotated.The class should use a generic type, ...
分类:
编程语言 时间:
2015-11-24 14:28:48
阅读次数:
195
LeetCode 232 Implement Queue using Stacksclass Queue { stack input, output;public: void push(int x) { input.push(x); } void pop(voi...
分类:
其他好文 时间:
2015-11-23 10:07:54
阅读次数:
180
在 str 中查找子串 str2 的出现次数 // 参数:1->源字符串,2->查找的字符串,3->计数 int getStringCount(char *strSource, char *strFind, int *nCount)第三个参数是查找的数量,可以返回查找多个str的数量,查找两个字符串...
分类:
其他好文 时间:
2015-11-23 06:14:15
阅读次数:
171