求一个字符串中不含重复字母的最大子串的长度。【思路】1.用临时tmp记录长度,遇到重复字母把tmp当前值赋给要返回的length,tmp归零比较tmp和length,当tmp>length时,更新length。2.每个字母向前遍历是否有重复字母,用哈希表。3.反复提交代码不能通过后看了题目tag,知...
分类:
其他好文 时间:
2015-05-05 19:15:55
阅读次数:
156
String encodePhoneNumber(String number)
{
int encnum = Integer.parseInt(number.substring(2));
int prefix = (number.charAt(1) - '2') /2; // '3'=>0, '5'=>1, '[67]'=>2, '8'=>3
...
分类:
移动开发 时间:
2015-05-05 16:38:30
阅读次数:
171
stringObject.substring(start,stop) substring() 方法用于提取字符串中介于两个指定下标之间的字符。stringObject.substr(start,length) 必需。要抽取的子串的起始下标。必须是数值。如果是负数,那么该参数声明从字符串的尾部开始算起...
分类:
Web程序 时间:
2015-05-04 19:40:11
阅读次数:
171
/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*var str = "0123456789";alert(str.substring(0));------------"012345...
分类:
Web程序 时间:
2015-05-04 15:23:35
阅读次数:
130
https://leetcode.com/problems/longest-substring-without-repeating-characters/Given a string, find the length of the longest substring without repeatin...
分类:
其他好文 时间:
2015-05-03 13:14:25
阅读次数:
121
substr(begin,end): begin表示起始index,end表示提取几位substring(begin,end):begin表示起始index,end表示结束index。slice(begin,end):同substring。slice与substring区别:1、substring中...
分类:
其他好文 时间:
2015-05-02 20:40:51
阅读次数:
130
后台接收值String[]ctrltypes=request.getParameterValues("ctrltypes"); Stringstr1=newString(); if(ctrltypes.length>0){ for(inti=0;i<ctrltypes.length;i++){ str1+=ctrltypes[i]+","; } tabUsers.setCtrltypes(str1.substring(0,str1.length()-1)..
分类:
数据库 时间:
2015-05-02 18:18:01
阅读次数:
269
1.字符串函数长度与分析用1,datalength(Char_expr)返回字符串包含字符数,但不包含后面的空格2,substring(expression,start,length)取子串,字符串的下标是从“1”,start为起始位置,length为字符串长度,实际应用中以len(expressi...
分类:
数据库 时间:
2015-05-02 12:24:41
阅读次数:
148
题目:给定两个字符串X,Y,求二者最长的公共子串,例如X=[aaaba],Y=[abaa]。二者的最长公共子串为[aba],长度为3。子序列是不要求连续的,字串必须是连续的。思路与代码:1、简单思想:遍历两个字符串X、Y,分别比较X的字串与Y的字串,求出最长的公共字串。设X长度为m,Y长度为n,最长...
分类:
其他好文 时间:
2015-05-01 11:58:58
阅读次数:
179
题目:Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, ...
分类:
其他好文 时间:
2015-05-01 00:32:38
阅读次数:
150