码迷,mamicode.com
首页 >  
搜索关键字:strlen    ( 2530个结果
UVA1584环状序列 Circular Sequence
如果是环状可以复制一份变直线求字符串最小表示法,如果存在一种,两个字符串相比前面相同,但是到后面不相同,且必然其中一个字典序打一些,那么大的字符串必然不可1-k前的子窜就不能满足条件。 1 #include <iostream> 2 #include <cstring> 3 using namesp ...
分类:其他好文   时间:2020-07-23 16:27:17    阅读次数:63
c++ sizeof和strlen
1 #include <iostream> 2 #include <cstring> 3 4 int main() 5 { 6 char *str1 = "happy"; 7 //64位系统,返回的是指针的大小(指针占8字节) 8 std::cout << str1 << "-sizeof:" << ...
分类:编程语言   时间:2020-07-22 11:20:43    阅读次数:71
Redis底层数据结构之string
我们都知道,Redis是由C语言编写的。在C语言中,字符串标准形式是以空字符\0作为结束符的,但是Redis里面的字符串却没有直接沿用C语言的字符串。主要是因为C语言中获取字符串长度可以调用strlen这个标准函数,这个函数的时间复杂度是O(N),由于Redis是单线程的,承受不了这个时间复杂度。 ...
分类:其他好文   时间:2020-07-21 11:35:32    阅读次数:69
AcWing 139 回文子串的最大长度(二分,hash ver.)
题目链接 #解题思路 马拉车当然是求最长回文既简单又快速的方法,不过这里因为要联系hash就没用马拉车了。设回文串的中心为a,b(奇回文a=b)先正着hash一遍,再倒着hash一遍,就能得到[a+len,a]和颠倒后的[b,b+len]两个子串哈希值,对比它们的哈希值就能判断两个子串是否相等,至于 ...
分类:Windows程序   时间:2020-07-19 00:48:20    阅读次数:91
最长公共前缀
char * longestCommonPrefix(char ** strs, int strsSize){ char ch; int len=0, i, j; if (strsSize < 1) {return "";} len = strlen(strs[0]); for (i=1; i<st ...
分类:其他好文   时间:2020-07-19 00:36:29    阅读次数:79
PATB1009
#include<stdlib.h> #include<string.h> #include<math.h> int main() { char str[100]; gets(str + 1); str[0] = ' '; for (int i = strlen(str); i >= 0; i--) ...
分类:其他好文   时间:2020-07-18 00:30:37    阅读次数:72
C 实战练习题目75
题目:输入一个整数,并将其反转后输出。 程序分析:无。 实例 - 使用 strlen() 1 #include <stdio.h> 2 int main() 3 { 4 int n, reversedNumber = 0, remainder; 5 6 printf("输入一个整数: "); 7 s ...
分类:其他好文   时间:2020-07-14 13:51:43    阅读次数:51
常用PHP内部函数练习
常用PHP内部函数练习 1、字符串函数 (1)strlen($str);//返回字符串长度 mb_strlen($str) 可以返回中文字符长度; (2)strtolower($str);//字母转小写 (3)strtoupper($str);//字母转大写 (4)ucwords($str);//每 ...
分类:Web程序   时间:2020-07-13 09:35:21    阅读次数:81
写一函数,求一个字符串的长度。在main函数中输入字符串,并输出其长度
写一函数,求一个字符串的长度。在main函数中输入字符串,并输出其长度。 解题思路: 字符串以\0作为结尾,则从第一个字符开始向后移动遇到\0认为字符串结束。 答案: #include <stdio.h> int mystrlen(char *str) { int len = 0; char *pt ...
分类:其他好文   时间:2020-07-09 19:20:11    阅读次数:89
通配符匹配_leetcode44
bool isMatch(char* s, char* p) { int m=strlen(s); int n=strlen(p); int dp[m+1][n+1]; memset(dp,0,sizeof(dp)); dp[0][0]=true; int i,j; //对边界问题进行处理 for( ...
分类:其他好文   时间:2020-07-06 01:27:59    阅读次数:66
2530条   上一页 1 ... 4 5 6 7 8 ... 253 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!