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 ...
分类:
其他好文 时间:
2016-09-04 10:12:08
阅读次数:
139
在写C++程序中,总会遇到要从一个字符串中查找一小段子字符串的情况,对于在C中,我们经常用到strstr()或者strchr()这两种方法。而对于C++的string,我们往往会用到find()。 C++:#inlcude<string>C: #include<string.h>find():在一个 ...
分类:
编程语言 时间:
2016-09-01 22:54:01
阅读次数:
205
字符串操作 strlen()函数:返回字符串的长度 strstr()函数:返回字符串中首次出现子串的地址 strcat()函数:连接字符串 strncat()函数:在字符串的结尾追加n个字符 strcpy()函数:复制字符串 strncpy()函数:复制字符串的前n个字符 memset()函数:将内 ...
分类:
其他好文 时间:
2016-08-27 19:16:07
阅读次数:
159
我们在求职的时候都会去看求职手册,其中CCIC就是一个常用的手册 这里我会放上我自的C++ 实现代码,给毕业生们参考 Implement an algorithm to determine if a string has all unique characters. What if you can ...
分类:
编程语言 时间:
2016-08-27 15:24:16
阅读次数:
198
(1)定义函数模板(function template) 函数模板是一个独立于类型的函数,可以产生函数的特定类型版本。 // implement strcmp-like generic compare function template <typename T> int compare(const ...
分类:
编程语言 时间:
2016-08-25 23:55:19
阅读次数:
157
Implement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) c ...
分类:
其他好文 时间:
2016-08-25 23:48:23
阅读次数:
163
[题目] Implement atoi to convert a string to an integer. [题目解析] 该题目比较常见,从LeetCode上看代码通过率却只有13.7%,于是编码提交,反复修改了三四次才完全通过。该题目主要需要考虑各种测试用例的情况,比如"+5"、" 67"、" ...
分类:
其他好文 时间:
2016-08-25 23:25:38
阅读次数:
136
Problem Description 问题很简单,给你一个字符串s,问s的子串中不包含s1,s2...sn的最长串有多长。 Input 输入包含多组数据。第一行为字符串s,字符串s的长度1到10^6次方,第二行是字符串s不能包含的子串个数n,n<=1000。接下来n行字符串,长度不大于100。 字 ...
分类:
其他好文 时间:
2016-08-24 15:52:32
阅读次数:
168
LeetCode 208 Implement Trie (Prefix Tree)...
分类:
其他好文 时间:
2016-08-24 11:23:33
阅读次数:
146
Part I:equals() (javadoc) must define an equivalence relation (it must be reflexive, symmetric, and transitive). In addition, it must be consistent (i ...
分类:
编程语言 时间:
2016-08-23 23:34:27
阅读次数:
289