Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes...
分类:
编程语言 时间:
2015-04-25 12:09:43
阅读次数:
158
要统计数据库的连接数,我们通常情况下是统计总数,没有细分到每个IP上。现在要监控每个IP的连接数,实现方式如下:1 select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist grou...
分类:
数据库 时间:
2015-04-24 11:50:36
阅读次数:
207
Given a string S, find the length of the longest substring T that contains at most two distinct characters.Given S = “eceba”,T is “ece” which its leng...
分类:
其他好文 时间:
2015-04-24 07:48:35
阅读次数:
109
asp.net中如何获取CheckBoxList的值stringitem=string.Empty;if(CheckBoxList1.SelectedIndex==-1){Alert("请选择");return;}else{foreach(ListItemliinCheckBoxList1.Items){if(li.Selected){item+=li.Value.ToString()+",";}}Selected=Selected.Substring(0,Selected.Length-..
分类:
Web程序 时间:
2015-04-24 01:22:43
阅读次数:
217
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters fo...
分类:
编程语言 时间:
2015-04-23 23:22:16
阅读次数:
203
找重复次数最多的字串,如果有多解,要求字典序最小。我也是跟着罗穗骞菊苣的论文才刷这道题的。首先还是枚举一个循环节的长度L,如果它出现两次的话,一定会包含s[0], s[L], s[2L]这些相邻两个之间。然后枚举相邻的两个,尽可能的向前和向后延伸,假设延伸长度为k,则重复次数为k / L + 1向后...
分类:
编程语言 时间:
2015-04-23 22:55:03
阅读次数:
184
题目Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring.For “(()”, the longest valid parentheses substring is “()”, which h...
分类:
其他好文 时间:
2015-04-23 21:49:15
阅读次数:
156
题目:Write a function to find the longest common prefix string amongst an array of strings.
翻译:求一个字符串数组中 共同的最长前缀。
思路:以第一个串为基准,逐个位置遍历,并遍历字符串数组,如果出现某个字符串长度小于当前位置,或者出现当前位置的字符不相同,返回字串strs[0].substring(0,p...
分类:
其他好文 时间:
2015-04-23 11:05:31
阅读次数:
108
传送门:http://poj.org/problem?id=3693
题目:给出一个串,求重复次数最多的连续重复子串;
分析:
枚举重复单元的长度,然后理所当然的枚举起点。利用rmq处理,后缀i,i+l的最长前缀。
lcp/l+1,为当前相邻l长度单元的串的重复次数,但是由于i+=l,提高了效率,但是i不一定刚好是重复串的起点,所以如果r%l!=0,把串往前移l-r%l个单位。找到...
分类:
编程语言 时间:
2015-04-22 09:36:52
阅读次数:
178
压力太大了,这道题先不做了public class Solution { public String minWindow(String S, String T) { // 讲解http://articles.leetcode.com/2010/11/finding-minimum...