函数fn:contains(string, substring) 如果参数string中包含参数substring,返回truefn:contains 判断字符串是否包含另外一个字符串 fn:containsIgnoreCase(string, substring) 如果参数string中包含参数s...
分类:
Web程序 时间:
2014-07-16 21:54:28
阅读次数:
265
Palindrome PartitioningGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioni...
分类:
其他好文 时间:
2014-07-16 17:41:15
阅读次数:
173
substr() 方法可在字符串中抽取从 start 下标开始的指定数目的字符。语法stringObject.substr(start,length)参数描述start必需。要抽取的子串的起始下标。必须是数值。如果是负数,那么该参数声明从字符串的尾部开始算起的位置。也就是说,-1 指字符串中最后一个...
分类:
Web程序 时间:
2014-07-16 11:56:58
阅读次数:
257
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[
["aa","...
分类:
其他好文 时间:
2014-07-12 23:21:30
阅读次数:
215
String pathname = "E:\\workspace\\stanfordner\\sample.txt";
File filename = new File(pathname); // 要读取以上路径的input。txt文件
String query_id = filename.getName().substring(0,filename.getName().last...
分类:
编程语言 时间:
2014-07-12 20:05:29
阅读次数:
259
// 代码段
/* 自动生成随机账单 */
function getCKD(){
var d=document.getElementById("billNo");
var date=new Date();
var year1=date.getUTCFullYear().toString().substring(2,4);
v...
分类:
其他好文 时间:
2014-07-09 12:59:01
阅读次数:
206
Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a ...
分类:
其他好文 时间:
2014-07-08 21:44:23
阅读次数:
177
如果一个字符串从左向右写和从右向左写是一样的,这样的字符串就叫做palindromic string,如aba,或者abba。本题是这样的,给定输入一个字符串,要求输出一个子串,使得子串是最长的padromic string。
下边演示3种思路
1.两侧比较法
以abba这样一个字符串为例来看,abba中,一共有偶数个字,第1位=倒数第1位,第2位=倒数第2位......第N位=倒数第...
分类:
编程语言 时间:
2014-07-08 17:49:03
阅读次数:
238
SPOJ Problem Set (classical)
1812. Longest Common Substring II
Problem code: LCS2
A string is finite sequence of characters over a non-empty finite set Σ.
In this problem, Σ is...
分类:
其他好文 时间:
2014-07-08 17:14:39
阅读次数:
291
题目大意:
求出字典序最小,重复次数最多,的子串。
思路分析:
RMQ + height 数组可以求出任意两个后缀的lcp
我们枚举答案字符串的重复的长度。
如果这个字符串的长度为 l ,而且这个字符串出现过两次或两次以上
那么你会发现在原串中 str[0] str[l] str[2*l] ....肯定有相邻的两个被包含在重复的串中。
我们求出这两个相邻的后缀的lcp
我...
分类:
其他好文 时间:
2014-07-05 23:47:48
阅读次数:
178