1 class Solution { 2 public: 3 // param n : description of n 4 // return: description of return 5 long long trailingZeros(long long n) ...
分类:
其他好文 时间:
2015-06-28 17:04:28
阅读次数:
213
1 class Solution { 2 public: 3 /** 4 * @param A, B: Two string. 5 * @return: the length of the longest common substring. 6 */ ...
分类:
其他好文 时间:
2015-06-28 17:00:49
阅读次数:
94
1 class Solution { 2 public: 3 /** 4 * @param s A string 5 * @return the length of last word 6 */ 7 int lengthOfLastWord(strin...
分类:
其他好文 时间:
2015-06-28 16:53:33
阅读次数:
145
1 class Solution { 2 public: 3 /** 4 * @param s A string 5 * @return Whether the string is a valid palindrome 6 */ 7 bool isPa...
分类:
其他好文 时间:
2015-06-28 16:46:14
阅读次数:
298
Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor...
分类:
其他好文 时间:
2015-06-28 15:32:03
阅读次数:
126
/** 将image懒加载,获取图片 使用self.icon给image赋值*/-(UIImage *)image { if (_image == nil) { _image = [UIImage imageNamed:self.icon]; } return _im...
分类:
其他好文 时间:
2015-06-28 15:29:13
阅读次数:
106
Given a range [m, n] where 0 >1; n = n>>1; count++; } return m<<count; }}
分类:
其他好文 时间:
2015-06-28 15:22:19
阅读次数:
93
存储过程创建如下:create proc jiancha(@a int,@b nvarchar(20),@c int output)asset @a=3;set @b='ssss';set @c=1;return 7777;Go其中,@c是输出参数,然后return 7777是返回值。然后,ado....
分类:
Web程序 时间:
2015-06-28 14:00:13
阅读次数:
185
实现库函数strcat
字符串的连接,给出核心代码,至于安全性,就不考虑了。
char* strcat(char* dest, const char* src)
{
char* crtn = dest;
while(*dest++);
dest--;
while((*dest++ = *src++) != '\0');
return crtn;
}
还有更简单的做法吗?...
分类:
其他好文 时间:
2015-06-28 12:50:53
阅读次数:
129
字符串查找两种情况,查找返回子字符串的指针位置和在字符串中的位置。
1.
const char* strstr(const char* src, const char* sub)
{
if (src == NULL && sub == NULL)
{
return src;
}
const char* ps = src;
const char* pb = sub;
while ...
分类:
其他好文 时间:
2015-06-28 12:49:28
阅读次数:
99